[−][src]Macro fixed_hash::construct_fixed_hash
Construct a fixed-size hash type.
Examples
Create a public unformatted hash type with 32 bytes size.
use fixed_hash::construct_fixed_hash; construct_fixed_hash!{ pub struct H256(32); } assert_eq!(std::mem::size_of::<H256>(), 32);
With additional attributes and doc comments.
use fixed_hash::construct_fixed_hash; construct_fixed_hash!{ /// My unformatted 160 bytes sized hash type. #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] pub struct H160(20); } assert_eq!(std::mem::size_of::<H160>(), 20);
The visibility modifier is optional and you can create a private hash type.
use fixed_hash::construct_fixed_hash; construct_fixed_hash!{ struct H512(64); } assert_eq!(std::mem::size_of::<H512>(), 64);