Struct grin_core::core::hash::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 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 protocol_version(&self) -> ProtocolVersion

Protocol version for version specific serialization rules.
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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<T> UnsafeAny for T
where T: Any,