tendermint/abci/response/
echo.rs

1use crate::prelude::*;
2
3#[doc = include_str!("../doc/response-echo.md")]
4#[derive(Clone, PartialEq, Eq, Debug, Default)]
5pub struct Echo {
6    /// The message sent in the request.
7    pub message: String,
8}
9
10// =============================================================================
11// Protobuf conversions
12// =============================================================================
13
14tendermint_pb_modules! {
15    use super::Echo;
16
17    impl From<Echo> for pb::abci::ResponseEcho {
18        fn from(echo: Echo) -> Self {
19            Self {
20                message: echo.message,
21            }
22        }
23    }
24
25    impl TryFrom<pb::abci::ResponseEcho> for Echo {
26        type Error = crate::Error;
27
28        fn try_from(echo: pb::abci::ResponseEcho) -> Result<Self, Self::Error> {
29            Ok(Self {
30                message: echo.message,
31            })
32        }
33    }
34
35    impl Protobuf<pb::abci::ResponseEcho> for Echo {}
36}