Skip to main content

parse_async

Function parse_async 

Source
pub async fn parse_async<R>(reader: R) -> Result<Document, HtmlError>
where R: AsyncRead + Unpin,
Available on crate feature async-tokio only.
Expand description

Parse HTML asynchronously from an AsyncRead source.

Convenience function that creates an AsyncParser with default settings.

§Example

use fhp_tree::async_parser::parse_async;

let html = b"<div><p>Hello</p></div>";
let doc = parse_async(&html[..]).await?;
assert_eq!(doc.root().text_content(), "Hello");