Skip to main content

polars_utils/
scratch_vec.rs

1/// Vec container with a getter that clears the vec.
2#[derive(Default)]
3pub struct ScratchVec<T>(Vec<T>);
4
5impl<T> ScratchVec<T> {
6    /// Clear the vec and return a mutable reference to it.
7    pub fn get(&mut self) -> &mut Vec<T> {
8        self.0.clear();
9        &mut self.0
10    }
11}