Cons

Struct Cons 

Source
pub struct Cons<Head, Tail>(pub Head, pub Tail)
where
    Tail: ?Sized;
Expand description

Heterogenous list with head and tail values, where tail is another heterogenous list.

Tuple Fields§

§0: Head§1: Tail

Implementations§

Source§

impl<Head, Tail> Cons<Head, Tail>

Source

pub const fn new(head: Head, tail: Tail) -> Self

Constructs a new Cons with provided head and tail values.

§Examples
use hlist2::Cons;

let list = Cons::new(1, "hello world");
assert_eq!(list, Cons(1, "hello world"));
Source

pub fn into_head(self) -> Head

Converts self into head value, discarding its tail.

§Examples
use hlist2::Cons;

let list = Cons::new(1, "hello world");
let head = list.into_head();
assert_eq!(head, 1);
Source

pub fn into_tail(self) -> Tail

Converts self into tail value, discarding its head.

§Examples
use hlist2::Cons;

let list = Cons::new(1, "hello world");
let tail = list.into_tail();
assert_eq!(tail, "hello world");
Source§

impl<Head, Tail> Cons<Head, Tail>
where Tail: ?Sized,

Source

pub const fn head(&self) -> &Head

Borrows head value of self by reference.

§Examples
use hlist2::Cons;

let list = Cons::new(1, "hello world");
let head = list.head();
assert_eq!(head, &1);
Source

pub fn head_mut(&mut self) -> &mut Head

Borrows head value of self by mutable reference.

§Examples
use hlist2::Cons;

let mut list = Cons::new(1, "hello world");
let head = list.head_mut();
*head = 2;
assert_eq!(list, Cons(2, "hello world"));
Source

pub const fn tail(&self) -> &Tail

Borrows tail value of self by reference.

§Examples
use hlist2::Cons;

let list = Cons::new(1, "hello world");
let tail = list.tail();
assert_eq!(tail, &"hello world");
Source

pub fn tail_mut(&mut self) -> &mut Tail

Borrows tail value of self by mutable reference.

§Examples
use hlist2::Cons;

let mut list = Cons::new(1, "hello world");
let tail = list.tail_mut();
*tail = "привет, мир";
assert_eq!(list, Cons(1, "привет, мир"));

Trait Implementations§

Source§

impl<Head, Tail> Append for Cons<Head, Tail>
where Tail: Append,

Source§

type Output<T> = Cons<Head, <Tail as Append>::Output<T>>

Type of heterogenous list with new element.
Source§

fn append<T>(self, value: T) -> Self::Output<T>

Appends new element to the heterogenous list. Read more
Source§

impl<Head, Tail> AsMut<Cons<Head, Tail>> for Cons<Head, Tail>
where Tail: ?Sized,

Source§

fn as_mut(&mut self) -> &mut Cons<Head, Tail>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<Head, Tail> AsRef<Cons<Head, Tail>> for Cons<Head, Tail>
where Tail: ?Sized,

Source§

fn as_ref(&self) -> &Cons<Head, Tail>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Head: Clone, Tail> Clone for Cons<Head, Tail>
where Tail: ?Sized + Clone,

Source§

fn clone(&self) -> Cons<Head, Tail>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Head: Debug, Tail> Debug for Cons<Head, Tail>
where Tail: ?Sized + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Head: Default, Tail> Default for Cons<Head, Tail>
where Tail: ?Sized + Default,

Source§

fn default() -> Cons<Head, Tail>

Returns the “default value” for a type. Read more
Source§

impl<Head, Tail> Extend for Cons<Head, Tail>
where Tail: Extend,

Source§

type Output<T> = Cons<Head, <Tail as Extend>::Output<T>> where T: HList

Type of heterogenous list extended with elements of another heterogenous list.
Source§

fn extend<T>(self, list: T) -> Self::Output<T>
where T: HList,

Extends heterogenous list with another heterogenous list. Read more
Source§

impl<Head, Tail> Flatten for Cons<Head, Tail>
where Head: Extend, Tail: Flatten,

Source§

type Output = <Head as Extend>::Output<<Tail as Flatten>::Output>

Flattened heterogenous list.
Source§

fn flatten(self) -> Self::Output

Flattens a heterogenous list of heterogenous lists, removing one level of indirection. Read more
Source§

impl<A, FHead, FTail, Head, Tail> Fold<A, Cons<FHead, FTail>> for Cons<Head, Tail>
where FHead: FnOnce(A, Head) -> A, Tail: Fold<A, FTail>,

Source§

fn fold(self, init: A, folder: Cons<FHead, FTail>) -> A

Folds every element into an accumulator by applying an operation via folder, returning the final result. Read more
Source§

impl<A, F, Head, Tail> Fold<A, F> for Cons<Head, Tail>
where F: FnMut(A, Head) -> A, Tail: Fold<A, F>,

Source§

fn fold(self, init: A, folder: F) -> A

Folds every element into an accumulator by applying an operation via folder, returning the final result. Read more
Source§

impl<A, F, Head, Tail> Fold<A, Folder<F>> for Cons<Head, Tail>
where F: FoldFn<A, Head>, Tail: Fold<A, Folder<F>>,

Source§

fn fold(self, init: A, folder: Folder<F>) -> A

Folds every element into an accumulator by applying an operation via folder, returning the final result. Read more
Source§

impl<A> From<(A,)> for Cons<A, Nil>

Source§

fn from(value: (A,)) -> Self

Converts to this type from the input type.
Source§

impl<A, B> From<(A, B)> for Cons<A, Cons<B, Nil>>

Source§

fn from(value: (A, B)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C> From<(A, B, C)> for Cons<A, Cons<B, Cons<C, Nil>>>

Source§

fn from(value: (A, B, C)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D> From<(A, B, C, D)> for Cons<A, Cons<B, Cons<C, Cons<D, Nil>>>>

Source§

fn from(value: (A, B, C, D)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E> From<(A, B, C, D, E)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Nil>>>>>

Source§

fn from(value: (A, B, C, D, E)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F> From<(A, B, C, D, E, F)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Nil>>>>>>

Source§

fn from(value: (A, B, C, D, E, F)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G> From<(A, B, C, D, E, F, G)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Nil>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H> From<(A, B, C, D, E, F, G, H)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Nil>>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G, H)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I> From<(A, B, C, D, E, F, G, H, I)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Nil>>>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G, H, I)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J> From<(A, B, C, D, E, F, G, H, I, J)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Nil>>>>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G, H, I, J)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J, K> From<(A, B, C, D, E, F, G, H, I, J, K)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Nil>>>>>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G, H, I, J, K)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> From<(A, B, C, D, E, F, G, H, I, J, K, L)> for Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Cons<L, Nil>>>>>>>>>>>>

Source§

fn from(value: (A, B, C, D, E, F, G, H, I, J, K, L)) -> Self

Converts to this type from the input type.
Source§

impl<Head, Tail> From<(Head, Tail)> for Cons<Head, Tail>

Source§

fn from(value: (Head, Tail)) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Cons<L, Nil>>>>>>>>>>>>> for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Cons<L, Nil>>>>>>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J, K> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Nil>>>>>>>>>>>> for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Cons<K, Nil>>>>>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I, J> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Nil>>>>>>>>>>> for (A, B, C, D, E, F, G, H, I, J)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Cons<J, Nil>>>>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H, I> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Nil>>>>>>>>>> for (A, B, C, D, E, F, G, H, I)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Cons<I, Nil>>>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G, H> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Nil>>>>>>>>> for (A, B, C, D, E, F, G, H)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Cons<H, Nil>>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F, G> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Nil>>>>>>>> for (A, B, C, D, E, F, G)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Cons<G, Nil>>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E, F> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Nil>>>>>>> for (A, B, C, D, E, F)

Source§

fn from( value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Nil>>>>>>, ) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D, E> From<Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Nil>>>>>> for (A, B, C, D, E)

Source§

fn from(value: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Nil>>>>>) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C, D> From<Cons<A, Cons<B, Cons<C, Cons<D, Nil>>>>> for (A, B, C, D)

Source§

fn from(value: Cons<A, Cons<B, Cons<C, Cons<D, Nil>>>>) -> Self

Converts to this type from the input type.
Source§

impl<A, B, C> From<Cons<A, Cons<B, Cons<C, Nil>>>> for (A, B, C)

Source§

fn from(value: Cons<A, Cons<B, Cons<C, Nil>>>) -> Self

Converts to this type from the input type.
Source§

impl<A, B> From<Cons<A, Cons<B, Nil>>> for (A, B)

Source§

fn from(value: Cons<A, Cons<B, Nil>>) -> Self

Converts to this type from the input type.
Source§

impl<A> From<Cons<A, Nil>> for (A,)

Source§

fn from(value: Cons<A, Nil>) -> Self

Converts to this type from the input type.
Source§

impl<Head, Tail> From<Cons<Head, Tail>> for (Head, Tail)

Source§

fn from(value: Cons<Head, Tail>) -> Self

Converts to this type from the input type.
Source§

impl<Head, Tail> FromIterator<Head> for Cons<Head, Tail>
where Tail: FromIterator<Head>,

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = Head>,

Creates a new heterogenous list from an input iterator.

Iterator must contain the same count of elements as the target list type.

§Panics

This function will panic if there is not enough elements in the iterator or if there is no space for elements from the iterator.

§Examples
use hlist2::hlist;

let hlist!(a, b, c, d, e) = [42; 5].into_iter().collect();

If iterator is too long, this call will panic:

use hlist2::hlist;

let hlist!(a, b, c, d, e) = [42; 10].into_iter().collect();

If iterator is too short, this also will panic:

use hlist2::hlist;

let hlist!(a, b, c, d, e) = [42; 1].into_iter().collect();
Source§

impl<Head, Tail, FromTail, TailIndex> Get<FromTail, There<TailIndex>> for Cons<Head, Tail>
where Tail: Get<FromTail, TailIndex> + ?Sized, TailIndex: Index,

Desired type is located somewhere in the tail of the heterogenous list.

Source§

fn get(&self) -> &FromTail

Retrieves a reference to the element of the heterogenous list by type. Read more
Source§

fn get_mut(&mut self) -> &mut FromTail

Retrieves a mutable reference to the element of the heterogenous list by type. Read more
Source§

impl<Head, Tail> Get<Head, Here> for Cons<Head, Tail>
where Tail: HList + ?Sized,

Desired type is located in the head of the heterogenous list.

Source§

fn get(&self) -> &Head

Retrieves a reference to the element of the heterogenous list by type. Read more
Source§

fn get_mut(&mut self) -> &mut Head

Retrieves a mutable reference to the element of the heterogenous list by type. Read more
Source§

impl<Head, Tail> HList for Cons<Head, Tail>
where Tail: HList + ?Sized,

Source§

fn len(&self) -> usize

Returns the length (count of elements) of the heterogenous list. Read more
Source§

fn is_empty(&self) -> bool

Checks if the heterogenous list is empty. Read more
Source§

impl<Head: Hash, Tail> Hash for Cons<Head, Tail>
where Tail: ?Sized + Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Head, Tail> Index<Here> for Cons<Head, Tail>
where Tail: HList + ?Sized,

Retrieves the first element of the heterogenous list in immutable contexts.

§Examples

use hlist2::{hlist, ops::Here};

let list = hlist![1, 2.0, false];
let a = list[Here];
assert_eq!(a, 1);
Source§

type Output = Head

The returned type after indexing.
Source§

fn index(&self, _: Here) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<Head, Tail, TailIndex> Index<There<TailIndex>> for Cons<Head, Tail>
where Tail: Index<TailIndex> + ?Sized, TailIndex: Idx,

Performs indexing operation in the tail of the heterogenous list in immutable contexts.

§Examples

use hlist2::{hlist, ops::{Here, Inc}};

let list = hlist![1, 2.0, false];

let index = Here.inc();
assert_eq!(list[index], 2.0);

let index = index.inc();
assert_eq!(list[index], false);
Source§

type Output = <Tail as Index<TailIndex>>::Output

The returned type after indexing.
Source§

fn index(&self, index: There<TailIndex>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<Head, Tail> IndexMut<Here> for Cons<Head, Tail>
where Tail: HList + ?Sized,

Retrieves the first element of the heterogenous list in mutable contexts.

§Examples

use hlist2::{hlist, ops::Here};

let mut list = hlist![1, 2.0, false];
list[Here] = 5;

let a = list[Here];
assert_eq!(a, 5);
Source§

fn index_mut(&mut self, _: Here) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<Head, Tail, TailIndex> IndexMut<There<TailIndex>> for Cons<Head, Tail>
where Tail: IndexMut<TailIndex> + ?Sized, TailIndex: Idx,

Performs indexing operation in the tail of the heterogenous list in mutable contexts.

§Examples

use hlist2::{hlist, ops::{Here, Inc}};

let mut list = hlist![1, 2.0, false];

let index = Here.inc();
list[index] = 16_f32.sqrt();

let b = list[index];
assert_eq!(b, 4.0);
Source§

fn index_mut(&mut self, index: There<TailIndex>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, Head, Tail> IntoIterator for &'a Cons<Head, Tail>
where Cons<Head, Tail>: ToRef, <Cons<Head, Tail> as ToRef>::Ref<'a>: PrepareIter, <<Cons<Head, Tail> as ToRef>::Ref<'a> as PrepareIter>::Output: ReadyIter<Item = &'a Head>, Tail: ?Sized,

Source§

type Item = &'a Head

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<Cons<Head, Tail> as ToRef>::Ref<'a>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, Head, Tail> IntoIterator for &'a mut Cons<Head, Tail>
where Cons<Head, Tail>: ToRef, <Cons<Head, Tail> as ToRef>::RefMut<'a>: PrepareIter, <<Cons<Head, Tail> as ToRef>::RefMut<'a> as PrepareIter>::Output: ReadyIter<Item = &'a mut Head>, Tail: ?Sized,

Source§

type Item = &'a mut Head

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<Cons<Head, Tail> as ToRef>::RefMut<'a>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<Head, Tail> IntoIterator for Cons<Head, Tail>
where Self: PrepareIter, <Self as PrepareIter>::Output: ReadyIter<Item = Head>,

Source§

type Item = Head

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Cons<Head, Tail>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<Head, Tail> Len for Cons<Head, Tail>
where Tail: Len,

Source§

const LEN: usize

Length (count of elements) of the heterogenous list. Read more
Source§

impl<MHead, MTail, Head, Tail, R> Map<Cons<MHead, MTail>> for Cons<Head, Tail>
where MHead: FnOnce(Head) -> R, Tail: Map<MTail>,

Source§

type Output = Cons<R, <Tail as Map<MTail>>::Output>

Type of new heterogenous list after transformation.
Source§

fn map(self, mapper: Cons<MHead, MTail>) -> Self::Output

Transforms the heterogenous list into another heterogenous list by applying an operation to each element by mapper. Read more
Source§

impl<M, R, Head, Tail> Map<M> for Cons<Head, Tail>
where M: FnMut(Head) -> R, Tail: Map<M>,

Source§

type Output = Cons<R, <Tail as Map<M>>::Output>

Type of new heterogenous list after transformation.
Source§

fn map(self, mapper: M) -> Self::Output

Transforms the heterogenous list into another heterogenous list by applying an operation to each element by mapper. Read more
Source§

impl<M, Head, Tail> Map<Mapper<M>> for Cons<Head, Tail>
where M: MapFn<Head>, Tail: Map<Mapper<M>>,

Source§

type Output = Cons<<M as MapFn<Head>>::Output, <Tail as Map<Mapper<M>>>::Output>

Type of new heterogenous list after transformation.
Source§

fn map(self, mapper: Mapper<M>) -> Self::Output

Transforms the heterogenous list into another heterogenous list by applying an operation to each element by mapper. Read more
Source§

impl<Head: Ord, Tail> Ord for Cons<Head, Tail>
where Tail: ?Sized + Ord,

Source§

fn cmp(&self, other: &Cons<Head, Tail>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Head: PartialEq, Tail> PartialEq for Cons<Head, Tail>
where Tail: ?Sized + PartialEq,

Source§

fn eq(&self, other: &Cons<Head, Tail>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Head: PartialOrd, Tail> PartialOrd for Cons<Head, Tail>
where Tail: ?Sized + PartialOrd,

Source§

fn partial_cmp(&self, other: &Cons<Head, Tail>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Head> Pop for Cons<Head, Nil>

Source§

type Last = Head

The last element of the heterogenous list.
Source§

type Remainder = Nil

Remaining part of the heterogenous list without the last element.
Source§

fn pop(self) -> (Self::Last, Self::Remainder)

Removes the last element from the heterogenous list. Read more
Source§

impl<Head, Tail> Pop for Cons<Head, Tail>
where Tail: Pop, Tail::Remainder: Prepend,

Source§

type Last = <Tail as Pop>::Last

The last element of the heterogenous list.
Source§

type Remainder = <<Tail as Pop>::Remainder as Prepend>::Output<Head>

Remaining part of the heterogenous list without the last element.
Source§

fn pop(self) -> (Self::Last, Self::Remainder)

Removes the last element from the heterogenous list. Read more
Source§

impl<Head, Tail> PopFront for Cons<Head, Tail>
where Tail: HList,

Source§

type First = Head

The first element of the heterogenous list.
Source§

type Remainder = Tail

Remaining part of the heterogenous list without the first element.
Source§

fn pop_front(self) -> (Self::First, Self::Remainder)

Removes the first element from the heterogenous list. Read more
Source§

impl<A, FHead, FTail, Head, Tail> RFold<A, Cons<FHead, FTail>> for Cons<Head, Tail>
where FHead: FnOnce(A, Head) -> A, Tail: RFold<A, FTail>,

Source§

fn rfold(self, init: A, folder: Cons<FHead, FTail>) -> A

Folds every element into an accumulator from the back by applying an operation via folder, returning the final result. Read more
Source§

impl<A, F, Head, Tail> RFold<A, F> for Cons<Head, Tail>
where F: FnMut(A, Head) -> A, Tail: RFoldWithFolder<A, F>,

Source§

fn rfold(self, init: A, folder: F) -> A

Folds every element into an accumulator from the back by applying an operation via folder, returning the final result. Read more
Source§

impl<A, F, Head, Tail> RFold<A, Folder<F>> for Cons<Head, Tail>
where F: FoldFn<A, Head>, Tail: RFoldWithFolder<A, Folder<F>>,

Source§

fn rfold(self, init: A, folder: Folder<F>) -> A

Folds every element into an accumulator from the back by applying an operation via folder, returning the final result. Read more
Source§

impl<Head, Tail, FromTail, TailIndex> Remove<FromTail, There<TailIndex>> for Cons<Head, Tail>
where Tail: Remove<FromTail, TailIndex>, TailIndex: Index, Tail::Remainder: Prepend,

Source§

type Remainder = <<Tail as Remove<FromTail, TailIndex>>::Remainder as Prepend>::Output<Head>

Remaining part of the heterogenous list without a removed element.
Source§

fn remove(self) -> (FromTail, Self::Remainder)

Moves element out of the heterogenous list by type. Read more
Source§

impl<Head, Tail> Remove<Head, Here> for Cons<Head, Tail>
where Tail: HList,

Source§

type Remainder = Tail

Remaining part of the heterogenous list without a removed element.
Source§

fn remove(self) -> (Head, Self::Remainder)

Moves element out of the heterogenous list by type. Read more
Source§

impl<Head, Tail, OtherHead, OtherTail, IndexHead, IndexTail> RemoveMany<Cons<OtherHead, OtherTail>, Cons<IndexHead, IndexTail>> for Cons<Head, Tail>
where OtherTail: HList, IndexHead: Index, IndexTail: ManyIndex, Self: Remove<OtherHead, IndexHead>, <Self as Remove<OtherHead, IndexHead>>::Remainder: RemoveMany<OtherTail, IndexTail>,

Source§

type Remainder = <<Cons<Head, Tail> as Remove<OtherHead, IndexHead>>::Remainder as RemoveMany<OtherTail, IndexTail>>::Remainder

Remaining part of the heterogenous list without removed elements.
Source§

fn remove_many(self) -> (Cons<OtherHead, OtherTail>, Self::Remainder)

Moves many elements out of the heterogenous list by their types. Read more
Source§

impl<Head, Tail> ToRef for Cons<Head, Tail>
where Tail: ToRef + ?Sized,

Source§

type Ref<'a> = Cons<&'a Head, <Tail as ToRef>::Ref<'a>> where Self: 'a

Type of new heterogenous list with references of elements.
Source§

type RefMut<'a> = Cons<&'a mut Head, <Tail as ToRef>::RefMut<'a>> where Self: 'a

Type of new heterogenous list with mutable references of elements.
Source§

fn to_ref(&self) -> Self::Ref<'_>

Converts the heterogenous list into heterogenous list of references. Read more
Source§

fn to_mut(&mut self) -> Self::RefMut<'_>

Converts the heterogenous list into heterogenous list of mutable references. Read more
Source§

impl<First, Second, Tail> Unzip for Cons<(First, Second), Tail>
where Tail: Unzip,

Source§

type First = Cons<First, <Tail as Unzip>::First>

Type of the first heterogenous list from the resulting pair.
Source§

type Second = Cons<Second, <Tail as Unzip>::Second>

Type of the second heterogenous list from the resulting pair.
Source§

fn unzip(self) -> (Self::First, Self::Second)

Converts a heterogenous list of pairs into a pair of heterogenous lists. Read more
Source§

impl<Head, Tail, OHead, OTail> Zip<Cons<OHead, OTail>> for Cons<Head, Tail>
where Tail: Zip<OTail>, OTail: HList,

Source§

type Output = Cons<(Head, OHead), <Tail as Zip<OTail>>::Output>

Type of new heterogenous list after merging.
Source§

fn zip(self, other: Cons<OHead, OTail>) -> Self::Output

Merges, or ‘zips up’ two heterogenous lists into a single heterogenous list of pairs. Read more
Source§

impl<Head: Copy, Tail> Copy for Cons<Head, Tail>
where Tail: ?Sized + Copy,

Source§

impl<Head: Eq, Tail> Eq for Cons<Head, Tail>
where Tail: ?Sized + Eq,

Source§

impl<Head, Tail> Homogenous for Cons<Head, Tail>
where Self: IntoIterator<Item = Head> + FromIterator<Head>, Tail: HList,

Source§

impl<Head, Tail> ManyIndex for Cons<Head, Tail>
where Head: Index, Tail: ManyIndex,

Source§

impl<Head, Tail> StructuralPartialEq for Cons<Head, Tail>
where Tail: ?Sized,

Auto Trait Implementations§

§

impl<Head, Tail> Freeze for Cons<Head, Tail>
where Head: Freeze, Tail: Freeze + ?Sized,

§

impl<Head, Tail> RefUnwindSafe for Cons<Head, Tail>
where Head: RefUnwindSafe, Tail: RefUnwindSafe + ?Sized,

§

impl<Head, Tail> Send for Cons<Head, Tail>
where Head: Send, Tail: Send + ?Sized,

§

impl<Head, Tail> Sync for Cons<Head, Tail>
where Head: Sync, Tail: Sync + ?Sized,

§

impl<Head, Tail> Unpin for Cons<Head, Tail>
where Head: Unpin, Tail: Unpin + ?Sized,

§

impl<Head, Tail> UnwindSafe for Cons<Head, Tail>
where Head: UnwindSafe, Tail: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromHList for T
where T: HList,

Source§

type HList = T

Type of heterogenous list from which conversion will be performed.
Source§

fn from_hlist(hlist: <T as FromHList>::HList) -> T

Converts heterogenous list into a value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoHList for T
where T: HList,

Source§

type HList = T

Type of heterogenous list value of some type will be converted to.
Source§

fn into_hlist(self) -> <T as IntoHList>::HList

Converts self into heterogenous list. Read more
Source§

impl<L> Prepend for L
where L: HList,

Source§

type Output<T> = Cons<T, L>

Type of heterogenous list with new element.
Source§

fn prepend<T>(self, value: T) -> <L as Prepend>::Output<T>

Prepends new element to the heterogenous list. Read more
Source§

impl<T> RemoveMany<Nil, Nil> for T
where T: HList,

Source§

type Remainder = T

Remaining part of the heterogenous list without removed elements.
Source§

fn remove_many(self) -> (Nil, <T as RemoveMany<Nil, Nil>>::Remainder)

Moves many elements out of the heterogenous list by their types. Read more
Source§

impl<T> Reverse for T
where T: Rewind<Nil>,

Source§

type Output = <T as Rewind<Nil>>::Output

Type of new heterogenous list with the opposite order of elements.
Source§

fn reverse(self) -> <T as Reverse>::Output

Reverses elements of the heterogenous list. Read more
Source§

impl<T, L, I> Shuffle<L, I> for T
where L: HList, T: RemoveMany<L, I, Remainder = Nil>, I: ManyIndex,

Source§

fn shuffle(self) -> L

Shuffles current heterogenous list, or changes order of its elements. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.