Trait SerdeHash

Source
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> { ... } }
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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