[−][src]Struct async_injector::Injector
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]
T: Clone + Any + Send + Sync + 'static,
Clear the given value.
pub fn clear_key<T>(&self, key: &Key<T>) where
T: Clone + Any + Send + Sync + 'static,
[src]
T: Clone + Any + Send + Sync + 'static,
Clear the given value.
pub fn update<T>(&self, value: T) where
T: Any + Send + Sync + 'static + Clone,
[src]
T: Any + Send + Sync + 'static + Clone,
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]
T: Any + Send + Sync + 'static + Clone,
Set the given value and notify any subscribers.
pub fn get<T>(&self) -> Option<T> where
T: Any + Send + Sync + 'static + Clone,
[src]
T: Any + Send + Sync + 'static + Clone,
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]
T: Any + Send + Sync + 'static + Clone,
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]
T: Any + Send + Sync + 'static + Clone,
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]
T: Any + Send + Sync + 'static + Clone,
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]
T: Any + Send + Sync + 'static + Clone + Unpin,
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]
T: Any + Send + Sync + 'static + Clone + Unpin,
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
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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &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, 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,