1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use seq_macro::seq;

use crate::protos::protobuf::pulsar_api::ProtocolVersion as Protobuf_ProtocolVersion;

seq!(N in 0..=17 {
    #[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Debug, Clone)]
    pub enum ProtocolVersion {
        #(
            V#N,
        )*
    }
});

seq!(N in 0..=17 {
    impl From<ProtocolVersion> for Protobuf_ProtocolVersion {
        fn from(pv: ProtocolVersion) -> Self {
            match pv {
                #(
                    ProtocolVersion::V#N => Self::v#N,
                )*
            }
        }
    }
});

seq!(N in 0..=17 {
    impl From<Protobuf_ProtocolVersion> for ProtocolVersion {
        fn from(pv: Protobuf_ProtocolVersion) -> Self {
            match pv {
                #(
                    Protobuf_ProtocolVersion::v#N => Self::V#N,
                )*
            }
        }
    }
});