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§
Required Associated Types§
Sourcetype Extend<Suffix>: VariadicExt
where
Suffix: VariadicExt
type Extend<Suffix>: VariadicExt where Suffix: VariadicExt
Creates a new (longer) variadic type by appending Suffix onto the end of this variadc.
Sourcetype Reverse: VariadicExt
type Reverse: VariadicExt
The reverse of this variadic type.
Sourcetype AsRefVar<'a>: RefVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>>
where
Self: 'a
type AsRefVar<'a>: RefVariadic<UnRefVar = Self, RefVar = Self::AsRefVar<'a>, MutVar = Self::AsMutVar<'a>> where Self: 'a
This as a variadic of references.
Sourcetype AsMutVar<'a>: MutVariadic<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
This as a variadic of exclusive (mut) references.
Sourcetype IterAnyRef<'a>: Iterator<Item = &'a dyn Any>
where
Self: 'static
type IterAnyRef<'a>: Iterator<Item = &'a dyn Any> where Self: 'static
Iterator type returned by Self::iter_any_ref.
Sourcetype IterAnyMut<'a>: Iterator<Item = &'a mut dyn Any>
where
Self: 'static
type IterAnyMut<'a>: Iterator<Item = &'a mut dyn Any> where Self: 'static
Iterator type returned by Self::iter_any_mut.
Sourcetype IntoOption
type IntoOption
type for all elements of the variadic being wrapped in Option
Sourcetype IntoVec: VecVariadic<UnVec = Self> + Default
Available on crate feature std only.
type IntoVec: VecVariadic<UnVec = Self> + Default
std only.type for all elements of the variadic being wrapped in Vec
Required Methods§
Sourcefn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>where
Suffix: VariadicExt,
fn extend<Suffix>(self, suffix: Suffix) -> Self::Extend<Suffix>where
Suffix: VariadicExt,
Extends this variadic value by appending suffix onto the end.
Sourcefn reverse_ref(
this: Self::AsRefVar<'_>,
) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>
fn reverse_ref( this: Self::AsRefVar<'_>, ) -> <Self::Reverse as VariadicExt>::AsRefVar<'_>
Reverses an AsRefVar variadic value
Sourcefn as_ref_var(&self) -> Self::AsRefVar<'_>
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();Sourcefn as_mut_var(&mut self) -> Self::AsMutVar<'_>
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();Sourcefn iter_any_ref(&self) -> Self::IterAnyRef<'_>where
Self: 'static,
fn iter_any_ref(&self) -> Self::IterAnyRef<'_>where
Self: 'static,
Iterate this variadic as &dyn Any references.
Sourcefn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>where
Self: 'static,
fn iter_any_mut(&mut self) -> Self::IterAnyMut<'_>where
Self: 'static,
Iterate this variadic as &mut dyn Any exclusive references.
Sourcefn into_option(self) -> Self::IntoOption
fn into_option(self) -> Self::IntoOption
wrap all elements of the variadic in `Option``
Sourcefn into_singleton_vec(self) -> Self::IntoVec
Available on crate feature std only.
fn into_singleton_vec(self) -> Self::IntoVec
std only.wrap all elements of the variadic in a Vec
Provided Methods§
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 ()
impl VariadicExt for ()
const LEN: usize = 0usize
type Extend<Suffix> = Suffix where Suffix: VariadicExt
type Reverse = ()
type AsRefVar<'a> = ()
type AsMutVar<'a> = ()
type IterAnyRef<'a> = Empty<&'a (dyn Any + 'static)> where Self: 'static
type IterAnyMut<'a> = Empty<&'a mut (dyn Any + 'static)> where Self: 'static
type IntoOption = ()
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
Source§fn into_singleton_vec(self) -> Self::IntoVec
fn into_singleton_vec(self) -> Self::IntoVec
std only.Source§impl<Item, Rest> VariadicExt for (Item, Rest)where
Rest: VariadicExt,
impl<Item, Rest> VariadicExt for (Item, Rest)where
Rest: VariadicExt,
const LEN: usize
type Extend<Suffix> = (Item, <Rest as VariadicExt>::Extend<Suffix>) where Suffix: VariadicExt
type Reverse = <<Rest as VariadicExt>::Reverse as VariadicExt>::Extend<(Item, ())>
type AsRefVar<'a> = (&'a Item, <Rest as VariadicExt>::AsRefVar<'a>) where Self: 'a
type AsMutVar<'a> = (&'a mut Item, <Rest as VariadicExt>::AsMutVar<'a>) where Self: 'a
type IterAnyRef<'a> = Chain<Once<&'a (dyn Any + 'static)>, <Rest as VariadicExt>::IterAnyRef<'a>> where Self: 'static
type IterAnyMut<'a> = Chain<Once<&'a mut (dyn Any + 'static)>, <Rest as VariadicExt>::IterAnyMut<'a>> where Self: 'static
type IntoOption = (Option<Item>, <Rest as VariadicExt>::IntoOption)
Source§type IntoVec = (Vec<Item>, <Rest as VariadicExt>::IntoVec)
type IntoVec = (Vec<Item>, <Rest as VariadicExt>::IntoVec)
std only.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
Source§fn into_singleton_vec(self) -> Self::IntoVec
fn into_singleton_vec(self) -> Self::IntoVec
std only.