pub struct Html;Expand description
Namespace for HTML-related functions.
Implementations§
Source§impl Html
impl Html
Sourcepub fn parse<T: AsRef<[u8]>>(html: T) -> Result<Document, HtmlError>
pub fn parse<T: AsRef<[u8]>>(html: T) -> Result<Document, HtmlError>
Parse HTML into a Document.
As there is no base URL specified, absolute URL resolution requires the
HTML to have a <base href> tag.
Sourcepub fn parse_with_url<T: AsRef<[u8]>, B: AsRef<str>>(
html: T,
base_url: B,
) -> Result<Document, HtmlError>
pub fn parse_with_url<T: AsRef<[u8]>, B: AsRef<str>>( html: T, base_url: B, ) -> Result<Document, HtmlError>
Parse HTML into a Document, with a base URL.
The given base_url will be used for any URLs that occurs before a
<base href> tag is defined.
Sourcepub fn parse_fragment<T: AsRef<[u8]>>(html: T) -> Result<Document, HtmlError>
pub fn parse_fragment<T: AsRef<[u8]>>(html: T) -> Result<Document, HtmlError>
Parse a HTML fragment, assuming that it forms the body of the HTML.
Similar to Html::parse, relative URLs will not be resolved unless
there is a <base href> tag.
Sourcepub fn parse_fragment_with_url<T: AsRef<[u8]>, B: AsRef<str>>(
html: T,
base_url: B,
) -> Result<Document, HtmlError>
pub fn parse_fragment_with_url<T: AsRef<[u8]>, B: AsRef<str>>( html: T, base_url: B, ) -> Result<Document, HtmlError>
Parse a HTML fragment, assuming that it forms the body of the HTML, with a base URL.
Similar to Html::parse_with_url, URL resolution occurs for any that appears
before a <base href> tag.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Html
impl RefUnwindSafe for Html
impl Send for Html
impl Sync for Html
impl Unpin for Html
impl UnwindSafe for Html
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more