tt-equal

Build Status Latest Version Rust Documentation

This library is an entry in the tt_call series of modular interoperable tt-muncher building blocks.

Inludes the procedural macro tt_equal that acts as a predicate for whether two token trees are equal. Intended for use with tt_if.

```rust use ttequal::ttequal; use ttcall::ttif;

macrorules! sameident{ { $id1:ident, $id2:ident } => { ttif!{ condition = [{ttequal}] input = [{ $id1 $id2 }] // The two identifiers are here passed to 'tt_equal' true = [{ const $id1: bool = true; }] false = [{ const $id1: bool = false; }] } } }

sameident!(ANIDENT, ANIDENT); // Equal identifiers result in a true constant sameident!(ADIFFERENTIDENT, AN_IDENT); // Different identifiers result in a false constant

fn main() { asserteq!(ANIDENT, true); asserteq!(ADIFFERENT_IDENT, false); } ```

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.