Trait persian_rug::Mutator
source · [−]pub trait Mutator {
type Context: Context;
fn add<T>(&mut self, proxy: T) -> Proxy<T>
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
fn get<T>(&self, what: &Proxy<T>) -> &T
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
fn get_mut<T>(&mut self, what: &Proxy<T>) -> &mut T
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
fn get_iter<T>(&self) -> TableIterator<'_, T>ⓘNotable traits for TableIterator<'a, T>impl<'a, T> Iterator for TableIterator<'a, T> type Item = &'a T;
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
fn get_iter_mut<T>(&mut self) -> TableMutIterator<'_, T>ⓘNotable traits for TableMutIterator<'a, T>impl<'a, T> Iterator for TableMutIterator<'a, T> type Item = &'a mut T;
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, T>ⓘNotable traits for TableProxyIterator<'a, T>impl<'a, T> Iterator for TableProxyIterator<'a, T> type Item = &'a Proxy<T>;
where
Self::Context: Owner<T>,
T: Contextual<Context = Self::Context>;
}
Expand description
A convenient way to handle Context
write access.
Rather than plumbing references to a context throughout your code, especially when you are implementing derive macros that rely on this crate, it can be more convenient to use this abstraction of read-write access to a context.
In most hand-written code, it is simplest to use an exclusive reference to a context as a Mutator.