stable-hash 0.4.3

A stable, structured hash with backward compatibility
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::prelude::*;

impl StableHash for String {
    fn stable_hash<H: StableHasher>(&self, field_address: H::Addr, state: &mut H) {
        profile_method!(stable_hash);

        self.as_str().stable_hash(field_address, state);
    }
}

impl<'a> StableHash for &'a str {
    fn stable_hash<H: StableHasher>(&self, field_address: H::Addr, state: &mut H) {
        profile_method!(stable_hash);

        AsBytes(self.as_bytes()).stable_hash(field_address, state)
    }
}