pub trait Encode {
// Required method
fn encode(&self, w: &mut dyn Writer) -> Result<()>;
// Provided method
fn encoded_len(&self) -> usize { ... }
}Expand description
Something that can be written to a Writer.
Required Methods§
Provided Methods§
Sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
The number of bytes Encode::encode will write.
Implementations must agree with encode. The default counts what encode
writes, so it agrees by construction; an override that does not is a buffer
sized wrongly, and tests/robustness.rs checks the two against each other for
everything it decodes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Encode for Aare<'_>
impl Encode for Aarq<'_>
impl Encode for AccessRequest<'_>
impl Encode for AccessRequestSpecification<'_>
impl Encode for AccessResponse<'_>
impl Encode for AccessResponseSpecification
impl Encode for ActionRequest<'_>
impl Encode for ActionResponse<'_>
impl Encode for ActionResponseWithOptionalData<'_>
impl Encode for ActionResult
impl Encode for Apdu<'_>
impl Encode for AttributeDescriptor
impl Encode for AttributeDescriptorWithSelection<'_>
impl Encode for CaptureObject
impl Encode for CipheredService<'_>
impl Encode for ConfirmedServiceError
impl Encode for Data<'_>
impl Encode for DataAccessResult
impl Encode for DataBlockG<'_>
impl Encode for DataBlockSA<'_>
impl Encode for DataBuf
Available on crate feature
alloc only.