pub trait Serializer<T> {
    fn serialize_into(&self, value: &T, builder: &mut Builder);

    fn to_value(&self, value: &T) -> Value { ... }
    fn serialize(&self, value: &T) -> String { ... }
    fn serialize_iter<'a, I>(&self, values: I) -> String
    where
        I: IntoIterator<Item = &'a T>,
        T: 'a
, { ... } }
Expand description

The trait you implement in order to make a serializer.

Required Methods

Add key-value pairs to the builder for the given object.

You shouldn’t have to call this method yourself. It’ll be called by other method in this trait.

Provided Methods

Turn the given object into a serde_json::Value.

Turn the given object into a JSON string.

Turn the given iterable into JSON array. The main usecase for this is to turn Vecs into JSON arrays, but works for any iterator.

Implementors