celestia_core/abci/response/
begin_block.rs1use super::super::Event;
2use crate::prelude::*;
3
4#[doc = include_str!("../doc/response-beginblock.md")]
5#[derive(Clone, PartialEq, Eq, Debug, Default)]
6pub struct BeginBlock {
7 pub events: Vec<Event>,
9}
10
11tendermint_pb_modules! {
16 use super::BeginBlock;
17
18 impl From<BeginBlock> for pb::abci::ResponseBeginBlock {
19 fn from(begin_block: BeginBlock) -> Self {
20 Self {
21 events: begin_block.events.into_iter().map(Into::into).collect(),
22 }
23 }
24 }
25
26 impl TryFrom<pb::abci::ResponseBeginBlock> for BeginBlock {
27 type Error = crate::Error;
28
29 fn try_from(begin_block: pb::abci::ResponseBeginBlock) -> Result<Self, Self::Error> {
30 Ok(Self {
31 events: begin_block
32 .events
33 .into_iter()
34 .map(TryInto::try_into)
35 .collect::<Result<_, _>>()?,
36 })
37 }
38 }
39
40 impl Protobuf<pb::abci::ResponseBeginBlock> for BeginBlock {}
41}