[−][src]Struct join_impl::join::join_generator::JoinGenerator
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]
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,
Creates new JoinGenerator
with given branches - ActionExprChain
s, 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]
&self,
result_pats: &[TPat],
result_vars: &[TVar]
) -> TokenStream
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]
&self,
results_var: &Ident,
handler_name: &Ident
) -> TokenStream
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]
&self,
step_number: impl Into<u16>,
result_vars: &[TVar],
step_results_name: &TName
) -> TokenStream
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]
&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
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]
&self,
branch_index: impl Into<usize>
) -> TokenStream
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]
&self,
step_number: impl Into<u16>,
branch_index: impl Into<u16>
) -> bool
Returns true
if branch with given index is active in provided step.
Trait Implementations
impl<'a> ToTokens for JoinGenerator<'a>
[src]
fn to_tokens(&self, output: &mut TokenStream)
[src]
fn to_token_stream(&self) -> TokenStream
[src]
fn into_token_stream(self) -> TokenStream
[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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Spanned for T where
T: Spanned + ?Sized,
[src]
T: Spanned + ?Sized,