[][src]Struct async_injector::Injector

pub struct Injector { /* fields omitted */ }

Use for handling injection.

Methods

impl Injector[src]

pub fn new() -> Self[src]

Create a new injector instance.

pub fn clear<T>(&self) where
    T: Clone + Any + Send + Sync + 'static, 
[src]

Clear the given value.

pub fn clear_key<T>(&self, key: &Key<T>) where
    T: Clone + Any + Send + Sync + 'static, 
[src]

Clear the given value.

pub fn update<T>(&self, value: T) where
    T: Any + Send + Sync + 'static + Clone
[src]

Set the given value and notify any subscribers.

pub fn update_key<T>(&self, key: &Key<T>, value: T) where
    T: Any + Send + Sync + 'static + Clone
[src]

Set the given value and notify any subscribers.

pub fn get<T>(&self) -> Option<T> where
    T: Any + Send + Sync + 'static + Clone
[src]

Get a value from the injector.

pub fn get_key<T>(&self, key: &Key<T>) -> Option<T> where
    T: Any + Send + Sync + 'static + Clone
[src]

Get a value from the injector with the given key.

pub fn stream<T>(&self) -> (Stream<T>, Option<T>) where
    T: Any + Send + Sync + 'static + Clone
[src]

Get an existing value and setup a stream for updates at the same time.

pub fn stream_key<T>(&self, key: &Key<T>) -> (Stream<T>, Option<T>) where
    T: Any + Send + Sync + 'static + Clone
[src]

Get an existing value and setup a stream for updates at the same time.

pub fn var<T>(&self) -> Result<Arc<RwLock<Option<T>>>, Error> where
    T: Any + Send + Sync + 'static + Clone + Unpin
[src]

Get a synchronized variable for the given configuration key.

pub fn var_key<T>(&self, key: &Key<T>) -> Result<Arc<RwLock<Option<T>>>, Error> where
    T: Any + Send + Sync + 'static + Clone + Unpin
[src]

Get a synchronized variable for the given configuration key.

pub async fn drive(self) -> Result<(), Error>[src]

Run the injector as a future, making sure all asynchronous processes associated with it are driven to completion.

This has to be called for the injector to perform important tasks.

Trait Implementations

impl Clone for Injector[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Sync for Injector

impl Send for Injector

impl Unpin for Injector

impl !RefUnwindSafe for Injector

impl !UnwindSafe for Injector

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,