pub struct PluginLoader { /* private fields */ }Expand description
Loads and manages dynamically-discovered middleware plugins.
Implementations§
Source§impl PluginLoader
impl PluginLoader
Sourcepub fn new(plugins_dir: impl Into<PathBuf>) -> Self
pub fn new(plugins_dir: impl Into<PathBuf>) -> Self
Create a loader rooted at the given plugins directory.
Sourcepub async fn load(&self, manifest_path: &Path) -> SdkResult<String>
pub async fn load(&self, manifest_path: &Path) -> SdkResult<String>
Load a plugin from its manifest file, registering it by name.
Sourcepub fn middlewares(&self) -> Vec<Arc<dyn Middleware>>
pub fn middlewares(&self) -> Vec<Arc<dyn Middleware>>
Return all currently loaded middlewares.
Sourcepub fn get(&self, name: &str) -> Option<Arc<dyn Middleware>>
pub fn get(&self, name: &str) -> Option<Arc<dyn Middleware>>
Look up a loaded middleware by name.
Sourcepub fn unload(&self, name: &str) -> bool
pub fn unload(&self, name: &str) -> bool
Remove the plugin with the given name; returns true if it was present.
Sourcepub fn register(&self, middleware: Arc<dyn Middleware>)
pub fn register(&self, middleware: Arc<dyn Middleware>)
Register an already-constructed middleware, keyed by its Middleware::name.
Auto Trait Implementations§
impl !RefUnwindSafe for PluginLoader
impl !UnwindSafe for PluginLoader
impl Freeze for PluginLoader
impl Send for PluginLoader
impl Sync for PluginLoader
impl Unpin for PluginLoader
impl UnsafeUnpin for PluginLoader
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.