stellar_xdr/generated/
data_entry.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
24#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
25#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
26#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
27#[cfg_attr(
28 all(feature = "serde", feature = "alloc"),
29 serde_with::serde_as,
30 derive(serde::Serialize, serde::Deserialize),
31 serde(rename_all = "snake_case")
32)]
33#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
34pub struct DataEntry {
35 pub account_id: AccountId,
36 pub data_name: String64,
37 pub data_value: DataValue,
38 pub ext: DataEntryExt,
39}
40
41impl ReadXdr for DataEntry {
42 #[cfg(feature = "std")]
43 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
44 r.with_limited_depth(|r| {
45 Ok(Self {
46 account_id: AccountId::read_xdr(r)?,
47 data_name: String64::read_xdr(r)?,
48 data_value: DataValue::read_xdr(r)?,
49 ext: DataEntryExt::read_xdr(r)?,
50 })
51 })
52 }
53}
54
55impl WriteXdr for DataEntry {
56 #[cfg(feature = "std")]
57 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
58 w.with_limited_depth(|w| {
59 self.account_id.write_xdr(w)?;
60 self.data_name.write_xdr(w)?;
61 self.data_value.write_xdr(w)?;
62 self.ext.write_xdr(w)?;
63 Ok(())
64 })
65 }
66}