Struct BoxedAsyncMakeService

Source
pub struct BoxedAsyncMakeService<S, E> { /* private fields */ }
Expand description

A type-erased wrapper for asynchronous service factories. A type-erased wrapper for asynchronous service factories.

BoxedAsyncMakeService enables dynamic dispatch for async service factories, allowing for flexible composition of asynchronous service creation pipelines.

Implementations§

Source§

impl<S, E> BoxedAsyncMakeService<S, E>

Source

pub fn new<AMS>(ams: AMS) -> Self
where AMS: AsyncMakeService<Service = S, Error = E> + Send + Sync + 'static, S: 'static,

Source

pub fn downcast_ref<T: Any>(&self) -> Option<&T>

Source

pub unsafe fn downcast_ref_unchecked<T: Any>(&self) -> &T

§Safety

If you are sure the inner type is T, you can downcast it.

Trait Implementations§

Source§

impl<S, E> AsyncMakeService for BoxedAsyncMakeService<S, E>

Source§

type Service = S

The type of service this factory creates.
Source§

type Error = E

The type of error that can occur during service creation.
Source§

async fn make_via_ref( &self, old: Option<&Self::Service>, ) -> Result<Self::Service, Self::Error>

Asynchronously creates a new service, optionally using an existing service as a reference. Read more
Source§

fn make(&self) -> impl Future<Output = Result<Self::Service, Self::Error>>

Asynchronously creates a new service without referencing an existing one. Read more
Source§

impl<S, E> Drop for BoxedAsyncMakeService<S, E>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S, E> Send for BoxedAsyncMakeService<S, E>

Source§

impl<S, E> Sync for BoxedAsyncMakeService<S, E>

Auto Trait Implementations§

§

impl<S, E> Freeze for BoxedAsyncMakeService<S, E>

§

impl<S, E> RefUnwindSafe for BoxedAsyncMakeService<S, E>

§

impl<S, E> Unpin for BoxedAsyncMakeService<S, E>

§

impl<S, E> UnwindSafe for BoxedAsyncMakeService<S, E>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.