pub struct Nonce(/* private fields */);
Expand description
The NONCE attribute may be present in requests and responses. It
contains a sequence of qdtext
or quoted-pair
, which are defined in
RFC3261
.
Note that this means that the NONCE attribute will not
contain the actual surrounding quote characters.
§Examples
// Create a nonce attribute using an input string that is
// sequence of `qdtext` or `quoted-pair`
let attr = Nonce::try_from("f//499k954d6OL34oL9FSTvy64sA")?;
assert_eq!(attr, "f//499k954d6OL34oL9FSTvy64sA");
// Next input string is not a valid sequence of `qdtext` or `quoted-pair`
let result = Nonce::try_from("\u{fd}\u{80}");
assert_eq!(result.expect_err("Error expected"), StunErrorType::InvalidParam);
Implementations§
source§impl Nonce
impl Nonce
Creates a Nonce
attribute if the value provided
is a valid sequence of qdtext
or quoted-pair
Returns true if this is a nonce cookie
sourcepub fn security_features(
&self,
) -> Result<BitFlags<StunSecurityFeatures>, StunError>
pub fn security_features( &self, ) -> Result<BitFlags<StunSecurityFeatures>, StunError>
Returns the security flags set in the Nonce Cookie.
Trait Implementations§
source§impl From<Nonce> for StunAttribute
impl From<Nonce> for StunAttribute
source§impl Ord for Nonce
impl Ord for Nonce
source§impl PartialOrd for Nonce
impl PartialOrd for Nonce
source§impl StunAttributeType for Nonce
impl StunAttributeType for Nonce
source§fn get_type() -> AttributeTypewhere
Self: Sized,
fn get_type() -> AttributeTypewhere
Self: Sized,
Returns the STUN attribute type.
source§fn attribute_type(&self) -> AttributeType
fn attribute_type(&self) -> AttributeType
Returns the STUN attribute type of this instance.
impl Eq for Nonce
impl StructuralPartialEq for Nonce
Auto Trait Implementations§
impl Freeze for Nonce
impl RefUnwindSafe for Nonce
impl Send for Nonce
impl Sync for Nonce
impl Unpin for Nonce
impl UnwindSafe for Nonce
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)