Trait persian_rug::Accessor

source ·
pub trait Accessor: Clone {
    type Context: Context;

    // Required methods
    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> 
       where Self::Context: Owner<T>,
             T: Contextual<Context = Self::Context>;
    fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, 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.

Required Associated Types§

Required Methods§

source

fn get<T>(&self, what: &Proxy<T>) -> &T
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source

fn get_iter<T>(&self) -> TableIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source

fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, C> Accessor for &'a C
where C: Context,

§

type Context = C

source§

fn get<T>(&self, what: &Proxy<T>) -> &T
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source§

fn get_iter<T>(&self) -> TableIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source§

fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source§

impl<C> Accessor for Arc<C>
where C: Context,

§

type Context = C

source§

fn get<T>(&self, what: &Proxy<T>) -> &T
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source§

fn get_iter<T>(&self) -> TableIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

source§

fn get_proxy_iter<T>(&self) -> TableProxyIterator<'_, T>
where Self::Context: Owner<T>, T: Contextual<Context = Self::Context>,

Implementors§