Trait 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 Constants§

Source

const LEN: usize

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

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 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§

type Reverse = ()

Source§

type AsRefVar<'a> = ()

Source§

type AsMutVar<'a> = ()

Source§

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

Source§

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

Source§

type IntoOption = ()

Source§

type IntoVec = ()

Source§

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

Source§

fn reverse(self) -> Self::Reverse

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn into_option(self) -> Self::IntoOption

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§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn reverse(self) -> Self::Reverse

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn into_option(self) -> Self::IntoOption

Source§

fn into_singleton_vec(self) -> Self::IntoVec

Implementors§