parsers: use derive macros for simple text-based elements
This commit is contained in:
parent
b0803f831b
commit
298bf006bf
3 changed files with 43 additions and 35 deletions
|
|
@ -13,8 +13,10 @@
|
|||
//! For vCard updates defined in [XEP-0153](https://xmpp.org/extensions/xep-0153.html),
|
||||
//! see [`vcard_update`][crate::vcard_update] module.
|
||||
|
||||
use xso::{FromXml, IntoXml};
|
||||
|
||||
use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload};
|
||||
use crate::util::text_node_codecs::{Codec, Text, WhitespaceAwareBase64};
|
||||
use crate::util::text_node_codecs::{Codec, WhitespaceAwareBase64};
|
||||
use crate::{ns, Error};
|
||||
use minidom::Element;
|
||||
|
||||
|
|
@ -30,14 +32,14 @@ generate_element!(
|
|||
]
|
||||
);
|
||||
|
||||
generate_element!(
|
||||
/// The type of the photo.
|
||||
Type, "TYPE", VCARD,
|
||||
text: (
|
||||
/// The type as a plain text string; at least "image/jpeg", "image/gif" and "image/png" SHOULD be supported.
|
||||
data: Text
|
||||
)
|
||||
);
|
||||
/// The type of the photo.
|
||||
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
|
||||
#[xml(namespace = ns::VCARD, name = "TYPE")]
|
||||
pub struct Type {
|
||||
/// The type as a plain text string; at least "image/jpeg", "image/gif" and "image/png" SHOULD be supported.
|
||||
#[xml(text)]
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
generate_element!(
|
||||
/// The binary data of the photo.
|
||||
|
|
|
|||
Loading…
Reference in a new issue