pub struct AutoRegisterModule;
Available on crate feature
auto-register
only.Expand description
A module that auto-registers all providers.
This module is enabled by the auto-register
feature.
Because auto-registration relies on inventory
crate, auto-registration
is not available on platforms where inventory
is not supported.
§Example
use rudi::{modules, AutoRegisterModule, Context, Singleton, Transient};
#[Singleton]
#[derive(Clone)]
struct A;
#[Transient]
struct B(A);
let mut cx = Context::create(modules![AutoRegisterModule]);
assert!(cx.resolve_option::<B>().is_some());
Trait Implementations§
Source§impl Module for AutoRegisterModule
impl Module for AutoRegisterModule
Source§fn providers() -> Vec<DynProvider>
fn providers() -> Vec<DynProvider>
Included providers.
Source§fn eager_create() -> bool
fn eager_create() -> bool
Whether the providers included in the module should be created eagerly, default is false.
Source§fn submodules() -> Option<Vec<ResolveModule>>
fn submodules() -> Option<Vec<ResolveModule>>
Included submodules, default is None.
Auto Trait Implementations§
impl Freeze for AutoRegisterModule
impl RefUnwindSafe for AutoRegisterModule
impl Send for AutoRegisterModule
impl Sync for AutoRegisterModule
impl Unpin for AutoRegisterModule
impl UnwindSafe for AutoRegisterModule
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