[−][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 child(&self) -> Injector
[src]
Construct a new child injector.
When a child injector is dropped, all associated listeners are cleaned up as well.
pub async fn clear<'_, T>(&'_ self) where
T: Clone + Any + Send + Sync + 'static,
[src]
T: Clone + Any + Send + Sync + 'static,
Clear the given value.
pub async fn clear_key<'_, T>(&'_ self, key: impl AsRef<Key<T>>) where
T: Clone + Any + Send + Sync + 'static,
[src]
T: Clone + Any + Send + Sync + 'static,
Clear the given value.
pub async 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 async fn update_key<'_, T>(&'_ self, key: impl AsRef<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 async 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 async fn get_key<'_, T>(&'_ self, key: impl AsRef<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 async 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 async fn stream_key<'_, T>(
&'_ self,
key: impl AsRef<Key<T>>
) -> (Stream<T>, Option<T>) where
T: Any + Send + Sync + 'static + Clone,
[src]
&'_ self,
key: impl AsRef<Key<T>>
) -> (Stream<T>, Option<T>) where
T: Any + Send + Sync + 'static + Clone,
Get an existing value and setup a stream for updates at the same time.
pub async fn var<'_, T>(&'_ self) -> Result<Var<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 var_key<'_, T>(
&'_ self,
key: impl AsRef<Key<T>>
) -> Result<Var<Option<T>>, Error> where
T: Any + Send + Sync + 'static + Clone + Unpin,
[src]
&'_ self,
key: impl AsRef<Key<T>>
) -> Result<Var<Option<T>>, Error> where
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 !RefUnwindSafe for Injector
impl Send for Injector
impl Sync for Injector
impl Unpin for Injector
impl !UnwindSafe for Injector
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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,