// Enum over all the cases in which the `select!` waiting has completed and the result
// can be processed.
//
// `enum __PrivResult<_1, _2, ...> { _1(_1), _2(_2), ..., Complete }`
Enum over all the cases in which the `select!` waiting has completed and the result
can be processed.


Enum over all the cases in which the ` select! ` waiting has completed and the result can be processed .
fn declare_result_enum(
    result_ident: Ident,
    variants: usize,
    complete: bool,
    span: Span
) -> (Vec<Ident>, syn::ItemEnum) {
    // "_0", "_1", "_2"
    let variant_names: Vec<Ident> =
        (0..variants)
            .map(|num| format_ident!("_{}", num, span = span))
            .collect();
    let type_parameters = &variant_names;
    let variants = &variant_names;
    let complete_variant = if complete {
        Some(quote!(Complete))
    } else {
        None
    };
    let enum_item = parse_quote! {
        enum #result_ident<#(#type_parameters,)*> {
            #(
                #variants(#type_parameters),
            )*
            #complete_variant
        }
    };
    (variant_names, enum_item)
}
fn declare_result_enum ( result_ident : Ident , variants : usize , complete : bool , span : Span ) -> ( Vec < Ident > , syn :: ItemEnum ) { // "_0", "_1", "_2" let variant_names : Vec < Ident > = ( 0 .. variants ) . map ( | num | format_ident ! ( " " num span span ) ) . collect ( ) ; let type_parameters = & variant_names ; let variants = & variant_names ; let complete_variant = if complete { Some ( quote ! ( Complete ) ) } else { None } ; let enum_item = parse_quote ! { enum result_ident ( type_parameters ) { ( variants ( type_parameters ) ) complete_variant } } ; ( variant_names , enum_item ) }
Enum over all the cases in which the `select!` waiting has completed and the result
can be processed.
Enum over all the cases in which the ` select! ` waiting has completed and the result can be processed .
result_ident
Ident
variants
usize
complete
bool
span
Span