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