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
sourceimpl<Name, Type> Ord for Field<Name, Type>where
Name: Ord,
Type: Ord,
impl<Name, Type> Ord for Field<Name, Type>where
Name: Ord,
Type: Ord,
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl<Name, Type> PartialEq<Field<Name, Type>> for Field<Name, Type>where
Name: PartialEq<Name>,
Type: PartialEq<Type>,
impl<Name, Type> PartialEq<Field<Name, Type>> for Field<Name, Type>where
Name: PartialEq<Name>,
Type: PartialEq<Type>,
sourceimpl<Name, Type> PartialOrd<Field<Name, Type>> for Field<Name, Type>where
Name: PartialOrd<Name>,
Type: PartialOrd<Type>,
impl<Name, Type> PartialOrd<Field<Name, Type>> for Field<Name, Type>where
Name: PartialOrd<Name>,
Type: PartialOrd<Type>,
sourcefn partial_cmp(&self, other: &Field<Name, Type>) -> Option<Ordering>
fn partial_cmp(&self, other: &Field<Name, Type>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl<Key, Source, Target, InnerIndices> Transmogrifier<Box<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Box<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<Box<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Box<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over an Box
in a Field
, transmogrifying the
contained element on the way past.
sourcefn transmogrify(self) -> Box<Target, Global>
fn transmogrify(self) -> Box<Target, Global>
sourceimpl<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
.
sourcefn transmogrify(self) -> HCons<TargetHead, TargetTail>
fn transmogrify(self) -> HCons<TargetHead, TargetTail>
sourceimpl<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.
sourcefn transmogrify(self) -> LinkedList<Target>
fn transmogrify(self) -> LinkedList<Target>
sourceimpl<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.
sourcefn transmogrify(self) -> Option<Target>
fn transmogrify(self) -> Option<Target>
sourceimpl<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.
sourcefn transmogrify(self) -> SourceValue
fn transmogrify(self) -> SourceValue
sourceimpl<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,
sourcefn transmogrify(self) -> TargetValue
fn transmogrify(self) -> TargetValue
sourceimpl<Key, Source, Target, InnerIndices> Transmogrifier<Vec<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Vec<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<Vec<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, Vec<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over a $container
in a Field
, transmogrifying the
elements on the way past.
sourcefn transmogrify(self) -> Vec<Target, Global>
fn transmogrify(self) -> Vec<Target, Global>
sourceimpl<Key, Source, Target, InnerIndices> Transmogrifier<VecDeque<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, VecDeque<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
impl<Key, Source, Target, InnerIndices> Transmogrifier<VecDeque<Target, Global>, MappingIndicesWrapper<InnerIndices>> for Field<Key, VecDeque<Source, Global>>where
Source: Transmogrifier<Target, InnerIndices>,
Implementation of Transmogrifier
that maps over a $container
in a Field
, transmogrifying the
elements on the way past.