pub enum Resolved<T> {
Scoped(T),
Singleton(Arc<T>),
}Expand description
Represents a value from a Container.
Variants
Scoped(T)
An owned value.
Singleton(Arc<T>)
A shared value.
Implementations
sourceimpl<T> Resolved<T>
impl<T> Resolved<T>
sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Returns true if the value is a singleton.
sourcepub fn get_mut(&mut self) -> Option<&mut T>
pub fn get_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the value.
Returns
- Some(&mut T): If the value is scoped or if the singleton has only has one reference to it.
- None: If the value is a singleton and have more than a reference to it.
sourcepub fn into_singleton(self) -> Option<Arc<T>>
pub fn into_singleton(self) -> Option<Arc<T>>
Attempts to downcast the value to a singleton.
sourcepub fn into_scoped(self) -> Option<T>
pub fn into_scoped(self) -> Option<T>
Attempts to downcast the value to a value.
Trait Implementations
sourceimpl<T: Ord> Ord for Resolved<T>
impl<T: Ord> Ord for Resolved<T>
sourceimpl<T: PartialOrd> PartialOrd<Resolved<T>> for Resolved<T>
impl<T: PartialOrd> PartialOrd<Resolved<T>> for Resolved<T>
sourcefn partial_cmp(&self, other: &Resolved<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Resolved<T>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<T: Eq> Eq for Resolved<T>
impl<T> StructuralEq for Resolved<T>
impl<T> StructuralPartialEq for Resolved<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Resolved<T> where
T: RefUnwindSafe,
impl<T> Send for Resolved<T> where
T: Send + Sync,
impl<T> Sync for Resolved<T> where
T: Send + Sync,
impl<T> Unpin for Resolved<T> where
T: Unpin,
impl<T> UnwindSafe for Resolved<T> where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more