[][src]Trait exonum_merkledb::indexes::proof_map::ToProofPath

pub trait ToProofPath<K: ?Sized> {
    fn transform_key(key: &K) -> ProofPath;
}

Trait defining key transformation into the format usable in Merkle Patricia trees.

Merkle Patricia trees can only use keys of a fixed byte length (32 bytes). Since maps frequently have a key type that does not provide an obvious mapping to [u8; 32], keys need to be transformed. This transform is encapsulated in the ToProofPath trait.

There are two supported transforms:

  • Hashed hashes the key serialized according to BinaryKey implementation using the SHA-256 function. The resulting output has the exact length needed for the Merkle Patricia tree.
  • Raw is the identity transform and is thus defined only for types with natural mapping to [u8; 32].

Required methods

fn transform_key(key: &K) -> ProofPath

Transforms the provided key.

Loading content...

Implementors

impl ToProofPath<[u8; 32]> for Raw[src]

impl ToProofPath<Hash> for Raw[src]

impl ToProofPath<PublicKey> for Raw[src]

impl<K: ObjectHash + ?Sized> ToProofPath<K> for Hashed[src]

impl<T: RawKey> ToProofPath<T> for Raw[src]

Loading content...