Trait typenum::Same
[−]
[src]
pub trait Same<Rhs = Self> { type Output; }
A type operator that ensures that Rhs
is the same as Self
, it is mainly useful
for writing macros that can take arbitrary binary or unary operators.
Note that Rust lazily evaluates types, so this will only fail for two different types if
the Output
is used.
Example
use typenum::Same; use typenum::consts::{U4, U5}; use typenum::uint::Unsigned; assert_eq!(<U5 as Same<U5>>::Output::to_u32(), 5); // Only an error if we use it: type Undefined = <U5 as Same<U4>>::Output; // Compiler error: // Undefined::to_u32();
Associated Types
type Output
Should always be Self