Skip to main content

stellar_xdr/generated/
account_entry_extension_v3.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// AccountEntryExtensionV3 is an XDR Struct defined as:
5///
6/// ```text
7/// struct AccountEntryExtensionV3
8/// {
9///     // We can use this to add more fields, or because it is first, to
10///     // change AccountEntryExtensionV3 into a union.
11///     ExtensionPoint ext;
12///
13///     // Ledger number at which `seqNum` took on its present value.
14///     uint32 seqLedger;
15///
16///     // Time at which `seqNum` took on its present value.
17///     TimePoint seqTime;
18/// };
19/// ```
20///
21#[cfg_attr(feature = "alloc", derive(Default))]
22#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
23#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
24#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
25#[cfg_attr(
26    all(feature = "serde", feature = "alloc"),
27    serde_with::serde_as,
28    derive(serde::Serialize, serde::Deserialize),
29    serde(rename_all = "snake_case")
30)]
31#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
32pub struct AccountEntryExtensionV3 {
33    pub ext: ExtensionPoint,
34    pub seq_ledger: u32,
35    pub seq_time: TimePoint,
36}
37
38impl ReadXdr for AccountEntryExtensionV3 {
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                ext: ExtensionPoint::read_xdr(r)?,
44                seq_ledger: u32::read_xdr(r)?,
45                seq_time: TimePoint::read_xdr(r)?,
46            })
47        })
48    }
49}
50
51impl WriteXdr for AccountEntryExtensionV3 {
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.ext.write_xdr(w)?;
56            self.seq_ledger.write_xdr(w)?;
57            self.seq_time.write_xdr(w)?;
58            Ok(())
59        })
60    }
61}