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