Skip to main content

stellar_xdr/generated/
parallel_txs_component.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ParallelTxsComponent is an XDR Struct defined as:
5///
6/// ```text
7/// struct ParallelTxsComponent
8/// {
9///   int64* baseFee;
10///   // A sequence of stages that *may* have arbitrary data dependencies between
11///   // each other, i.e. in a general case the stage execution order may not be
12///   // arbitrarily shuffled without affecting the end result.
13///   ParallelTxExecutionStage executionStages<>;
14/// };
15/// ```
16///
17#[cfg_attr(feature = "alloc", derive(Default))]
18#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
20#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21#[cfg_attr(
22    all(feature = "serde", feature = "alloc"),
23    serde_with::serde_as,
24    derive(serde::Serialize, serde::Deserialize),
25    serde(rename_all = "snake_case")
26)]
27#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28pub struct ParallelTxsComponent {
29    #[cfg_attr(
30        all(feature = "serde", feature = "alloc"),
31        serde_as(as = "Option<NumberOrString>")
32    )]
33    pub base_fee: Option<i64>,
34    pub execution_stages: VecM<ParallelTxExecutionStage>,
35}
36
37impl ReadXdr for ParallelTxsComponent {
38    #[cfg(feature = "std")]
39    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
40        r.with_limited_depth(|r| {
41            Ok(Self {
42                base_fee: Option::<i64>::read_xdr(r)?,
43                execution_stages: VecM::<ParallelTxExecutionStage>::read_xdr(r)?,
44            })
45        })
46    }
47}
48
49impl WriteXdr for ParallelTxsComponent {
50    #[cfg(feature = "std")]
51    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
52        w.with_limited_depth(|w| {
53            self.base_fee.write_xdr(w)?;
54            self.execution_stages.write_xdr(w)?;
55            Ok(())
56        })
57    }
58}