pub trait IntoValueLabelled {
    type Output;

    // Required method
    fn into_value_labelled(self) -> Self::Output;
}
Expand description

A trait that strips type-level strings from the labels

Required Associated Types§

Required Methods§

source

fn into_value_labelled(self) -> Self::Output

Turns the current HList into a value-labelled one.

Effectively extracts the names and values held inside the individual Fields and puts them into ValueFields, which do not have type-level names.

Examples
use frunk::labelled::{ValueField, IntoValueLabelled};
use frunk::labelled::chars::*;
use frunk_core::{field, hlist, HList};

let labelled_hlist = hlist![
    field!((n, a, m, e), "joe"),
    field!((a, g, e), 3)
];
// Notice the lack of type-level names
let value_labelled: HList![ValueField<&str>, ValueField<isize>] = labelled_hlist.into_value_labelled();

assert_eq!(
  value_labelled,
  hlist![
    ValueField {
      name: "name",
      value: "joe",
    },
    ValueField {
      name: "age",
      value: 3,
    },
]);
Run

Implementors§

source§

impl IntoValueLabelled for HNil

§

type Output = HNil

source§

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

§

type Output = HCons<ValueField<Value>, <Tail as IntoValueLabelled>::Output>