numext-fixed-hash 0.1.3

Fixed-size hash types.
Documentation

A series of fixed hash types.

Constructors

This crate provides a series of macros that used to construct fixed hashes in compile time.

The input is a hexadecimal string literal with 0x prefix. Completed strings or trimmed strings both are allowed.

And you can use any number of _ in the string literal to separate it for more readable.

Examples

use numext_fixed_hash::{h128, H128};

const H128_VAL: H128 = h128!("0x123456789abcdef");

fn main () -> ::std::io::Result<()> {
let x1 = h128!("0x123456789abcdef");
let x2 = h128!("0x00000000000000000123456789abcdef");
let y = H128::from_trimmed_hex_str("123456789abcdef").unwrap();
assert_eq!(x1, y);
assert_eq!(x2, y);
assert_eq!(H128_VAL, y);
Ok(())
}