diff --git a/Cargo.toml b/Cargo.toml index 608f2ff5..b7053811 100644 --- a/Cargo.toml +++ b/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" diff --git a/src/attention.rs b/src/attention.rs index b28b5cc3..c53040c4 100644 --- a/src/attention.rs +++ b/src/attention.rs @@ -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 for Attention { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("attention", ns::ATTENTION) { @@ -39,7 +39,7 @@ impl Into for Attention { #[cfg(test)] mod tests { - use std::convert::TryFrom; + use try_from::TryFrom; use minidom::Element; use error::Error; use super::Attention; diff --git a/src/caps.rs b/src/caps.rs index e883a64a..aad50eb2 100644 --- a/src/caps.rs +++ b/src/caps.rs @@ -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 for Caps { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("c", ns::CAPS) { diff --git a/src/chatstates.rs b/src/chatstates.rs index 47df01e0..ff1baa95 100644 --- a/src/chatstates.rs +++ b/src/chatstates.rs @@ -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 for ChatState { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if elem.ns() != Some(ns::CHATSTATES) { diff --git a/src/data_forms.rs b/src/data_forms.rs index 7e187ec1..d4678c09 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -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 for DataForm { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("x", ns::DATA_FORMS) { diff --git a/src/delay.rs b/src/delay.rs index d744751d..7b56ab7e 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -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 for Delay { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("delay", ns::DELAY) { diff --git a/src/disco.rs b/src/disco.rs index a36f997e..43727d51 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -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 for DiscoInfoQuery { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("query", ns::DISCO_INFO) { @@ -103,7 +103,7 @@ pub struct DiscoInfoResult { } impl TryFrom for DiscoInfoResult { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("query", ns::DISCO_INFO) { diff --git a/src/ecaps2.rs b/src/ecaps2.rs index da74533d..0e92796d 100644 --- a/src/ecaps2.rs +++ b/src/ecaps2.rs @@ -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 for ECaps2 { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("c", ns::ECAPS2) { diff --git a/src/eme.rs b/src/eme.rs index fe973861..ee71e21c 100644 --- a/src/eme.rs +++ b/src/eme.rs @@ -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 for ExplicitMessageEncryption { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("encryption", ns::EME) { diff --git a/src/forwarding.rs b/src/forwarding.rs index 9ad416b8..d10860ff 100644 --- a/src/forwarding.rs +++ b/src/forwarding.rs @@ -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 for Forwarded { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("forwarded", ns::FORWARD) { diff --git a/src/hashes.rs b/src/hashes.rs index 07f2822c..6520fede 100644 --- a/src/hashes.rs +++ b/src/hashes.rs @@ -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 for Hash { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("hash", ns::HASHES) { diff --git a/src/ibb.rs b/src/ibb.rs index ad987377..969f3419 100644 --- a/src/ibb.rs +++ b/src/ibb.rs @@ -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 for IBB { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if elem.is("open", ns::IBB) { diff --git a/src/ibr.rs b/src/ibr.rs index 183d3716..a0c7cc72 100644 --- a/src/ibr.rs +++ b/src/ibr.rs @@ -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 for Query { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("query", ns::REGISTER) { diff --git a/src/idle.rs b/src/idle.rs index 82009668..3809ff8b 100644 --- a/src/idle.rs +++ b/src/idle.rs @@ -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 for Idle { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("idle", ns::IDLE) { diff --git a/src/iq.rs b/src/iq.rs index 976d79f8..10161021 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -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 for IqGetPayload { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { @@ -98,7 +98,7 @@ impl Into for IqGetPayload { } impl TryFrom for IqSetPayload { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { @@ -137,7 +137,7 @@ impl Into for IqSetPayload { } impl TryFrom for IqResultPayload { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { @@ -199,7 +199,7 @@ pub struct Iq { } impl TryFrom for Iq { - type Error = Error; + type Err = Error; fn try_from(root: Element) -> Result { if !root.is("iq", ns::JABBER_CLIENT) { diff --git a/src/jingle.rs b/src/jingle.rs index ece7fa02..c9470326 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -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 for Content { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("content", ns::JINGLE) { @@ -196,7 +196,7 @@ pub struct ReasonElement { } impl TryFrom for ReasonElement { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("reason", ns::JINGLE) { @@ -261,7 +261,7 @@ pub struct Jingle { } impl TryFrom for Jingle { - type Error = Error; + type Err = Error; fn try_from(root: Element) -> Result { if !root.is("jingle", ns::JINGLE) { diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs index a70b012b..5e070cd5 100644 --- a/src/jingle_ft.rs +++ b/src/jingle_ft.rs @@ -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 for Description { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("description", ns::JINGLE_FT) { diff --git a/src/jingle_ibb.rs b/src/jingle_ibb.rs index 72ebba55..08a31329 100644 --- a/src/jingle_ibb.rs +++ b/src/jingle_ibb.rs @@ -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 for Transport { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("transport", ns::JINGLE_IBB) { diff --git a/src/jingle_message.rs b/src/jingle_message.rs index d6113342..216e1877 100644 --- a/src/jingle_message.rs +++ b/src/jingle_message.rs @@ -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 { } impl TryFrom for JingleMI { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if elem.ns() != Some(ns::JINGLE_MESSAGE) { diff --git a/src/jingle_s5b.rs b/src/jingle_s5b.rs index 57807be3..603dbb24 100644 --- a/src/jingle_s5b.rs +++ b/src/jingle_s5b.rs @@ -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 for Transport { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if elem.is("transport", ns::JINGLE_S5B) { diff --git a/src/lib.rs b/src/lib.rs index f82e6df3..35dacabd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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) => ( diff --git a/src/mam.rs b/src/mam.rs index 920cf8d0..62b035e1 100644 --- a/src/mam.rs +++ b/src/mam.rs @@ -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 for Query { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("query", ns::MAM) { @@ -77,7 +77,7 @@ impl TryFrom for Query { } impl TryFrom for Result_ { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("result", ns::MAM) { @@ -103,7 +103,7 @@ impl TryFrom for Result_ { } impl TryFrom for Fin { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("fin", ns::MAM) { @@ -129,7 +129,7 @@ impl TryFrom for Fin { } impl TryFrom for Prefs { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("prefs", ns::MAM) { diff --git a/src/media_element.rs b/src/media_element.rs index b1c36a64..aa15efb5 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -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 for MediaElement { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("media", ns::MEDIA_ELEMENT) { diff --git a/src/message.rs b/src/message.rs index 47c8db16..3c7fefc8 100644 --- a/src/message.rs +++ b/src/message.rs @@ -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 for MessagePayload { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { @@ -143,7 +143,7 @@ impl Message { } impl TryFrom for Message { - type Error = Error; + type Err = Error; fn try_from(root: Element) -> Result { if !root.is("message", ns::JABBER_CLIENT) { diff --git a/src/message_correct.rs b/src/message_correct.rs index 8ce747f1..5376f860 100644 --- a/src/message_correct.rs +++ b/src/message_correct.rs @@ -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 for Replace { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("replace", ns::MESSAGE_CORRECT) { diff --git a/src/muc/muc.rs b/src/muc/muc.rs index 75667d87..e7e6a238 100644 --- a/src/muc/muc.rs +++ b/src/muc/muc.rs @@ -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 for Muc { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("x", ns::MUC) { diff --git a/src/muc/user.rs b/src/muc/user.rs index 833b5604..1609b0c8 100644 --- a/src/muc/user.rs +++ b/src/muc/user.rs @@ -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 for Status { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("status", ns::MUC_USER) { @@ -160,7 +159,7 @@ pub enum Actor { } impl TryFrom for Actor { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("actor", ns::MUC_USER) { @@ -210,7 +209,7 @@ pub struct Continue { } impl TryFrom for Continue { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("continue", ns::MUC_USER) { @@ -247,7 +246,7 @@ impl IntoElements for Continue { pub struct Reason(String); impl TryFrom for Reason { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("reason", ns::MUC_USER) { @@ -305,7 +304,7 @@ pub struct Item { } impl TryFrom for Item { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("item", ns::MUC_USER) { @@ -374,7 +373,7 @@ pub struct MucUser { } impl TryFrom for MucUser { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("x", ns::MUC_USER) { diff --git a/src/ping.rs b/src/ping.rs index 84a7cebf..27204451 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -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 for Ping { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("ping", ns::PING) { diff --git a/src/presence.rs b/src/presence.rs index 74458797..1eb0b23f 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -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 for PresencePayload { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { @@ -214,7 +214,7 @@ impl Presence { } impl TryFrom for Presence { - type Error = Error; + type Err = Error; fn try_from(root: Element) -> Result { if !root.is("presence", ns::JABBER_CLIENT) { diff --git a/src/pubsub/event.rs b/src/pubsub/event.rs index 07e465c8..ef5e994b 100644 --- a/src/pubsub/event.rs +++ b/src/pubsub/event.rs @@ -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 { } impl TryFrom for PubSubEvent { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("event", ns::PUBSUB_EVENT) { diff --git a/src/receipts.rs b/src/receipts.rs index 72b357a1..ae564f74 100644 --- a/src/receipts.rs +++ b/src/receipts.rs @@ -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 for Receipt { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { for _ in elem.children() { diff --git a/src/roster.rs b/src/roster.rs index db939ad8..4e6a38c6 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -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 for Item { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("item", ns::ROSTER) { @@ -83,7 +83,7 @@ pub struct Roster { } impl TryFrom for Roster { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("query", ns::ROSTER) { diff --git a/src/rsm.rs b/src/rsm.rs index e8d7109d..cfb6f292 100644 --- a/src/rsm.rs +++ b/src/rsm.rs @@ -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 for Set { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("set", ns::RSM) { diff --git a/src/stanza_error.rs b/src/stanza_error.rs index badd1efa..c25c5792 100644 --- a/src/stanza_error.rs +++ b/src/stanza_error.rs @@ -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 for StanzaError { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { if !elem.is("error", ns::JABBER_CLIENT) { diff --git a/src/stanza_id.rs b/src/stanza_id.rs index 38008d0c..634def50 100644 --- a/src/stanza_id.rs +++ b/src/stanza_id.rs @@ -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 for StanzaId { - type Error = Error; + type Err = Error; fn try_from(elem: Element) -> Result { let is_stanza_id = elem.is("stanza-id", ns::SID);