Trait persian_rug::Accessor
source · [−]pub trait Accessor: Clone {
type Context: Context;
fn get<T>(&self, what: &Proxy<T>) -> &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_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
read 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-only access to a context.
In most hand-written code, it is simplest to use a shared reference to a context as an Accessor.