Trait iron::prelude::Pluggable
[−]
[src]
pub trait Pluggable { fn get<P>(&mut self) -> Result<P::Value, P::Error> where P: Plugin<Self>, Self: Extensible, P::Value: Clone, P::Value: Any { ... } fn get_ref<P>(&mut self) -> Result<&P::Value, P::Error> where P: Plugin<Self>, Self: Extensible, P::Value: Any { ... } fn get_mut<P>(&mut self) -> Result<&mut P::Value, P::Error> where Self: Extensible, P: Plugin<Self>, P::Value: Any { ... } fn compute<P>(&mut self) -> Result<P::Value, P::Error> where P: Plugin<Self> { ... } }
An interface for plugins that cache values between calls.
R
is the type of the plugin's return value, which must be cloneable.
Provided Methods
fn get<P>(&mut self) -> Result<P::Value, P::Error> where P: Plugin<Self>, Self: Extensible, P::Value: Clone, P::Value: Any
Return a copy of the plugin's produced value.
The plugin will be created if it doesn't exist already. If plugin creation fails, an error is returned.
P
is the plugin type.
fn get_ref<P>(&mut self) -> Result<&P::Value, P::Error> where P: Plugin<Self>, Self: Extensible, P::Value: Any
Return a reference to the plugin's produced value.
The plugin will be created if it doesn't exist already. If plugin creation fails an error is returned.
P
is the plugin type.
fn get_mut<P>(&mut self) -> Result<&mut P::Value, P::Error> where Self: Extensible, P: Plugin<Self>, P::Value: Any
Return a mutable reference to the plugin's produced value.
The plugin will be created if it doesn't exist already. If plugin creation fail an error is returned.
P
is the plugin type.
fn compute<P>(&mut self) -> Result<P::Value, P::Error> where P: Plugin<Self>
Create and evaluate a once-off instance of a plugin.