bind: Easily convert BindResponse into FullJid or Jid.
This commit is contained in:
parent
a1ae45add8
commit
6f1fc7b009
1 changed files with 13 additions and 1 deletions
14
src/bind.rs
14
src/bind.rs
|
@ -7,7 +7,7 @@
|
|||
use crate::util::error::Error;
|
||||
use crate::iq::{IqResultPayload, IqSetPayload};
|
||||
use crate::ns;
|
||||
use jid::FullJid;
|
||||
use jid::{FullJid, Jid};
|
||||
use minidom::Element;
|
||||
use std::str::FromStr;
|
||||
use std::convert::TryFrom;
|
||||
|
@ -85,6 +85,18 @@ pub struct BindResponse {
|
|||
|
||||
impl IqResultPayload for BindResponse {}
|
||||
|
||||
impl From<BindResponse> for FullJid {
|
||||
fn from(bind: BindResponse) -> FullJid {
|
||||
bind.jid
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BindResponse> for Jid {
|
||||
fn from(bind: BindResponse) -> Jid {
|
||||
Jid::Full(bind.jid)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<Element> for BindResponse {
|
||||
type Error = Error;
|
||||
|
||||
|
|
Loading…
Reference in a new issue