Cargo.toml 🔗
@@ -22,3 +22,4 @@ sha2 = "0.6.0"
sha3 = "0.6.0"
blake2 = "0.6.0"
chrono = "0.4.0"
+try_from = "0.2.2"
Emmanuel Gil Peyrot created
This makes xmpp-parsers usable on stable.
Cargo.toml | 1 +
src/attention.rs | 6 +++---
src/caps.rs | 4 ++--
src/chatstates.rs | 4 ++--
src/data_forms.rs | 4 ++--
src/delay.rs | 4 ++--
src/disco.rs | 6 +++---
src/ecaps2.rs | 4 ++--
src/eme.rs | 4 ++--
src/forwarding.rs | 4 ++--
src/hashes.rs | 4 ++--
src/ibb.rs | 4 ++--
src/ibr.rs | 4 ++--
src/idle.rs | 4 ++--
src/iq.rs | 10 +++++-----
src/jingle.rs | 8 ++++----
src/jingle_ft.rs | 4 ++--
src/jingle_ibb.rs | 4 ++--
src/jingle_message.rs | 4 ++--
src/jingle_s5b.rs | 4 ++--
src/lib.rs | 3 +--
src/mam.rs | 10 +++++-----
src/media_element.rs | 4 ++--
src/message.rs | 6 +++---
src/message_correct.rs | 4 ++--
src/muc/muc.rs | 4 ++--
src/muc/user.rs | 15 +++++++--------
src/ping.rs | 4 ++--
src/presence.rs | 6 +++---
src/pubsub/event.rs | 4 ++--
src/receipts.rs | 4 ++--
src/roster.rs | 6 +++---
src/rsm.rs | 4 ++--
src/stanza_error.rs | 4 ++--
src/stanza_id.rs | 4 ++--
35 files changed, 86 insertions(+), 87 deletions(-)
@@ -22,3 +22,4 @@ sha2 = "0.6.0"
sha3 = "0.6.0"
blake2 = "0.6.0"
chrono = "0.4.0"
+try_from = "0.2.2"
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -16,7 +16,7 @@ use ns;
pub struct Attention;
impl TryFrom<Element> for Attention {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Attention, Error> {
if !elem.is("attention", ns::ATTENTION) {
@@ -39,7 +39,7 @@ impl Into<Element> for Attention {
#[cfg(test)]
mod tests {
- use std::convert::TryFrom;
+ use try_from::TryFrom;
use minidom::Element;
use error::Error;
use super::Attention;
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use disco::{Feature, Identity, DiscoInfoResult, DiscoInfoQuery};
use data_forms::DataForm;
@@ -29,7 +29,7 @@ pub struct Caps {
}
impl TryFrom<Element> for Caps {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Caps, Error> {
if !elem.is("c", ns::CAPS) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -22,7 +22,7 @@ pub enum ChatState {
}
impl TryFrom<Element> for ChatState {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<ChatState, Error> {
if elem.ns() != Some(ns::CHATSTATES) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
@@ -103,7 +103,7 @@ pub struct DataForm {
}
impl TryFrom<Element> for DataForm {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<DataForm, Error> {
if !elem.is("x", ns::DATA_FORMS) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
use chrono::{DateTime, FixedOffset};
@@ -22,7 +22,7 @@ pub struct Delay {
}
impl TryFrom<Element> for Delay {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Delay, Error> {
if !elem.is("delay", ns::DELAY) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::{Element, IntoElements, ElementEmitter};
@@ -19,7 +19,7 @@ pub struct DiscoInfoQuery {
}
impl TryFrom<Element> for DiscoInfoQuery {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<DiscoInfoQuery, Error> {
if !elem.is("query", ns::DISCO_INFO) {
@@ -103,7 +103,7 @@ pub struct DiscoInfoResult {
}
impl TryFrom<Element> for DiscoInfoResult {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<DiscoInfoResult, Error> {
if !elem.is("query", ns::DISCO_INFO) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use disco::{Feature, Identity, DiscoInfoResult, DiscoInfoQuery};
use data_forms::DataForm;
@@ -26,7 +26,7 @@ pub struct ECaps2 {
}
impl TryFrom<Element> for ECaps2 {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<ECaps2, Error> {
if !elem.is("c", ns::ECAPS2) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -19,7 +19,7 @@ pub struct ExplicitMessageEncryption {
}
impl TryFrom<Element> for ExplicitMessageEncryption {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<ExplicitMessageEncryption, Error> {
if !elem.is("encryption", ns::EME) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -23,7 +23,7 @@ pub struct Forwarded {
}
impl TryFrom<Element> for Forwarded {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Forwarded, Error> {
if !elem.is("forwarded", ns::FORWARD) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoAttributeValue};
@@ -75,7 +75,7 @@ pub struct Hash {
}
impl TryFrom<Element> for Hash {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Hash, Error> {
if !elem.is("hash", ns::HASHES) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoAttributeValue};
@@ -37,7 +37,7 @@ pub enum IBB {
}
impl TryFrom<Element> for IBB {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<IBB, Error> {
if elem.is("open", ns::IBB) {
@@ -5,7 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::collections::HashMap;
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::{Element, IntoElements, ElementEmitter};
@@ -26,7 +26,7 @@ pub struct Query {
}
impl TryFrom<Element> for Query {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Query, Error> {
if !elem.is("query", ns::REGISTER) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
use chrono::{DateTime, FixedOffset};
@@ -19,7 +19,7 @@ pub struct Idle {
}
impl TryFrom<Element> for Idle {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Idle, Error> {
if !elem.is("idle", ns::IDLE) {
@@ -5,7 +5,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
use minidom::IntoAttributeValue;
@@ -61,7 +61,7 @@ pub enum IqResultPayload {
}
impl TryFrom<Element> for IqGetPayload {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<IqGetPayload, Error> {
Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) {
@@ -98,7 +98,7 @@ impl Into<Element> for IqGetPayload {
}
impl TryFrom<Element> for IqSetPayload {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<IqSetPayload, Error> {
Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) {
@@ -137,7 +137,7 @@ impl Into<Element> for IqSetPayload {
}
impl TryFrom<Element> for IqResultPayload {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<IqResultPayload, Error> {
Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) {
@@ -199,7 +199,7 @@ pub struct Iq {
}
impl TryFrom<Element> for Iq {
- type Error = Error;
+ type Err = Error;
fn try_from(root: Element) -> Result<Iq, Error> {
if !root.is("iq", ns::JABBER_CLIENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
@@ -57,7 +57,7 @@ pub struct Content {
}
impl TryFrom<Element> for Content {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Content, Error> {
if !elem.is("content", ns::JINGLE) {
@@ -196,7 +196,7 @@ pub struct ReasonElement {
}
impl TryFrom<Element> for ReasonElement {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<ReasonElement, Error> {
if !elem.is("reason", ns::JINGLE) {
@@ -261,7 +261,7 @@ pub struct Jingle {
}
impl TryFrom<Element> for Jingle {
- type Error = Error;
+ type Err = Error;
fn try_from(root: Element) -> Result<Jingle, Error> {
if !root.is("jingle", ns::JINGLE) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use hashes::Hash;
@@ -85,7 +85,7 @@ impl IntoElements for Received {
}
impl TryFrom<Element> for Description {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Description, Error> {
if !elem.is("description", ns::JINGLE_FT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoAttributeValue};
@@ -25,7 +25,7 @@ pub struct Transport {
}
impl TryFrom<Element> for Transport {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Transport, Error> {
if !elem.is("transport", ns::JINGLE_IBB) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -44,7 +44,7 @@ fn check_empty_and_get_sid(elem: Element) -> Result<SessionId, Error> {
}
impl TryFrom<Element> for JingleMI {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<JingleMI, Error> {
if elem.ns() != Some(ns::JINGLE_MESSAGE) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoAttributeValue};
@@ -73,7 +73,7 @@ pub struct Transport {
}
impl TryFrom<Element> for Transport {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Transport, Error> {
if elem.is("transport", ns::JINGLE_S5B) {
@@ -13,8 +13,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#![feature(try_from)]
-
extern crate minidom;
extern crate jid;
extern crate base64;
@@ -24,6 +22,7 @@ extern crate sha2;
extern crate sha3;
extern crate blake2;
extern crate chrono;
+extern crate try_from;
macro_rules! get_attr {
($elem:ident, $attr:tt, $type:tt) => (
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoAttributeValue};
@@ -53,7 +53,7 @@ pub struct Prefs {
}
impl TryFrom<Element> for Query {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Query, Error> {
if !elem.is("query", ns::MAM) {
@@ -77,7 +77,7 @@ impl TryFrom<Element> for Query {
}
impl TryFrom<Element> for Result_ {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Result_, Error> {
if !elem.is("result", ns::MAM) {
@@ -103,7 +103,7 @@ impl TryFrom<Element> for Result_ {
}
impl TryFrom<Element> for Fin {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Fin, Error> {
if !elem.is("fin", ns::MAM) {
@@ -129,7 +129,7 @@ impl TryFrom<Element> for Fin {
}
impl TryFrom<Element> for Prefs {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Prefs, Error> {
if !elem.is("prefs", ns::MAM) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::{Element, IntoElements, ElementEmitter};
@@ -42,7 +42,7 @@ pub struct MediaElement {
}
impl TryFrom<Element> for MediaElement {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<MediaElement, Error> {
if !elem.is("media", ns::MEDIA_ELEMENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use std::collections::BTreeMap;
@@ -43,7 +43,7 @@ pub enum MessagePayload {
}
impl TryFrom<Element> for MessagePayload {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<MessagePayload, Error> {
Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) {
@@ -143,7 +143,7 @@ impl Message {
}
impl TryFrom<Element> for Message {
- type Error = Error;
+ type Err = Error;
fn try_from(root: Element) -> Result<Message, Error> {
if !root.is("message", ns::JABBER_CLIENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -18,7 +18,7 @@ pub struct Replace {
}
impl TryFrom<Element> for Replace {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Replace, Error> {
if !elem.is("replace", ns::MESSAGE_CORRECT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -18,7 +18,7 @@ pub struct Muc {
}
impl TryFrom<Element> for Muc {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Muc, Error> {
if !elem.is("x", ns::MUC) {
@@ -4,8 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
-use std::convert::TryInto;
+use try_from::{TryFrom, TryInto};
use std::str::FromStr;
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
@@ -74,7 +73,7 @@ pub enum Status {
}
impl TryFrom<Element> for Status {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Status, Error> {
if !elem.is("status", ns::MUC_USER) {
@@ -160,7 +159,7 @@ pub enum Actor {
}
impl TryFrom<Element> for Actor {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Actor, Error> {
if !elem.is("actor", ns::MUC_USER) {
@@ -210,7 +209,7 @@ pub struct Continue {
}
impl TryFrom<Element> for Continue {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Continue, Error> {
if !elem.is("continue", ns::MUC_USER) {
@@ -247,7 +246,7 @@ impl IntoElements for Continue {
pub struct Reason(String);
impl TryFrom<Element> for Reason {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Reason, Error> {
if !elem.is("reason", ns::MUC_USER) {
@@ -305,7 +304,7 @@ pub struct Item {
}
impl TryFrom<Element> for Item {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Item, Error> {
if !elem.is("item", ns::MUC_USER) {
@@ -374,7 +373,7 @@ pub struct MucUser {
}
impl TryFrom<Element> for MucUser {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<MucUser, Error> {
if !elem.is("x", ns::MUC_USER) {
@@ -5,7 +5,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -17,7 +17,7 @@ use ns;
pub struct Ping;
impl TryFrom<Element> for Ping {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Ping, Error> {
if !elem.is("ping", ns::PING) {
@@ -5,7 +5,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use std::collections::BTreeMap;
@@ -91,7 +91,7 @@ pub enum PresencePayload {
}
impl TryFrom<Element> for PresencePayload {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<PresencePayload, Error> {
Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) {
@@ -214,7 +214,7 @@ impl Presence {
}
impl TryFrom<Element> for Presence {
- type Error = Error;
+ type Err = Error;
fn try_from(root: Element) -> Result<Presence, Error> {
if !root.is("presence", ns::JABBER_CLIENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
@@ -138,7 +138,7 @@ fn parse_items(elem: Element, node: String) -> Result<PubSubEvent, Error> {
}
impl TryFrom<Element> for PubSubEvent {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<PubSubEvent, Error> {
if !elem.is("event", ns::PUBSUB_EVENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -19,7 +19,7 @@ pub enum Receipt {
}
impl TryFrom<Element> for Receipt {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Receipt, Error> {
for _ in elem.children() {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
@@ -32,7 +32,7 @@ pub struct Item {
}
impl TryFrom<Element> for Item {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Item, Error> {
if !elem.is("item", ns::ROSTER) {
@@ -83,7 +83,7 @@ pub struct Roster {
}
impl TryFrom<Element> for Roster {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Roster, Error> {
if !elem.is("query", ns::ROSTER) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
@@ -25,7 +25,7 @@ pub struct Set {
}
impl TryFrom<Element> for Set {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<Set, Error> {
if !elem.is("set", ns::RSM) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use std::str::FromStr;
use std::collections::BTreeMap;
@@ -122,7 +122,7 @@ pub struct StanzaError {
}
impl TryFrom<Element> for StanzaError {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<StanzaError, Error> {
if !elem.is("error", ns::JABBER_CLIENT) {
@@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use std::convert::TryFrom;
+use try_from::TryFrom;
use minidom::Element;
use jid::Jid;
@@ -25,7 +25,7 @@ pub enum StanzaId {
}
impl TryFrom<Element> for StanzaId {
- type Error = Error;
+ type Err = Error;
fn try_from(elem: Element) -> Result<StanzaId, Error> {
let is_stanza_id = elem.is("stanza-id", ns::SID);