parse

Function parse 

Source
pub fn parse(
    input: &str,
    options: ParserOptions,
) -> Result<VDom<'_>, ParseError>
Expand description

Parses the given input string

This is the “entry point” and function that is called to parse HTML. The input string must be kept alive, and must outlive VDom. If you need an “owned” version that takes an input string and can be kept around forever, consider using parse_owned().

§Errors

Throughout the parser it is assumed that spans never overflow a u32. To prevent this, this function will return an error if the input string length would overflow a u32. If the input string length fits in a u32, then it is safe to assume that none of the substrings can overflow a u32.

§Example

let dom = parse("<div>Hello, world!</div>", ParserOptions::default()).unwrap();
assert_eq!(dom.query_selector("div").unwrap().count(), 1);