From 4ccf92081c4284c268f1a3b9d001e6d7c1d50865 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 8 Aug 2018 19:44:55 +0200 Subject: [PATCH] bind: Document this module. --- src/bind.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bind.rs b/src/bind.rs index 7329ed61..1922093b 100644 --- a/src/bind.rs +++ b/src/bind.rs @@ -4,8 +4,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/. -#![allow(missing_docs)] - use std::str::FromStr; use try_from::TryFrom; @@ -16,14 +14,25 @@ use jid::Jid; use ns; use iq::{IqSetPayload, IqResultPayload}; +/// The request for resource binding, which is the process by which a client +/// can obtain a full JID and start exchanging on the XMPP network. +/// +/// See https://xmpp.org/rfcs/rfc6120.html#bind #[derive(Debug, Clone, PartialEq)] pub enum Bind { + /// Requests no particular resource, a random one will be affected by the + /// server. None, + + /// Requests this resource, the server may associate another one though. Resource(String), + + /// The full JID returned by the server for this client. Jid(Jid), } impl Bind { + /// Creates a resource binding request. pub fn new(resource: Option) -> Bind { match resource { None => Bind::None,