pub trait Module:
Send
+ Sync
+ 'static {
// Required method
fn register(&self, m: &mut ModuleBuilder);
// Provided methods
fn id(&self) -> ModuleId { ... }
fn name(&self) -> &'static str { ... }
fn is_configured(&self) -> bool { ... }
}Expand description
A unit of an app: it registers providers, exports, imports, contributions,
lifecycle hooks and commands through a ModuleBuilder.
register is called once per ModuleId per boot. A configured instance
(for_root(...), is_configured returns true)
wins over plain imports of the same module type.
Required Methods§
Sourcefn register(&self, m: &mut ModuleBuilder)
fn register(&self, m: &mut ModuleBuilder)
Registers everything the module contributes.
Provided Methods§
Sourcefn id(&self) -> ModuleId
fn id(&self) -> ModuleId
The module identity. for_root wrappers override this to return the id
of the module type they configure.
Sourcefn is_configured(&self) -> bool
fn is_configured(&self) -> bool
for_root(...) values return true; at most one configured instance per id.
Trait Implementations§
Source§impl Module for Box<dyn Module>
impl Module for Box<dyn Module>
Source§fn id(&self) -> ModuleId
fn id(&self) -> ModuleId
The module identity.
for_root wrappers override this to return the id
of the module type they configure.Source§fn is_configured(&self) -> bool
fn is_configured(&self) -> bool
for_root(...) values return true; at most one configured instance per id.Source§fn register(&self, m: &mut ModuleBuilder)
fn register(&self, m: &mut ModuleBuilder)
Registers everything the module contributes.
Source§impl Module for Pin<Box<dyn Module>>
impl Module for Pin<Box<dyn Module>>
Source§fn id(&self) -> ModuleId
fn id(&self) -> ModuleId
The module identity.
for_root wrappers override this to return the id
of the module type they configure.Source§fn is_configured(&self) -> bool
fn is_configured(&self) -> bool
for_root(...) values return true; at most one configured instance per id.Source§fn register(&self, m: &mut ModuleBuilder)
fn register(&self, m: &mut ModuleBuilder)
Registers everything the module contributes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".