Skip to main content

ProviderDefinition

Struct ProviderDefinition 

Source
pub struct ProviderDefinition { /* private fields */ }
Expand description

A provider registration, similar to a Nest provider entry.

Implementations§

Source§

impl ProviderDefinition

Source

pub fn singleton<T>(value: T) -> Self
where T: Send + Sync + 'static,

Source

pub fn named_singleton<T>(token: impl Into<String>, value: T) -> Self
where T: Send + Sync + 'static,

Source

pub fn from_arc<T>(value: Arc<T>) -> Self
where T: Send + Sync + 'static,

Source

pub fn named_from_arc<T>(token: impl Into<String>, value: Arc<T>) -> Self
where T: Send + Sync + 'static,

Source

pub fn factory<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn factory_arc<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn named_factory<T, F>(token: impl Into<String>, factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn named_factory_arc<T, F>(token: impl Into<String>, factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn async_factory<T, F, Fut>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(ModuleRef) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<T>> + Send + 'static,

Source

pub fn async_factory_arc<T, F, Fut>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(ModuleRef) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Arc<T>>> + Send + 'static,

Source

pub fn named_async_factory<T, F, Fut>( token: impl Into<String>, factory: F, ) -> Self
where T: Send + Sync + 'static, F: Fn(ModuleRef) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<T>> + Send + 'static,

Source

pub fn named_async_factory_arc<T, F, Fut>( token: impl Into<String>, factory: F, ) -> Self
where T: Send + Sync + 'static, F: Fn(ModuleRef) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Arc<T>>> + Send + 'static,

Source

pub fn injectable<T>() -> Self
where T: FromModuleRef,

Source

pub fn named_injectable<T>(token: impl Into<String>) -> Self
where T: FromModuleRef,

Source

pub fn alias<T>(target: ProviderToken) -> Self
where T: Send + Sync + 'static,

Source

pub fn named_alias(token: impl Into<String>, target: ProviderToken) -> Self

Source

pub fn transient<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn transient_arc<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn named_transient<T, F>(token: impl Into<String>, factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn named_transient_arc<T, F>(token: impl Into<String>, factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn transient_injectable<T>() -> Self
where T: FromModuleRef,

Source

pub fn named_transient_injectable<T>(token: impl Into<String>) -> Self
where T: FromModuleRef,

Source

pub fn request_scoped<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn request_scoped_arc<T, F>(factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn named_request_scoped<T, F>(token: impl Into<String>, factory: F) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<T> + Send + Sync + 'static,

Source

pub fn named_request_scoped_arc<T, F>( token: impl Into<String>, factory: F, ) -> Self
where T: Send + Sync + 'static, F: Fn(&ModuleRef) -> Result<Arc<T>> + Send + Sync + 'static,

Source

pub fn request_scoped_injectable<T>() -> Self
where T: FromModuleRef,

Source

pub fn named_request_scoped_injectable<T>(token: impl Into<String>) -> Self
where T: FromModuleRef,

Source

pub fn app_guard<T>() -> Self
where T: FromModuleRef + Guard,

Register an injectable provider as an application-wide HTTP guard.

Source

pub fn app_pipe<T>() -> Self
where T: FromModuleRef + Pipe,

Register an injectable provider as an application-wide HTTP pipe.

Source

pub fn app_interceptor<T>() -> Self

Register an injectable provider as an application-wide HTTP interceptor.

Source

pub fn app_filter<T>() -> Self

Register an injectable provider as an application-wide HTTP exception filter.

Source

pub fn app_websocket_guard<T>() -> Self

Register an injectable provider as an application-wide WebSocket guard.

Source

pub fn app_websocket_pipe<T>() -> Self

Register an injectable provider as an application-wide WebSocket pipe.

Source

pub fn app_websocket_interceptor<T>() -> Self

Register an injectable provider as an application-wide WebSocket interceptor.

Source

pub fn app_websocket_filter<T>() -> Self

Register an injectable provider as an application-wide WebSocket exception filter.

Source

pub fn app_transport_guard<T>() -> Self

Register an injectable provider as an application-wide transport guard.

Source

pub fn app_transport_pipe<T>() -> Self

Register an injectable provider as an application-wide transport pipe.

Source

pub fn app_transport_interceptor<T>() -> Self

Register an injectable provider as an application-wide transport interceptor.

Source

pub fn app_transport_filter<T>() -> Self

Register an injectable provider as an application-wide transport exception filter.

Source

pub fn with_app_guard<T>(self) -> Self
where T: Guard,

Mark this provider as an application-wide HTTP guard.

Source

pub fn with_app_pipe<T>(self) -> Self
where T: Pipe,

Mark this provider as an application-wide HTTP pipe.

Source

pub fn with_app_interceptor<T>(self) -> Self
where T: Interceptor,

Mark this provider as an application-wide HTTP interceptor.

Source

pub fn with_app_filter<T>(self) -> Self
where T: ExceptionFilter,

Mark this provider as an application-wide HTTP exception filter.

Source

pub fn with_app_websocket_guard<T>(self) -> Self
where T: WebSocketGuard,

Mark this provider as an application-wide WebSocket guard.

Source

pub fn with_app_websocket_pipe<T>(self) -> Self
where T: WebSocketPipe,

Mark this provider as an application-wide WebSocket pipe.

Source

pub fn with_app_websocket_interceptor<T>(self) -> Self

Mark this provider as an application-wide WebSocket interceptor.

Source

pub fn with_app_websocket_filter<T>(self) -> Self

Mark this provider as an application-wide WebSocket exception filter.

Source

pub fn with_app_transport_guard<T>(self) -> Self
where T: TransportGuard,

Mark this provider as an application-wide transport guard.

Source

pub fn with_app_transport_pipe<T>(self) -> Self
where T: TransportPipe,

Mark this provider as an application-wide transport pipe.

Source

pub fn with_app_transport_interceptor<T>(self) -> Self

Mark this provider as an application-wide transport interceptor.

Source

pub fn with_app_transport_filter<T>(self) -> Self

Mark this provider as an application-wide transport exception filter.

Source

pub fn with_scope(self, scope: ProviderScope) -> Self

Source

pub fn with_dependencies<I>(self, dependencies: I) -> Self

Declare the dependencies captured by this provider factory.

Source

pub fn depends_on<T>(self) -> Self
where T: Send + Sync + 'static,

Add one required typed dependency to this provider factory.

Source

pub fn depends_on_named(self, token: impl Into<String>) -> Self

Add one required named dependency to this provider factory.

Source

pub fn with_dependency(self, dependency: ProviderDependency) -> Self

Add one dependency while retaining previously declared metadata.

Source

pub fn with_on_module_init<T>(self) -> Self

Source

pub fn with_on_application_bootstrap<T>(self) -> Self

Source

pub fn with_on_module_destroy<T>(self) -> Self

Source

pub fn with_before_application_shutdown<T>(self) -> Self

Source

pub fn with_on_application_shutdown<T>(self) -> Self

Source

pub fn token(&self) -> &ProviderToken

Source

pub fn scope(&self) -> ProviderScope

Source

pub fn dependencies(&self) -> Option<&[ProviderDependency]>

Declared dependency metadata, or None for an opaque factory.

Trait Implementations§

Source§

impl Clone for ProviderDefinition

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProviderDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more