pub struct AuthParams<'a> { /* private fields */ }Expand description
Comma-separated auth-params, validated.
Debug prints the parameter names only: values can be secrets.
§Examples
use parse_net::{auth, AuthPayload, Limits};
let c = auth::parse_credentials(b"Digest username=\"a\", realm=\"r\"", &Limits::DEFAULT)?;
let AuthPayload::Params(p) = c.payload() else { unreachable!() };
assert_eq!(p.len(), 2);
assert!(p.get("realm").is_some_and(|v| v.eq_bytes(b"r")));Implementations§
Source§impl<'a> AuthParams<'a>
impl<'a> AuthParams<'a>
Sourcepub fn iter(&self) -> impl Iterator<Item = (&'a [u8], Word<'a>)> + use<'a>
pub fn iter(&self) -> impl Iterator<Item = (&'a [u8], Word<'a>)> + use<'a>
The parameters, in order.
§Examples
use parse_net::{auth, AuthPayload, Limits};
let c = auth::parse_credentials(b"Digest username=\"a\", nc=1", &Limits::DEFAULT)?;
let AuthPayload::Params(p) = c.payload() else { unreachable!() };
let names: Vec<&[u8]> = p.iter().map(|(n, _)| n).collect();
assert_eq!(names, [&b"username"[..], b"nc"]);Sourcepub fn get(&self, name: &str) -> Option<Word<'a>>
pub fn get(&self, name: &str) -> Option<Word<'a>>
The value of the parameter name (ASCII case-insensitive).
§Examples
use parse_net::{auth, AuthPayload, Limits};
let c = auth::parse_credentials(b"Digest Realm=\"api\"", &Limits::DEFAULT)?;
let AuthPayload::Params(p) = c.payload() else { unreachable!() };
assert!(p.get("realm").is_some_and(|v| v.eq_bytes(b"api")));
assert!(p.get("nonce").is_none());Trait Implementations§
Source§impl<'a> Clone for AuthParams<'a>
impl<'a> Clone for AuthParams<'a>
impl<'a> Copy for AuthParams<'a>
Source§impl Debug for AuthParams<'_>
impl Debug for AuthParams<'_>
impl<'a> Eq for AuthParams<'a>
Source§impl<'a> Hash for AuthParams<'a>
impl<'a> Hash for AuthParams<'a>
Source§impl<'a> PartialEq for AuthParams<'a>
impl<'a> PartialEq for AuthParams<'a>
impl<'a> StructuralPartialEq for AuthParams<'a>
Auto Trait Implementations§
impl<'a> Freeze for AuthParams<'a>
impl<'a> RefUnwindSafe for AuthParams<'a>
impl<'a> Send for AuthParams<'a>
impl<'a> Sync for AuthParams<'a>
impl<'a> Unpin for AuthParams<'a>
impl<'a> UnsafeUnpin for AuthParams<'a>
impl<'a> UnwindSafe for AuthParams<'a>
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