Skip to main content

stellar_xdr/generated/
stellar_value_proposed_value.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// StellarValueProposedValue is an XDR NestedStruct defined as:
5///
6/// ```text
7/// struct
8///         {
9///             Hash txSetHash;
10///             Hash previousLedgerHash;
11///             uint32 previousLedgerVersion;
12///             LedgerCloseValueSignature lcValueSignature;
13///         }
14/// ```
15///
16#[cfg(feature = "cap_0083")]
17#[cfg_attr(feature = "alloc", derive(Default))]
18#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
20#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21#[cfg_attr(
22    all(feature = "serde", feature = "alloc"),
23    serde_with::serde_as,
24    derive(serde::Serialize, serde::Deserialize),
25    serde(rename_all = "snake_case")
26)]
27#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28pub struct StellarValueProposedValue {
29    pub tx_set_hash: Hash,
30    pub previous_ledger_hash: Hash,
31    pub previous_ledger_version: u32,
32    pub lc_value_signature: LedgerCloseValueSignature,
33}
34
35#[cfg(feature = "cap_0083")]
36impl ReadXdr for StellarValueProposedValue {
37    #[cfg(feature = "std")]
38    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
39        r.with_limited_depth(|r| {
40            Ok(Self {
41                tx_set_hash: Hash::read_xdr(r)?,
42                previous_ledger_hash: Hash::read_xdr(r)?,
43                previous_ledger_version: u32::read_xdr(r)?,
44                lc_value_signature: LedgerCloseValueSignature::read_xdr(r)?,
45            })
46        })
47    }
48}
49
50#[cfg(feature = "cap_0083")]
51impl WriteXdr for StellarValueProposedValue {
52    #[cfg(feature = "std")]
53    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
54        w.with_limited_depth(|w| {
55            self.tx_set_hash.write_xdr(w)?;
56            self.previous_ledger_hash.write_xdr(w)?;
57            self.previous_ledger_version.write_xdr(w)?;
58            self.lc_value_signature.write_xdr(w)?;
59            Ok(())
60        })
61    }
62}