Struct tokio_mqttc::proto::MqttPacket
[−]
[src]
pub struct MqttPacket { pub ty: PacketType, pub flags: PacketFlags, pub headers: Headers, pub payload: Payload, }
Fields
ty: PacketType
flags: PacketFlags
headers: Headers
payload: Payload
Methods
impl MqttPacket
[src]
fn from_slice<B: AsRef<[u8]>>(
data: B
) -> MqttResult<Option<(MqttPacket, Vec<u8>)>>
[src]
data: B
) -> MqttResult<Option<(MqttPacket, Vec<u8>)>>
Attempts to decode a MQTT Control Packet from the provided slice of bytes.
If there is a fully formed packet in the slice, Ok(Some((MqttPacket, Vec<u8>)))
will be
returned, containing the formed packet and the rest of the slice.
If there is not enough bytes in the slice to create a fully formed packet, Ok(None)
will
be returned.
If an error occurs decoding the bytes, an error will be returned.
fn validate(&self) -> MqttResult<()>
[src]
fn connect_packet(
version: ProtoLvl,
lwt: Option<LWTMessage>,
creds: Credentials<MqttString>,
clean: bool,
keep_alive: u16,
id: Option<MqttString>
) -> MqttPacket
[src]
version: ProtoLvl,
lwt: Option<LWTMessage>,
creds: Credentials<MqttString>,
clean: bool,
keep_alive: u16,
id: Option<MqttString>
) -> MqttPacket
fn publish_packet(
flags: PacketFlags,
topic: MqttString,
id: u16,
msg: Bytes
) -> MqttPacket
[src]
flags: PacketFlags,
topic: MqttString,
id: u16,
msg: Bytes
) -> MqttPacket
fn pub_ack_packet(id: u16) -> MqttPacket
[src]
fn pub_rec_packet(id: u16) -> MqttPacket
[src]
fn pub_rel_packet(id: u16) -> MqttPacket
[src]
fn pub_comp_packet(id: u16) -> MqttPacket
[src]
fn subscribe_packet(id: u16, subscriptions: Vec<Subscription>) -> MqttPacket
[src]
fn unsubscribe_packet(id: u16, subscriptions: Vec<Subscription>) -> MqttPacket
[src]
fn ping_req_packet() -> MqttPacket
[src]
fn disconnect_packet() -> MqttPacket
[src]
fn encode(&self) -> Option<Bytes>
[src]
Trait Implementations
impl Clone for MqttPacket
[src]
fn clone(&self) -> MqttPacket
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more