[][src]Macro summon::circle

macro_rules! circle {
    (($($arg_name:tt $arg_colon:tt &$arg_ty:ty),*) -> $return_ty:tt $body:block) => { ... };
}

Use this to inscribe a transmutation between a set of input types and an output type.

use summon::{Tome, circle};
#[derive(Clone)]
struct Normal(u32);
struct Double(u32);
struct Half(u32);
let mut tome = Tome::new();
tome.ether(Normal(4));
tome.inscribe(summon::circle!((n: &Normal) -> Double { Double(n.0 * 2) }));
tome.inscribe(summon::circle!((n: &Normal) -> Half { Half(n.0 / 2) }));
assert_eq!(8, tome.summon::<Double>().unwrap().0);
assert_eq!(2, tome.summon::<Half>().unwrap().0);