type-equalities

Documentation Further crate info

The central type, TypeEq<_, _>, allows for zero-overhead, safe value coercions and is itself zero-sized. Further, naming TypeEq<T, U> is well-formed for any types, but an inhabitant is available only if the equality holds. For trait-level type equality, T: IsEqual<U> can be used.

The zero overhead claim can be seen in the provided benchmarks:

```rust let eq = refl::().liftthrough::>(); // b.iter(|| [0; BENCHLEN]); // benchnocoerce b.iter(|| eq.coerce([0; BENCHLEN])); // benchcoercearrayrefl

running 2 tests test benches::benchnocoerce ... bench: 10,665 ns/iter (+/- 695) test benches::benchcoercearray_refl ... bench: 10,776 ns/iter (+/- 1,004) ```

License

Licensed under either of * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.