tendermint/abci/request/
offer_snapshot.rs1use super::super::types::Snapshot;
2#[allow(unused)]
4use super::ApplySnapshotChunk;
5use crate::{prelude::*, AppHash};
6
7#[doc = include_str!("../doc/request-offersnapshot.md")]
8#[derive(Clone, PartialEq, Eq, Debug)]
9pub struct OfferSnapshot {
10 pub snapshot: Snapshot,
12 pub app_hash: AppHash,
14}
15
16tendermint_pb_modules! {
21 use super::OfferSnapshot;
22
23 impl From<OfferSnapshot> for pb::abci::RequestOfferSnapshot {
24 fn from(offer_snapshot: OfferSnapshot) -> Self {
25 Self {
26 snapshot: Some(offer_snapshot.snapshot.into()),
27 app_hash: offer_snapshot.app_hash.into(),
28 }
29 }
30 }
31
32 impl TryFrom<pb::abci::RequestOfferSnapshot> for OfferSnapshot {
33 type Error = crate::Error;
34
35 fn try_from(offer_snapshot: pb::abci::RequestOfferSnapshot) -> Result<Self, Self::Error> {
36 Ok(Self {
37 snapshot: offer_snapshot
38 .snapshot
39 .ok_or_else(crate::Error::missing_data)?
40 .try_into()?,
41 app_hash: offer_snapshot.app_hash.try_into()?,
42 })
43 }
44 }
45
46 impl Protobuf<pb::abci::RequestOfferSnapshot> for OfferSnapshot {}
47}