Trait dialectic_tokio_serde::Serializer[][src]

pub trait Serializer {
    type Error;
    type Output;
    fn serialize<T: Serialize>(
        &mut self,
        item: &T
    ) -> Result<Self::Output, Self::Error>; }

The serialization end of a serialization format: an object which can serialize any Serialize value.

This trait resembles serde::Serializer, but is not identical to it. Unlike serde::Serializer, it defines the Output of a serializer, which should be something like Bytes, String, or another output format.

Most serde::Serializers can be easily given an instance of Serializer. When implementing this trait, you should pick the most specific output format for Output. For instance, if you can serialize to a String or a Vec<u8>, pick String, because it implements AsRef<[u8]>.

Associated Types

type Error[src]

The type of errors during serialization.

type Output[src]

The output format for serialization (e.g. Bytes, String, etc.).

Loading content...

Required methods

fn serialize<T: Serialize>(
    &mut self,
    item: &T
) -> Result<Self::Output, Self::Error>
[src]

Serialize a reference to any Serialize value.

Loading content...

Implementors

Loading content...