grain-id 0.17.0

Compact, human-readable unique IDs — grain-sized, yet enough for a lifetime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use grain_id::*;

pub fn assert_conversion(value: GrainId) {
    assert_eq!(value, value.to_string().parse::<GrainId>().unwrap());
    assert_eq!(
        value,
        value.to_string().to_uppercase().parse::<GrainId>().unwrap()
    );
    assert_eq!(value, GrainId::try_from(u64::from(value)).unwrap());
    assert_eq!(value, GrainId::from_byte_prefix(&value.to_byte_prefix()));
    assert_eq!(value, GrainId::from_byte_suffix(&value.to_byte_suffix()));
}