use alloc::vec::Vec;
pub trait Recyclable {
fn recycle(self) -> Self;
}
impl<T> Recyclable for Vec<T> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}
impl<K, V, S: Clone> Recyclable for hashbrown::HashMap<K, V, S> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}
impl<K, S: Clone> Recyclable for hashbrown::HashSet<K, S> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}
impl<K, S: Clone> Recyclable for indexmap::IndexSet<K, S> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}
impl<K: Ord, V> Recyclable for alloc::collections::BTreeMap<K, V> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}
impl<K, V> Recyclable for crate::arena::HandleVec<K, V> {
fn recycle(mut self) -> Self {
self.clear();
self
}
}