pub trait HtmlStr {
const TAG_DOCTYPE_PAT: &'static str = "<!doctype";
const TAG_DOCTYPE_HTML_PAT: &'static str = "<!doctype html";
const TAG_DOCTYPE_HTML: &'static str = "<!DOCTYPE html>";
const START_TAG_HTML_PAT: &'static str = "<html";
const END_TAG_HTML: &'static str = "</html>";
// Required methods
fn is_empty_html(&self) -> bool;
fn has_html_start_tag(&self) -> bool;
fn is_html_unchecked(&self) -> bool;
// Provided methods
fn is_empty_html2(html: &str) -> bool { ... }
fn has_html_start_tag2(html: &str) -> bool { ... }
}Expand description
This trait deals with tagged HTML &str data.
Provided Associated Constants§
Sourceconst TAG_DOCTYPE_PAT: &'static str = "<!doctype"
const TAG_DOCTYPE_PAT: &'static str = "<!doctype"
Lowercase pattern to check if this is a Doctype tag.
Sourceconst TAG_DOCTYPE_HTML_PAT: &'static str = "<!doctype html"
const TAG_DOCTYPE_HTML_PAT: &'static str = "<!doctype html"
Lowercase pattern to check if this Doctype is HTML.
Sourceconst TAG_DOCTYPE_HTML: &'static str = "<!DOCTYPE html>"
const TAG_DOCTYPE_HTML: &'static str = "<!DOCTYPE html>"
Doctype HTML tag. This is inserted by
<HtmlString>.prepend_html_start_tag()
Sourceconst START_TAG_HTML_PAT: &'static str = "<html"
const START_TAG_HTML_PAT: &'static str = "<html"
Pattern to check if f this is an HTML start tag.
Sourceconst END_TAG_HTML: &'static str = "</html>"
const END_TAG_HTML: &'static str = "</html>"
HTML end tag.
Required Methods§
Sourcefn is_empty_html(&self) -> bool
fn is_empty_html(&self) -> bool
We consider self empty, when it equals to <!DOCTYPE html...> or
when it is empty.
Sourcefn has_html_start_tag(&self) -> bool
fn has_html_start_tag(&self) -> bool
True if stream starts with <!DOCTYPE html...>.
Sourcefn is_html_unchecked(&self) -> bool
fn is_html_unchecked(&self) -> bool
Some heuristics to guess if the input stream contains HTML. Current implementation: True if:
- The stream starts with
<!DOCTYPE html ...>, or - the stream starts with
<html ...>
This function does not check if the recognized HTML is valid.
Provided Methods§
Sourcefn is_empty_html2(html: &str) -> bool
fn is_empty_html2(html: &str) -> bool
We consider html empty, when it equals to <!DOCTYPE html...> or
when it is empty.
This is identical to is_empty_html(), but does not pull in
additional trait bounds.
Sourcefn has_html_start_tag2(html: &str) -> bool
fn has_html_start_tag2(html: &str) -> bool
True if html starts with <!DOCTYPE html...>.
This is identical to has_html_start_tag(), but does not pull in
additional trait bounds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".