pub struct Shared<S: ?Sized + IShared> { /* private fields */ }Expand description
A pointer to a shared instance from the service container.
Implementations§
Sourcepub fn into_inner(self) -> S::Pointer
pub fn into_inner(self) -> S::Pointer
Returns the inner smart pointer of the shared instance.
Sourcepub fn is(&self, other: &Self) -> bool
pub fn is(&self, other: &Self) -> bool
Returns true if two shared instances point to the same instance.
Only compares the pointers, not the contents of the shared instances, and is therefore always cheap.
Sourcepub fn try_access<U, F>(&self, f: F) -> Option<U>
pub fn try_access<U, F>(&self, f: F) -> Option<U>
Get access to the shared instance through a closure.
Sourcepub fn access_mut<U, F>(&self, f: F) -> U
pub fn access_mut<U, F>(&self, f: F) -> U
Get access to the shared instance through a closure.
Sourcepub fn try_access_mut<U, F>(&self, f: F) -> Option<U>
pub fn try_access_mut<U, F>(&self, f: F) -> Option<U>
Get access to the shared instance through a closure.
Trait Implementations§
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clones the pointer to the shared instance.
Only increases the reference count, so this is very cheap.
See Rc::clone and Arc::clone.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
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