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