tendermint/abci/request/
info.rs

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use crate::prelude::*;

#[doc = include_str!("../doc/request-info.md")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct Info {
    /// The Tendermint software semantic version.
    pub version: String,
    /// The Tendermint block protocol version.
    pub block_version: u64,
    /// The Tendermint p2p protocol version.
    pub p2p_version: u64,
    /// The ABCI protocol version.
    pub abci_version: String,
}

// =============================================================================
// Protobuf conversions
// =============================================================================

mod v0_34 {
    use super::Info;
    use tendermint_proto::v0_34::abci as pb;
    use tendermint_proto::Protobuf;

    impl From<Info> for pb::RequestInfo {
        fn from(info: Info) -> Self {
            Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
            }
        }
    }

    impl TryFrom<pb::RequestInfo> for Info {
        type Error = crate::Error;

        fn try_from(info: pb::RequestInfo) -> Result<Self, Self::Error> {
            Ok(Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
                abci_version: Default::default(),
            })
        }
    }

    impl Protobuf<pb::RequestInfo> for Info {}
}

mod v0_37 {
    use super::Info;
    use tendermint_proto::v0_37::abci as pb;
    use tendermint_proto::Protobuf;

    impl From<Info> for pb::RequestInfo {
        fn from(info: Info) -> Self {
            Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
                abci_version: info.abci_version,
            }
        }
    }

    impl TryFrom<pb::RequestInfo> for Info {
        type Error = crate::Error;

        fn try_from(info: pb::RequestInfo) -> Result<Self, Self::Error> {
            Ok(Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
                abci_version: info.abci_version,
            })
        }
    }

    impl Protobuf<pb::RequestInfo> for Info {}
}

mod v0_38 {
    use super::Info;
    use tendermint_proto::v0_38::abci as pb;
    use tendermint_proto::Protobuf;

    impl From<Info> for pb::RequestInfo {
        fn from(info: Info) -> Self {
            Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
                abci_version: info.abci_version,
            }
        }
    }

    impl TryFrom<pb::RequestInfo> for Info {
        type Error = crate::Error;

        fn try_from(info: pb::RequestInfo) -> Result<Self, Self::Error> {
            Ok(Self {
                version: info.version,
                block_version: info.block_version,
                p2p_version: info.p2p_version,
                abci_version: info.abci_version,
            })
        }
    }

    impl Protobuf<pb::RequestInfo> for Info {}
}