pub trait Reset {
// Required method
fn reset(&mut self);
}
Expand description
Trait for types that can be reset to their Default
while keeping allocated memory.
Types should not implement this trait if memory is deallocated when reset, such as
BTreeMap
.
struct MyEpicStruct {
vec: Vec<bool>,
option: Option<bool>,
}
impl Reset for MyEpicStruct {
fn reset(&mut self) {
self.vec.clear();
self.option = None;
}
}