[−][src]Struct xmpp_parsers::BareJid
A struct representing a bare Jabber ID.
A bare Jabber ID is composed of 2 components, of which one is optional:
- A node/name,
node
, which is the optional part before the @. - A domain,
domain
, which is the mandatory part after the @.
Unlike a FullJid
, it can’t contain a resource, and should only be used when you are certain
there is no case where a resource can be set. Otherwise, use a Jid
enum.
Fields
node: Option<String>
The node part of the Jabber ID, if it exists, else None.
domain: String
The domain of the Jabber ID.
Methods
impl BareJid
[src]
pub fn new<NS, DS>(node: NS, domain: DS) -> BareJid where
DS: Into<String>,
NS: Into<String>,
[src]
DS: Into<String>,
NS: Into<String>,
Constructs a bare Jabber ID, containing two components.
This is of the form node
@domain
.
Examples
use jid::BareJid; let jid = BareJid::new("node", "domain"); assert_eq!(jid.node, Some("node".to_owned())); assert_eq!(jid.domain, "domain".to_owned());
pub fn domain<DS>(domain: DS) -> BareJid where
DS: Into<String>,
[src]
DS: Into<String>,
Constructs a bare Jabber ID containing only a domain
.
This is of the form domain
.
Examples
use jid::BareJid; let jid = BareJid::domain("domain"); assert_eq!(jid.node, None); assert_eq!(jid.domain, "domain".to_owned());
pub fn with_node<NS>(&self, node: NS) -> BareJid where
NS: Into<String>,
[src]
NS: Into<String>,
Constructs a new Jabber ID from an existing one, with the node swapped out with a new one.
Examples
use jid::BareJid; let jid = BareJid::domain("domain"); assert_eq!(jid.node, None); let new_jid = jid.with_node("node"); assert_eq!(new_jid.node, Some("node".to_owned()));
pub fn with_domain<DS>(&self, domain: DS) -> BareJid where
DS: Into<String>,
[src]
DS: Into<String>,
Constructs a new Jabber ID from an existing one, with the domain swapped out with a new one.
Examples
use jid::BareJid; let jid = BareJid::domain("domain"); assert_eq!(jid.domain, "domain"); let new_jid = jid.with_domain("new_domain"); assert_eq!(new_jid.domain, "new_domain");
pub fn with_resource<RS>(self, resource: RS) -> FullJid where
RS: Into<String>,
[src]
RS: Into<String>,
Constructs a full Jabber ID from a bare Jabber ID, specifying a resource
.
Examples
use jid::BareJid; let bare = BareJid::new("node", "domain"); let full = bare.with_resource("resource"); assert_eq!(full.node, Some("node".to_owned())); assert_eq!(full.domain, "domain".to_owned()); assert_eq!(full.resource, "resource".to_owned());
Trait Implementations
impl IntoAttributeValue for BareJid
[src]
fn into_attribute_value(self) -> Option<String>
[src]
impl Clone for BareJid
[src]
impl Debug for BareJid
[src]
impl Into<Node> for BareJid
[src]
impl Into<BareJid> for FullJid
[src]
impl Display for BareJid
[src]
impl Eq for BareJid
[src]
impl Hash for BareJid
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl FromStr for BareJid
[src]
type Err = JidParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<BareJid, JidParseError>
[src]
impl From<BareJid> for Jid
[src]
impl PartialEq<BareJid> for BareJid
[src]
Auto Trait Implementations
impl Send for BareJid
impl Unpin for BareJid
impl Sync for BareJid
impl UnwindSafe for BareJid
impl RefUnwindSafe for BareJid
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self