[−][src]Macro fixed_hash::impl_fixed_hash_conversions
Implements lossy conversions between the given types.
Note
- Both types must be of different sizes.
- Type
large_ty
must have a larger memory footprint compared tosmall_ty
.
Panics
Both From
implementations will panic if sizes of the given types
do not meet the requirements stated above.
Example
use fixed_hash::{construct_fixed_hash, impl_fixed_hash_conversions}; construct_fixed_hash!{ struct H160(20); } construct_fixed_hash!{ struct H256(32); } impl_fixed_hash_conversions!(H256, H160); // now use it! assert_eq!(H256::from(H160::zero()), H256::zero()); assert_eq!(H160::from(H256::zero()), H160::zero());