whiteout 1.0.1

Provides macros that erase the type of any value into an impl Trait for a given trait.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented3 out of 3 items with examples
  • Size
  • Source code size: 5.77 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 189.00 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • NoraCodes/whiteout
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NoraCodes

whiteout

crates.io badge documentation License: MIT

whiteout provides macros that erase the type of any value into an impl Trait for a given trait. This gives you a value that can only be use with the methods of that trait, and whose type is unnameable.

#[macro_use] extern crate whiteout;
fn main() {
    let a = erase!(10, std:ops::Add<i64, Output=i64>);
    assert_eq!(a + 10, 20);
}

Since we sometimes want to use these values together, whiteout provides both a one-time macro and a macro that produces a function which returns a consistent unnameable type, allowing multiple erased values to be used in conjunction. See the documentation for more info.