[][src]Struct rmp_serde::encode::Serializer

pub struct Serializer<W, V> { /* fields omitted */ }
[]

Represents MessagePack serialization implementation.

Note

MessagePack has no specification about how to encode enum types. Thus we are free to do whatever we want, so the given chose may be not ideal for you.

Every Rust enum value can be represented as a tuple of index with a value.

All instances of ErrorKind::Interrupted are handled by this function and the underlying operation is retried.

Implementations

impl<W: Write> Serializer<W, StructMapWriter>[src][]

pub fn new_named(wr: W) -> Self[src][]

Constructs a new MessagePack serializer whose output will be written to the writer specified.

Note

This is the default constructor, which returns a serializer that will serialize structs using large named representation.

impl<W, V> Serializer<W, V>[src][]

pub fn set_max_depth(&mut self, depth: usize)[src][]

Changes the maximum nesting depth that is allowed

impl<W: Write> Serializer<W, StructArrayWriter>[src][]

pub fn new(wr: W) -> Self[src][]

Constructs a new MessagePack serializer whose output will be written to the writer specified.

Note

This is the default constructor, which returns a serializer that will serialize structs using compact tuple representation, without field names.

pub fn compact(wr: W) -> Self[src]

impl<W: Write, V> Serializer<W, V>[src][]

pub fn get_ref(&self) -> &W[src][]

Gets a reference to the underlying writer.

pub fn get_mut(&mut self) -> &mut W[src][]

Gets a mutable reference to the underlying writer.

It is inadvisable to directly write to the underlying writer.

pub fn into_inner(self) -> W[src][]

Unwraps this Serializer, returning the underlying writer.

impl<W: Write, V: VariantWriter> Serializer<W, V>[src][]

pub fn with(wr: W, vw: V) -> Self[src][]

Creates a new MessagePack encoder whose output will be written to the writer specified.

Trait Implementations

impl<'a, W: Write, V: VariantWriter> Serializer for &'a mut Serializer<W, V>[src][+]

type Ok = ()

The output type produced by this Serializer during successful serialization. Most serializers that produce text or binary output should set Ok = () and serialize into an io::Write or buffer contained within the Serializer instance. Serializers that build in-memory data structures may be simplified by using Ok to propagate the data structure around. Read more

type Error = Error

The error type when some error occurs during serialization.

type SerializeSeq = Compound<'a, W, V>

Type returned from serialize_seq for serializing the content of the sequence. Read more

type SerializeTuple = Compound<'a, W, V>

Type returned from serialize_tuple for serializing the content of the tuple. Read more

type SerializeTupleStruct = Compound<'a, W, V>

Type returned from serialize_tuple_struct for serializing the content of the tuple struct. Read more

type SerializeTupleVariant = Compound<'a, W, V>

Type returned from serialize_tuple_variant for serializing the content of the tuple variant. Read more

type SerializeMap = Compound<'a, W, V>

Type returned from serialize_map for serializing the content of the map. Read more

type SerializeStruct = Compound<'a, W, V>

Type returned from serialize_struct for serializing the content of the struct. Read more

type SerializeStructVariant = Compound<'a, W, V>

Type returned from serialize_struct_variant for serializing the content of the struct variant. Read more

Auto Trait Implementations

impl<W, V> RefUnwindSafe for Serializer<W, V> where
    V: RefUnwindSafe,
    W: RefUnwindSafe

impl<W, V> Send for Serializer<W, V> where
    V: Send,
    W: Send

impl<W, V> Sync for Serializer<W, V> where
    V: Sync,
    W: Sync

impl<W, V> Unpin for Serializer<W, V> where
    V: Unpin,
    W: Unpin

impl<W, V> UnwindSafe for Serializer<W, V> where
    V: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

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

The type returned in the event of a conversion error.