Skip to main content

stellar_xdr/generated/
soroban_transaction_meta_v2.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// SorobanTransactionMetaV2 is an XDR Struct defined as:
5///
6/// ```text
7/// struct SorobanTransactionMetaV2
8/// {
9///     SorobanTransactionMetaExt ext;
10///
11///     SCVal* returnValue;
12/// };
13/// ```
14///
15#[cfg_attr(feature = "alloc", derive(Default))]
16#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
18#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19#[cfg_attr(
20    all(feature = "serde", feature = "alloc"),
21    serde_with::serde_as,
22    derive(serde::Serialize, serde::Deserialize),
23    serde(rename_all = "snake_case")
24)]
25#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26pub struct SorobanTransactionMetaV2 {
27    pub ext: SorobanTransactionMetaExt,
28    pub return_value: Option<ScVal>,
29}
30
31impl ReadXdr for SorobanTransactionMetaV2 {
32    #[cfg(feature = "std")]
33    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
34        r.with_limited_depth(|r| {
35            Ok(Self {
36                ext: SorobanTransactionMetaExt::read_xdr(r)?,
37                return_value: Option::<ScVal>::read_xdr(r)?,
38            })
39        })
40    }
41}
42
43impl WriteXdr for SorobanTransactionMetaV2 {
44    #[cfg(feature = "std")]
45    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
46        w.with_limited_depth(|w| {
47            self.ext.write_xdr(w)?;
48            self.return_value.write_xdr(w)?;
49            Ok(())
50        })
51    }
52}