Skip to main content

stellar_xdr/generated/
config_setting_contract_bandwidth_v0.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ConfigSettingContractBandwidthV0 is an XDR Struct defined as:
5///
6/// ```text
7/// struct ConfigSettingContractBandwidthV0
8/// {
9///     // Maximum sum of all transaction sizes in the ledger in bytes
10///     uint32 ledgerMaxTxsSizeBytes;
11///     // Maximum size in bytes for a transaction
12///     uint32 txMaxSizeBytes;
13///
14///     // Fee for 1 KB of transaction size
15///     int64 feeTxSize1KB;
16/// };
17/// ```
18///
19#[cfg_attr(feature = "alloc", derive(Default))]
20#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
21#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
22#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
23#[cfg_attr(
24    all(feature = "serde", feature = "alloc"),
25    serde_with::serde_as,
26    derive(serde::Serialize, serde::Deserialize),
27    serde(rename_all = "snake_case")
28)]
29#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
30pub struct ConfigSettingContractBandwidthV0 {
31    pub ledger_max_txs_size_bytes: u32,
32    pub tx_max_size_bytes: u32,
33    #[cfg_attr(
34        all(feature = "serde", feature = "alloc"),
35        serde_as(as = "NumberOrString")
36    )]
37    pub fee_tx_size1_kb: i64,
38}
39
40impl ReadXdr for ConfigSettingContractBandwidthV0 {
41    #[cfg(feature = "std")]
42    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
43        r.with_limited_depth(|r| {
44            Ok(Self {
45                ledger_max_txs_size_bytes: u32::read_xdr(r)?,
46                tx_max_size_bytes: u32::read_xdr(r)?,
47                fee_tx_size1_kb: i64::read_xdr(r)?,
48            })
49        })
50    }
51}
52
53impl WriteXdr for ConfigSettingContractBandwidthV0 {
54    #[cfg(feature = "std")]
55    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
56        w.with_limited_depth(|w| {
57            self.ledger_max_txs_size_bytes.write_xdr(w)?;
58            self.tx_max_size_bytes.write_xdr(w)?;
59            self.fee_tx_size1_kb.write_xdr(w)?;
60            Ok(())
61        })
62    }
63}