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>(&self, writer: &mut W) -> Result<usize, Error>
where W: Write { ... }
fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> impl Future<Output = Result<usize, Error>> + Send
where W: AsyncWrite + Send + Unpin { ... }
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, Self), Error>
where R: Read,
Self: Sized { ... }
fn decode_from_async_reader<R>(
reader: &mut R,
) -> impl Future<Output = Result<(usize, Self), Error>> + Send
where R: AsyncRead + Send + Unpin,
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>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature std only.
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
std only.Encodes the value into the given writer for transmission.
Sourcefn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> impl Future<Output = Result<usize, Error>> + Send
Available on crate feature async only.
fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> impl Future<Output = Result<usize, Error>> + Send
async only.Encodes the value into the given async writer for transmission.
Sourcefn decode_from_reader<R>(reader: &mut R) -> Result<(usize, Self), Error>
Available on crate feature std only.
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, Self), Error>
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.
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
impl Transformable for IpAddr
type Error = IpAddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <IpAddr as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, IpAddr), <IpAddr as Transformable>::Error>
Source§impl Transformable for SocketAddr
impl Transformable for SocketAddr
type Error = SocketAddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SocketAddr as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, SocketAddr), <SocketAddr as Transformable>::Error>where
SocketAddr: Sized,
Source§fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddr), Error>
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddr), Error>
Available on crate feature
std only.Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, SocketAddr), Error>
async fn decode_from_async_reader<R>( reader: &mut R, ) -> Result<(usize, SocketAddr), Error>
Available on crate feature
async only.Source§impl Transformable for SecretKey
impl Transformable for SecretKey
type Error = SecretKeyTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SecretKey as Transformable>::Error>
fn encoded_len(&self) -> usize
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn decode( src: &[u8], ) -> Result<(usize, SecretKey), <SecretKey as Transformable>::Error>
Source§impl Transformable for i8
impl Transformable for i8
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <i8 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, i8), <i8 as Transformable>::Error>
Source§impl Transformable for i16
impl Transformable for i16
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <i16 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, i16), <i16 as Transformable>::Error>
Source§impl Transformable for i32
impl Transformable for i32
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <i32 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, i32), <i32 as Transformable>::Error>
Source§impl Transformable for i64
impl Transformable for i64
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <i64 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, i64), <i64 as Transformable>::Error>
Source§impl Transformable for i128
impl Transformable for i128
type Error = NumberTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <i128 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, i128), <i128 as Transformable>::Error>
Source§impl Transformable for u8
impl Transformable for u8
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <u8 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, u8), <u8 as Transformable>::Error>
Source§impl Transformable for u16
impl Transformable for u16
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <u16 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, u16), <u16 as Transformable>::Error>
Source§impl Transformable for u32
impl Transformable for u32
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <u32 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, u32), <u32 as Transformable>::Error>
Source§impl Transformable for u64
impl Transformable for u64
type Error = NumberTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <u64 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, u64), <u64 as Transformable>::Error>
Source§impl Transformable for u128
impl Transformable for u128
type Error = NumberTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <u128 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, u128), <u128 as Transformable>::Error>
Source§impl Transformable for Box<str>
impl Transformable for Box<str>
type Error = StringTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Box<str> as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Box<str>), <Box<str> as Transformable>::Error>
Source§impl Transformable for Box<[u8]>
impl Transformable for Box<[u8]>
type Error = BytesTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Box<[u8]> as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Box<[u8]>), <Box<[u8]> as Transformable>::Error>
Source§impl Transformable for String
impl Transformable for String
type Error = StringTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <String as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, String), <String as Transformable>::Error>
Source§impl Transformable for Arc<str>
impl Transformable for Arc<str>
type Error = StringTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Arc<str> as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Arc<str>), <Arc<str> as Transformable>::Error>
Source§impl Transformable for Arc<[u8]>
impl Transformable for Arc<[u8]>
type Error = BytesTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Arc<[u8]> as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Arc<[u8]>), <Arc<[u8]> as Transformable>::Error>
Source§impl Transformable for Vec<u8>
impl Transformable for Vec<u8>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature std only.
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature async only.
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async only.Source§fn decode_from_reader<R>(src: &mut R) -> Result<(usize, Vec<u8>), Error>
Available on crate feature std only.
fn decode_from_reader<R>(src: &mut R) -> Result<(usize, Vec<u8>), Error>
std only.Source§async fn decode_from_async_reader<R>(
src: &mut R,
) -> Result<(usize, Vec<u8>), Error>
Available on crate feature async only.
async fn decode_from_async_reader<R>( src: &mut R, ) -> Result<(usize, Vec<u8>), Error>
async only.type Error = BytesTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Vec<u8> as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Vec<u8>), <Vec<u8> as Transformable>::Error>
Source§impl Transformable for Ipv4Addr
impl Transformable for Ipv4Addr
type Error = AddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Ipv4Addr as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Ipv4Addr), <Ipv4Addr as Transformable>::Error>
Source§impl Transformable for Ipv6Addr
impl Transformable for Ipv6Addr
type Error = AddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Ipv6Addr as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Ipv6Addr), <Ipv6Addr as Transformable>::Error>
Source§impl Transformable for SocketAddrV4
impl Transformable for SocketAddrV4
type Error = AddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SocketAddrV4 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, SocketAddrV4), <SocketAddrV4 as Transformable>::Error>where
SocketAddrV4: Sized,
Source§fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddrV4), Error>
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddrV4), Error>
Available on crate feature
std only.Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, SocketAddrV4), Error>
async fn decode_from_async_reader<R>( reader: &mut R, ) -> Result<(usize, SocketAddrV4), Error>
Available on crate feature
async only.Source§impl Transformable for SocketAddrV6
impl Transformable for SocketAddrV6
type Error = AddrTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SocketAddrV6 as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, SocketAddrV6), <SocketAddrV6 as Transformable>::Error>where
SocketAddrV6: Sized,
Source§fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddrV6), Error>
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SocketAddrV6), Error>
Available on crate feature
std only.Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, SocketAddrV6), Error>
async fn decode_from_async_reader<R>( reader: &mut R, ) -> Result<(usize, SocketAddrV6), Error>
Available on crate feature
async only.Source§impl Transformable for Duration
impl Transformable for Duration
type Error = DurationTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Duration as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Duration), <Duration as Transformable>::Error>
Source§impl Transformable for Instant
impl Transformable for Instant
type Error = InstantTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Instant as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Instant), <Instant as Transformable>::Error>
Source§impl Transformable for SystemTime
impl Transformable for SystemTime
type Error = SystemTimeTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SystemTime as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, SystemTime), <SystemTime as Transformable>::Error>where
SystemTime: Sized,
Source§fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SystemTime), Error>
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, SystemTime), Error>
Available on crate feature
std only.Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, SystemTime), Error>where
R: AsyncRead + Send + Unpin,
SystemTime: Sized,
<SystemTime as Transformable>::Error: Send + Sync + 'static,
async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, SystemTime), Error>where
R: AsyncRead + Send + Unpin,
SystemTime: Sized,
<SystemTime as Transformable>::Error: Send + Sync + 'static,
Available on crate feature
async only.Source§impl Transformable for Bytes
impl Transformable for Bytes
type Error = BytesTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Bytes as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Bytes), <Bytes as Transformable>::Error>
Source§impl Transformable for Ack
impl Transformable for Ack
type Error = AckTransformError
fn encode(&self, dst: &mut [u8]) -> Result<usize, <Ack as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Ack), <Ack as Transformable>::Error>
Source§impl Transformable for Nack
impl Transformable for Nack
type Error = <u32 as Transformable>::Error
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Nack as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(src: &[u8]) -> Result<(usize, Nack), <Nack as Transformable>::Error>
Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§impl Transformable for ErrorResponse
impl Transformable for ErrorResponse
type Error = <SmolStr as Transformable>::Error
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <ErrorResponse as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, ErrorResponse), <ErrorResponse as Transformable>::Error>where
ErrorResponse: Sized,
Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Available on crate feature
async only.Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§fn decode_from_reader<R>(
reader: &mut R,
) -> Result<(usize, ErrorResponse), Error>
fn decode_from_reader<R>( reader: &mut R, ) -> Result<(usize, ErrorResponse), Error>
Available on crate feature
std only.Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, ErrorResponse), Error>
async fn decode_from_async_reader<R>( reader: &mut R, ) -> Result<(usize, ErrorResponse), Error>
Available on crate feature
async only.Source§impl Transformable for Meta
impl Transformable for Meta
Source§impl Transformable for SecretKeys
impl Transformable for SecretKeys
type Error = SecretKeysTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SecretKeys as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, SecretKeys), <SecretKeys as Transformable>::Error>where
SecretKeys: Sized,
Source§impl Transformable for SmolStr
impl Transformable for SmolStr
type Error = StringTransformError
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <SmolStr as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, SmolStr), <SmolStr as Transformable>::Error>
Source§impl<I> Transformable for Dead<I>where
I: Transformable,
impl<I> Transformable for Dead<I>where
I: Transformable,
Source§impl<I> Transformable for Suspect<I>where
I: Transformable,
impl<I> Transformable for Suspect<I>where
I: Transformable,
Source§impl<I, A> Transformable for Message<I, A>
impl<I, A> Transformable for Message<I, A>
type Error = MessageTransformError<I, A>
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <Message<I, A> as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, Message<I, A>), <Message<I, A> as Transformable>::Error>
Source§impl<I, A> Transformable for Alive<I, A>where
I: Transformable + 'static,
A: Transformable + 'static,
impl<I, A> Transformable for Alive<I, A>where
I: Transformable + 'static,
A: Transformable + 'static,
Source§impl<I, A> Transformable for IndirectPing<I, A>where
I: Transformable,
A: Transformable,
impl<I, A> Transformable for IndirectPing<I, A>where
I: Transformable,
A: Transformable,
type Error = IndirectPingTransformError<I, A>
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <IndirectPing<I, A> as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, IndirectPing<I, A>), <IndirectPing<I, A> as Transformable>::Error>where
IndirectPing<I, A>: Sized,
Source§impl<I, A> Transformable for Ping<I, A>where
I: Transformable,
A: Transformable,
impl<I, A> Transformable for Ping<I, A>where
I: Transformable,
A: Transformable,
Source§impl<I, A> Transformable for PushNodeState<I, A>where
I: Transformable,
A: Transformable,
impl<I, A> Transformable for PushNodeState<I, A>where
I: Transformable,
A: Transformable,
type Error = PushPullTransformError<I, A>
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <PushNodeState<I, A> as Transformable>::Error>
fn encoded_len(&self) -> usize
fn decode(
src: &[u8],
) -> Result<(usize, PushNodeState<I, A>), <PushNodeState<I, A> as Transformable>::Error>where
PushNodeState<I, A>: Sized,
Source§impl<I, A> Transformable for PushPull<I, A>where
I: Transformable,
A: Transformable,
impl<I, A> Transformable for PushPull<I, A>where
I: Transformable,
A: Transformable,
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, <[u8; N] as Transformable>::Error>
Source§fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, dst: &mut W) -> Result<usize, Error>where
W: Write,
Available on crate feature
std only.Source§async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
async fn encode_to_async_writer<W>(&self, dst: &mut W) -> Result<usize, Error>
Available on crate feature
async only.fn encoded_len(&self) -> usize
fn decode( src: &[u8], ) -> Result<(usize, [u8; N]), <[u8; N] as Transformable>::Error>
Implementors§
Source§impl Transformable for KeyRequestMessage
Available on crate feature encryption only.
impl Transformable for KeyRequestMessage
Available on crate feature
encryption only.Source§impl Transformable for KeyResponseMessage
Available on crate feature encryption only.
impl Transformable for KeyResponseMessage
Available on crate feature
encryption only.Source§impl Transformable for LamportTime
impl Transformable for LamportTime
Source§impl Transformable for NodeAddress
Available on crate feature transformable only.
impl Transformable for NodeAddress
Available on crate feature
transformable only.type Error = NodeAddressError
Source§impl Transformable for NodeId
Available on crate feature transformable only.
impl Transformable for NodeId
Available on crate feature
transformable only.