Expand description
Parameters: *( OWS ";" OWS [ parameter ] ) (RFC 9110 section 5.6.6).
§Examples
use parse_net::{param, Limits};
let (p, used) = param::parse(b"; charset=utf-8;format=\"flowed\" , next", &Limits::DEFAULT)?;
assert_eq!(used, 31);
assert!(p.get("Charset").is_some_and(|v| v.eq_bytes(b"utf-8")));
assert_eq!(format!("{p:?}"), "Params([\"charset\", \"format\"])");Structs§
- Param
- One parameter: a name and a value.
- Param
Iter - The parameters of a validated
Params. - Params
- Validated parameters. Iterating them cannot fail.
Constants§
- MAX_
CHECKED_ PARAMS - The most parameters one element may have when repeated names are
refused: RFC 9110 parameters under
DuplicatePolicy::Refuse, authentication parameters, and MIME parameters. Their name offsets are kept on the stack, so a repeat is found by comparing names in place, never by reading the parameters again (D-072). Without it, the check for a repeat reads every earlier parameter, values included, and a field of many parameters costs the square of its length.
Functions§
- parse
- Parses parameters at the start of
s.