Skip to main content

stellar_xdr/generated/
flood_advert.rs

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