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
use crate::prelude::*;

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

        if let Some(value) = self {
            value.stable_hash(field_address.child(0), state);
            state.write(field_address, &[]);
        }
    }
}