Trait sc_network::multiaddr::multihash::typenum::Same [−]
pub trait Same<Rhs = Self> { type Output; }
Expand description
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.
Same
is implemented generically for all types; it should never need to be implemented
for anything else.
Note that Rust lazily evaluates types, so this will only fail for two different types if
the Output
is used.
Example
use typenum::{Same, U4, U5, 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
type Output
Should always be Self
Implementors
impl<T> Same<T> for T