MapBind

Struct MapBind 

Source
pub struct MapBind<S, T> { /* private fields */ }
Expand description

Arc is used to clone the inner type lazily. First the Arc gets cloned so the inner T can be reachable in an async move block (as opposed to reference captured in a normal async block, which makes them ?Send). Then, S is run and the inner T is cloned iff the result is ok.

Trait Implementations§

Source§

impl<S: Clone, T: Clone> Clone for MapBind<S, T>

Source§

fn clone(&self) -> MapBind<S, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S, T> Pipe for MapBind<S, T>
where S: Pipe + 'static, S::Output: ResultT, <S::Output as ResultT>::Ok: Append<T>, T: Send + Sync + Clone + 'static,

Source§

type Input = <S as Pipe>::Input

Source§

type Output = Result<<<<S as Pipe>::Output as ResultT>::Ok as Append<T>>::Output, <<S as Pipe>::Output as ResultT>::Err>

Source§

fn run(&self, i: Self::Input) -> PinBoxFut<Self::Output>

Auto Trait Implementations§

§

impl<S, T> Freeze for MapBind<S, T>
where S: Freeze,

§

impl<S, T> RefUnwindSafe for MapBind<S, T>

§

impl<S, T> Send for MapBind<S, T>
where S: Send, T: Sync + Send,

§

impl<S, T> Sync for MapBind<S, T>
where S: Sync, T: Sync + Send,

§

impl<S, T> Unpin for MapBind<S, T>
where S: Unpin,

§

impl<S, T> UnwindSafe for MapBind<S, T>

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