Trait ferrum::Plugin
[−]
[src]
pub trait Plugin<A = UnsafeAny + 'static> where
A: UnsafeAnyExt + ?Sized, { fn get<'a, P>(
&'a mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error>
where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Clone,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>, { ... } fn get_ref<'a, P>(
&'a mut self
) -> Result<&'a <P as Key>::Value, <P as Plugin<Self>>::Error>
where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>, { ... } fn get_mut<'a, P>(
&'a mut self
) -> Result<&'a mut <P as Key>::Value, <P as Plugin<Self>>::Error>
where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>, { ... } fn compute<P>(
&mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error>
where
P: Plugin<Self>, { ... } }
An interface for plugins that cache values between calls.
Provided Methods
fn get<'a, P>(
&'a mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Clone,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
&'a mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Clone,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
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<'a, P>(
&'a mut self
) -> Result<&'a <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
&'a mut self
) -> Result<&'a <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
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<'a, P>(
&'a mut self
) -> Result<&'a mut <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
&'a mut self
) -> Result<&'a mut <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
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 as Key>::Value, <P as Plugin<Self>>::Error> where
P: Plugin<Self>,
&mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
P: Plugin<Self>,
Create and evaluate a once-off instance of a plugin.