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
type Ok
Must match the Ok
type of our Serializer
.
type Error: Error
Must match the Error
type of our Serializer
.
Required Methods
fn serialize_field<T: ?Sized + Serialize>(&mut self,
key: &'static str,
value: &T)
-> Result<(), Self::Error>
key: &'static str,
value: &T)
-> Result<(), Self::Error>
Serialize a struct field.
fn end(self) -> Result<Self::Ok, Self::Error>
Finish serializing a struct.
Implementors
impl<Ok, E> SerializeStruct for Impossible<Ok, E> where E: Error