Struct PipeLine

Source
pub struct PipeLine<'pl, E, C> {
    pub marker: String,
    pub rank: i16,
    pub extensions: Extensions,
    /* private fields */
}
Expand description

Represents a medium that manipulates the collected data structure of App

In practise, it processes the collected data and consume it according to the marker and rank

Fields§

§marker: String§rank: i16§extensions: Extensions

additional arguments for extensive application

Implementations§

Source§

impl<'pl, E, C> PipeLine<'pl, E, C>

Source

pub fn builder() -> PipeLineBuilder<'pl, E, C>

Create an instance of PipeLinesBuilder that used to build a PipeLine

§Examples
async fn process_entity(&mut Vec<E>, &mut App<E>) {}
let pipeline = Pipeline::builder()
    .process_entity(process_entity)
    .build("marker");
Source

pub fn rank(&self) -> i16

get the rank of PipeLine

§Examples
async fn process_entity(&mut Vec<E>, &mut App<E>) {}
let pipeline = Pipeline::builder()
    .process_entity(process_entity)
    .build("marker");
assert_eq!(pipeline.rank(), 0);
Source

pub fn rank_mut(&mut self) -> &mut i16

get mutable reference to rank of PipeLine

§Examples
async fn process_entity(&mut Vec<E>, &mut App<E>) {}
let pipeline = Pipeline::builder()
    .process_entity(process_entity)
    .build("marker");
pipeline.rank_mut() = 3;
assert_eq!(pipeline.rank(), 3);
Source

pub fn extensions_mut(&mut self) -> &mut Extensions

mutate the extensions of PipeLine

§Examples
let mut pipeline = Pipeline::builder()
    .extensions(1i32)
    .build("marker");
pipeline.extension_mut().insert(2i32);
Source

pub fn extensions(&self) -> &Extensions

get extensions of PipeLine

§Examples
let pipeline = Pipeline::builder()
    .extensions(1i32)
    .build("marker");
assert_eq!(pipeline.extensions().get::<i32>(), 1);
Source

pub fn initializer_mut( self, initials: &'pl dyn for<'a> Fn(&'a mut App<E>) -> BoxFuture<'a, Option<C>>, ) -> Self

Set the initializer of PipeLine, if not called, the default value is None

§Examples
async fn initializer(_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .initializer_mut(&initializer)
    .build("marker".into());
assert! (pipeline.initializer.is_some())
Source

pub fn initializer( &self, ) -> Option<&'pl dyn for<'a> Fn(&'a mut App<E>) -> BoxFuture<'a, Option<C>>>

Get the shared reference of initializer of PipeLine, if not set before, None is returned

§Examples
async fn initializer(_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .initializer_mut(&initializer)
    .build("marker".into());
assert_eq! (pipeline.initializer (), Some(initializer))
Source

pub fn disposer_mut( self, dispose: &'pl dyn for<'a> Fn(&'a mut App<E>) -> BoxFuture<'a, ()>, ) -> Self

Set the disposer of PipeLine, if not called, the default value is None

§Examples
async fn disposer(_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .disposer_mut(&disposer)
    .build("marker".into());
assert! (pipeline.disposer.is_some())
Source

pub fn disposer( &self, ) -> Option<&'pl dyn for<'a> Fn(&'a mut App<E>) -> BoxFuture<'a, ()>>

Get the shared reference of disposer of PipeLine, if not set before, None is returned

§Examples
async fn disposer(_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .disposer_mut(&disposer)
    .build("marker".into());
assert_eq! (pipeline.disposer (), Some(disposer))
Source

pub fn entity_mut( self, entity: &'pl dyn for<'a> Fn(Vec<E>, &'a mut App<E>) -> BoxFuture<'a, ()>, ) -> Self

Set the process_entity of PipeLine, if not called, the default value is None

§Examples
async fn process_entity(_ : & mut Vec < E > ,_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .entity_mut(&process_entity)
    .build("marker".into());
assert! (pipeline.process_entity.is_some())
Source

pub fn entity( &self, ) -> Option<&'pl dyn for<'a> Fn(Vec<E>, &'a mut App<E>) -> BoxFuture<'a, ()>>

Get the shared reference of process_entity of PipeLine, if not set before, None is returned

§Examples
async fn process_entity(_ : & mut Vec < E > ,_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .entity_mut(&process_entity)
    .build("marker".into());
assert_eq! (pipeline.entity (), Some(process_entity))
Source

pub fn yerr_mut( self, yerr: &'pl dyn for<'a> Fn(Vec<Result<Response, MetaResponse>>, &'a mut App<E>) -> BoxFuture<'a, ()>, ) -> Self

Set the process_yerr of PipeLine, if not called, the default value is None

§Examples
async fn process_yerr(_ : & mut Vec < Result<Response, MetaResponse> > ,_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .yerr_mut(&process_yerr)
    .build("marker".into());
assert! (pipeline.process_yerr.is_some())
Source

pub fn yerr( &self, ) -> Option<&'pl dyn for<'a> Fn(Vec<Result<Response, MetaResponse>>, &'a mut App<E>) -> BoxFuture<'a, ()>>

Get the shared reference of process_yerr of PipeLine, if not set before, None is returned

§Examples
async fn process_yerr(_ : & mut Vec < Result<Response, MetaResponse> > ,_: &mut App<E>) {}
let pipeline = PipeLines::builder()
    .yerr_mut(&process_yerr)
    .build("marker".into());
assert_eq! (pipeline.yerr (), Some(process_yerr))

Auto Trait Implementations§

§

impl<'pl, E, C> Freeze for PipeLine<'pl, E, C>

§

impl<'pl, E, C> !RefUnwindSafe for PipeLine<'pl, E, C>

§

impl<'pl, E, C> !Send for PipeLine<'pl, E, C>

§

impl<'pl, E, C> !Sync for PipeLine<'pl, E, C>

§

impl<'pl, E, C> Unpin for PipeLine<'pl, E, C>

§

impl<'pl, E, C> !UnwindSafe for PipeLine<'pl, E, C>

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> 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<T> Same for T

Source§

type Output = T

Should always be Self
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.
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