Struct frunk_core::labelled::Field
source · pub struct Field<Name, Type> {
pub name: &'static str,
pub value: Type,
/* private fields */
}
Expand description
A Label contains a type-level Name, a runtime value, and
a reference to a &'static str
name.
To construct one, use the field!
macro.
Examples
use frunk::labelled::chars::*;
use frunk_core::field;
let labelled = field![(n,a,m,e), "joe"];
assert_eq!(labelled.name, "name");
assert_eq!(labelled.value, "joe")
RunFields§
§name: &'static str
§value: Type
Trait Implementations§
source§impl<Name: Ord, Type: Ord> Ord for Field<Name, Type>
impl<Name: Ord, Type: Ord> Ord for Field<Name, Type>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<Name: PartialEq, Type: PartialEq> PartialEq for Field<Name, Type>
impl<Name: PartialEq, Type: PartialEq> PartialEq for Field<Name, Type>
source§impl<Name: PartialOrd, Type: PartialOrd> PartialOrd for Field<Name, Type>
impl<Name: PartialOrd, Type: PartialOrd> PartialOrd for Field<Name, Type>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Key, Source, Target, InnerIndices> Transmogrifier<Box<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Box<Source>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<Box<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Box<Source>>where Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over an Box
in a Field
, transmogrifying the
contained element on the way past.
source§fn transmogrify(self) -> Box<Target>
fn transmogrify(self) -> Box<Target>
source§impl<SourceHead, SourceTail, TargetName, TargetHead, TargetTail, TransmogHeadIndex, TransmogTailIndices> Transmogrifier<HCons<TargetHead, TargetTail>, HCons<TransmogHeadIndex, TransmogTailIndices>> for Field<TargetName, HCons<SourceHead, SourceTail>>where
HCons<SourceHead, SourceTail>: Transmogrifier<HCons<TargetHead, TargetTail>, HCons<TransmogHeadIndex, TransmogTailIndices>>,
impl<SourceHead, SourceTail, TargetName, TargetHead, TargetTail, TransmogHeadIndex, TransmogTailIndices> Transmogrifier<HCons<TargetHead, TargetTail>, HCons<TransmogHeadIndex, TransmogTailIndices>> for Field<TargetName, HCons<SourceHead, SourceTail>>where HCons<SourceHead, SourceTail>: Transmogrifier<HCons<TargetHead, TargetTail>, HCons<TransmogHeadIndex, TransmogTailIndices>>,
Implementation of Transmogrifier
for when the target is an HList
, and the Source
is a plucked
HList
.
source§fn transmogrify(self) -> HCons<TargetHead, TargetTail>
fn transmogrify(self) -> HCons<TargetHead, TargetTail>
source§impl<Key, Source, Target, InnerIndices> Transmogrifier<LinkedList<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, LinkedList<Source>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<LinkedList<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, LinkedList<Source>>where Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over a $container
in a Field
, transmogrifying the
elements on the way past.
source§fn transmogrify(self) -> LinkedList<Target>
fn transmogrify(self) -> LinkedList<Target>
source§impl<Key, Source, Target, InnerIndices> Transmogrifier<Option<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Option<Source>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<Option<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Option<Source>>where Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over an Option
in a Field
, transmogrifying the
contained element on the way past if present.
source§fn transmogrify(self) -> Option<Target>
fn transmogrify(self) -> Option<Target>
source§impl<Key, SourceValue> Transmogrifier<SourceValue, IdentityTransMog> for Field<Key, SourceValue>
impl<Key, SourceValue> Transmogrifier<SourceValue, IdentityTransMog> for Field<Key, SourceValue>
Implementation of Transmogrifier
for identity plucked Field
to Field
Transforms.
source§fn transmogrify(self) -> SourceValue
fn transmogrify(self) -> SourceValue
source§impl<Source, TargetName, TargetValue, TransmogIndices> Transmogrifier<TargetValue, PluckedLabelledGenericIndicesWrapper<TransmogIndices>> for Field<TargetName, Source>where
Source: LabelledGeneric + Transmogrifier<TargetValue, TransmogIndices>,
TargetValue: LabelledGeneric,
impl<Source, TargetName, TargetValue, TransmogIndices> Transmogrifier<TargetValue, PluckedLabelledGenericIndicesWrapper<TransmogIndices>> for Field<TargetName, Source>where Source: LabelledGeneric + Transmogrifier<TargetValue, TransmogIndices>, TargetValue: LabelledGeneric,
source§fn transmogrify(self) -> TargetValue
fn transmogrify(self) -> TargetValue
source§impl<Key, Source, Target, InnerIndices> Transmogrifier<Vec<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Vec<Source>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<Vec<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Vec<Source>>where Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over a $container
in a Field
, transmogrifying the
elements on the way past.
source§fn transmogrify(self) -> Vec<Target>
fn transmogrify(self) -> Vec<Target>
source§impl<Key, Source, Target, InnerIndices> Transmogrifier<VecDeque<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, VecDeque<Source>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<VecDeque<Target>, MappingIndicesWrapper<InnerIndices>> for Field<Key, VecDeque<Source>>where Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over a $container
in a Field
, transmogrifying the
elements on the way past.