Skip to main content

stellar_xdr/generated/
config_setting_contract_events_v0.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ConfigSettingContractEventsV0 is an XDR Struct defined as:
5///
6/// ```text
7/// struct ConfigSettingContractEventsV0
8/// {
9///     // Maximum size of events that a contract call can emit.
10///     uint32 txMaxContractEventsSizeBytes;
11///     // Fee for generating 1KB of contract events.
12///     int64 feeContractEvents1KB;
13/// };
14/// ```
15///
16#[cfg_attr(feature = "alloc", derive(Default))]
17#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
18#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
19#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
20#[cfg_attr(
21    all(feature = "serde", feature = "alloc"),
22    serde_with::serde_as,
23    derive(serde::Serialize, serde::Deserialize),
24    serde(rename_all = "snake_case")
25)]
26#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
27pub struct ConfigSettingContractEventsV0 {
28    pub tx_max_contract_events_size_bytes: u32,
29    #[cfg_attr(
30        all(feature = "serde", feature = "alloc"),
31        serde_as(as = "NumberOrString")
32    )]
33    pub fee_contract_events1_kb: i64,
34}
35
36impl ReadXdr for ConfigSettingContractEventsV0 {
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                tx_max_contract_events_size_bytes: u32::read_xdr(r)?,
42                fee_contract_events1_kb: i64::read_xdr(r)?,
43            })
44        })
45    }
46}
47
48impl WriteXdr for ConfigSettingContractEventsV0 {
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.tx_max_contract_events_size_bytes.write_xdr(w)?;
53            self.fee_contract_events1_kb.write_xdr(w)?;
54            Ok(())
55        })
56    }
57}