Trait serde::ser::SerializeTupleVariant
[−]
[src]
pub trait SerializeTupleVariant { type Ok; type Error: Error; fn serialize_field<T: ?Sized + Serialize>(
&mut self,
value: &T
) -> Result<(), Self::Error>; fn end(self) -> Result<Self::Ok, Self::Error>; }
Returned from Serializer::serialize_tuple_variant
.
ⓘThis example is not tested
match *self { E::T(ref a, ref b) => { let mut tv = serializer.serialize_tuple_variant("E", 0, "T", 2)?; tv.serialize_field(a)?; tv.serialize_field(b)?; tv.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,
value: &T
) -> Result<(), Self::Error>
&mut self,
value: &T
) -> Result<(), Self::Error>
Serialize a tuple variant field.
fn end(self) -> Result<Self::Ok, Self::Error>
Finish serializing a tuple variant.
Implementors
impl<Ok, E> SerializeTupleVariant for Impossible<Ok, E> where
E: Error, type Ok = Ok; type Error = E;