Trait plugin::Plugin
[−]
[src]
pub trait Plugin<E: ?Sized>: Key { type Error; fn eval(&mut E) -> Result<Self::Value, Self::Error>; }
Implementers of this trait can act as plugins for other types, via OtherType::get<P>()
.
To create a plugin, implement this trait and provide an empty implementation
of Key
to associate the plugin with its return type, Key::Value
.
Associated Types
type Error
[−]
The error type associated with this plugin.
Required Methods
fn eval(&mut E) -> Result<Self::Value, Self::Error>
[−]
Create the plugin from an instance of the extended type.
While eval
is given a mutable reference to the extended
type, it is important for implementers to remember that
the result of eval
is usually cached, so care should
be taken when doing mutation on the extended type.
Implementors
impl<'a, 'b, P: Key> Plugin<Request<'a, 'b>> for State<P> where P::Value: Send + Sync
impl<'a, 'b, P: Key> Plugin<Request<'a, 'b>> for Read<P> where P::Value: Send + Sync
impl<'a, 'b, P: Key> Plugin<Request<'a, 'b>> for Write<P> where P::Value: Send
impl<'a, 'b> Plugin<Request<'a, 'b>> for Raw
impl<'a, 'b> Plugin<Request<'a, 'b>> for Json
impl<'a, 'b, T> Plugin<Request<'a, 'b>> for Struct<T> where T: Decodable + Any