From d7a74b2f28b6812ec8ae1889151fbda105c607d7 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 10 Jun 2019 22:55:15 +0200 Subject: [PATCH] Specify what is a bare and a full JID, and when to use something else. --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8ef7a3d..ad9ac02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,6 +77,9 @@ impl From for String { /// - A node/name, `node`, which is the optional part before the @. /// - A domain, `domain`, which is the mandatory part after the @ but before the /. /// - A resource, `resource`, which is the part after the /. +/// +/// Unlike a `BareJid`, it always contains a resource, and should only be used when you are certain +/// there is no case where a resource can be missing. Otherwise, use a `Jid` enum. #[derive(Clone, PartialEq, Eq, Hash)] pub struct FullJid { /// The node part of the Jabber ID, if it exists, else None. @@ -92,7 +95,10 @@ pub struct FullJid { /// 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 @ but 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. #[derive(Clone, PartialEq, Eq, Hash)] pub struct BareJid { /// The node part of the Jabber ID, if it exists, else None.