Expand description
Provides a Container value.
Variants
Scoped(Scoped)
A provider that returns a new value each time is requested.
Singleton(Shared<'a>)
A provider that returns the same value each time is required.
Implementations
sourceimpl<'a> Provider<'a>
impl<'a> Provider<'a>
sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Returns true if the provider is a singleton.
sourcepub fn kind(&self) -> ProviderKind
pub fn kind(&self) -> ProviderKind
Returns the type of this provider.
sourcepub fn get_scoped<T>(&self) -> Option<T> where
T: Send + Sync + 'static,
pub fn get_scoped<T>(&self) -> Option<T> where
T: Send + Sync + 'static,
Gets a value of the specified type T or None if T is Inject.
sourcepub fn get_inject<T>(&self, container: &Container<'_>) -> Option<T> where
T: Inject + 'static,
pub fn get_inject<T>(&self, container: &Container<'_>) -> Option<T> where
T: Inject + 'static,
Gets a value of the specified type T or None if T is not Inject.
sourcepub fn get_singleton<T>(&self) -> Option<Singleton<T>> where
T: Send + Sync + 'static,
pub fn get_singleton<T>(&self) -> Option<Singleton<T>> where
T: Send + Sync + 'static,
Gets the singleton value of the specified type or None
or None if the provider is not a singleton.
pub fn get_singleton_with<T>(
&self,
container: &Container<'_>
) -> Option<Singleton<T>> where
T: Send + Sync + 'static,
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Provider<'a>
impl<'a> Send for Provider<'a>
impl<'a> Sync for Provider<'a>
impl<'a> Unpin for Provider<'a>
impl<'a> !UnwindSafe for Provider<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more