pub trait Encode: Debug {
type Error: From<Error> + Debug;
// Required methods
fn encode_len(&self) -> Result<usize, Self::Error>;
fn encode(&self, buff: &mut [u8]) -> Result<usize, Self::Error>;
}Expand description
Encode trait implemented for binary encodable objects
Required Associated Types§
Required Methods§
Sourcefn encode_len(&self) -> Result<usize, Self::Error>
fn encode_len(&self) -> Result<usize, Self::Error>
Calculate expected encoded length for an object
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T, const N: usize> Encode for Vec<T, N>
Available on crate feature heapless only.Encode implementation for heapless heapless::Vec containing encodable types
impl<T, const N: usize> Encode for Vec<T, N>
Available on crate feature
heapless only.Encode implementation for heapless heapless::Vec containing encodable types
Source§impl<T> Encode for Vec<T>
Available on crate feature alloc only.Encode implementation for std/alloc alloc::vec::Vec containing encodable types
impl<T> Encode for Vec<T>
Available on crate feature
alloc only.Encode implementation for std/alloc alloc::vec::Vec containing encodable types