pub struct PasswordAlgorithm(/* private fields */);
Expand description
The PASSWORD-ALGORITHM attribute is present only in requests. It contains the algorithm that the server must use to derive a key from the long-term password.
§Examples
// Creates a MD5 password algorithm without parameters
let attr = PasswordAlgorithm::new(Algorithm::from(AlgorithmId::MD5));
assert_eq!(attr.algorithm(), AlgorithmId::MD5);
assert_eq!(attr.parameters(), None);
// Creates a custom password algorithm with parameters
let params = [0x01, 0x02, 0x03, 0x04, 0x05];
let algorithm = Algorithm::new(AlgorithmId::Unassigned(255), params.as_ref());
let attr = PasswordAlgorithm::new(algorithm);
assert_eq!(attr.algorithm(), AlgorithmId::Unassigned(255));
assert_eq!(attr.parameters(), Some(params.as_ref()));
Implementations§
source§impl PasswordAlgorithm
impl PasswordAlgorithm
sourcepub fn new(algorithm: Algorithm) -> Self
pub fn new(algorithm: Algorithm) -> Self
Creates a new PasswordAlgorithm
attribute.
§Attributes:
algorithm
- The Algorithm.value
- Specific parameters for the algorithm, if any.
sourcepub fn algorithm(&self) -> AlgorithmId
pub fn algorithm(&self) -> AlgorithmId
Returns the algorithm
sourcepub fn parameters(&self) -> Option<&[u8]>
pub fn parameters(&self) -> Option<&[u8]>
Returns the parameters required by the algorithm.
Trait Implementations§
source§impl AsRef<Algorithm> for PasswordAlgorithm
impl AsRef<Algorithm> for PasswordAlgorithm
source§impl Clone for PasswordAlgorithm
impl Clone for PasswordAlgorithm
source§fn clone(&self) -> PasswordAlgorithm
fn clone(&self) -> PasswordAlgorithm
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PasswordAlgorithm
impl Debug for PasswordAlgorithm
source§impl From<PasswordAlgorithm> for StunAttribute
impl From<PasswordAlgorithm> for StunAttribute
source§fn from(value: PasswordAlgorithm) -> Self
fn from(value: PasswordAlgorithm) -> Self
Converts to this type from the input type.
source§impl PartialEq for PasswordAlgorithm
impl PartialEq for PasswordAlgorithm
source§impl StunAttributeType for PasswordAlgorithm
impl StunAttributeType for PasswordAlgorithm
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 PasswordAlgorithm
impl StructuralPartialEq for PasswordAlgorithm
Auto Trait Implementations§
impl Freeze for PasswordAlgorithm
impl RefUnwindSafe for PasswordAlgorithm
impl !Send for PasswordAlgorithm
impl !Sync for PasswordAlgorithm
impl Unpin for PasswordAlgorithm
impl UnwindSafe for PasswordAlgorithm
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
)