Skip to main content

Branch

Enum Branch 

Source
pub enum Branch<Req, Resp> {
    Continue(Req),
    Done(Resp),
}
Expand description

Outcome of a guard jig: either continue with a (possibly transformed) request, or short-circuit the pipeline with a response.

Variants§

§

Continue(Req)

Continue the pipeline with this request.

§

Done(Resp)

Stop the pipeline and return this response.

Implementations§

Source§

impl<Req, Resp> Branch<Req, Resp>

Source

pub fn is_continue(&self) -> bool

Returns true if this is Branch::Continue.

Source

pub fn is_done(&self) -> bool

Returns true if this is Branch::Done.

Source§

impl<REQ, RESP> Branch<REQ, RESP>
where REQ: Request, RESP: Response,

Source

pub fn then<J, Out>(self, jig: J) -> <Out as Merge<RESP>>::Merged
where J: Jig<REQ, Out = Out>, Out: Merge<RESP>,

Append the next jig to a guarded pipeline. If the previous step was Done, its response is propagated and jig is not run.

Trait Implementations§

Source§

impl<Req: Debug, Resp: Debug> Debug for Branch<Req, Resp>

Source§

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

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

impl<REQ, RESP> Merge<RESP> for Branch<REQ, RESP>
where REQ: Request, RESP: Response,

Source§

type Merged = Branch<REQ, RESP>

Result of merging this value with the prior Branch.
Source§

fn into_continue(self) -> Self::Merged

Called when the previous Branch was Continue.
Source§

fn from_done(resp: RESP) -> Self::Merged

Called when the previous Branch was Done, propagating its response.
Source§

impl<REQ, RESP> Status for Branch<REQ, RESP>
where REQ: Request, RESP: Response,

Source§

fn succeeded(&self) -> bool

Returns true if the value represents a successful outcome.
Source§

fn error(&self) -> Option<String>

Error message, if any. Defaults to None.
Source§

impl<REQ, RESP> Step for Branch<REQ, RESP>
where REQ: Request, RESP: Response,

Source§

type Out = Branch<REQ, RESP>

Resolved output of this step.
Source§

type Fut = Ready<Branch<REQ, RESP>>

Future yielding the output.
Source§

fn into_step(self) -> Self::Fut

Convert this value into the future the chain awaits.

Auto Trait Implementations§

§

impl<Req, Resp> Freeze for Branch<Req, Resp>
where Req: Freeze, Resp: Freeze,

§

impl<Req, Resp> RefUnwindSafe for Branch<Req, Resp>
where Req: RefUnwindSafe, Resp: RefUnwindSafe,

§

impl<Req, Resp> Send for Branch<Req, Resp>
where Req: Send, Resp: Send,

§

impl<Req, Resp> Sync for Branch<Req, Resp>
where Req: Sync, Resp: Sync,

§

impl<Req, Resp> Unpin for Branch<Req, Resp>
where Req: Unpin, Resp: Unpin,

§

impl<Req, Resp> UnsafeUnpin for Branch<Req, Resp>
where Req: UnsafeUnpin, Resp: UnsafeUnpin,

§

impl<Req, Resp> UnwindSafe for Branch<Req, Resp>
where Req: UnwindSafe, Resp: 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> 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.