pub struct ProviderDefinition { /* private fields */ }Expand description
A provider registration, similar to a Nest provider entry.
Implementations§
Source§impl ProviderDefinition
impl ProviderDefinition
pub fn singleton<T>(value: T) -> Self
pub fn named_singleton<T>(token: impl Into<String>, value: T) -> Self
pub fn from_arc<T>(value: Arc<T>) -> Self
pub fn named_from_arc<T>(token: impl Into<String>, value: Arc<T>) -> Self
pub fn factory<T, F>(factory: F) -> Self
pub fn factory_arc<T, F>(factory: F) -> Self
pub fn named_factory<T, F>(token: impl Into<String>, factory: F) -> Self
pub fn named_factory_arc<T, F>(token: impl Into<String>, factory: F) -> Self
pub fn async_factory<T, F, Fut>(factory: F) -> Self
pub fn async_factory_arc<T, F, Fut>(factory: F) -> Self
pub fn named_async_factory<T, F, Fut>( token: impl Into<String>, factory: F, ) -> Self
pub fn named_async_factory_arc<T, F, Fut>( token: impl Into<String>, factory: F, ) -> Self
pub fn injectable<T>() -> Selfwhere
T: FromModuleRef,
pub fn named_injectable<T>(token: impl Into<String>) -> Selfwhere
T: FromModuleRef,
pub fn alias<T>(target: ProviderToken) -> Self
pub fn named_alias(token: impl Into<String>, target: ProviderToken) -> Self
pub fn transient<T, F>(factory: F) -> Self
pub fn transient_arc<T, F>(factory: F) -> Self
pub fn named_transient<T, F>(token: impl Into<String>, factory: F) -> Self
pub fn named_transient_arc<T, F>(token: impl Into<String>, factory: F) -> Self
pub fn transient_injectable<T>() -> Selfwhere
T: FromModuleRef,
pub fn named_transient_injectable<T>(token: impl Into<String>) -> Selfwhere
T: FromModuleRef,
pub fn request_scoped<T, F>(factory: F) -> Self
pub fn request_scoped_arc<T, F>(factory: F) -> Self
pub fn named_request_scoped<T, F>(token: impl Into<String>, factory: F) -> Self
pub fn named_request_scoped_arc<T, F>( token: impl Into<String>, factory: F, ) -> Self
pub fn request_scoped_injectable<T>() -> Selfwhere
T: FromModuleRef,
pub fn named_request_scoped_injectable<T>(token: impl Into<String>) -> Selfwhere
T: FromModuleRef,
pub fn with_scope(self, scope: ProviderScope) -> Self
pub fn with_on_module_init<T>(self) -> Selfwhere
T: ProviderOnModuleInit,
pub fn with_on_application_bootstrap<T>(self) -> Selfwhere
T: ProviderOnApplicationBootstrap,
pub fn with_on_application_shutdown<T>(self) -> Selfwhere
T: ProviderOnApplicationShutdown,
pub fn token(&self) -> &ProviderToken
pub fn scope(&self) -> ProviderScope
Trait Implementations§
Source§impl Clone for ProviderDefinition
impl Clone for ProviderDefinition
Source§fn clone(&self) -> ProviderDefinition
fn clone(&self) -> ProviderDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ProviderDefinition
impl !UnwindSafe for ProviderDefinition
impl Freeze for ProviderDefinition
impl Send for ProviderDefinition
impl Sync for ProviderDefinition
impl Unpin for ProviderDefinition
impl UnsafeUnpin for ProviderDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more