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 { ... }
}Expand description
The type can transform its representation between structured and byte form.
Required Associated Types§
Required Methods§
Sourcefn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
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.
Sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the value. This is used to pre-allocate a buffer for encoding.
Provided Methods§
Sourcefn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
Available on crate features alloc or std only.
fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
alloc or std only.Encodes the value into a vec for transmission.
Sourcefn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Available on crate feature std only.
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Encodes the value into the given writer for transmission.
Sourcefn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> impl Future<Output = Result<usize>> + Send
Available on crate feature async only.
fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> impl Future<Output = Result<usize>> + Send
async only.Encodes the value into the given async writer for transmission.
Sourcefn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Available on crate feature std only.
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
std only.Decodes the value from the given reader received over the wire.
Returns the number of bytes read from the reader and the struct.
Sourcefn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
reader: &mut R,
) -> impl Future<Output = Result<(usize, Self)>> + Sendwhere
Self: Sized,
Available on crate feature async only.
fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
reader: &mut R,
) -> impl Future<Output = Result<(usize, Self)>> + Sendwhere
Self: Sized,
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Transformable for IpAddr
Available on crate feature std only.
impl Transformable for IpAddr
std only.type Error = IpAddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for SocketAddr
Available on crate feature std only.
impl Transformable for SocketAddr
std only.type Error = SocketAddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for i8
impl Transformable for i8
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for i16
impl Transformable for i16
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for i32
impl Transformable for i32
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for i64
impl Transformable for i64
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for i128
impl Transformable for i128
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for u8
impl Transformable for u8
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for u16
impl Transformable for u16
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for u32
impl Transformable for u32
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for u64
impl Transformable for u64
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for u128
impl Transformable for u128
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Box<str>
Available on crate features alloc or std only.
impl Transformable for Box<str>
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Box<[u8]>
Available on crate features alloc or std only.
impl Transformable for Box<[u8]>
alloc or std only.type Error = BytesTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for String
Available on crate features alloc or std only.
impl Transformable for String
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Arc<str>
Available on crate features alloc or std only.
impl Transformable for Arc<str>
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Arc<[u8]>
Available on crate features alloc or std only.
impl Transformable for Arc<[u8]>
alloc or std only.type Error = BytesTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Vec<u8>
Available on crate features alloc or std only.
impl Transformable for Vec<u8>
alloc or std only.Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
Available on crate feature std only.
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
Available on crate feature async only.
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.Source§fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Available on crate feature std only.
fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
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 feature async only.
async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
src: &mut R,
) -> Result<(usize, Self)>where
Self: Sized,
async only.type Error = BytesTransformError
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,
Source§impl Transformable for Ipv4Addr
Available on crate feature std only.
impl Transformable for Ipv4Addr
std only.type Error = AddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for Ipv6Addr
Available on crate feature std only.
impl Transformable for Ipv6Addr
std only.type Error = AddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for SocketAddrV4
Available on crate feature std only.
impl Transformable for SocketAddrV4
std only.type Error = AddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for SocketAddrV6
Available on crate feature std only.
impl Transformable for SocketAddrV6
std only.type Error = AddrTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for Duration
impl Transformable for Duration
type Error = DurationTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Instant
Available on crate feature std only.
impl Transformable for Instant
std only.type Error = InstantTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for SystemTime
Available on crate feature std only.
impl Transformable for SystemTime
std only.type Error = SystemTimeTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode_to_writer<W: Write>(&self, writer: &mut W) -> Result<usize>
Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
writer: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, writer: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode_from_reader<R: Read>(reader: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Source§impl Transformable for Bytes
Available on crate features alloc or std only.
impl Transformable for Bytes
alloc or std only.type Error = BytesTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for SmolStr
Available on crate features alloc or std only.
impl Transformable for SmolStr
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for SmolStr
Available on crate features alloc or std only.
impl Transformable for SmolStr
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Arc<str>
Available on crate features alloc or std only.
impl Transformable for Arc<str>
alloc or std only.type Error = StringTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl Transformable for Arc<[u8]>
Available on crate features alloc or std only.
impl Transformable for Arc<[u8]>
alloc or std only.type Error = BytesTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§impl<const N: usize> Transformable for SmallVec<[u8; N]>
Available on crate feature smallvec1 only.
impl<const N: usize> Transformable for SmallVec<[u8; N]>
smallvec1 only.Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
Available on crate feature std only.
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
Available on crate feature async only.
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.Source§fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
Available on crate feature std only.
fn decode_from_reader<R: Read>(src: &mut R) -> Result<(usize, Self)>where
Self: Sized,
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 feature async only.
async fn decode_from_async_reader<R: AsyncRead + Send + Unpin>(
src: &mut R,
) -> Result<(usize, Self)>where
Self: Sized,
async only.type Error = BytesTransformError
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,
Source§impl<const N: usize> Transformable for [u8; N]
impl<const N: usize> Transformable for [u8; N]
type Error = BytesTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
fn encode_to_writer<W: Write>(&self, dst: &mut W) -> Result<usize>
std only.Source§async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>(
&self,
dst: &mut W,
) -> Result<usize>
async fn encode_to_async_writer<W: AsyncWrite + Send + Unpin>( &self, dst: &mut W, ) -> Result<usize>
async only.