Skip to main content

MapAsync

Struct MapAsync 

Source
pub struct MapAsync<F, H> {
    pub handler: H,
    pub f: F,
}

Fields§

§handler: H§f: F

Trait Implementations§

Source§

impl<F: Clone, H: Clone> Clone for MapAsync<F, H>

Source§

fn clone(&self) -> MapAsync<F, H>

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<F: Copy, H: Copy> Copy for MapAsync<F, H>

Source§

impl<F: Debug, H: Debug> Debug for MapAsync<F, H>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<F: Eq, H: Eq> Eq for MapAsync<F, H>

Source§

impl<F, H, T, E> Handler<T, E> for MapAsync<F, H>
where T: Send, F: Send + Sync + Fn1ResultAsync<T, E>, H: Handler<F::Ok, E>,

Source§

type Output = <H as Handler<<F as Fn1ResultAsync<T, E>>::Ok, E>>::Output

Source§

fn handle<'a>( &'a self, request: T, ) -> impl Future<Output = Result<Self::Output, E>> + Send + Captures<(&'a Self, T)>

Source§

fn after<C>(self, current: C) -> Seq<C, Self>
where C: SeqHandler<T, E, Self>, Self: Sized,

Run this handler after specified, specified handler must implement SeqHandler to create something meaningful
Source§

fn or<R, EE>(self, rhs: R) -> Or<Self, R>
where Self: Sized + Handler<T, Recoverable<T, EE>>, R: Handler<T, EE>,

Logical or for handlers, refer to Or for documentation
Source§

fn serve<X, OTx, SRx>( self, rx: X, options: ServeOptions<OTx, SRx>, ) -> impl Future<Output = Result<(), E>> + Send
where T: Send + 'static, E: Send + 'static, Self::Output: Send, Self: Sized + Clone + 'static, X: RxChan<T, E, Self::Output>, X::Responder: Send + 'static, OTx: OutputTx<Self::Output, E> + 'static, SRx: ShutdownRx<E>,

Launches Server, same as calling Handler::into_server and Server::serve method on it
Source§

fn into_server<X>(self, rx: X) -> Server<Self, X>
where Self: Sized, X: RxChan<T, E, Self::Output>,

Creates server from that handler, for more, see docs for Server handler
Source§

fn provide<Env, F>(self, env: Env, f: F) -> Provide<Env, F, Self>
where Self: Sized,

Special case of Handler::map_async, refer to Provide documentation for more.
Source§

fn map_async<K, F>(self, f: F) -> MapAsync<F, Self>
where Self: Sized, F: Fn1ResultAsync<K, E, Ok = T>,

Same as Handler::map, but provided function is async
Source§

fn map<K, F>(self, f: F) -> Map<F, Self>
where Self: Sized, F: Fn1Result<K, E, SOut = T>,

Changes input of the handler into another type, to do that - it accepts function that maps that type to input type of the current handler
Source§

fn pipe<Dst>(self, dst: Dst) -> Pipe<Self, Dst>
where Self: Sized, Dst: Handler<Self::Output, E>,

Pipes output from one handler to Dst, refer to docs of Pipe for more.
Source§

fn share(self) -> Arc<Self>
where Self: Sized,

Wraps handler in Arc
Source§

fn erase(self) -> ErasedHandler<T, Self::Output, E>
where T: Send + 'static, Self: Sized + 'static,

Erase type of handler, this requires T to be Send + ’static, I am not sure if this is absolute requirement or it ('static) can be lifted, PRs are welcome
Source§

impl<F: PartialEq, H: PartialEq> PartialEq for MapAsync<F, H>

Source§

fn eq(&self, other: &MapAsync<F, H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F, H> StructuralPartialEq for MapAsync<F, H>

Auto Trait Implementations§

§

impl<F, H> Freeze for MapAsync<F, H>
where H: Freeze, F: Freeze,

§

impl<F, H> RefUnwindSafe for MapAsync<F, H>

§

impl<F, H> Send for MapAsync<F, H>
where H: Send, F: Send,

§

impl<F, H> Sync for MapAsync<F, H>
where H: Sync, F: Sync,

§

impl<F, H> Unpin for MapAsync<F, H>
where H: Unpin, F: Unpin,

§

impl<F, H> UnsafeUnpin for MapAsync<F, H>
where H: UnsafeUnpin, F: UnsafeUnpin,

§

impl<F, H> UnwindSafe for MapAsync<F, H>
where H: UnwindSafe, F: UnwindSafe,

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, U> Captures<U> for T
where U: ?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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.