pub struct ModuleBuilder { /* private fields */ }Expand description
Builder for explicit module definitions.
Implementations§
Source§impl ModuleBuilder
impl ModuleBuilder
Sourcepub fn new(name: impl Into<String>) -> ModuleBuilder
pub fn new(name: impl Into<String>) -> ModuleBuilder
Starts a module definition.
Sourcepub fn import(self, name: impl Into<String>) -> ModuleBuilder
pub fn import(self, name: impl Into<String>) -> ModuleBuilder
Adds an explicit module import.
Sourcepub fn import_typed<M>(self) -> ModuleBuilderwhere
M: Module,
pub fn import_typed<M>(self) -> ModuleBuilderwhere
M: Module,
Adds a typed module import.
Sourcepub fn provider(self, name: impl Into<String>) -> ModuleBuilder
pub fn provider(self, name: impl Into<String>) -> ModuleBuilder
Adds a provider declaration.
Sourcepub fn provider_typed<P>(self) -> ModuleBuilderwhere
P: ProviderRegistrant,
pub fn provider_typed<P>(self) -> ModuleBuilderwhere
P: ProviderRegistrant,
Adds a typed provider declaration and registration callback.
Sourcepub fn controller(self, name: impl Into<String>) -> ModuleBuilder
pub fn controller(self, name: impl Into<String>) -> ModuleBuilder
Adds a controller declaration.
Sourcepub fn controller_typed<C>(self) -> ModuleBuilderwhere
C: ControllerRegistrant,
pub fn controller_typed<C>(self) -> ModuleBuilderwhere
C: ControllerRegistrant,
Adds a typed controller declaration and runtime descriptor.
Sourcepub fn export(self, name: impl Into<String>) -> ModuleBuilder
pub fn export(self, name: impl Into<String>) -> ModuleBuilder
Adds a provider export declaration.
Sourcepub fn export_typed<P>(self) -> ModuleBuilder
pub fn export_typed<P>(self) -> ModuleBuilder
Adds a typed provider export declaration.
Sourcepub fn async_initializer(
self,
initializer: for<'a> fn(&'a mut Container) -> Pin<Box<dyn Future<Output = Result<(), NidusError>> + Send + 'a>>,
) -> ModuleBuilder
pub fn async_initializer( self, initializer: for<'a> fn(&'a mut Container) -> Pin<Box<dyn Future<Output = Result<(), NidusError>> + Send + 'a>>, ) -> ModuleBuilder
Adds an async provider initializer.
Sourcepub fn build(self) -> ModuleDefinition
pub fn build(self) -> ModuleDefinition
Completes the module definition.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModuleBuilder
impl RefUnwindSafe for ModuleBuilder
impl Send for ModuleBuilder
impl Sync for ModuleBuilder
impl Unpin for ModuleBuilder
impl UnsafeUnpin for ModuleBuilder
impl UnwindSafe for ModuleBuilder
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