Trait variadics::VariadicExt

source ·
pub trait VariadicExt: Variadic + Sealed {
    type Extend<Suffix>: VariadicExt
       where Suffix: VariadicExt;
    type Reverse: VariadicExt;
    type AsRefVar<'a>: RefVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>>
       where Self: 'a;
    type AsMutVar<'a>: MutVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>>
       where Self: 'a;
    type IterAnyRef<'a>: Iterator<Item = &'a dyn Any>
       where Self: 'static;
    type IterAnyMut<'a>: Iterator<Item = &'a mut dyn Any>
       where Self: 'static;
    type IntoOption;
    type IntoVec: VecVariadic<UnVec = Self> + Default;

    const LEN: usize;

    // Required methods
    fn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>
       where Suffix: VariadicExt;
    fn reverse(self) -> Self::Reverse;
    fn reverse_ref(
        this: Self::AsRefVar<'_>,
    ) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>;
    fn as_ref_var(&self) -> Self::AsRefVar<'_>;
    fn as_mut_var(&mut self) -> Self::AsMutVar<'_>;
    fn iter_any_ref(&self) -> Self::IterAnyRef<'_>
       where Self: 'static;
    fn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>
       where Self: 'static;
    fn into_option(self) -> Self::IntoOption;
    fn into_singleton_vec(self) -> Self::IntoVec;

    // Provided methods
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

Extension methods/types for Variadics.

This is a sealed trait.

Required Associated Types§

source

type Extend<Suffix>: VariadicExt where Suffix: VariadicExt

Creates a new (longer) variadic type by appending Suffix onto the end of this variadc.

source

type Reverse: VariadicExt

The reverse of this variadic type.

source

type AsRefVar<'a>: RefVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>> where Self: 'a

This as a variadic of references.

source

type AsMutVar<'a>: MutVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>> where Self: 'a

This as a variadic of exclusive (mut) references.

source

type IterAnyRef<'a>: Iterator<Item = &'a dyn Any> where Self: 'static

Iterator type returned by Self::iter_any_ref.

source

type IterAnyMut<'a>: Iterator<Item = &'a mut dyn Any> where Self: 'static

Iterator type returned by Self::iter_any_mut.

source

type IntoOption

type for all elements of the variadic being wrapped in Option

source

type IntoVec: VecVariadic<UnVec = Self> + Default

type for all elements of the variadic being wrapped in Vec

Required Associated Constants§

source

const LEN: usize

The number of items in this variadic (its length).

Required Methods§

source

fn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>
where Suffix: VariadicExt,

Extends this variadic value by appending suffix onto the end.

source

fn reverse(self) -> Self::Reverse

Reverses this variadic value.

source

fn reverse_ref( this: Self::AsRefVar<'_>, ) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>

Reverses an AsRefVar variadic value

source

fn as_ref_var(&self) -> Self::AsRefVar<'_>

Convert a reference to this variadic into a variadic of references.

let as_ref: var_type!(&u32, &String, &bool) =
    var_expr!(1_u32, "Hello".to_owned(), false).as_ref_var();
source

fn as_mut_var(&mut self) -> Self::AsMutVar<'_>

Convert an exclusive (mut) reference to this variadic into a variadic of exclusive (mut) references.

let as_mut: var_type!(&mut u32, &mut String, &mut bool) =
    var_expr!(1_u32, "Hello".to_owned(), false).as_mut_var();
source

fn iter_any_ref(&self) -> Self::IterAnyRef<'_>
where Self: 'static,

Iterate this variadic as &dyn Any references.

source

fn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>
where Self: 'static,

Iterate this variadic as &mut dyn Any exclusive references.

source

fn into_option(self) -> Self::IntoOption

wrap all elements of the variadic in `Option``

source

fn into_singleton_vec(self) -> Self::IntoVec

wrap all elements of the variadic in a Vec

Provided Methods§

source

fn len(&self) -> usize

The length of this variadic type

source

fn is_empty(&self) -> bool

Checks if this variadic type is empty.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl VariadicExt for ()

source§

const LEN: usize = 0usize

source§

type Extend<Suffix> = Suffix where Suffix: VariadicExt

source§

fn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>
where Suffix: VariadicExt,

source§

type Reverse = ()

source§

fn reverse(self) -> Self::Reverse

source§

fn reverse_ref( _this: Self::AsRefVar<'_>, ) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>

source§

type AsRefVar<'a> = ()

source§

fn as_ref_var(&self) -> Self::AsRefVar<'_>

source§

type AsMutVar<'a> = ()

source§

fn as_mut_var(&mut self) -> Self::AsMutVar<'_>

source§

type IterAnyRef<'a> = Empty<&'a (dyn Any + 'static)> where Self: 'static

source§

fn iter_any_ref(&self) -> Self::IterAnyRef<'_>
where Self: 'static,

source§

type IterAnyMut<'a> = Empty<&'a mut (dyn Any + 'static)> where Self: 'static

source§

fn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>
where Self: 'static,

source§

type IntoOption = ()

source§

fn into_option(self) -> Self::IntoOption

source§

type IntoVec = ()

source§

fn into_singleton_vec(self) -> Self::IntoVec

source§

impl<Item, Rest> VariadicExt for (Item, Rest)
where Rest: VariadicExt,

source§

const LEN: usize = _

source§

type Extend<Suffix> = (Item, <Rest as VariadicExt>::Extend<Suffix>) where Suffix: VariadicExt

source§

fn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>
where Suffix: VariadicExt,

source§

type Reverse = <<Rest as VariadicExt>::Reverse as VariadicExt>::Extend<(Item, ())>

source§

fn reverse(self) -> Self::Reverse

source§

fn reverse_ref( this: Self::AsRefVar<'_>, ) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>

source§

type AsRefVar<'a> = (&'a Item, <Rest as VariadicExt>::AsRefVar<'a>) where Self: 'a

source§

fn as_ref_var(&self) -> Self::AsRefVar<'_>

source§

type AsMutVar<'a> = (&'a mut Item, <Rest as VariadicExt>::AsMutVar<'a>) where Self: 'a

source§

fn as_mut_var(&mut self) -> Self::AsMutVar<'_>

source§

type IterAnyRef<'a> = Chain<Once<&'a (dyn Any + 'static)>, <Rest as VariadicExt>::IterAnyRef<'a>> where Self: 'static

source§

fn iter_any_ref(&self) -> Self::IterAnyRef<'_>
where Self: 'static,

source§

type IterAnyMut<'a> = Chain<Once<&'a mut (dyn Any + 'static)>, <Rest as VariadicExt>::IterAnyMut<'a>> where Self: 'static

source§

fn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>
where Self: 'static,

source§

type IntoOption = (Option<Item>, <Rest as VariadicExt>::IntoOption)

source§

fn into_option(self) -> Self::IntoOption

source§

type IntoVec = (Vec<Item>, <Rest as VariadicExt>::IntoVec)

source§

fn into_singleton_vec(self) -> Self::IntoVec

Implementors§