Skip to main content

stellar_xdr/generated/
config_upgrade_set_key.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ConfigUpgradeSetKey is an XDR Struct defined as:
5///
6/// ```text
7/// struct ConfigUpgradeSetKey {
8///     ContractID contractID;
9///     Hash contentHash;
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 ConfigUpgradeSetKey {
25    pub contract_id: ContractId,
26    pub content_hash: Hash,
27}
28
29impl ReadXdr for ConfigUpgradeSetKey {
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                contract_id: ContractId::read_xdr(r)?,
35                content_hash: Hash::read_xdr(r)?,
36            })
37        })
38    }
39}
40
41impl WriteXdr for ConfigUpgradeSetKey {
42    #[cfg(feature = "std")]
43    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
44        w.with_limited_depth(|w| {
45            self.contract_id.write_xdr(w)?;
46            self.content_hash.write_xdr(w)?;
47            Ok(())
48        })
49    }
50}