Skip to main content

stellar_xdr/generated/
sc_nonce_key.rs

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