lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

error.rs (1299B)


      1 use core::fmt;
      2 
      3 #[derive(Clone, Debug, PartialEq, Eq)]
      4 pub enum RadrootsMeshError {
      5     EmptyCustomScope,
      6     InvalidCustomScope,
      7     EmptyMessageId,
      8     InvalidTtl,
      9     PayloadTransmissionForbidden,
     10     InvalidCbor,
     11     InvalidUtf8,
     12     UnknownFrameType,
     13     UnknownScope,
     14     UnsupportedVersion,
     15 }
     16 
     17 impl fmt::Display for RadrootsMeshError {
     18     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     19         match self {
     20             Self::EmptyCustomScope => f.write_str("mesh custom scope is empty"),
     21             Self::InvalidCustomScope => f.write_str("mesh custom scope is invalid"),
     22             Self::EmptyMessageId => f.write_str("mesh message id is empty"),
     23             Self::InvalidTtl => f.write_str("mesh frame TTL is invalid"),
     24             Self::PayloadTransmissionForbidden => {
     25                 f.write_str("mesh payload transmission is forbidden")
     26             }
     27             Self::InvalidCbor => f.write_str("mesh frame CBOR is invalid"),
     28             Self::InvalidUtf8 => f.write_str("mesh frame text is invalid UTF-8"),
     29             Self::UnknownFrameType => f.write_str("mesh frame type is unknown"),
     30             Self::UnknownScope => f.write_str("mesh scope is unknown"),
     31             Self::UnsupportedVersion => f.write_str("mesh frame version is unsupported"),
     32         }
     33     }
     34 }