pub enum Cl<'a, T: ?Sized + 'a> {
Val(Box<T>),
Ref(&'a T),
}Expand description
“Component Lifetime”. Wrapper around an injection that may be scoped(owned by the component) or freestanding(owned by the item injecting it). Deref to access the content.
Typically, this is used when the dependent does not care who owns the dependency, as it will
not try to move it. Injecting scoped dependency as T or injected freestanding dependency as
&T is a compile failure, but both can be injected as Cl<T>
§Lifetime
Cl's lifetime is bounded by the component providing it.
Variants§
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Cl<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for Cl<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for Cl<'a, T>
impl<'a, T> Sync for Cl<'a, T>
impl<'a, T> Unpin for Cl<'a, T>where
T: ?Sized,
impl<'a, T> UnsafeUnpin for Cl<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for Cl<'a, 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