FormatEncoder

Trait FormatEncoder 

Source
pub trait FormatEncoder<V: ?Sized> {
    type EncodeError;

    // Required method
    fn encode(
        &mut self,
        writer: impl Write,
        value: &V,
    ) -> Result<(), Self::EncodeError>;
}
Expand description

A trait for encoding values of type V into a specific format

Required Associated Types§

Source

type EncodeError

The error type that can occur during encoding

Required Methods§

Source

fn encode( &mut self, writer: impl Write, value: &V, ) -> Result<(), Self::EncodeError>

Encodes the given value into the provided writer

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, V> FormatEncoder<V> for &mut T
where T: ?Sized + FormatEncoder<V>, V: ?Sized,

Source§

type EncodeError = <T as FormatEncoder<V>>::EncodeError

Source§

fn encode( &mut self, writer: impl Write, value: &V, ) -> Result<(), Self::EncodeError>

Source§

impl<T, V> FormatEncoder<V> for Box<T>
where T: ?Sized + FormatEncoder<V>, V: ?Sized,

Source§

type EncodeError = <T as FormatEncoder<V>>::EncodeError

Source§

fn encode( &mut self, writer: impl Write, value: &V, ) -> Result<(), Self::EncodeError>

Implementors§