pub struct LazyResolveRc<T> { /* private fields */ }Expand description
Single-threaded lazy resolution wrapper using OnceCell Can be cheaply cloned as it uses Rc internally
Implementations§
Source§impl<T: Clone> LazyResolveRc<T>
impl<T: Clone> LazyResolveRc<T>
Sourcepub fn get_or_resolve(&self, ioc: &IocContainer) -> Result<&T>
pub fn get_or_resolve(&self, ioc: &IocContainer) -> Result<&T>
Get or resolve the value from the IoC container The resolution happens exactly once, subsequent calls return the cached value
Sourcepub fn get(&self) -> Option<&T>
pub fn get(&self) -> Option<&T>
Get the resolved value if it exists, without attempting to resolve
Sourcepub fn is_resolved(&self) -> bool
pub fn is_resolved(&self) -> bool
Check if the value has been resolved
Trait Implementations§
Source§impl<T: Clone> Clone for LazyResolveRc<T>
impl<T: Clone> Clone for LazyResolveRc<T>
Auto Trait Implementations§
impl<T> Freeze for LazyResolveRc<T>
impl<T> !RefUnwindSafe for LazyResolveRc<T>
impl<T> !Send for LazyResolveRc<T>
impl<T> !Sync for LazyResolveRc<T>
impl<T> Unpin for LazyResolveRc<T>
impl<T> !UnwindSafe for LazyResolveRc<T>
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