rumq_core/
lib.rs

1use std::io;
2use std::string::FromUtf8Error;
3
4pub mod mqtt4;
5
6// TODO Probably convert this to io::Error (for simplicity) and provide a function for meaningful enum?
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    #[error("Invalid connect return code `{0}`")]
10    InvalidConnectReturnCode(u8),
11    #[error("Invalid level `{1}` for protocol `{0}`")]
12    InvalidProtocolLevel(String, u8),
13    #[error("Incorrect packet format")]
14    IncorrectPacketFormat,
15    #[error("Unsupported QoS")]
16    UnsupportedQoS,
17    #[error("Unsupported packet type `{0}`")]
18    UnsupportedPacketType(u8),
19    #[error("Payload size incorrect")]
20    PayloadSizeIncorrect,
21    #[error("Payload too long")]
22    PayloadTooLong,
23    #[error("Payload size limit exceeded")]
24    PayloadSizeLimitExceeded,
25    #[error("Payload required")]
26    PayloadRequired,
27    #[error("Topic name must only contain valid UTF-8")]
28    TopicNameMustNotContainNonUtf8(#[from] FromUtf8Error),
29    #[error("Malformed remaining length")]
30    MalformedRemainingLength,
31    #[error("Io")]
32    Io(#[from] io::Error),
33}