Trait serde::ser::SerializeStruct [] [src]

pub trait SerializeStruct {
    type Ok;
    type Error: Error;
    fn serialize_field<T: ?Sized + Serialize>(
        &mut self,
        key: &'static str,
        value: &T
    ) -> Result<(), Self::Error>; fn end(self) -> Result<Self::Ok, Self::Error>; }

Returned from Serializer::serialize_struct.

let mut struc = serializer.serialize_struct("Rgb", 3)?;
struc.serialize_field("r", &self.r)?;
struc.serialize_field("g", &self.g)?;
struc.serialize_field("b", &self.b)?;
struc.end()

Associated Types

Must match the Ok type of our Serializer.

Must match the Error type of our Serializer.

Required Methods

Serialize a struct field.

Finish serializing a struct.

Implementors