pub fn parse<'a: 'query, 'html: 'query, 'query: 'html>(
html: &'html str,
queries: &'a [Query<'query>],
) -> Store<'html, 'query>Expand description
Parse an HTML string against one or more pre-built Query objects and
return a Store containing all matched elements.
This is the main entry point of scah. It wires together the streaming
XHtmlParser, the QueryMultiplexer, and the result Store.
§Parameters
html: The HTML source string. All returned string slices in the resultingStoreborrow directly from this string (zero-copy).queries: A slice of compiledQueryobjects. Each query is executed concurrently against the same token stream in a single pass.
§Returns
A Store containing all matched elements. Use Store::get with the
original selector string to retrieve results for a specific query.
§Example
use scah::{Query, Save, parse};
let html = "<div><a href='link'>Hello</a></div>";
let queries = &[Query::all("a", Save::all()).build()];
let store = parse(html, queries);
let links: Vec<_> = store.get("a").unwrap().collect();
assert_eq!(links.len(), 1);
assert_eq!(links[0].name, "a");