[][src]Struct join_impl::join::join_generator::JoinGenerator

pub struct JoinGenerator<'a> { /* fields omitted */ }

Generator of join! macro output.

Methods

impl<'a> JoinGenerator<'a>[src]

pub fn new(
    branches: &'a [ActionExprChain],
    handler: Option<&'a Handler>,
    futures_crate_path: Option<&'a Path>,
    custom_joiner: Option<&'a TokenStream>,
    custom_transpose_results: Option<bool>,
    lazy_branches: Option<bool>,
    config: Config
) -> Result<Self, &'static str> where
    Self: Sized
[src]

Creates new JoinGenerator with given branches - ActionExprChains, optional handler, optional futures_crate_path and Config. Will return Err if macro isn't try but map or and_then handler provided, or if then handler provided for try macro, if futures_crate_path provided for non async macro, if branches count is equal to 0.

pub fn generate_steps<TPat: ToTokens + Clone, TVar: ToTokens + Clone>(
    &self,
    result_pats: &[TPat],
    result_vars: &[TVar]
) -> TokenStream
[src]

Generates TokenStream which contains all steps. result_pats will be used in let destructuring patterns and result_vars will be placed in actual step streams. They both are needed to join steps and make results of previous values in next.

pub fn generate_handle(
    &self,
    results_var: &Ident,
    handler_name: &Ident
) -> TokenStream
[src]

Generates token stream which contains handler call with final results (if handler exists) or returns final results.

pub fn generate_step<TVar: ToTokens, TName: ToTokens>(
    &self,
    step_number: impl Into<u16>,
    result_vars: &[TVar],
    step_results_name: &TName
) -> TokenStream
[src]

Generates TokenStream for step with given index. Result vars are variables with previous step results. result_vars will be used as source values for step and step_result_name will contain tuple of step results.

pub fn join_steps<TPat: ToTokens + Clone, TVar: ToTokens + Clone, TName: ToTokens>(
    &self,
    step_number: impl Into<u16>,
    step_stream: TokenStream,
    next_step_stream: impl Into<Option<TokenStream>>,
    result_pats: &[TPat],
    result_vars: &[TVar],
    step_results_name: &TName
) -> TokenStream
[src]

Joins step steam with next step stream (if Some), returning TokenStream which contains all code. result_pats will be used for desturcturing let patterns while result_vars will be source values for next step. result_vars are also used in results transposer.

pub fn get_branch_result_pat(
    &self,
    branch_index: impl Into<usize>
) -> TokenStream
[src]

Returns provided PatIdent or autogenerated branch name for use in let bindings.

pub fn get_branch_result_name(&self, branch_index: impl Into<usize>) -> Ident[src]

Returns provided or autogenerated Ident for use in expressions.

pub fn wrap_into_block<TVal: ToTokens>(&self, value: &TVal) -> TokenStream[src]

Wraps given value into {...} if sync or into async move {...} if async.

pub fn get_active_step_branch_count(&self, step_number: impl Into<u16>) -> u16[src]

Returns count of active branches for given step.

pub fn is_branch_active_in_step(
    &self,
    step_number: impl Into<u16>,
    branch_index: impl Into<u16>
) -> bool
[src]

Returns true if branch with given index is active in provided step.

Trait Implementations

impl<'a> ToTokens for JoinGenerator<'a>[src]

Auto Trait Implementations

impl<'a> !Send for JoinGenerator<'a>

impl<'a> !Sync for JoinGenerator<'a>

impl<'a> Unpin for JoinGenerator<'a>

impl<'a> !UnwindSafe for JoinGenerator<'a>

impl<'a> !RefUnwindSafe for JoinGenerator<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Spanned for T where
    T: Spanned + ?Sized
[src]