pub struct ModuleManager { /* private fields */ }Expand description
Manages the set of modules loaded into the kernel.
ModuleManager is cheaply cloneable (it wraps its state in an Arc) so it
can be handed to subsystems that need to inspect module status, e.g. the
future CLI.
Implementations§
Source§impl ModuleManager
impl ModuleManager
Sourcepub fn new(bus: MessageBus) -> Self
pub fn new(bus: MessageBus) -> Self
Construct a new manager bound to the given message bus.
Sourcepub async fn register_native<M: Module>(&self, module: M) -> Result<()>
pub async fn register_native<M: Module>(&self, module: M) -> Result<()>
Register a native Rust Module with the manager.
The module is moved into the manager and held until it is unloaded.
Sourcepub async fn register_wasm<M: WasmModule>(&self, module: M) -> Result<()>
pub async fn register_wasm<M: WasmModule>(&self, module: M) -> Result<()>
Register a WasmModule plugin with the manager.
Sourcepub async fn unload(&self, id: &str) -> Result<()>
pub async fn unload(&self, id: &str) -> Result<()>
Stop and remove a module from the manager entirely.
Sourcepub async fn state(&self, id: &str) -> Option<ModuleState>
pub async fn state(&self, id: &str) -> Option<ModuleState>
Return the current state of a module, if it is registered.
Sourcepub async fn list(&self) -> Vec<(ModuleMetadata, ModuleState)>
pub async fn list(&self) -> Vec<(ModuleMetadata, ModuleState)>
Return a snapshot of all registered modules and their states.
Trait Implementations§
Source§impl Clone for ModuleManager
impl Clone for ModuleManager
Source§fn clone(&self) -> ModuleManager
fn clone(&self) -> ModuleManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ModuleManager
impl !RefUnwindSafe for ModuleManager
impl Send for ModuleManager
impl Sync for ModuleManager
impl Unpin for ModuleManager
impl UnsafeUnpin for ModuleManager
impl !UnwindSafe for ModuleManager
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> 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