pub trait SerdeHash: Sized + FromStr + Display + Index<usize, Output = u8, Output = [u8]> + Index<RangeFull>where
    Self::Err: Display,{
    const N: usize;

    // Required method
    fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>;

    // Provided methods
    fn serialize<S>(
        &self,
        s: S
    ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
       where S: Serializer { ... }
    fn deserialize<'de, D>(
        d: D
    ) -> Result<Self, <D as Deserializer<'de>>::Error>
       where D: Deserializer<'de> { ... }
}
Expand description

Default serialization/deserialization methods.

Required Associated Constants§

source

const N: usize

Size, in bits, of the hash.

Required Methods§

source

fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>

Helper function to turn a deserialized slice into the correct hash type.

Provided Methods§

source

fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

Do serde serialization.

source

fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

Do serde deserialization.

Implementors§

source§

impl SerdeHash for secp256k1::hashes::hash160::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for secp256k1::hashes::ripemd160::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for secp256k1::hashes::sha1::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for secp256k1::hashes::sha256::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for Midstate

source§

const N: usize = 32usize

source§

impl SerdeHash for secp256k1::hashes::sha256d::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for secp256k1::hashes::sha384::Hash

source§

const N: usize = 48usize

source§

impl SerdeHash for secp256k1::hashes::sha512::Hash

source§

const N: usize = 64usize

source§

impl SerdeHash for secp256k1::hashes::sha512_256::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for secp256k1::hashes::siphash24::Hash

source§

const N: usize = 8usize

source§

impl<T> SerdeHash for secp256k1::hashes::sha256t::Hash<T>where T: Tag,

source§

const N: usize = 32usize