Trait Reset

Source
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;
	}
}

Required Methods§

Source

fn reset(&mut self)

Reset to the default state while keeping allocated memory.

Implementations on Foreign Types§

Source§

impl Reset for String

Source§

fn reset(&mut self)

Source§

impl Reset for OsString

Source§

fn reset(&mut self)

Source§

impl Reset for PathBuf

Source§

fn reset(&mut self)

Source§

impl<A> Reset for (A,)
where A: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B> Reset for (A, B)
where A: Reset, B: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C> Reset for (A, B, C)
where A: Reset, B: Reset, C: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D> Reset for (A, B, C, D)
where A: Reset, B: Reset, C: Reset, D: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E> Reset for (A, B, C, D, E)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F> Reset for (A, B, C, D, E, F)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G> Reset for (A, B, C, D, E, F, G)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H> Reset for (A, B, C, D, E, F, G, H)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I> Reset for (A, B, C, D, E, F, G, H, I)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset, I: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I, J> Reset for (A, B, C, D, E, F, G, H, I, J)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset, I: Reset, J: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> Reset for (A, B, C, D, E, F, G, H, I, J, K)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset, I: Reset, J: Reset, K: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> Reset for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset, I: Reset, J: Reset, K: Reset, L: Reset,

Source§

fn reset(&mut self)

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> Reset for (A, B, C, D, E, F, G, H, I, J, K, L, M)
where A: Reset, B: Reset, C: Reset, D: Reset, E: Reset, F: Reset, G: Reset, H: Reset, I: Reset, J: Reset, K: Reset, L: Reset, M: Reset,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for &mut T
where T: Reset,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for Box<T>
where T: Reset,

Source§

fn reset(&mut self)

Source§

impl<T> Reset for BinaryHeap<T>

Source§

fn reset(&mut self)

Source§

impl<T> Reset for VecDeque<T>

Source§

fn reset(&mut self)

Source§

impl<T> Reset for Vec<T>

Source§

fn reset(&mut self)

Source§

impl<T, U> Reset for HashMap<T, U>

Source§

fn reset(&mut self)

Source§

impl<T, U> Reset for HashSet<T, U>

Source§

fn reset(&mut self)

Implementors§