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