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,
Sourcepub fn app_guard<T>() -> Selfwhere
T: FromModuleRef + Guard,
pub fn app_guard<T>() -> Selfwhere
T: FromModuleRef + Guard,
Register an injectable provider as an application-wide HTTP guard.
Sourcepub fn app_pipe<T>() -> Selfwhere
T: FromModuleRef + Pipe,
pub fn app_pipe<T>() -> Selfwhere
T: FromModuleRef + Pipe,
Register an injectable provider as an application-wide HTTP pipe.
Sourcepub fn app_interceptor<T>() -> Selfwhere
T: FromModuleRef + Interceptor,
pub fn app_interceptor<T>() -> Selfwhere
T: FromModuleRef + Interceptor,
Register an injectable provider as an application-wide HTTP interceptor.
Sourcepub fn app_filter<T>() -> Selfwhere
T: FromModuleRef + ExceptionFilter,
pub fn app_filter<T>() -> Selfwhere
T: FromModuleRef + ExceptionFilter,
Register an injectable provider as an application-wide HTTP exception filter.
Sourcepub fn app_websocket_guard<T>() -> Selfwhere
T: FromModuleRef + WebSocketGuard,
pub fn app_websocket_guard<T>() -> Selfwhere
T: FromModuleRef + WebSocketGuard,
Register an injectable provider as an application-wide WebSocket guard.
Sourcepub fn app_websocket_pipe<T>() -> Selfwhere
T: FromModuleRef + WebSocketPipe,
pub fn app_websocket_pipe<T>() -> Selfwhere
T: FromModuleRef + WebSocketPipe,
Register an injectable provider as an application-wide WebSocket pipe.
Sourcepub fn app_websocket_interceptor<T>() -> Selfwhere
T: FromModuleRef + WebSocketInterceptor,
pub fn app_websocket_interceptor<T>() -> Selfwhere
T: FromModuleRef + WebSocketInterceptor,
Register an injectable provider as an application-wide WebSocket interceptor.
Sourcepub fn app_websocket_filter<T>() -> Selfwhere
T: FromModuleRef + WebSocketExceptionFilter,
pub fn app_websocket_filter<T>() -> Selfwhere
T: FromModuleRef + WebSocketExceptionFilter,
Register an injectable provider as an application-wide WebSocket exception filter.
Sourcepub fn app_transport_guard<T>() -> Selfwhere
T: FromModuleRef + TransportGuard,
pub fn app_transport_guard<T>() -> Selfwhere
T: FromModuleRef + TransportGuard,
Register an injectable provider as an application-wide transport guard.
Sourcepub fn app_transport_pipe<T>() -> Selfwhere
T: FromModuleRef + TransportPipe,
pub fn app_transport_pipe<T>() -> Selfwhere
T: FromModuleRef + TransportPipe,
Register an injectable provider as an application-wide transport pipe.
Sourcepub fn app_transport_interceptor<T>() -> Selfwhere
T: FromModuleRef + TransportInterceptor,
pub fn app_transport_interceptor<T>() -> Selfwhere
T: FromModuleRef + TransportInterceptor,
Register an injectable provider as an application-wide transport interceptor.
Sourcepub fn app_transport_filter<T>() -> Selfwhere
T: FromModuleRef + TransportExceptionFilter,
pub fn app_transport_filter<T>() -> Selfwhere
T: FromModuleRef + TransportExceptionFilter,
Register an injectable provider as an application-wide transport exception filter.
Sourcepub fn with_app_guard<T>(self) -> Selfwhere
T: Guard,
pub fn with_app_guard<T>(self) -> Selfwhere
T: Guard,
Mark this provider as an application-wide HTTP guard.
Sourcepub fn with_app_pipe<T>(self) -> Selfwhere
T: Pipe,
pub fn with_app_pipe<T>(self) -> Selfwhere
T: Pipe,
Mark this provider as an application-wide HTTP pipe.
Sourcepub fn with_app_interceptor<T>(self) -> Selfwhere
T: Interceptor,
pub fn with_app_interceptor<T>(self) -> Selfwhere
T: Interceptor,
Mark this provider as an application-wide HTTP interceptor.
Sourcepub fn with_app_filter<T>(self) -> Selfwhere
T: ExceptionFilter,
pub fn with_app_filter<T>(self) -> Selfwhere
T: ExceptionFilter,
Mark this provider as an application-wide HTTP exception filter.
Sourcepub fn with_app_websocket_guard<T>(self) -> Selfwhere
T: WebSocketGuard,
pub fn with_app_websocket_guard<T>(self) -> Selfwhere
T: WebSocketGuard,
Mark this provider as an application-wide WebSocket guard.
Sourcepub fn with_app_websocket_pipe<T>(self) -> Selfwhere
T: WebSocketPipe,
pub fn with_app_websocket_pipe<T>(self) -> Selfwhere
T: WebSocketPipe,
Mark this provider as an application-wide WebSocket pipe.
Sourcepub fn with_app_websocket_interceptor<T>(self) -> Selfwhere
T: WebSocketInterceptor,
pub fn with_app_websocket_interceptor<T>(self) -> Selfwhere
T: WebSocketInterceptor,
Mark this provider as an application-wide WebSocket interceptor.
Sourcepub fn with_app_websocket_filter<T>(self) -> Selfwhere
T: WebSocketExceptionFilter,
pub fn with_app_websocket_filter<T>(self) -> Selfwhere
T: WebSocketExceptionFilter,
Mark this provider as an application-wide WebSocket exception filter.
Sourcepub fn with_app_transport_guard<T>(self) -> Selfwhere
T: TransportGuard,
pub fn with_app_transport_guard<T>(self) -> Selfwhere
T: TransportGuard,
Mark this provider as an application-wide transport guard.
Sourcepub fn with_app_transport_pipe<T>(self) -> Selfwhere
T: TransportPipe,
pub fn with_app_transport_pipe<T>(self) -> Selfwhere
T: TransportPipe,
Mark this provider as an application-wide transport pipe.
Sourcepub fn with_app_transport_interceptor<T>(self) -> Selfwhere
T: TransportInterceptor,
pub fn with_app_transport_interceptor<T>(self) -> Selfwhere
T: TransportInterceptor,
Mark this provider as an application-wide transport interceptor.
Sourcepub fn with_app_transport_filter<T>(self) -> Selfwhere
T: TransportExceptionFilter,
pub fn with_app_transport_filter<T>(self) -> Selfwhere
T: TransportExceptionFilter,
Mark this provider as an application-wide transport exception filter.
pub fn with_scope(self, scope: ProviderScope) -> Self
Sourcepub fn with_dependencies<I>(self, dependencies: I) -> Selfwhere
I: IntoIterator<Item = ProviderDependency>,
pub fn with_dependencies<I>(self, dependencies: I) -> Selfwhere
I: IntoIterator<Item = ProviderDependency>,
Declare the dependencies captured by this provider factory.
Sourcepub fn depends_on<T>(self) -> Self
pub fn depends_on<T>(self) -> Self
Add one required typed dependency to this provider factory.
Sourcepub fn depends_on_named(self, token: impl Into<String>) -> Self
pub fn depends_on_named(self, token: impl Into<String>) -> Self
Add one required named dependency to this provider factory.
Sourcepub fn with_dependency(self, dependency: ProviderDependency) -> Self
pub fn with_dependency(self, dependency: ProviderDependency) -> Self
Add one dependency while retaining previously declared metadata.
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_module_destroy<T>(self) -> Selfwhere
T: ProviderOnModuleDestroy,
pub fn with_before_application_shutdown<T>(self) -> Selfwhere
T: ProviderBeforeApplicationShutdown,
pub fn with_on_application_shutdown<T>(self) -> Selfwhere
T: ProviderOnApplicationShutdown,
pub fn token(&self) -> &ProviderToken
pub fn scope(&self) -> ProviderScope
Sourcepub fn dependencies(&self) -> Option<&[ProviderDependency]>
pub fn dependencies(&self) -> Option<&[ProviderDependency]>
Declared dependency metadata, or None for an opaque factory.
Trait Implementations§
Source§impl Clone for ProviderDefinition
impl Clone for ProviderDefinition
Source§fn clone(&self) -> ProviderDefinition
fn clone(&self) -> ProviderDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more