pub struct PluginManager<T>(/* private fields */)
where
T: PluginAware;
Expand description
Facilities applying plugins and determining which plugins have been applied to a plugin aware object.
Implementations§
Source§impl<T> PluginManager<T>where
T: PluginAware,
impl<T> PluginManager<T>where
T: PluginAware,
Sourcepub fn new() -> PluginManager<T>
pub fn new() -> PluginManager<T>
Create a new plugin manager instance
Sourcepub fn has_plugin(&self, id: &str) -> bool
pub fn has_plugin(&self, id: &str) -> bool
Check if this manager has a known plugin
pub fn has_plugin_ty<P>(&self) -> boolwhere
P: Plugin<T>,
Sourcepub fn apply<P>(
&mut self,
target: &mut T,
) -> Result<(), PayloadError<ProjectError>>where
P: Plugin<T>,
pub fn apply<P>(
&mut self,
target: &mut T,
) -> Result<(), PayloadError<ProjectError>>where
P: Plugin<T>,
Applies this plugin if it hasn’t been applied before
Sourcepub fn with_plugin<F>(
&mut self,
id: &str,
target: &mut T,
action: F,
) -> Result<(), PayloadError<ProjectError>>where
F: 'static + for<'a> FnOnce(&'a mut T) -> Result<(), PayloadError<ProjectError>> + for<'a> Send + for<'a> Sync,
T: 'static,
pub fn with_plugin<F>(
&mut self,
id: &str,
target: &mut T,
action: F,
) -> Result<(), PayloadError<ProjectError>>where
F: 'static + for<'a> FnOnce(&'a mut T) -> Result<(), PayloadError<ProjectError>> + for<'a> Send + for<'a> Sync,
T: 'static,
Set an action to perform if a plugin has been applied
Trait Implementations§
Source§impl<T> Clone for PluginManager<T>where
T: PluginAware,
impl<T> Clone for PluginManager<T>where
T: PluginAware,
Source§fn clone(&self) -> PluginManager<T>
fn clone(&self) -> PluginManager<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for PluginManager<T>where
T: PluginAware,
impl<T> Debug for PluginManager<T>where
T: PluginAware,
Source§impl<T> Default for PluginManager<T>where
T: PluginAware,
impl<T> Default for PluginManager<T>where
T: PluginAware,
Source§fn default() -> PluginManager<T>
fn default() -> PluginManager<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T> Freeze for PluginManager<T>
impl<T> !RefUnwindSafe for PluginManager<T>
impl<T> Send for PluginManager<T>
impl<T> Sync for PluginManager<T>
impl<T> Unpin for PluginManager<T>
impl<T> !UnwindSafe for PluginManager<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InstanceOf for T
impl<T> InstanceOf for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more