pub trait SerdeHash
where Self: Sized + FromStr + Display + Index<usize, Output = u8> + Index<RangeFull, Output = [u8]>, <Self as FromStr>::Err: Display,
{ const N: usize; // Required method fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>; // Provided methods fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error> { ... } fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Self, D::Error> { ... } }
Available on crate feature serde only.
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: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Do serde serialization.

source

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

Do serde deserialization.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl SerdeHash for bitcoin_hashes::hash160::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for bitcoin_hashes::ripemd160::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for bitcoin_hashes::sha1::Hash

source§

const N: usize = 20usize

source§

impl SerdeHash for bitcoin_hashes::sha256::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for Midstate

source§

const N: usize = 32usize

source§

impl SerdeHash for bitcoin_hashes::sha256d::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for bitcoin_hashes::sha384::Hash

source§

const N: usize = 48usize

source§

impl SerdeHash for bitcoin_hashes::sha512::Hash

source§

const N: usize = 64usize

source§

impl SerdeHash for bitcoin_hashes::sha512_256::Hash

source§

const N: usize = 32usize

source§

impl SerdeHash for bitcoin_hashes::siphash24::Hash

source§

const N: usize = 8usize

source§

impl<T: Tag> SerdeHash for bitcoin_hashes::sha256t::Hash<T>

source§

const N: usize = 32usize