Skip to main content

stellar_xdr/generated/
ledger_key_ttl.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// LedgerKeyTtl is an XDR NestedStruct defined as:
5///
6/// ```text
7/// struct
8///     {
9///         // Hash of the LedgerKey that is associated with this TTLEntry
10///         Hash keyHash;
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 LedgerKeyTtl {
26    pub key_hash: Hash,
27}
28
29impl ReadXdr for LedgerKeyTtl {
30    #[cfg(feature = "std")]
31    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
32        r.with_limited_depth(|r| {
33            Ok(Self {
34                key_hash: Hash::read_xdr(r)?,
35            })
36        })
37    }
38}
39
40impl WriteXdr for LedgerKeyTtl {
41    #[cfg(feature = "std")]
42    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
43        w.with_limited_depth(|w| {
44            self.key_hash.write_xdr(w)?;
45            Ok(())
46        })
47    }
48}