Skip to main content

MessagePackSerializer

Struct MessagePackSerializer 

Source
pub struct MessagePackSerializer<T> { /* private fields */ }
Expand description

A serializer that takes a serde::Serialize T and implements protosocket::Serialize. You can use this with a protosocket Connection or rpc.

Trait Implementations§

Source§

impl<T: Debug> Debug for MessagePackSerializer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for MessagePackSerializer<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Serialize for MessagePackSerializer<T>
where T: Serialize + Debug,

Source§

type Message = T

Outbound message type, to be serialized into buffers.
Source§

fn serialize_into_buffer( &mut self, message: Self::Message, buffer: &mut Vec<u8>, )

Write a message into a pooled buffer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Encoder for T
where T: Serialize,

Source§

type Message = <T as Serialize>::Message

The message type consumed by this serializer.
Source§

type Serialized = OwnedBuffer

The type this serializer produces. Read more
Source§

fn encode( &mut self, message: <T as Encoder>::Message, ) -> <T as Encoder>::Serialized

Encode a message into a buffer.
Source§

fn return_buffer(&mut self, _buffer: Self::Serialized)

Buffers are sent back to the encoder once the message is sent. Buffers are not guaranteed to be advanced to the end. You can reset and reuse your buffer, if appropriate.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.