Skip to main content

stellar_xdr/generated/
sc_spec_event_param_v0.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ScSpecEventParamV0 is an XDR Struct defined as:
5///
6/// ```text
7/// struct SCSpecEventParamV0
8/// {
9///     string doc<SC_SPEC_DOC_LIMIT>;
10///     string name<30>;
11///     SCSpecTypeDef type;
12///     SCSpecEventParamLocationV0 location;
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 ScSpecEventParamV0 {
28    pub doc: StringM<1024>,
29    pub name: StringM<30>,
30    #[cfg_attr(
31        all(feature = "serde", feature = "alloc"),
32        serde(rename = "type", alias = "type_")
33    )]
34    #[cfg_attr(feature = "schemars", schemars(rename = "type"))]
35    pub type_: ScSpecTypeDef,
36    pub location: ScSpecEventParamLocationV0,
37}
38
39impl ReadXdr for ScSpecEventParamV0 {
40    #[cfg(feature = "std")]
41    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
42        r.with_limited_depth(|r| {
43            Ok(Self {
44                doc: StringM::<1024>::read_xdr(r)?,
45                name: StringM::<30>::read_xdr(r)?,
46                type_: ScSpecTypeDef::read_xdr(r)?,
47                location: ScSpecEventParamLocationV0::read_xdr(r)?,
48            })
49        })
50    }
51}
52
53impl WriteXdr for ScSpecEventParamV0 {
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.doc.write_xdr(w)?;
58            self.name.write_xdr(w)?;
59            self.type_.write_xdr(w)?;
60            self.location.write_xdr(w)?;
61            Ok(())
62        })
63    }
64}