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