Skip to main content

stellar_xdr/generated/
account_entry_extension_v1.rs

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