pub struct SignatureDeserializer;
Expand description
Serializer for Signature
Implementations§
Trait Implementations§
source§impl Default for SignatureDeserializer
impl Default for SignatureDeserializer
source§fn default() -> SignatureDeserializer
fn default() -> SignatureDeserializer
Returns the “default value” for a type. Read more
source§impl Deserializer<Signature> for SignatureDeserializer
impl Deserializer<Signature> for SignatureDeserializer
source§fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
&self,
buffer: &'a [u8],
) -> IResult<&'a [u8], Signature, E>
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>( &self, buffer: &'a [u8], ) -> IResult<&'a [u8], Signature, E>
use massa_signature::{Signature, SignatureDeserializer, KeyPair};
use massa_serialization::{DeserializeError, Deserializer};
use massa_hash::Hash;
let keypair = KeyPair::generate(0).unwrap();
let data = Hash::compute_from("Hello World!".as_bytes());
let signature = keypair.sign(&data).unwrap();
let serialized = signature.to_bytes();
let (rest, deser_signature) = SignatureDeserializer::new().deserialize::<DeserializeError>(&serialized).unwrap();
assert!(rest.is_empty());
assert_eq!(signature, deser_signature);
Auto Trait Implementations§
impl Freeze for SignatureDeserializer
impl RefUnwindSafe for SignatureDeserializer
impl Send for SignatureDeserializer
impl Sync for SignatureDeserializer
impl Unpin for SignatureDeserializer
impl UnwindSafe for SignatureDeserializer
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