Skip to main content

parse_word

Function parse_word 

Source
pub fn parse_word(s: &[u8]) -> Result<(Word<'_>, usize), ParseError>
Expand description

Parses a word at the start of s: a quoted string when s starts with ", a token otherwise.

§Errors

As parse_token and parse_quoted.

§Examples

use parse_net::text::parse_word;

let (a, _) = parse_word(b"utf-8")?;
let (b, _) = parse_word(b"\"UTF-8\"")?;
assert!(a.eq_ignore_ascii_case(b"UTF-8") && b.eq_ignore_ascii_case(b"utf-8"));