Skip to main content

stellar_xdr/generated/
claimable_balance_entry_extension_v1.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ClaimableBalanceEntryExtensionV1 is an XDR Struct defined as:
5///
6/// ```text
7/// struct ClaimableBalanceEntryExtensionV1
8/// {
9///     union switch (int v)
10///     {
11///     case 0:
12///         void;
13///     }
14///     ext;
15///
16///     uint32 flags; // see ClaimableBalanceFlags
17/// };
18/// ```
19///
20#[cfg_attr(feature = "alloc", derive(Default))]
21#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
22#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
23#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
24#[cfg_attr(
25    all(feature = "serde", feature = "alloc"),
26    serde_with::serde_as,
27    derive(serde::Serialize, serde::Deserialize),
28    serde(rename_all = "snake_case")
29)]
30#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31pub struct ClaimableBalanceEntryExtensionV1 {
32    pub ext: ClaimableBalanceEntryExtensionV1Ext,
33    pub flags: u32,
34}
35
36impl ReadXdr for ClaimableBalanceEntryExtensionV1 {
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                ext: ClaimableBalanceEntryExtensionV1Ext::read_xdr(r)?,
42                flags: u32::read_xdr(r)?,
43            })
44        })
45    }
46}
47
48impl WriteXdr for ClaimableBalanceEntryExtensionV1 {
49    #[cfg(feature = "std")]
50    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
51        w.with_limited_depth(|w| {
52            self.ext.write_xdr(w)?;
53            self.flags.write_xdr(w)?;
54            Ok(())
55        })
56    }
57}