Trait iron::Plugin
[−]
[src]
pub trait Plugin { 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 P: Plugin<Self>, Self: Extensible, 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 P: Plugin<Self>, Self: Extensible, 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.
Implementors
impl Plugin for Response
impl<'a, 'b> Plugin for Request<'a, 'b>
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: Deserialize + Any
impl<'a, 'b> Plugin<Request<'a, 'b>> for UrlEncodedQuery
impl<'a, 'b> Plugin<Request<'a, 'b>> for UrlEncodedBody
impl<'a, 'b> Plugin<Request<'a, 'b>> for Params