Struct fama::Pipeline

source ·
pub struct Pipeline<T: Send + Sync + 'static> { /* private fields */ }
Expand description

The pipes manager

Implementations§

source§

impl<T: Clone + Send + Sync + 'static> Pipeline<T>

source

pub fn pass(content: T) -> Self

Accepts the pipeline content/input. This is the beginning of the pipeline

source

pub async fn through_fn<H, Args, O>(self, handler: H) -> Selfwhere H: PipeFnHandler<Args, O>, Args: Injectable + 'static,

Accepts a closure or function as a pipe. The closure can accept zero or more arguments. Unlike a struct pipe, a closure does not have to use a tuple for multiple arguments. Arguments can be up to 17

source

pub async fn next_fn<H, Args>(self, handler: H) -> Selfwhere H: PipeFnHandler<Args, bool>, Args: Injectable + 'static,

Accepts a closure or function as a pipe. The closure can accept zero or more arguments. Unlike a struct pipe, a closure does not have to use a tuple for multiple arguments. Arguments can be up to 17 Closure must return a boolean. False will stop the pipe flow

source

pub async fn store_fn<H, Args, O: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: PipeFnHandler<Args, O>, Args: Injectable + 'static,

Stores the result from the pipe handler

source

pub async fn some_fn<H, Args, O: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: PipeFnHandler<Args, Option<O>>, Args: Injectable + 'static,

source

pub async fn ok_fn<H, Args, O: Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: PipeFnHandler<Args, Result<O, E>>, Args: Injectable + 'static,

source

pub async fn through<H, Args, O>(self, handler: H) -> Selfwhere H: FamaPipe<Args, O>, Args: Injectable + 'static,

Accepts an instance of a struct that implements fama::FamaPipe The returned result will be store for the next pipe handlers

source

pub async fn next<H, Args>(self, handler: H) -> Selfwhere H: FamaPipe<Args, bool>, Args: Injectable + 'static,

Accepts an instance of a struct that implements fama::FamaPipe Must return a boolean. False will halt the flow

source

pub async fn store<H, Args, O: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: FamaPipe<Args, O>, Args: Injectable + 'static,

source

pub async fn some<H, Args, O: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: FamaPipe<Args, Option<O>>, Args: Injectable + 'static,

source

pub async fn ok<H, Args, O: Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static>( self, handler: H ) -> Selfwhere H: FamaPipe<Args, Result<O, E>>, Args: Injectable + 'static,

source

pub fn deliver(&self) -> T

Returns the passed variable

source

pub fn try_to_deliver(&self) -> Option<T>

Returns the passed variable wrapped in an Option<T>

source

pub fn deliver_as<R: Clone + 'static>(&self) -> R

Returns a different type that may have been set by one of the pipes

source

pub fn try_deliver_as<R: Clone + 'static>(&self) -> Option<R>

Returns a different type that may have been set by one of the pipes. The returned type will be wrapped in an Option<T>

source

pub fn confirm(&self) -> bool

Returns true if the content went through all the registered pipes

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Pipeline<T>where T: RefUnwindSafe,

§

impl<T> Send for Pipeline<T>

§

impl<T> Sync for Pipeline<T>

§

impl<T> Unpin for Pipeline<T>where T: Unpin,

§

impl<T> UnwindSafe for Pipeline<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.