Skip to main content

AndThen

Struct AndThen 

Source
pub struct AndThen<First, Second> { /* private fields */ }
Expand description

Type-chained sequence: feed input through first, then feed the intermediate through second. The type system enforces first::Out = second::In; the error channel is bridged by Second::Err: From<First::Err> (thiserror #[from] chains supply the impls). This is the composition law of the form family — the only operator the backport lands at G2; Race/Tee/Quorum follow when a use case asks.

AndThen is itself a Pipe (and a SendPipe when both stages are), so chains nest: AndThen::new(a, AndThen::new(b, c)).

Implementations§

Source§

impl<First, Second> AndThen<First, Second>

Source

pub const fn new(first: First, second: Second) -> Self

Construct a two-stage AndThen. Nest for longer chains.

Trait Implementations§

Source§

impl<First: AllocFree, Second: AllocFree> AllocFree for AndThen<First, Second>

Source§

impl<First: Clone, Second: Clone> Clone for AndThen<First, Second>

Source§

fn clone(&self) -> Self

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<First: Commutative, Second: Commutative> Commutative for AndThen<First, Second>

Source§

impl<First: Copy, Second: Copy> Copy for AndThen<First, Second>

Source§

impl<First: Debug, Second: Debug> Debug for AndThen<First, Second>

Source§

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

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

impl<First: Deterministic, Second: Deterministic> Deterministic for AndThen<First, Second>

Source§

impl<First: DropSafe, Second: DropSafe> DropSafe for AndThen<First, Second>

Source§

impl<First: IdempotentSideEffectFree, Second: IdempotentSideEffectFree> IdempotentSideEffectFree for AndThen<First, Second>

Source§

impl<First: IsPure, Second: IsPure> IsPure for AndThen<First, Second>

Source§

impl<First: NoStd, Second: NoStd> NoStd for AndThen<First, Second>

Source§

impl<First, Second> Pipe for AndThen<First, Second>
where First: Pipe, Second: Pipe<In = First::Out>, Second::Err: From<First::Err>,

Source§

type In = <First as Pipe>::In

Input the pipe consumes.
Source§

type Out = <Second as Pipe>::Out

Output the pipe produces.
Source§

type Err = <Second as Pipe>::Err

Error the pipe can fail with. Debug + 'static; Send is added only on the cross-core SendPipe form.
Source§

fn call( &self, input: Self::In, ) -> impl Future<Output = Result<Self::Out, Self::Err>>

Apply the pipe. The returned future is NOT required to be Send.
Source§

impl<First: Reproducible, Second: Reproducible> Reproducible for AndThen<First, Second>

Source§

impl<First, Second> SendPipe for AndThen<First, Second>
where First: SendPipe, Second: SendPipe<In = First::Out>, Second::Err: From<First::Err>, First::In: Send,

Source§

type In = <First as SendPipe>::In

Input the pipe consumes.
Source§

type Out = <Second as SendPipe>::Out

Output the pipe produces.
Source§

type Err = <Second as SendPipe>::Err

Error the pipe can fail with — Send here so it can cross cores.
Source§

fn call( &self, input: Self::In, ) -> impl Future<Output = Result<Self::Out, Self::Err>> + Send

Apply the pipe. The returned future IS Send.
Source§

impl<First, Second> UnpinPipe for AndThen<First, Second>
where First: UnpinPipe, Second: UnpinPipe<In = First::Out>, Second::Err: From<First::Err>,

Source§

type In = <First as UnpinPipe>::In

Input the pipe consumes.
Source§

type Out = <Second as UnpinPipe>::Out

Output the pipe produces.
Source§

type Err = <Second as UnpinPipe>::Err

Error the pipe can fail with.
Source§

fn call( &self, input: Self::In, ) -> impl Future<Output = Result<Self::Out, Self::Err>> + Unpin

Apply the pipe. The returned future IS Unpin — pollable in place.
Source§

impl<First, Second> UnpinSendPipe for AndThen<First, Second>
where First: UnpinSendPipe, Second: UnpinSendPipe<In = First::Out>, Second::Err: From<First::Err>,

Source§

type In = <First as UnpinSendPipe>::In

Input the pipe consumes.
Source§

type Out = <Second as UnpinSendPipe>::Out

Output the pipe produces.
Source§

type Err = <Second as UnpinSendPipe>::Err

Error the pipe can fail with — Send here so it can cross cores.
Source§

fn call( &self, input: Self::In, ) -> impl Future<Output = Result<Self::Out, Self::Err>> + Send + Unpin

Apply the pipe. The returned future is Send AND Unpin.
Source§

impl<First: WithoutFilesystem, Second: WithoutFilesystem> WithoutFilesystem for AndThen<First, Second>

Source§

impl<First: WithoutNetwork, Second: WithoutNetwork> WithoutNetwork for AndThen<First, Second>

Source§

impl<First: WithoutRandom, Second: WithoutRandom> WithoutRandom for AndThen<First, Second>

Source§

impl<First: WithoutSpawn, Second: WithoutSpawn> WithoutSpawn for AndThen<First, Second>

Source§

impl<First: WithoutTime, Second: WithoutTime> WithoutTime for AndThen<First, Second>

Auto Trait Implementations§

§

impl<First, Second> Freeze for AndThen<First, Second>
where First: Freeze, Second: Freeze,

§

impl<First, Second> RefUnwindSafe for AndThen<First, Second>
where First: RefUnwindSafe, Second: RefUnwindSafe,

§

impl<First, Second> Send for AndThen<First, Second>
where First: Send, Second: Send,

§

impl<First, Second> Sync for AndThen<First, Second>
where First: Sync, Second: Sync,

§

impl<First, Second> Unpin for AndThen<First, Second>
where First: Unpin, Second: Unpin,

§

impl<First, Second> UnsafeUnpin for AndThen<First, Second>
where First: UnsafeUnpin, Second: UnsafeUnpin,

§

impl<First, Second> UnwindSafe for AndThen<First, Second>
where First: UnwindSafe, Second: 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> 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<P> DynPipe<<P as Pipe>::In, <P as Pipe>::Out> for P
where P: Pipe, ProximaError: From<<P as Pipe>::Err>,

Source§

fn call_dyn( &self, input: <P as Pipe>::In, ) -> Pin<Box<dyn Future<Output = Result<<P as Pipe>::Out, ProximaError>> + '_>>

Erased dispatch — boxes the inner pipe’s future and converts its error into ProximaError.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Implementor> Handler for Implementor
where Implementor: SendPipe<In = Request<Bytes>, Out = Response<Bytes>, Err = ProximaError>,

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

Source§

fn and_then<Next>(self, next: Next) -> AndThen<Self, Next>
where Next: Pipe<In = Self::Out>, Next::Err: From<Self::Err>,

self.and_then(next) is AndThen::new(self, next) — reads left-to-right at the call site.
Source§

fn filter<Pred>(self, predicate: Pred) -> AndThen<Pred, Self>
where Pred: Pipe<Out = Self::In>, Self::Err: From<Pred::Err>,

Gate self behind predicate.
Source§

fn fanout(self, other: Self) -> FanOut<Self, AllOrNothing>
where Self: Clone, Self::In: Clone,

Broadcast to self and other, all-or-nothing.
Source§

fn fanin<Strategy>( self, other: Self, strategy: Strategy, ) -> FanIn<Self, Strategy, 2>
where Self: UnpinPipe<In = (), Err = Exhausted> + DropSafe, Strategy: FanInStrategy,

Merge self and other into a two-source FanIn. FanIn sources are UnpinPipe-shaped (In = (), Err = Exhausted), hence the extra bound.
Source§

impl<S> PollSourceExt for S
where S: UnpinPipe<In = (), Err = Exhausted>,

Source§

fn into_stream(self) -> AsStream<Self>

Owns self, wrapping it as a futures::Stream.
Source§

fn as_stream(&mut self) -> AsStream<&mut Self>

Borrows self MUTABLY as a futures::Stream, so the source can be reused once the stream handle is dropped — the same shape as Iterator::by_ref. &mut Self composes via the UnpinPipe blanket impl for &mut S below, with no wrapper reinvention.
Source§

impl<P> SendDynPipe<<P as SendPipe>::In, <P as SendPipe>::Out> for P
where P: SendPipe, <P as SendPipe>::In: Send, ProximaError: From<<P as SendPipe>::Err>,

Source§

fn call_dyn( &self, input: <P as SendPipe>::In, ) -> Pin<Box<dyn Future<Output = Result<<P as SendPipe>::Out, ProximaError>> + Send + '_>>

Erased dispatch — boxes the inner pipe’s Send future and converts its error into ProximaError.
Source§

impl<Implementor> SourcePipe for Implementor
where Implementor: SendPipe<In = Signal, Out = (), Err = ProximaError>,

Source§

impl<Implementor> ThreadLocalHandler for Implementor
where Implementor: Pipe<In = Request<Bytes>, Out = Response<Bytes>, Err = ProximaError>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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