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

The error type associated with this plugin.

Required Methods

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