Skip to main content

stellar_xdr/generated/
inflation_payout.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// InflationPayout is an XDR Struct defined as:
5///
6/// ```text
7/// struct InflationPayout // or use PaymentResultAtom to limit types?
8/// {
9///     AccountID destination;
10///     int64 amount;
11/// };
12/// ```
13///
14#[cfg_attr(feature = "alloc", derive(Default))]
15#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
16#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
17#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
18#[cfg_attr(
19    all(feature = "serde", feature = "alloc"),
20    serde_with::serde_as,
21    derive(serde::Serialize, serde::Deserialize),
22    serde(rename_all = "snake_case")
23)]
24#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25pub struct InflationPayout {
26    pub destination: AccountId,
27    #[cfg_attr(
28        all(feature = "serde", feature = "alloc"),
29        serde_as(as = "NumberOrString")
30    )]
31    pub amount: i64,
32}
33
34impl ReadXdr for InflationPayout {
35    #[cfg(feature = "std")]
36    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
37        r.with_limited_depth(|r| {
38            Ok(Self {
39                destination: AccountId::read_xdr(r)?,
40                amount: i64::read_xdr(r)?,
41            })
42        })
43    }
44}
45
46impl WriteXdr for InflationPayout {
47    #[cfg(feature = "std")]
48    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
49        w.with_limited_depth(|w| {
50            self.destination.write_xdr(w)?;
51            self.amount.write_xdr(w)?;
52            Ok(())
53        })
54    }
55}