[][src]Macro whiteout::erase

macro_rules! erase {
    ($val:expr, $($tr:tt)*) => { ... };
}

erase!(value, trait) turns a value of any type that implements trait into an erasted type which is impl Trait for that trait.

Examples

let a = erase!(10, std::ops::Add<i64, Output=i64>);
let b = erase!(5, std::ops::Add<i64, Output=i64>);
assert_eq!(a + 10, 20);
assert_eq!(b + 10, 15);
// This fails, the types are opaque
// assert_eq!(a + b, 15);