use crate::UnitVec;
#[derive(Default)]
pub struct ScratchVec<T>(Vec<T>);
impl<T> ScratchVec<T> {
pub fn with_capacity(capacity: usize) -> Self {
Self(Vec::with_capacity(capacity))
}
pub fn get(&mut self) -> &mut Vec<T> {
self.0.clear();
&mut self.0
}
}
#[derive(Default)]
pub struct ScratchUnitVec<T>(UnitVec<T>);
impl<T> ScratchUnitVec<T> {
pub fn with_capacity(capacity: usize) -> Self {
Self(UnitVec::with_capacity(capacity))
}
pub fn get(&mut self) -> &mut UnitVec<T> {
self.0.clear();
&mut self.0
}
}