pub struct DynamicModule {
pub registry: ProviderRegistry,
pub router: Router,
pub exports: Vec<TypeId>,
}Expand description
Runtime-composed module unit for conditional imports (feature flags, env switches, plugins).
Typical constructors: Self::from_module, Self::from_parts, Self::lazy, or builders
such as DynamicModuleBuilder / ConfigurableModuleBuilder. Import the resulting value from
#[module(imports = [...])] when the macro accepts a DynamicModule expression.
Docs: mdBook Fundamentals (docs/src/fundamentals.md).
Fields§
§registry: ProviderRegistryProvider registry for this dynamic module.
router: Router§exports: Vec<TypeId>Types exported to importing modules.
Implementations§
Source§impl DynamicModule
impl DynamicModule
Sourcepub fn from_module<M>() -> DynamicModulewhere
M: Module,
pub fn from_module<M>() -> DynamicModulewhere
M: Module,
Builds a dynamic module from a static Module type.
Sourcepub fn from_router(router: Router) -> DynamicModule
pub fn from_router(router: Router) -> DynamicModule
Wrap an already-built Router subtree as a dynamic module.
Sourcepub fn from_parts(
registry: ProviderRegistry,
router: Router,
exports: Vec<TypeId>,
) -> DynamicModule
pub fn from_parts( registry: ProviderRegistry, router: Router, exports: Vec<TypeId>, ) -> DynamicModule
Construct a dynamic module from explicit parts.
Sourcepub fn lazy<M>() -> DynamicModulewhere
M: Module + 'static,
pub fn lazy<M>() -> DynamicModulewhere
M: Module + 'static,
NestJS-style lazy module: M::build() runs at most once per process; imports clone bindings
so singleton ProviderRegistry cells stay shared (see ProviderRegistry::absorb_exported_from).
Trait Implementations§
Source§impl Clone for DynamicModule
impl Clone for DynamicModule
Source§fn clone(&self) -> DynamicModule
fn clone(&self) -> DynamicModule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more