Skip to main content

stellar_xdr/generated/
ledger_close_meta_ext_v1.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// LedgerCloseMetaExtV1 is an XDR Struct defined as:
5///
6/// ```text
7/// struct LedgerCloseMetaExtV1
8/// {
9///     ExtensionPoint ext;
10///     int64 sorobanFeeWrite1KB;
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 LedgerCloseMetaExtV1 {
26    pub ext: ExtensionPoint,
27    #[cfg_attr(
28        all(feature = "serde", feature = "alloc"),
29        serde_as(as = "NumberOrString")
30    )]
31    pub soroban_fee_write1_kb: i64,
32}
33
34impl ReadXdr for LedgerCloseMetaExtV1 {
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                ext: ExtensionPoint::read_xdr(r)?,
40                soroban_fee_write1_kb: i64::read_xdr(r)?,
41            })
42        })
43    }
44}
45
46impl WriteXdr for LedgerCloseMetaExtV1 {
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.ext.write_xdr(w)?;
51            self.soroban_fee_write1_kb.write_xdr(w)?;
52            Ok(())
53        })
54    }
55}