[][src]Macro frunk_core::field

macro_rules! field {
    (($($repeated: ty),*), $value: expr) => { ... };
    (($($repeated: ty,)*), $value: expr) => { ... };
    ($name_type: ty, $value: expr) => { ... };
    ($name_type: ty, $value: expr, $name: expr) => { ... };
}

Used for creating a Field

There are 3 forms of this macro:

Examples

use frunk::labelled::chars::*;
let labelled = field![(n,a,m,e), "joe"];
assert_eq!(labelled.name, "name");
assert_eq!(labelled.value, "joe")Run
enum first_name {}
let labelled = field![first_name, "Joe"];
assert_eq!(labelled.name, "first_name");
assert_eq!(labelled.value, "Joe");Run
use frunk::labelled::chars::*;

// useful aliasing of our type-level string
type age = (a, g, e);
let labelled = field![age, 30, "Age"];
assert_eq!(labelled.name, "Age");
assert_eq!(labelled.value, 30);Run