pub struct ZSerializer(/* private fields */);
Expand description
Serializer implementing the Zenoh serialization format.
Serializing objects one after the other is equivalent to serialize a tuple of these objects.
§Examples
use zenoh_ext::*;
let mut serializer = ZSerializer::new();
serializer.serialize(42i32);
serializer.serialize(vec![1u8, 2, 3]);
let zbytes = serializer.finish();
assert_eq!(z_deserialize::<(i32, Vec<u8>)>(&zbytes).unwrap(), (42i32, vec![1u8, 2, 3]));
Implementations§
Source§impl ZSerializer
impl ZSerializer
Sourcepub fn new() -> Self
pub fn new() -> Self
Instantiate a ZSerializer
.
Sourcepub fn serialize<T: Serialize>(&mut self, t: T)
pub fn serialize<T: Serialize>(&mut self, t: T)
Serialize the given object into a ZSerializer
.
Serialization doesn’t take the ownership of the data.
Sourcepub fn serialize_iter<T: Serialize, I: IntoIterator<Item = T>>(
&mut self,
iter: I,
)where
I::IntoIter: ExactSizeIterator,
pub fn serialize_iter<T: Serialize, I: IntoIterator<Item = T>>(
&mut self,
iter: I,
)where
I::IntoIter: ExactSizeIterator,
Serialize the given iterator into a ZSerializer
.
Sequence serialized with this method may be deserialized with ZDeserializer::deserialize_iter
.
See Zenoh serialization format RFC.
Trait Implementations§
Source§impl Debug for ZSerializer
impl Debug for ZSerializer
Source§impl Default for ZSerializer
impl Default for ZSerializer
Source§impl From<ZSerializer> for ZBytes
impl From<ZSerializer> for ZBytes
Source§fn from(value: ZSerializer) -> Self
fn from(value: ZSerializer) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ZSerializer
impl !RefUnwindSafe for ZSerializer
impl Send for ZSerializer
impl Sync for ZSerializer
impl Unpin for ZSerializer
impl !UnwindSafe for ZSerializer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more