https://github.com/noracodes/whiteout
Utilities for describing the types of values by their behavior
https://github.com/noracodes/whiteout
Last synced: over 1 year ago
JSON representation
Utilities for describing the types of values by their behavior
- Host: GitHub
- URL: https://github.com/noracodes/whiteout
- Owner: NoraCodes
- Created: 2017-09-01T18:37:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-12T16:28:16.000Z (almost 7 years ago)
- Last Synced: 2025-04-10T04:54:16.608Z (over 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# whiteout
[](https://crates.io/crates/whiteout) [documentation](https://docs.rs/whiteout/) [](https://opensource.org/licenses/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.
```rust
#[macro_use] extern crate whiteout;
fn main() {
let a = erase!(10, std:ops::Add);
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.