Trait anterofit::serialize::Serializer [−][src]
pub trait Serializer: Send + Sync + 'static { fn serialize<T: Serialize, W: Write>(
&self,
val: &T,
write: &mut W
) -> Result<()>; fn content_type(&self) -> Option<Mime>; }
A trait describing types which can concurrently serialize other types into byte-streams.
Required Methods
fn serialize<T: Serialize, W: Write>(
&self,
val: &T,
write: &mut W
) -> Result<()>
&self,
val: &T,
write: &mut W
) -> Result<()>
Serialize T
to write
, returning any errors.
fn content_type(&self) -> Option<Mime>
Return the MIME type of the serialized content, if applicable.
Used to set the Content-Type
header of the request this serializer
is being used for.
Implementors
impl Serializer for NoSerializer
impl Serializer for Serializer
impl Serializer for PrettySerializer