mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Fix cargo doc warnings in jid crate
This commit is contained in:
parent
ba48f6de46
commit
119c04801c
1 changed files with 12 additions and 6 deletions
|
@ -14,12 +14,14 @@ fn length_check(len: usize, error_empty: Error, error_too_long: Error) -> Result
|
|||
}
|
||||
}
|
||||
|
||||
/// The [`NodePart`] is the optional part before the (optional) `@` in any [`Jid`], whether [`BareJid`] or [`FullJid`].
|
||||
/// The [`NodePart`] is the optional part before the (optional) `@` in any [`Jid`][crate::Jid],
|
||||
/// whether [`BareJid`][crate::BareJid] or [`FullJid`][crate::FullJid].
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct NodePart(pub(crate) String);
|
||||
|
||||
impl NodePart {
|
||||
/// Build a new [`NodePart`] from a string slice. Will fail in case of stringprep validation error.
|
||||
/// Build a new [`NodePart`] from a string slice. Will fail in case of stringprep validation
|
||||
/// error.
|
||||
pub fn new(s: &str) -> Result<NodePart, Error> {
|
||||
let node = nodeprep(s).map_err(|_| Error::NodePrep)?;
|
||||
length_check(node.len(), Error::NodeEmpty, Error::NodeTooLong)?;
|
||||
|
@ -37,12 +39,14 @@ impl fmt::Display for NodePart {
|
|||
}
|
||||
}
|
||||
|
||||
/// The [`DomainPart`] is the part between the (optional) `@` and the (optional) `/` in any [`Jid`], whether [`BareJid`] or [`FullJid`].
|
||||
/// The [`DomainPart`] is the part between the (optional) `@` and the (optional) `/` in any
|
||||
/// [`Jid`][crate::Jid], whether [`BareJid`][crate::BareJid] or [`FullJid`][crate::FullJid].
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct DomainPart(pub(crate) String);
|
||||
|
||||
impl DomainPart {
|
||||
/// Build a new [`DomainPart`] from a string slice. Will fail in case of stringprep validation error.
|
||||
/// Build a new [`DomainPart`] from a string slice. Will fail in case of stringprep validation
|
||||
/// error.
|
||||
pub fn new(s: &str) -> Result<DomainPart, Error> {
|
||||
let domain = nameprep(s).map_err(|_| Error::NamePrep)?;
|
||||
length_check(domain.len(), Error::DomainEmpty, Error::DomainTooLong)?;
|
||||
|
@ -60,12 +64,14 @@ impl fmt::Display for DomainPart {
|
|||
}
|
||||
}
|
||||
|
||||
/// The [`ResourcePart`] is the optional part after the `/` in a [`Jid`]. It is mandatory in [`FullJid`].
|
||||
/// The [`ResourcePart`] is the optional part after the `/` in a [`Jid`][crate::Jid]. It is
|
||||
/// mandatory in [`FullJid`][crate::FullJid].
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct ResourcePart(pub(crate) String);
|
||||
|
||||
impl ResourcePart {
|
||||
/// Build a new [`ResourcePart`] from a string slice. Will fail in case of stringprep validation error.
|
||||
/// Build a new [`ResourcePart`] from a string slice. Will fail in case of stringprep
|
||||
/// validation error.
|
||||
pub fn new(s: &str) -> Result<ResourcePart, Error> {
|
||||
let resource = resourceprep(s).map_err(|_| Error::ResourcePrep)?;
|
||||
length_check(resource.len(), Error::ResourceEmpty, Error::ResourceTooLong)?;
|
||||
|
|
Loading…
Reference in a new issue