Crate ckb_fixed_hash_macros[][src]

Provide several proc-macros to construct const fixed-sized hashes.

If we use an array to construct const fixed-sized hashes, it's difficult to read.

If we use FromStr::from_str to construct fixed-sized hashes, the result is not a constant. So, it will reduce runtime performance. And it could cause a runtime error if the input is malformed.

With proc-macros, we can construct human-readable const fixed-sized hashes. And it will be checked in compile time, it could never cause any runtime error.

Notice

This is an internal crate used by crate ckb_fixed_hash, do not use this crate directly.

All proc-macros in this crate are re-exported in crate ckb_fixed_hash.

And you can found examples in crate ckb_fixed_hash.

Macros

h160

A proc-macro used to create a const H160 from a hexadecimal string or a trimmed hexadecimal string.

h256

A proc-macro used to create a const H256 from a hexadecimal string or a trimmed hexadecimal string.

h512

A proc-macro used to create a const H512 from a hexadecimal string or a trimmed hexadecimal string.

h520

A proc-macro used to create a const H520 from a hexadecimal string or a trimmed hexadecimal string.