Skip to main content

stellar_xdr/generated/
contract_executable_external_ref.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ContractExecutableExternalRef is an XDR Struct defined as:
5///
6/// ```text
7/// struct ContractExecutableExternalRef {
8///     SCAddress executable_owner;
9///     SCString tag;
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 ContractExecutableExternalRef {
25    pub executable_owner: ScAddress,
26    pub tag: ScString,
27}
28
29impl ReadXdr for ContractExecutableExternalRef {
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                executable_owner: ScAddress::read_xdr(r)?,
35                tag: ScString::read_xdr(r)?,
36            })
37        })
38    }
39}
40
41impl WriteXdr for ContractExecutableExternalRef {
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.executable_owner.write_xdr(w)?;
46            self.tag.write_xdr(w)?;
47            Ok(())
48        })
49    }
50}