tendermint/block/
block_id_flag.rs1#[derive(Debug, Copy, Clone, PartialEq, Eq)]
3pub enum BlockIdFlag {
4 Absent,
6 Commit,
8 Nil,
10}
11
12tendermint_pb_modules! {
13 use super::BlockIdFlag;
14 use crate::{error::Error, prelude::*};
15 use pb::types::BlockIdFlag as RawBlockIdFlag;
16
17 impl TryFrom<RawBlockIdFlag> for BlockIdFlag {
18 type Error = Error;
19
20 fn try_from(value: RawBlockIdFlag) -> Result<Self, Self::Error> {
21 match value {
22 RawBlockIdFlag::Absent => Ok(BlockIdFlag::Absent),
23 RawBlockIdFlag::Commit => Ok(BlockIdFlag::Commit),
24 RawBlockIdFlag::Nil => Ok(BlockIdFlag::Nil),
25 _ => Err(Error::block_id_flag()), }
26 }
27 }
28
29 impl From<BlockIdFlag> for RawBlockIdFlag {
30 fn from(value: BlockIdFlag) -> RawBlockIdFlag {
31 match value {
32 BlockIdFlag::Absent => RawBlockIdFlag::Absent,
33 BlockIdFlag::Commit => RawBlockIdFlag::Commit,
34 BlockIdFlag::Nil => RawBlockIdFlag::Nil,
35 }
36 }
37 }
38}