[][src]Macro hyperbole::f

macro_rules! f {
    ($name:ident) => { ... };
    ($name:ident : $type:ty) => { ... };
    ($name:ident = $val:expr) => { ... };
}

Expands to either the type of a named field, or a (~consty) expression that evaluates to an instantiated field.

First form: evaluates to the type of a named field with an inferred value type

use hyperbole::f;

let one: f![abc] = 256.into();
let two: f![abc] = one;

Named fields with different names have different types, so for example this will not compile:

This example deliberately fails to compile
use hyperbole::f;

let one: f![abc] = 1234.into();
let two: f![bca] = one;

Second form: evaluates to the type of a named field with a concrete value type

use hyperbole::f;

let one: f![abc: u32] = 40.into();
let two: f![bca: &str] = "hello world".into();

Third form: evaluates to an instantiated named field

use hyperbole::f;

let one = f![hello_world = "this string"];

const TWO: f![xyz: &str] = f![xyz = "is const"];