Struct Mux

Source
pub struct Mux<E, I, ReqB, Res>
where E: From<MuxError>, I: Prepend<Request<ReqB>>,
{ /* private fields */ }

Implementations§

Source§

impl<E, I, ReqB, Res> Mux<E, I, ReqB, Res>
where E: From<MuxError>, I: Prepend<Request<ReqB>>,

Source

pub fn handle_fn<T, Hf, Fut>(self, route: Route<T>, f: Hf) -> Self
where E: 'static, Res: 'static, Hf: Call<<I::Output as Merge<T>>::Output, Fut> + Clone + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send + 'static, I::Output: Merge<T>, T: for<'a, 'b> TryFrom<PathParser<'a, 'b>, Error = PathParseError> + 'static,

Source

pub fn handle<T, Hp>(self, route: Route<T>, pipe: Hp) -> Self
where E: 'static, I::Output: Merge<T>, Res: 'static, Hp: Pipe<Input = <I::Output as Merge<T>>::Output, Output = Result<Res, E>> + Send + Sync + 'static, T: for<'a, 'b> TryFrom<PathParser<'a, 'b>, Error = PathParseError> + 'static,

Source

pub fn serve(&self, input: I::Output) -> impl Future<Output = Result<Res, E>>

Trait Implementations§

Source§

impl<E, I, ReqB, Res> Pipe for Mux<E, I, ReqB, Res>
where E: From<MuxError> + Send + 'static, I: Prepend<Request<ReqB>> + 'static, ReqB: 'static, Res: 'static,

Source§

type Input = <I as Prepend<Request<ReqB>>>::Output

Source§

type Output = Result<Res, E>

Source§

fn run( &self, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Self::Output> + Send>>

Auto Trait Implementations§

§

impl<E, I, ReqB, Res> Freeze for Mux<E, I, ReqB, Res>

§

impl<E, I, ReqB, Res> !RefUnwindSafe for Mux<E, I, ReqB, Res>

§

impl<E, I, ReqB, Res> Send for Mux<E, I, ReqB, Res>

§

impl<E, I, ReqB, Res> Sync for Mux<E, I, ReqB, Res>

§

impl<E, I, ReqB, Res> Unpin for Mux<E, I, ReqB, Res>

§

impl<E, I, ReqB, Res> !UnwindSafe for Mux<E, I, ReqB, Res>

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> PipeExt for T
where T: Pipe,

Source§

fn bind<T>(self, t: T) -> Bind<Self, T>
where Self: Sized, Self::Output: Append<T> + 'static, T: Send + Clone + 'static,

adds a clone of T to the current output
Source§

fn map_bind<T>(self, t: T) -> MapBind<Self, T>
where Self: Sized + 'static, Self::Output: ResultT, <Self::Output as ResultT>::Ok: Append<T>, T: Clone + Send + Sync + 'static,

A combination of map and bind; adds a clone of t to the result if it is Ok. Read more
Source§

fn tuple(self) -> Tuple<Self>
where Self: Sized, Self::Output: 'static,

Puts the Output in a tuple such that it becomes part of the TypeCons and TupleApply traits.
Source§

fn map_tuple(self) -> MapTuple<Self>
where Self: Sized, Self::Output: ResultT + 'static,

A combination of map and tuple; if the result of the current computation is Ok then it gets put in a tuple.
Source§

fn aand_then<F, Fut, O>(self, f: F) -> AAndThen<Self, F, Fut>
where Self: Sized, Self::Output: ResultT + 'static, <Self::Output as ResultT>::Err: Send, F: Call<<Self::Output as ResultT>::Ok, Fut> + Clone + Send + 'static, Fut: Future + Send, <Fut as Future>::Output: ResultT<Ok = O, Err = <Self::Output as ResultT>::Err>,

Like Result::and_then, sequence an asynchronous computation that only runs when the current commputation returns an Ok
Source§

fn and_then<F, OOk>( self, f: F, ) -> AndThen<Self, F, Result<OOk, <Self::Output as ResultT>::Err>>
where Self: Sized, Self::Output: ResultT + 'static, F: Call<<Self::Output as ResultT>::Ok, Result<OOk, <Self::Output as ResultT>::Err>> + Send + Sync + Clone + 'static,

Like Result::and_then, sequence a synchronous computation that only runs when the current commputation returns an Ok
Source§

fn amap<F, Fut, O>(self, f: F) -> AMap<Self, F, Fut>
where Self: Sized, Self::Output: ResultT + Send + 'static, <Self::Output as ResultT>::Ok: Send, <Self::Output as ResultT>::Err: Send, F: Call<<Self::Output as ResultT>::Ok, Fut> + Clone + Send + 'static, Fut: Future<Output = O> + Send,

Like Result::map, sequence an asynchronous computation that only runs when the current commputation returns an Ok
Source§

fn map<F, O>(self, f: F) -> Map<Self, F, O>
where Self: Sized, Self::Output: ResultT + 'static, F: Call<<Self::Output as ResultT>::Ok, O> + Send + Sync + Clone + 'static,

Like Result::map, sequence a synchronous computation that only runs when the current commputation returns an Ok
Source§

fn aseqt<F, Fut, O>(self, f: F) -> Tuple<ASeq<Self, F, Fut>>
where Self: Sized, Self::Output: Send + 'static, O: 'static, Fut: Future<Output = O> + Send, F: Call<Self::Output, Fut> + Send + Clone + 'static,

A convenience function equivalent to calling aseq then tuple
Source§

fn aseq<F, Fut, O>(self, f: F) -> ASeq<Self, F, Fut>
where Self: Sized, Self::Output: Send + 'static, F: Call<Self::Output, Fut> + Send + Clone + 'static, Fut: Future<Output = O> + Send,

Sequence the current computation with an asynchronous one
Source§

fn seqt<F, O>(self, f: F) -> Tuple<Seq<Self, F, O>>
where Self: Sized, Self::Output: 'static, O: 'static, F: Call<Self::Output, O> + Send + Clone + 'static,

A convenience function equivalent to calling seq then tuple
Source§

fn seq<F, O>(self, f: F) -> Seq<Self, F, O>
where Self: Sized, Self::Output: 'static, F: Call<Self::Output, O> + Send + Clone + 'static,

Sequence the current computatation with a synchronous one
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.