Trait fourleaf::ser::Serialize [] [src]

pub trait Serialize {
    fn serialize_element<R: Write>(
        &self,
        dst: &mut Stream<R>,
        tag: u8
    ) -> Result<()>; fn serialize_body<R: Write>(&self, dst: &mut Stream<R>) -> Result<()> { ... } fn serialize_field<R: Write>(
        &self,
        dst: &mut Stream<R>,
        tag: u8
    ) -> Result<()> { ... } fn serialize_slice<R: Write>(
        selves: &[Self],
        dst: &mut Stream<R>,
        tag: u8
    ) -> Option<Result<()>>
    where
        Self: Sized
, { ... } }

Trait for serialising values via fourleaf.

Required Methods

Serialises this value, which is an element of a collection, to the given stream.

The callee must write exactly one field pair with a field tag of tag to the stream.

Provided Methods

Serialises this value, which is at top-level or the tail part of a struct.

The callee shall write any number (including zero) of field elements with balanced EndOfStruct elements, followed by exactly one EndOfStruct element.

By default, this calls serialize_field with a tag of 1 and then writes an end-of-struct.

Serialises this value, which is a field of a struct, to the given stream.

The callee may write any number (including 0) of field pairs with a field tag of tag to the stream.

By default, this delegates to serialize_element.

If slices of this type should be written specially, do so and return Some result. Otherwise, return None.

If this does handle the value specially, it must write exactly one field with the given tag to dst.

This mainly exists so that [u8] is serialised as a blob.

Implementors