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]
Trait Implementations
impl<H: PartialEq, T: PartialEq> PartialEq for HCons<H, T>
[src]
fn eq(&self, __arg_0: &HCons<H, T>) -> bool
[src]
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
[src]
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>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
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]
fn partial_cmp(&self, __arg_0: &HCons<H, T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &HCons<H, T>) -> bool
[src]
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
[src]
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
[src]
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
[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]
fn cmp(&self, __arg_0: &HCons<H, T>) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
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]
fn hash<__HHT: Hasher>(&self, __arg_0: &mut __HHT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<H, T: HList> HList for HCons<H, T>
[src]
const LEN: usize
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
fn static_len() -> usize
[src]
: 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
fn length(&self) -> u32
[src]
: Please use len() or static_len() instead.
fn len(&self) -> usize
[src]
Returns the length of a given HList Read more
fn prepend<H>(self, h: H) -> HCons<H, Self>
[src]
Prepends an item to the current HList Read more
impl<H, T> AsRef<HCons<H, T>> for HCons<H, T>
[src]
impl<H, T, RHS> Add<RHS> for HCons<H, T> where
T: Add<RHS>,
RHS: HList,
[src]
T: Add<RHS>,
RHS: HList,
type Output = HCons<H, <T as Add<RHS>>::Output>
The resulting type after applying the +
operator.
fn add(self, rhs: RHS) -> Self::Output
[src]
Performs the +
operation.
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]
Tail: Selector<FromTail, TailIndex>,
impl<T, Tail> Plucker<T, Here> for HCons<T, Tail>
[src]
Implementation when the pluck target is in head
type Remainder = Tail
What is left after you pluck the target from the Self
fn pluck(self) -> (T, Self::Remainder)
[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]
Tail: Plucker<FromTail, TailIndex>,
Implementation when the pluck target is in the tail
type Remainder = HCons<Head, <Tail as Plucker<FromTail, TailIndex>>::Remainder>
What is left after you pluck the target from the Self
fn pluck(self) -> (FromTail, Self::Remainder)
[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]
HCons<SHead, STail>: Plucker<THead, IndexHead>,
<HCons<SHead, STail> as Plucker<THead, IndexHead>>::Remainder: Sculptor<TTail, IndexTail>,
Implementation for when we have a non-empty HCons target
Indices is HCons
type Remainder = <<HCons<SHead, STail> as Plucker<THead, IndexHead>>::Remainder as Sculptor<TTail, IndexTail>>::Remainder
fn sculpt(self) -> (HCons<THead, TTail>, Self::Remainder)
[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]
Tail: IntoReverse,
<Tail as IntoReverse>::Output: Add<HCons<H, HNil>>,
type Output = <<Tail as IntoReverse>::Output as Add<HCons<H, HNil>>>::Output
fn into_reverse(self) -> Self::Output
[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]
F: FnOnce(&'a H) -> R,
type Output = HCons<R, HNil>
fn map(self, f: HCons<F, HNil>) -> Self::Output
[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]
F: Fn(&'a H) -> R,
type Output = HCons<R, HNil>
fn map(self, f: F) -> Self::Output
[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]
F: FnOnce(H) -> MapperHeadR,
Tail: HMappable<MapperTail, Index>,
type Output = HCons<MapperHeadR, <Tail as HMappable<MapperTail, Index>>::Output>
fn map(self, mapper: HCons<F, MapperTail>) -> Self::Output
[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]
F: Fn(H) -> R,
Tail: HMappable<F, Index>,
type Output = HCons<R, <Tail as HMappable<F, Index>>::Output>
fn map(self, f: F) -> Self::Output
[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]
F: FnOnce(&'a H) -> MapperHeadR,
&'a Tail: HMappable<MapperTail, Index>,
type Output = HCons<MapperHeadR, <&'a Tail as HMappable<MapperTail, Index>>::Output>
fn map(self, mapper: HCons<F, MapperTail>) -> Self::Output
[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]
F: Fn(&'a H) -> R,
&'a Tail: HMappable<F, Index>,
type Output = HCons<R, <&'a Tail as HMappable<F, Index>>::Output>
fn map(self, f: F) -> Self::Output
[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]
Tail: HFoldRightable<FolderTail, Init, Index>,
F: FnOnce(H, <Tail as HFoldRightable<FolderTail, Init, Index>>::Output) -> FolderHeadR,
type Output = FolderHeadR
fn foldr(self, folder: HCons<F, FolderTail>, init: Init) -> Self::Output
[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]
Tail: HFoldRightable<&'a F, Init, Index>,
F: Fn(H, <Tail as HFoldRightable<&'a F, Init, Index>>::Output) -> R,
type Output = R
fn foldr(self, folder: &'a F, init: Init) -> Self::Output
[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]
F: FnOnce(Acc, &'a H) -> R,
type Output = R
fn foldl(self, folder: F, acc: Acc) -> Self::Output
[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]
F: FnOnce(Acc, &'a H) -> R,
type Output = R
fn foldl(self, folder: HCons<F, HNil>, acc: Acc) -> Self::Output
[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]
Tail: HFoldLeftable<FolderTail, FolderHeadR, Index>,
F: FnOnce(Acc, H) -> FolderHeadR,
type Output = <Tail as HFoldLeftable<FolderTail, FolderHeadR, Index>>::Output
fn foldl(self, folder: HCons<F, FolderTail>, acc: Acc) -> Self::Output
[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]
&'a Tail: HFoldLeftable<FolderTail, FolderHeadR, Index>,
F: FnOnce(Acc, &'a H) -> FolderHeadR,
type Output = <&'a Tail as HFoldLeftable<FolderTail, FolderHeadR, Index>>::Output
fn foldl(self, folder: HCons<F, FolderTail>, acc: Acc) -> Self::Output
[src]
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)
[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]
Tail: IntoTuple2,
type HeadType = T
The 0 element in the output tuple
type TailOutput = (<Tail as IntoTuple2>::HeadType, <Tail as IntoTuple2>::TailOutput)
The 1 element in the output tuple
fn into_tuple2(self) -> (Self::HeadType, Self::TailOutput)
[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]
Tail: HFoldLeftable<F, Acc, Index>,
F: Fn(Acc, H) -> Acc,
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
type Output = <Tail as HFoldLeftable<F, Acc, Index>>::Output
fn foldl(self, folder: F, acc: Acc) -> Self::Output
[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]
F: Fn(Acc, &'a H) -> Acc,
&'a Tail: HFoldLeftable<F, Acc, Index>,
type Output = <&'a Tail as HFoldLeftable<F, Acc, Index>>::Output
fn foldl(self, f: F, acc: Acc) -> Self::Output
[src]
foldl over a data structure Read more
impl<Label, Value, Tail> IntoUnlabelled for HCons<Field<Label, Value>, Tail> where
Tail: IntoUnlabelled,
[src]
Tail: IntoUnlabelled,
Implementation when we have a non-empty HCons holding a label in its head
type Output = HCons<Value, <Tail as IntoUnlabelled>::Output>
fn into_unlabelled(self) -> Self::Output
[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]
Tail: IntoValueLabelled,
type Output = HCons<ValueField<Value>, <Tail as IntoValueLabelled>::Output>
fn into_value_labelled(self) -> Self::Output
[src]
Turns the current HList into a value-labelled one. Read more