Struct HashWriter

Source
pub struct HashWriter { /* private fields */ }
Expand description

Serializer that outputs a hash of the serialized object

Implementations§

Source§

impl HashWriter

Source

pub fn finalize(self, output: &mut [u8])

Consume the HashWriter, outputting its current hash into a 32-byte array

Source

pub fn into_hash(self) -> Hash

Consume the HashWriter, outputting a Hash corresponding to its current state

Trait Implementations§

Source§

impl Default for HashWriter

Source§

fn default() -> HashWriter

Returns the “default value” for a type. Read more
Source§

impl Writer for HashWriter

Source§

fn serialization_mode(&self) -> SerializationMode

The mode this serializer is writing in
Source§

fn protocol_version(&self) -> ProtocolVersion

Protocol version for version specific serialization rules.
Source§

fn write_fixed_bytes<T: AsRef<[u8]>>(&mut self, bytes: T) -> Result<(), Error>

Writes a fixed number of bytes. The reader is expected to know the actual length on read.
Source§

fn write_u8(&mut self, n: u8) -> Result<(), Error>

Writes a u8 as bytes
Source§

fn write_u16(&mut self, n: u16) -> Result<(), Error>

Writes a u16 as bytes
Source§

fn write_u32(&mut self, n: u32) -> Result<(), Error>

Writes a u32 as bytes
Source§

fn write_i32(&mut self, n: i32) -> Result<(), Error>

Writes a u32 as bytes
Source§

fn write_u64(&mut self, n: u64) -> Result<(), Error>

Writes a u64 as bytes
Source§

fn write_i64(&mut self, n: i64) -> Result<(), Error>

Writes a i64 as bytes
Source§

fn write_bytes<T: AsRef<[u8]>>(&mut self, bytes: T) -> Result<(), Error>

Writes a variable number of bytes. The length is encoded as a 64-bit prefix.
Source§

fn write_empty_bytes(&mut self, length: usize) -> Result<(), Error>

Writes a fixed length of “empty” bytes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SafeBorrow<T> for T
where T: ?Sized,

Source§

fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V