Trait frunk_core::labelled::IntoValueLabelled[][src]

pub trait IntoValueLabelled {
    type Output;
    fn into_value_labelled(self) -> Self::Output;
}
Expand description

A trait that strips type-level strings from the labels

Associated Types

Required methods

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::*;

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