bind: Document this module.
This commit is contained in:
parent
687d744454
commit
4ccf92081c
1 changed files with 11 additions and 2 deletions
13
src/bind.rs
13
src/bind.rs
|
@ -4,8 +4,6 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// 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/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
#![allow(missing_docs)]
|
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use try_from::TryFrom;
|
use try_from::TryFrom;
|
||||||
|
|
||||||
|
@ -16,14 +14,25 @@ use jid::Jid;
|
||||||
use ns;
|
use ns;
|
||||||
use iq::{IqSetPayload, IqResultPayload};
|
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)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Bind {
|
pub enum Bind {
|
||||||
|
/// Requests no particular resource, a random one will be affected by the
|
||||||
|
/// server.
|
||||||
None,
|
None,
|
||||||
|
|
||||||
|
/// Requests this resource, the server may associate another one though.
|
||||||
Resource(String),
|
Resource(String),
|
||||||
|
|
||||||
|
/// The full JID returned by the server for this client.
|
||||||
Jid(Jid),
|
Jid(Jid),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bind {
|
impl Bind {
|
||||||
|
/// Creates a resource binding request.
|
||||||
pub fn new(resource: Option<String>) -> Bind {
|
pub fn new(resource: Option<String>) -> Bind {
|
||||||
match resource {
|
match resource {
|
||||||
None => Bind::None,
|
None => Bind::None,
|
||||||
|
|
Loading…
Reference in a new issue