pub trait Transformable: Send + Sync + 'static {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>;
    fn encoded_len(&self) -> usize;
    fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
       where Self: Sized;

    // Provided methods
    fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error> { ... }
    fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize> { ... }
    fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
        &self,
        writer: &mut W
    ) -> impl Future<Output = Result<usize>> + Send { ... }
    fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
       where Self: Sized { ... }
    fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
        reader: &mut R
    ) -> impl Future<Output = Result<(usize, Self)>> + Send
       where Self: Sized { ... }
}
Available on crate feature std only.
Expand description

The type can transform its representation between structured and byte form.

Required Associated Types§

source

type Error: Error + Send + Sync + 'static

The error type returned when encoding or decoding fails.

Required Methods§

source

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Encodes the value into the given buffer for transmission.

Returns the number of bytes written to the buffer.

source

fn encoded_len(&self) -> usize

Returns the encoded length of the value. This is used to pre-allocate a buffer for encoding.

source

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Decodes the value from the given buffer received over the wire.

Returns the number of bytes read from the buffer and the struct.

Provided Methods§

source

fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>

Encodes the value into a vec for transmission.

source

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Encodes the value into the given writer for transmission.

source

fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> impl Future<Output = Result<usize>> + Send

Available on crate feature async only.

Encodes the value into the given async writer for transmission.

source

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Decodes the value from the given reader received over the wire.

Returns the number of bytes read from the reader and the struct.

source

fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> impl Future<Output = Result<(usize, Self)>> + Send
where Self: Sized,

Available on crate feature async only.

Decodes the value from the given async reader received over the wire.

Returns the number of bytes read from the reader and the struct.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Transformable for IpAddr

§

type Error = IpAddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for SocketAddr

§

type Error = SocketAddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for i8

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for i16

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for i32

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for i64

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for i128

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for u8

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for u16

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for u32

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for u64

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for u128

§

type Error = NumberTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Box<str>

§

type Error = StringTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Box<[u8]>

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for String

§

type Error = StringTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Arc<str>

§

type Error = StringTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Arc<[u8]>

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Vec<u8>

source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.

Encodes the value into the given writer.

§Note

The implementation of this method is not optimized, which means if your writer is expensive (e.g. TcpStream, File), it is better to use a BufWriter to wrap your orginal writer to cut down the number of I/O times.

source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.

Encodes the value into the given async writer.

§Note

The implementation of this method is not optimized, which means if your writer is expensive (e.g. TcpStream, File), it is better to use a BufWriter to wrap your orginal writer to cut down the number of I/O times.

source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.

Decodes the value from the given reader.

§Note

The implementation of this method is not optimized, which means if your reader is expensive (e.g. TcpStream, File), it is better to use a BufReader to wrap your orginal reader to cut down the number of I/O times.

source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.

Decodes the value from the given async reader.

§Note

The implementation of this method is not optimized, which means if your reader is expensive (e.g. TcpStream, File), it is better to use a BufReader to wrap your orginal reader to cut down the number of I/O times.

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

impl Transformable for Ipv4Addr

§

type Error = AddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Ipv6Addr

§

type Error = AddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for SocketAddrV4

§

type Error = AddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for SocketAddrV6

§

type Error = AddrTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for Duration

§

type Error = DurationTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>
where Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized, Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

impl Transformable for Instant

§

type Error = InstantTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>
where Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized, Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

impl Transformable for SystemTime

§

type Error = SystemTimeTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W ) -> Result<usize>
where Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( reader: &mut R ) -> Result<(usize, Self)>
where Self: Sized, Self::Error: Send + Sync + 'static,

Available on crate features std and async only.
source§

impl Transformable for Bytes

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl Transformable for SmolStr

§

type Error = StringTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.
source§

impl<const N: usize> Transformable for SmallVec<[u8; N]>

source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.

Encodes the value into the given writer.

§Note

The implementation of this method is not optimized, which means if your writer is expensive (e.g. TcpStream, File), it is better to use a BufWriter to wrap your orginal writer to cut down the number of I/O times.

source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.

Encodes the value into the given async writer.

§Note

The implementation of this method is not optimized, which means if your writer is expensive (e.g. TcpStream, File), it is better to use a BufWriter to wrap your orginal writer to cut down the number of I/O times.

source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.

Decodes the value from the given reader.

§Note

The implementation of this method is not optimized, which means if your reader is expensive (e.g. TcpStream, File), it is better to use a BufReader to wrap your orginal reader to cut down the number of I/O times.

source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.

Decodes the value from the given async reader.

§Note

The implementation of this method is not optimized, which means if your reader is expensive (e.g. TcpStream, File), it is better to use a BufReader to wrap your orginal reader to cut down the number of I/O times.

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

impl<const N: usize> Transformable for [u8; N]

§

type Error = BytesTransformError

Available on crate feature std only.
source§

fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>

Available on crate feature std only.
source§

fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>

Available on crate feature std only.
source§

async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W ) -> Result<usize>

Available on crate features std and async only.
source§

fn encoded_len(&self) -> usize

Available on crate feature std only.
source§

fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>
where Self: Sized,

Available on crate feature std only.
source§

fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>
where Self: Sized,

Available on crate feature std only.
source§

async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>( src: &mut R ) -> Result<(usize, Self)>
where Self: Sized,

Available on crate features std and async only.

Implementors§