pub fn to_u8(&self) -> Result<u8, Error> {
    let mut flag: u8 = 0x00;

    match self {
      Flags::Publish(value) => {
        flag |= value.qos << 1;
        if value.retain {
          flag |= 0x01
        }
        if value.dup {
          flag |= 0x08
        }
      }
      Flags::Generic(value) => {
        if value.0 {
          flag |= 0x01;
        }
        if value.1 {
          flag |= 0x02;
        }
        if value.2 {
          flag |= 0x04;
        }
        if value.3 {
          flag |= 0x08;
        }
      }
    };

    Ok(flag)
  }
/// Convert Flag variants into u8.
Convert Flag variants into u8.
Convert Flag variants into u8 .
pub fn to_u8(&self) -> Result<u8, Error> {
    let mut flag: u8 = 0x00;
    match self {
      Flags::Publish(value) => {
        flag |= value.qos << 1;
        if value.retain {
          flag |= 0x01
        }
        if value.dup {
          flag |= 0x08
        }
      }
      Flags::Generic(value) => {
        if value.0 {
          flag |= 0x01;
        }
        if value.1 {
          flag |= 0x02;
        }
        if value.2 {
          flag |= 0x04;
        }
        if value.3 {
          flag |= 0x08;
        }
      }
    };
    Ok(flag)
  }
pub fn to_u8 ( & self ) -> Result < u8 , Error > { let mut flag : u8 = 0x00 ; match self { Flags :: Publish ( value ) => { flag |= value . qos << 1 ; if value . retain { flag |= 0x01 } if value . dup { flag |= 0x08 } } Flags :: Generic ( value ) => { if value . 0 { flag |= 0x01 ; } if value . 1 { flag |= 0x02 ; } if value . 2 { flag |= 0x04 ; } if value . 3 { flag |= 0x08 ; } } } ; Ok ( flag ) }
Convert Flag variants into u8.
Convert Flag variants into u8 .
&self
&self