pub struct ModuleRef { /* private fields */ }Expand description
NestJS ModuleRef analogue: typed access to the
root ProviderRegistry after the application graph is built.
Obtain it from NestApplication::module_ref
in the main nestrs crate (after NestFactory::create). Use Self::get for dynamic resolution
of registered providers by type.
Docs: the repository mdBook Fundamentals chapter (docs/src/fundamentals.md) describes
patterns alongside DiscoveryService and lifecycle ordering.
Implementations§
Source§impl ModuleRef
impl ModuleRef
pub fn new(registry: Arc<ProviderRegistry>) -> Self
pub fn into_inner(self) -> Arc<ProviderRegistry>
pub fn get<T: Send + Sync + 'static>(&self) -> Arc<T>
pub fn registry(&self) -> &ProviderRegistry
pub fn registry_arc(&self) -> &Arc<ProviderRegistry>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModuleRef
impl !RefUnwindSafe for ModuleRef
impl Send for ModuleRef
impl Sync for ModuleRef
impl Unpin for ModuleRef
impl UnsafeUnpin for ModuleRef
impl !UnwindSafe for ModuleRef
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