stellar_xdr/generated/
claimable_balance_entry.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
34#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
35#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
36#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
37#[cfg_attr(
38 all(feature = "serde", feature = "alloc"),
39 serde_with::serde_as,
40 derive(serde::Serialize, serde::Deserialize),
41 serde(rename_all = "snake_case")
42)]
43#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
44pub struct ClaimableBalanceEntry {
45 pub balance_id: ClaimableBalanceId,
46 pub claimants: VecM<Claimant, 10>,
47 pub asset: Asset,
48 #[cfg_attr(
49 all(feature = "serde", feature = "alloc"),
50 serde_as(as = "NumberOrString")
51 )]
52 pub amount: i64,
53 pub ext: ClaimableBalanceEntryExt,
54}
55
56impl ReadXdr for ClaimableBalanceEntry {
57 #[cfg(feature = "std")]
58 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
59 r.with_limited_depth(|r| {
60 Ok(Self {
61 balance_id: ClaimableBalanceId::read_xdr(r)?,
62 claimants: VecM::<Claimant, 10>::read_xdr(r)?,
63 asset: Asset::read_xdr(r)?,
64 amount: i64::read_xdr(r)?,
65 ext: ClaimableBalanceEntryExt::read_xdr(r)?,
66 })
67 })
68 }
69}
70
71impl WriteXdr for ClaimableBalanceEntry {
72 #[cfg(feature = "std")]
73 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
74 w.with_limited_depth(|w| {
75 self.balance_id.write_xdr(w)?;
76 self.claimants.write_xdr(w)?;
77 self.asset.write_xdr(w)?;
78 self.amount.write_xdr(w)?;
79 self.ext.write_xdr(w)?;
80 Ok(())
81 })
82 }
83}