pub struct LazyContainer { /* private fields */ }Expand description
Container that holds multiple lazy providers and can warm them up concurrently.
Implementations§
Source§impl LazyContainer
impl LazyContainer
Sourcepub fn new() -> LazyContainer
pub fn new() -> LazyContainer
Create a new empty container.
Sourcepub fn register_lazy<T, F, Fut>(&mut self, name: &str, factory: F)
pub fn register_lazy<T, F, Fut>(&mut self, name: &str, factory: F)
Register a lazy provider for type T with a name and factory.
Sourcepub async fn warm_up(&self) -> Result<(), DependencyError>
pub async fn warm_up(&self) -> Result<(), DependencyError>
Initialize all lazy bindings concurrently.
Spawns each initialization as a separate tokio task and waits for all to complete. If any initialization fails, the error is returned after all tasks finish.
Trait Implementations§
Source§impl Default for LazyContainer
impl Default for LazyContainer
Source§fn default() -> LazyContainer
fn default() -> LazyContainer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LazyContainer
impl !RefUnwindSafe for LazyContainer
impl Send for LazyContainer
impl Sync for LazyContainer
impl Unpin for LazyContainer
impl UnsafeUnpin for LazyContainer
impl !UnwindSafe for LazyContainer
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