Skip to main content

stellar_xdr/generated/
set_trust_line_flags_op.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// SetTrustLineFlagsOp is an XDR Struct defined as:
5///
6/// ```text
7/// struct SetTrustLineFlagsOp
8/// {
9///     AccountID trustor;
10///     Asset asset;
11///
12///     uint32 clearFlags; // which flags to clear
13///     uint32 setFlags;   // which flags to set
14/// };
15/// ```
16///
17#[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 SetTrustLineFlagsOp {
29    pub trustor: AccountId,
30    pub asset: Asset,
31    pub clear_flags: u32,
32    pub set_flags: u32,
33}
34
35impl ReadXdr for SetTrustLineFlagsOp {
36    #[cfg(feature = "std")]
37    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
38        r.with_limited_depth(|r| {
39            Ok(Self {
40                trustor: AccountId::read_xdr(r)?,
41                asset: Asset::read_xdr(r)?,
42                clear_flags: u32::read_xdr(r)?,
43                set_flags: u32::read_xdr(r)?,
44            })
45        })
46    }
47}
48
49impl WriteXdr for SetTrustLineFlagsOp {
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.trustor.write_xdr(w)?;
54            self.asset.write_xdr(w)?;
55            self.clear_flags.write_xdr(w)?;
56            self.set_flags.write_xdr(w)?;
57            Ok(())
58        })
59    }
60}