mqtt_proto/common/
mod.rs

1mod error;
2mod poll;
3mod types;
4mod utils;
5
6#[cfg(test)]
7mod tests;
8
9pub(crate) use embedded_io::{Read as SyncRead, Write as SyncWrite};
10pub(crate) use embedded_io_async::{Read as AsyncRead, Write as AsyncWrite};
11
12#[cfg(feature = "std")]
13pub(crate) use futures_lite::future::block_on;
14
15#[cfg(not(feature = "std"))]
16pub(crate) use embassy_futures::block_on;
17
18pub(crate) use utils::{
19    decode_var_int, encode_packet, packet_from, read_bytes, read_string, read_u16, read_u32,
20    read_u8, write_bytes, write_string, write_u16, write_u32, write_u8, write_var_int,
21};
22
23pub use error::{from_read_exact_error, Error, IoErrorKind};
24pub use poll::{
25    GenericPollBodyState, GenericPollPacket, GenericPollPacketState, PollHeader, PollHeaderState,
26};
27pub use types::{Encodable, Pid, Protocol, QoS, QosPid, TopicFilter, TopicName, VarBytes};
28pub use utils::{decode_raw_header, header_len, remaining_len, total_len, var_int_len};
29
30#[cfg(all(test, feature = "dhat-heap"))]
31pub use tests::MemorySummary;
32
33/// Character used to separate each level within a topic tree and provide a hierarchical structure.
34pub const LEVEL_SEP: char = '/';
35/// Wildcard character that matches only one topic level.
36pub const MATCH_ONE_CHAR: char = '+';
37/// Wildcard character that matches any number of levels within a topic.
38pub const MATCH_ALL_CHAR: char = '#';
39/// The &str version of `MATCH_ONE_CHAR`
40pub const MATCH_ONE_STR: &str = "+";
41/// The &str version of `MATCH_ALL_CHAR`
42pub const MATCH_ALL_STR: &str = "#";
43
44/// System topic prefix
45pub const SYS_PREFIX: &str = "$SYS/";
46/// Shared topic prefix
47pub const SHARED_PREFIX: &str = "$share/";