stellar_xdr/generated/
muxed_contract.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg(feature = "cap_0084_muxed_contract")]
15#[cfg_attr(feature = "alloc", derive(Default))]
16#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
17#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
18#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
19#[cfg_attr(
20 all(feature = "serde", feature = "alloc"),
21 serde_with::serde_as,
22 derive(serde::Serialize, serde::Deserialize),
23 serde(rename_all = "snake_case")
24)]
25#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
26pub struct MuxedContract {
27 #[cfg_attr(
28 all(feature = "serde", feature = "alloc"),
29 serde_as(as = "NumberOrString")
30 )]
31 pub id: u64,
32 pub contract_id: ContractId,
33}
34
35#[cfg(feature = "cap_0084_muxed_contract")]
36impl ReadXdr for MuxedContract {
37 #[cfg(feature = "std")]
38 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
39 r.with_limited_depth(|r| {
40 Ok(Self {
41 id: u64::read_xdr(r)?,
42 contract_id: ContractId::read_xdr(r)?,
43 })
44 })
45 }
46}
47
48#[cfg(feature = "cap_0084_muxed_contract")]
49impl WriteXdr for MuxedContract {
50 #[cfg(feature = "std")]
51 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
52 w.with_limited_depth(|w| {
53 self.id.write_xdr(w)?;
54 self.contract_id.write_xdr(w)?;
55 Ok(())
56 })
57 }
58}