6 releases

0.1.6 Oct 30, 2020
0.1.5 Oct 30, 2020
0.1.4 Apr 3, 2019
0.1.2 Dec 18, 2018

#867 in Algorithms

Download history 5/week @ 2022-10-18 23/week @ 2022-10-25 27/week @ 2022-11-01 24/week @ 2022-11-08 23/week @ 2022-11-15 10/week @ 2022-11-22 10/week @ 2022-11-29 23/week @ 2022-12-06 17/week @ 2022-12-13 17/week @ 2022-12-20 12/week @ 2022-12-27 6/week @ 2023-01-03 17/week @ 2023-01-10 11/week @ 2023-01-17 26/week @ 2023-01-24 28/week @ 2023-01-31

82 downloads per month
Used in 2 crates

Apache-2.0 OR MIT

11KB
134 lines

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(())
}

Dependencies

~210–640KB
~15K SLoC