Module serde::ser [] [src]

Generic serialization framework.

For Developers who want to serialize objects

Implement the Serialize trait for the type of objects you want to serialize. Call methods of the serializer object. For which methods to call and how to do so, look at the documentation of the Serializer trait.

For Serialization Format Developers

Implement the Serializer trait for a structure that contains fields that enable it to write the serialization result to your target. When a method's argument is an object of type Serialize, you can either forward the serializer object (self) or create a new one, depending on the quirks of your format.

Modules

impls

Implementations for all of Rust's builtin types. Tuples implement the Serialize trait if they have at most 16 fields. Arrays implement the Serialize trait if their length is 32 or less. You can always forward array serialization to slice serialization, which works for any length. Long tuples are best replaced by tuple structs, for which you can use derive(Serialize). In that case the number of fields is irrelevant.

Traits

Error

Error is a trait that allows a Serialize to generically create a Serializer error.

Serialize

A trait that describes a type that can be serialized by a Serializer.

Serializer

A trait that describes a type that can serialize a stream of values into the underlying format.