stellar_xdr/generated/
sc_spec_udt_struct_field_v0.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[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 ScSpecUdtStructFieldV0 {
27 pub doc: StringM<1024>,
28 pub name: StringM<30>,
29 #[cfg_attr(
30 all(feature = "serde", feature = "alloc"),
31 serde(rename = "type", alias = "type_")
32 )]
33 #[cfg_attr(feature = "schemars", schemars(rename = "type"))]
34 pub type_: ScSpecTypeDef,
35}
36
37impl ReadXdr for ScSpecUdtStructFieldV0 {
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 doc: StringM::<1024>::read_xdr(r)?,
43 name: StringM::<30>::read_xdr(r)?,
44 type_: ScSpecTypeDef::read_xdr(r)?,
45 })
46 })
47 }
48}
49
50impl WriteXdr for ScSpecUdtStructFieldV0 {
51 #[cfg(feature = "std")]
52 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
53 w.with_limited_depth(|w| {
54 self.doc.write_xdr(w)?;
55 self.name.write_xdr(w)?;
56 self.type_.write_xdr(w)?;
57 Ok(())
58 })
59 }
60}