Struct massa_hash::HashDeserializer
source · pub struct HashDeserializer;
Expand description
Deserializer for Hash
Implementations§
Trait Implementations§
source§impl Clone for HashDeserializer
impl Clone for HashDeserializer
source§fn clone(&self) -> HashDeserializer
fn clone(&self) -> HashDeserializer
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 HashDeserializer
impl Default for HashDeserializer
source§fn default() -> HashDeserializer
fn default() -> HashDeserializer
Returns the “default value” for a type. Read more
source§impl Deserializer<Hash> for HashDeserializer
impl Deserializer<Hash> for HashDeserializer
source§fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
&self,
buffer: &'a [u8],
) -> IResult<&'a [u8], Hash, E>
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>( &self, buffer: &'a [u8], ) -> IResult<&'a [u8], Hash, E>
§Example
use massa_hash::{Hash, HashDeserializer};
use massa_serialization::{Serializer, Deserializer, DeserializeError};
let hash_deserializer = HashDeserializer::new();
let hash = Hash::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 HashDeserializer
impl RefUnwindSafe for HashDeserializer
impl Send for HashDeserializer
impl Sync for HashDeserializer
impl Unpin for HashDeserializer
impl UnwindSafe for HashDeserializer
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
)