Struct massa_hash::HashXofDeserializer
source · pub struct HashXofDeserializer;
Expand description
Deserializer for HashXof
Implementations§
Trait Implementations§
source§impl Clone for HashXofDeserializer
impl Clone for HashXofDeserializer
source§fn clone(&self) -> HashXofDeserializer
fn clone(&self) -> HashXofDeserializer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for HashXofDeserializer
impl Default for HashXofDeserializer
source§fn default() -> HashXofDeserializer
fn default() -> HashXofDeserializer
Returns the “default value” for a type. Read more
source§impl<const SIZE: usize> Deserializer<HashXof<SIZE>> for HashXofDeserializer
impl<const SIZE: usize> Deserializer<HashXof<SIZE>> for HashXofDeserializer
source§fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
&self,
buffer: &'a [u8],
) -> IResult<&'a [u8], HashXof<SIZE>, E>
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>( &self, buffer: &'a [u8], ) -> IResult<&'a [u8], HashXof<SIZE>, E>
§Example
use massa_hash::{HashXof, HASH_XOF_SIZE_BYTES, HashXofDeserializer};
use massa_serialization::{Serializer, Deserializer, DeserializeError};
let hash_deserializer = HashXofDeserializer::new();
let hash: HashXof<HASH_XOF_SIZE_BYTES> = HashXof::compute_from(&"hello world".as_bytes());
let (rest, deserialized) = hash_deserializer.deserialize::<DeserializeError>(hash.to_bytes()).unwrap();
assert_eq!(deserialized, hash);
assert_eq!(rest.len(), 0);
Auto Trait Implementations§
impl Freeze for HashXofDeserializer
impl RefUnwindSafe for HashXofDeserializer
impl Send for HashXofDeserializer
impl Sync for HashXofDeserializer
impl Unpin for HashXofDeserializer
impl UnwindSafe for HashXofDeserializer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)