try_from_enum_to_integer! {
    #[repr(u8)]
    #[derive(Debug, Clone, PartialEq)]
    pub enum Opcode {
        Query = 0,
        IQuery = 1,
        Status = 2,

        Notify = 4,
        Update = 5,
        DSO = 6,
    }
}

try_from_enum_to_integer! {
    #[repr(u8)]
    #[derive(Debug, Clone, PartialEq)]
    pub enum RCode {
        NoError = 0,
        FormErr = 1,
        ServFail = 2,
        NXDomain = 3,
        NotImp = 4,
        Refused = 5,
        YXDomain = 6,
        YXRRSet = 7,
        NXRRSet = 8,
        NotAuth = 9,
        NotZone = 10,
        DSOTYPENI = 11,

        BADVERS = 16,
        BADKEY = 17,
        BADTIME = 18,
        BADMODE = 19,
        BADNAME = 20,
        BADALG = 21,
        BADTRUNC = 22,
        BADCOOKIE = 23,
    }
}
