Struct massa_time::MassaTimeDeserializer
source · pub struct MassaTimeDeserializer {
pub(crate) u64_deserializer: U64VarIntDeserializer,
}
Expand description
Deserializer for MassaTime
Fields§
§u64_deserializer: U64VarIntDeserializer
Implementations§
Trait Implementations§
source§impl Deserializer<MassaTime> for MassaTimeDeserializer
impl Deserializer<MassaTime> for MassaTimeDeserializer
source§fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>(
&self,
buffer: &'a [u8],
) -> IResult<&'a [u8], MassaTime, E>
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>>( &self, buffer: &'a [u8], ) -> IResult<&'a [u8], MassaTime, E>
use std::ops::Bound::Included;
use massa_serialization::{Serializer, Deserializer, DeserializeError};
use massa_time::{MassaTime, MassaTimeSerializer, MassaTimeDeserializer};
let time: MassaTime = MassaTime::from_millis(30);
let mut serialized = Vec::new();
let serializer = MassaTimeSerializer::new();
let deserializer = MassaTimeDeserializer::new((Included(MassaTime::from_millis(0)), Included(MassaTime::from_millis(u64::MAX))));
serializer.serialize(&time, &mut serialized).unwrap();
let (rest, time_deser) = deserializer.deserialize::<DeserializeError>(&serialized).unwrap();
assert!(rest.is_empty());
assert_eq!(time, time_deser);
Auto Trait Implementations§
impl Freeze for MassaTimeDeserializer
impl RefUnwindSafe for MassaTimeDeserializer
impl Send for MassaTimeDeserializer
impl Sync for MassaTimeDeserializer
impl Unpin for MassaTimeDeserializer
impl UnwindSafe for MassaTimeDeserializer
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request