mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
data_forms, ibr, message, presence, roster: Always use into_iter.
This commit is contained in:
parent
f6f6faeb77
commit
5df585ca40
5 changed files with 7 additions and 7 deletions
|
@ -72,7 +72,7 @@ impl From<Field> for Element {
|
||||||
.attr("label", field.label)
|
.attr("label", field.label)
|
||||||
.append(if field.required { Some(Element::builder("required").ns(ns::DATA_FORMS).build()) } else { None })
|
.append(if field.required { Some(Element::builder("required").ns(ns::DATA_FORMS).build()) } else { None })
|
||||||
.append(field.options)
|
.append(field.options)
|
||||||
.append(field.values.iter().map(|value| {
|
.append(field.values.into_iter().map(|value| {
|
||||||
Element::builder("value").ns(ns::DATA_FORMS).append(value).build()
|
Element::builder("value").ns(ns::DATA_FORMS).append(value).build()
|
||||||
}).collect::<Vec<_>>())
|
}).collect::<Vec<_>>())
|
||||||
.append(field.media)
|
.append(field.media)
|
||||||
|
|
|
@ -69,8 +69,8 @@ impl From<Query> for Element {
|
||||||
Element::builder("query")
|
Element::builder("query")
|
||||||
.ns(ns::REGISTER)
|
.ns(ns::REGISTER)
|
||||||
.append(if query.registered { Some(Element::builder("registered").ns(ns::REGISTER)) } else { None })
|
.append(if query.registered { Some(Element::builder("registered").ns(ns::REGISTER)) } else { None })
|
||||||
.append(query.fields.iter().map(|(name, value)| {
|
.append(query.fields.into_iter().map(|(name, value)| {
|
||||||
Element::builder(name.clone()).ns(ns::REGISTER).append(value.clone())
|
Element::builder(name).ns(ns::REGISTER).append(value)
|
||||||
}).collect::<Vec<_>>())
|
}).collect::<Vec<_>>())
|
||||||
.append(if query.remove { Some(Element::builder("remove").ns(ns::REGISTER)) } else { None })
|
.append(if query.remove { Some(Element::builder("remove").ns(ns::REGISTER)) } else { None })
|
||||||
.append(query.form)
|
.append(query.form)
|
||||||
|
|
|
@ -207,7 +207,7 @@ impl From<Message> for Element {
|
||||||
.attr("to", message.to.and_then(|value| Some(String::from(value))))
|
.attr("to", message.to.and_then(|value| Some(String::from(value))))
|
||||||
.attr("id", message.id)
|
.attr("id", message.id)
|
||||||
.attr("type", message.type_)
|
.attr("type", message.type_)
|
||||||
.append(message.subjects.iter()
|
.append(message.subjects.into_iter()
|
||||||
.map(|(lang, subject)| {
|
.map(|(lang, subject)| {
|
||||||
Element::builder("subject")
|
Element::builder("subject")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
|
@ -218,7 +218,7 @@ impl From<Message> for Element {
|
||||||
.append(subject)
|
.append(subject)
|
||||||
.build() })
|
.build() })
|
||||||
.collect::<Vec<_>>())
|
.collect::<Vec<_>>())
|
||||||
.append(message.bodies.iter()
|
.append(message.bodies.into_iter()
|
||||||
.map(|(lang, body)| {
|
.map(|(lang, body)| {
|
||||||
Element::builder("body")
|
Element::builder("body")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
|
|
|
@ -321,7 +321,7 @@ impl From<Presence> for Element {
|
||||||
.attr("id", presence.id)
|
.attr("id", presence.id)
|
||||||
.attr("type", presence.type_)
|
.attr("type", presence.type_)
|
||||||
.append(presence.show)
|
.append(presence.show)
|
||||||
.append(presence.statuses.iter().map(|(lang, status)| {
|
.append(presence.statuses.into_iter().map(|(lang, status)| {
|
||||||
Element::builder("status")
|
Element::builder("status")
|
||||||
.attr("xml:lang", match lang.as_ref() {
|
.attr("xml:lang", match lang.as_ref() {
|
||||||
"" => None,
|
"" => None,
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl From<Item> for Element {
|
||||||
.attr("jid", String::from(item.jid))
|
.attr("jid", String::from(item.jid))
|
||||||
.attr("name", item.name)
|
.attr("name", item.name)
|
||||||
.attr("subscription", item.subscription)
|
.attr("subscription", item.subscription)
|
||||||
.append(item.groups.iter().map(|group| Element::builder("group").ns(ns::ROSTER).append(group)).collect::<Vec<_>>())
|
.append(item.groups.into_iter().map(|group| Element::builder("group").ns(ns::ROSTER).append(group)).collect::<Vec<_>>())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue