Struct frunk_core::hlist::HCons [] [src]

pub struct HCons<H, T> {
    pub head: H,
    pub tail: T,
}

Represents the most basic non-empty HList. Its value is held in head while its tail is another HList.

Fields

Methods

impl<H, T> HCons<H, T>
[src]

[src]

Returns the head of the list and the tail of the list as a tuple2. The original list is consumed

Examples

let h = hlist!("hi");
let (h, tail) = h.pop();
assert_eq!(h, "hi");
assert_eq!(tail, HNil);Run

Trait Implementations

impl<H: PartialEq, T: PartialEq> PartialEq for HCons<H, T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<H: Debug, T: Debug> Debug for HCons<H, T>
[src]

[src]

Formats the value using the given formatter.

impl<H: Eq, T: Eq> Eq for HCons<H, T>
[src]

impl<H: Clone, T: Clone> Clone for HCons<H, T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<H: Copy, T: Copy> Copy for HCons<H, T>
[src]

impl<H: PartialOrd, T: PartialOrd> PartialOrd for HCons<H, T>
[src]

[src]

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

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<H: Ord, T: Ord> Ord for HCons<H, T>
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl<H: Hash, T: Hash> Hash for HCons<H, T>
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<H, T: HList> HList for HCons<H, T>
[src]

LEN: usize = 1 + <T as HList>::LEN

Returns the length of a given HList type without making use of any references, or in fact, any values at all. Read more

[src]

Deprecated since 0.1.31

: Please use LEN instead

Returns the length of a given HList type without making use of any references, or in fact, any values at all. Read more

[src]

Deprecated since 0.1.30

: Please use len() or static_len() instead.

[src]

Returns the length of a given HList Read more

[src]

Prepends an item to the current HList Read more

impl<H, T> AsRef<HCons<H, T>> for HCons<H, T>
[src]

[src]

Performs the conversion.

impl<H, T, RHS> Add<RHS> for HCons<H, T> where
    T: Add<RHS>,
    RHS: HList
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<T, Tail> Selector<T, Here> for HCons<T, Tail>
[src]

[src]

Allows you to retrieve a unique type from an HList Read more

impl<Head, Tail, FromTail, TailIndex> Selector<FromTail, There<TailIndex>> for HCons<Head, Tail> where
    Tail: Selector<FromTail, TailIndex>, 
[src]

[src]

Allows you to retrieve a unique type from an HList Read more

impl<T, Tail> Plucker<T, Here> for HCons<T, Tail>
[src]

Implementation when the pluck target is in head

What is left after you pluck the target from the Self

[src]

Returns the target with the remainder of the list in a pair Read more

impl<Head, Tail, FromTail, TailIndex> Plucker<FromTail, There<TailIndex>> for HCons<Head, Tail> where
    Tail: Plucker<FromTail, TailIndex>, 
[src]

Implementation when the pluck target is in the tail

What is left after you pluck the target from the Self

[src]

Returns the target with the remainder of the list in a pair Read more

impl<THead, TTail, SHead, STail, IndexHead, IndexTail> Sculptor<HCons<THead, TTail>, HCons<IndexHead, IndexTail>> for HCons<SHead, STail> where
    HCons<SHead, STail>: Plucker<THead, IndexHead>,
    <HCons<SHead, STail> as Plucker<THead, IndexHead>>::Remainder: Sculptor<TTail, IndexTail>, 
[src]

Implementation for when we have a non-empty HCons target

Indices is HCons here because the compiler is being asked to figure out the Index for Plucking the first item of type THead out of Self and the rest (IndexTail) is for the Plucker's remainder induce.

[src]

Consumes the current HList and returns an HList with the requested shape. Read more

impl<H, Tail> IntoReverse for HCons<H, Tail> where
    Tail: IntoReverse,
    <Tail as IntoReverse>::Output: Add<HCons<H, HNil>>, 
[src]

[src]

Reverses a given data structure. Read more

impl<'a, F, R, H> HMappable<HCons<F, HNil>, Here> for &'a HCons<H, HNil> where
    F: FnOnce(&'a H) -> R, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<'a, F, R, H> HMappable<F, Here> for &'a HCons<H, HNil> where
    F: Fn(&'a H) -> R, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<F, MapperHeadR, MapperTail, H, Tail, Index> HMappable<HCons<F, MapperTail>, There<Index>> for HCons<H, Tail> where
    F: FnOnce(H) -> MapperHeadR,
    Tail: HMappable<MapperTail, Index>, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<F, R, H, Tail, Index> HMappable<F, There<Index>> for HCons<H, Tail> where
    F: Fn(H) -> R,
    Tail: HMappable<F, Index>, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<'a, F, MapperHeadR, MapperTail, H, Tail, Index> HMappable<HCons<F, MapperTail>, There<Index>> for &'a HCons<H, Tail> where
    F: FnOnce(&'a H) -> MapperHeadR,
    &'a Tail: HMappable<MapperTail, Index>, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<'a, F, R, H, Tail, Index> HMappable<F, There<Index>> for &'a HCons<H, Tail> where
    F: Fn(&'a H) -> R,
    &'a Tail: HMappable<F, Index>, 
[src]

[src]

Maps over the current data structure using functions stored in another data structure. Read more

impl<F, FolderHeadR, FolderTail, H, Tail, Init, Index> HFoldRightable<HCons<F, FolderTail>, Init, There<Index>> for HCons<H, Tail> where
    Tail: HFoldRightable<FolderTail, Init, Index>,
    F: FnOnce(H, <Tail as HFoldRightable<FolderTail, Init, Index>>::Output) -> FolderHeadR, 
[src]

[src]

foldr over a data structure Read more

impl<'a, F, R, H, Tail, Init, Index> HFoldRightable<&'a F, Init, There<Index>> for HCons<H, Tail> where
    Tail: HFoldRightable<&'a F, Init, Index>,
    F: Fn(H, <Tail as HFoldRightable<&'a F, Init, Index>>::Output) -> R, 
[src]

[src]

foldr over a data structure Read more

impl<'a, F, R, H, Acc> HFoldLeftable<F, Acc, Here> for &'a HCons<H, HNil> where
    F: FnOnce(Acc, &'a H) -> R, 
[src]

[src]

foldl over a data structure Read more

impl<'a, F, R, H, Acc> HFoldLeftable<HCons<F, HNil>, Acc, Here> for &'a HCons<H, HNil> where
    F: FnOnce(Acc, &'a H) -> R, 
[src]

[src]

foldl over a data structure Read more

impl<F, FolderHeadR, FolderTail, H, Tail, Acc, Index> HFoldLeftable<HCons<F, FolderTail>, Acc, There<Index>> for HCons<H, Tail> where
    Tail: HFoldLeftable<FolderTail, FolderHeadR, Index>,
    F: FnOnce(Acc, H) -> FolderHeadR, 
[src]

[src]

foldl over a data structure Read more

impl<'a, F, FolderHeadR, FolderTail, H, Tail, Acc, Index> HFoldLeftable<HCons<F, FolderTail>, Acc, There<Index>> for &'a HCons<H, Tail> where
    &'a Tail: HFoldLeftable<FolderTail, FolderHeadR, Index>,
    F: FnOnce(Acc, &'a H) -> FolderHeadR, 
[src]

[src]

foldl over a data structure Read more

impl<T1, T2> IntoTuple2 for HCons<T1, HCons<T2, HNil>>
[src]

The 0 element in the output tuple

The 1 element in the output tuple

[src]

Turns an HList into nested Tuple2s, which are less troublesome to pattern match and have a nicer type signature. Read more

impl<T, Tail> IntoTuple2 for HCons<T, Tail> where
    Tail: IntoTuple2
[src]

The 0 element in the output tuple

The 1 element in the output tuple

[src]

Turns an HList into nested Tuple2s, which are less troublesome to pattern match and have a nicer type signature. Read more

impl<F, H, Tail, Acc, Index> HFoldLeftable<F, Acc, There<Index>> for HCons<H, Tail> where
    Tail: HFoldLeftable<F, Acc, Index>,
    F: Fn(Acc, H) -> Acc, 
[src]

Implementation for folding over an HList using a single function that can handle all cases

let h = hlist![1, 2, 3, 4, 5];

let r: isize = h.foldl(|acc, next| acc + next, 0);
assert_eq!(r, 15);Run

[src]

foldl over a data structure Read more

impl<'a, F, H, Tail, Acc, Index> HFoldLeftable<F, Acc, There<Index>> for &'a HCons<H, Tail> where
    F: Fn(Acc, &'a H) -> Acc,
    &'a Tail: HFoldLeftable<F, Acc, Index>, 
[src]

[src]

foldl over a data structure Read more

impl<Label, Value, Tail> IntoUnlabelled for HCons<Field<Label, Value>, Tail> where
    Tail: IntoUnlabelled
[src]

Implementation when we have a non-empty HCons holding a label in its head

[src]

Turns the current HList into an unlabelled one. Read more

impl<Label, Value, Tail> IntoValueLabelled for HCons<Field<Label, Value>, Tail> where
    Tail: IntoValueLabelled
[src]

[src]

Turns the current HList into a value-labelled one. Read more