Skip to main content

stellar_xdr/generated/
operation_meta_v2.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// OperationMetaV2 is an XDR Struct defined as:
5///
6/// ```text
7/// struct OperationMetaV2
8/// {
9///     ExtensionPoint ext;
10///
11///     LedgerEntryChanges changes;
12///
13///     ContractEvent events<>;
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 OperationMetaV2 {
29    pub ext: ExtensionPoint,
30    pub changes: LedgerEntryChanges,
31    pub events: VecM<ContractEvent>,
32}
33
34impl ReadXdr for OperationMetaV2 {
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                changes: LedgerEntryChanges::read_xdr(r)?,
41                events: VecM::<ContractEvent>::read_xdr(r)?,
42            })
43        })
44    }
45}
46
47impl WriteXdr for OperationMetaV2 {
48    #[cfg(feature = "std")]
49    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
50        w.with_limited_depth(|w| {
51            self.ext.write_xdr(w)?;
52            self.changes.write_xdr(w)?;
53            self.events.write_xdr(w)?;
54            Ok(())
55        })
56    }
57}