From 82eda09ca5a54e37b072449901ba95e96c78fb61 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 26 Feb 2019 19:25:43 +0100 Subject: [PATCH] =?UTF-8?q?iq:=20Allow=20any=20Into=20for=20the=20?= =?UTF-8?q?constructors=E2=80=99=20id.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iq.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/iq.rs b/src/iq.rs index e62a4cd8..bca785e9 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -71,41 +71,41 @@ pub struct Iq { impl Iq { /// Creates an `` stanza containing a get request. - pub fn from_get(id: String, payload: impl IqGetPayload) -> Iq { + pub fn from_get>(id: S, payload: impl IqGetPayload) -> Iq { Iq { from: None, to: None, - id, + id: id.into(), payload: IqType::Get(payload.into()), } } /// Creates an `` stanza containing a set request. - pub fn from_set(id: String, payload: impl IqSetPayload) -> Iq { + pub fn from_set>(id: S, payload: impl IqSetPayload) -> Iq { Iq { from: None, to: None, - id, + id: id.into(), payload: IqType::Set(payload.into()), } } /// Creates an `` stanza containing a result. - pub fn from_result(id: String, payload: Option) -> Iq { + pub fn from_result>(id: S, payload: Option) -> Iq { Iq { from: None, to: None, - id, + id: id.into(), payload: IqType::Result(payload.map(Into::into)), } } /// Creates an `` stanza containing an error. - pub fn from_error(id: String, payload: StanzaError) -> Iq { + pub fn from_error>(id: S, payload: StanzaError) -> Iq { Iq { from: None, to: None, - id, + id: id.into(), payload: IqType::Error(payload), } }