Skip to main content

Encode

Trait Encode 

pub trait Encode {
    // Required method
    fn encode<S: Sink>(&self, w: &mut Writer<S>) -> Result<(), S::Error>;

    // Provided method
    fn encoded_len(&self) -> usize { ... }
}
Expand description

A value with a fixed MQTT wire encoding.

Required Methods§

fn encode<S: Sink>(&self, w: &mut Writer<S>) -> Result<(), S::Error>

Writes the encoded value.

§Errors

Returns the sink’s error if it cannot take the bytes.

Provided Methods§

fn encoded_len(&self) -> usize

Returns the number of bytes encode writes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl Encode for Ack<'_>

§

impl Encode for Auth<'_>

§

impl Encode for Connack<'_>

§

impl Encode for Connect<'_>

§

impl Encode for Disconnect<'_>

§

impl Encode for Property<'_>

§

impl Encode for Publish<'_>

§

impl Encode for ReceivedPublish<'_>

§

impl Encode for Suback<'_>

§

impl Encode for Subscribe<'_>

§

impl Encode for Unsuback<'_>

§

impl Encode for Unsubscribe<'_>

§

impl<P: Constraint> Encode for Properties<P>

Encodes the properties section, including its length prefix.