Skip to main content

stellar_xdr/generated/
dont_have.rs

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