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
head: H
tail: T
Methods
impl<H, T> HCons<H, T>
[src]
fn pop(self) -> (H, T)
Returns the head of the list and the tail of the list as a tuple2. The original list is consumed
let h = hlist!("hi"); let (h, tail) = h.pop(); assert_eq!(h, "hi"); assert_eq!(tail, HNil);
Trait Implementations
impl<H: PartialEq, T: PartialEq> PartialEq for HCons<H, T>
[src]
fn eq(&self, __arg_0: &HCons<H, T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &HCons<H, T>) -> bool
This method tests for !=
.
impl<H: Debug, T: Debug> Debug for HCons<H, T>
[src]
impl<H: Eq, T: Eq> Eq for HCons<H, T>
[src]
impl<H: Clone, T: Clone> Clone for HCons<H, T>
[src]
fn clone(&self) -> HCons<H, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
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]
fn partial_cmp(&self, __arg_0: &HCons<H, T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &HCons<H, T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &HCons<H, T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &HCons<H, T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &HCons<H, T>) -> bool
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]
fn cmp(&self, __arg_0: &HCons<H, T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<H, T: HList> HList for HCons<H, T>
[src]
fn length(&self) -> u32
Returns the length of a given HList Read more
fn prepend<H>(self, h: H) -> HCons<H, Self>
Prepends an item to the current HList Read more
impl<H, T, RHS> Add<RHS> for HCons<H, T> where T: Add<RHS>, RHS: HList
[src]
type Output = HCons<H, T::Output>
The resulting type after applying the +
operator
fn add(self, rhs: RHS) -> Self::Output
The method for the +
operator
impl<T, Tail> Selector<T, Here> for HCons<T, Tail>
[src]
impl<Head, Tail, FromTail, TailIndex> Selector<FromTail, There<TailIndex>> for HCons<Head, Tail> where Tail: Selector<FromTail, TailIndex>
[src]
impl<H, Tail> IntoReverse for HCons<H, Tail> where Tail: IntoReverse,
Tail::Output: Add<HCons<H, HNil>>
[src]
Tail::Output: Add<HCons<H, HNil>>
type Output = Tail::Output::Output
fn into_reverse(self) -> Self::Output
Reverses a given data structure. Read more
impl<F, MapperHeadR, MapperTail, H, Tail> HMappable<HCons<F, MapperTail>> for HCons<H, Tail> where F: Fn(H) -> MapperHeadR,
Tail: HMappable<MapperTail>
[src]
Tail: HMappable<MapperTail>
type Output = HCons<MapperHeadR, Tail::Output>
fn map(self, mapper: HCons<F, MapperTail>) -> Self::Output
Maps over the current data structure using functions stored in another data structure. Read more
impl<F, FolderHeadR, FolderTail, H, Tail, Init> HFoldRightable<HCons<F, FolderTail>, Init> for HCons<H, Tail> where Tail: HFoldRightable<FolderTail, Init>,
F: Fn(H, Tail::Output) -> FolderHeadR
[src]
F: Fn(H, Tail::Output) -> FolderHeadR
type Output = FolderHeadR
fn foldr(self, folder: HCons<F, FolderTail>, init: Init) -> Self::Output
foldr over a data structure Read more
impl<F, FolderHeadR, FolderTail, H, Tail, Acc> HZipFoldLeftable<HCons<F, FolderTail>, Acc> for HCons<H, Tail> where Tail: HZipFoldLeftable<FolderTail, FolderHeadR>,
F: Fn(Acc, H) -> FolderHeadR
[src]
F: Fn(Acc, H) -> FolderHeadR
type Output = Tail::Output
fn foldl(self, folder: HCons<F, FolderTail>, acc: Acc) -> Self::Output
foldl over a data structure Read more
impl<T1, T2> IntoTuple2 for HCons<T1, HCons<T2, HNil>>
[src]
type HeadType = T1
The 0 element in the output tuple
type TailOutput = T2
The 1 element in the output tuple
fn into_tuple2(self) -> (Self::HeadType, Self::TailOutput)
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]
type HeadType = T
The 0 element in the output tuple
type TailOutput = (Tail::HeadType, Tail::TailOutput)
The 1 element in the output tuple
fn into_tuple2(self) -> (Self::HeadType, Self::TailOutput)
Turns an HList into nested Tuple2s, which are less troublesome to pattern match and have a nicer type signature. Read more