Skip to main content

parse

Function parse 

Source
pub fn parse<'a>(
    value: &'a [u8],
    limits: &Limits,
) -> Result<Directives<'a>, ParseError>
Expand description

Parses #( token [ "=" ( token / quoted-string ) ] ), keeping every directive raw.

§Errors

The list errors; ErrorKind::NotToken for a malformed directive; the quoted-string errors.

§Examples

use parse_net::{cache, Limits};

let d = cache::parse(b"no-cache=\"Set-Cookie\", x-y", &Limits::DEFAULT)?;
let names: Vec<&[u8]> = d.iter().map(|x| x.name).collect();
assert_eq!(names, [&b"no-cache"[..], b"x-y"]);