[−][src]Struct async_injector::Var
Proxy accessor for an injected variable.
This stores a reference to the given variable and provides methods for
accessing it, similarly to an RwLock
, but biased towards efficient
cloning.
Implementations
impl<T> Var<T>
[src]
impl<T> Var<T> where
T: Clone,
[src]
T: Clone,
pub async fn load<'_>(&'_ self) -> T
[src]
Load the given variable, cloning the underlying value while doing so.
impl<T> Var<T>
[src]
pub async fn read<'_, '_>(&'_ self) -> RwLockReadGuard<'_, T>
[src]
Read referentially from the underlying variable.
pub async fn write<'_, '_>(&'_ self) -> RwLockWriteGuard<'_, T>
[src]
Write to the underlying variable.
Trait Implementations
impl<T> Clone for Var<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for Var<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Var<T>
impl<T> Send for Var<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for Var<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for Var<T>
impl<T> !UnwindSafe for Var<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,