stellar_xdr/generated/
scp_statement_prepare.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
19#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
21#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22#[cfg_attr(
23 all(feature = "serde", feature = "alloc"),
24 serde_with::serde_as,
25 derive(serde::Serialize, serde::Deserialize),
26 serde(rename_all = "snake_case")
27)]
28#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29pub struct ScpStatementPrepare {
30 pub quorum_set_hash: Hash,
31 pub ballot: ScpBallot,
32 pub prepared: Option<ScpBallot>,
33 pub prepared_prime: Option<ScpBallot>,
34 pub n_c: u32,
35 pub n_h: u32,
36}
37
38impl ReadXdr for ScpStatementPrepare {
39 #[cfg(feature = "std")]
40 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
41 r.with_limited_depth(|r| {
42 Ok(Self {
43 quorum_set_hash: Hash::read_xdr(r)?,
44 ballot: ScpBallot::read_xdr(r)?,
45 prepared: Option::<ScpBallot>::read_xdr(r)?,
46 prepared_prime: Option::<ScpBallot>::read_xdr(r)?,
47 n_c: u32::read_xdr(r)?,
48 n_h: u32::read_xdr(r)?,
49 })
50 })
51 }
52}
53
54impl WriteXdr for ScpStatementPrepare {
55 #[cfg(feature = "std")]
56 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
57 w.with_limited_depth(|w| {
58 self.quorum_set_hash.write_xdr(w)?;
59 self.ballot.write_xdr(w)?;
60 self.prepared.write_xdr(w)?;
61 self.prepared_prime.write_xdr(w)?;
62 self.n_c.write_xdr(w)?;
63 self.n_h.write_xdr(w)?;
64 Ok(())
65 })
66 }
67}