Trait html5ever_ext::Minify
[−]
[src]
pub trait Minify {
fn debug_fmt<W: Write>(&self, f: &mut W) -> Result;
fn minify_to_writer<W: Write>(
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>;
fn debug_string(&self) -> String { ... }
fn minify_to_file_path<P: AsRef<Path>>(
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError> { ... }
fn minify_to_string(
&self,
html_head_and_body_tags_are_optional: bool
) -> String { ... }
fn minify_to_bytes(
&self,
html_head_and_body_tags_are_optional: bool
) -> Vec<u8> { ... }
}Minifies and serializes a html5ever HTML DOM (RcDom) or node (Rc
Required Methods
fn debug_fmt<W: Write>(&self, f: &mut W) -> Result
Identical to impl Debug's fmt() method, except we can't impl Debug for a trait and struct we don't own in this crate.
fn minify_to_writer<W: Write>(
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>
Minifies and serializes an instance of an HTML DOM to a writer.
only_serialize_children should be true only if you do not want to serialize '&self', eg <main><p>...</p>><p>...</p></main> with only_serialize_children set to true would serialize <p>...</p>><p>...</p>.
Note that this has no effect on a RcDom - it will still serialize an entire document, including a DOCTYPE, etc.
If creating AMP pages, set html_head_and_body_tags_are_optional to false.
If you need to serialize multiple RcDom or Node objects to the same writer, or need more control, consider using UltraMinifyingHtmlSerializer.
Provided Methods
fn debug_string(&self) -> String
A debug string representing this node and any children.
fn minify_to_file_path<P: AsRef<Path>>(
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>
Minifies and serializes an instance of an HTML DOM to file.
only_serialize_children should be true only if you do not want to serialize '&self', eg <main><p>...</p>><p>...</p></main> with only_serialize_children set to true would serialize <p>...</p>><p>...</p>.
Note that this has no effect on a RcDom - it will still serialize an entire document, including a DOCTYPE, etc.
If creating AMP pages, set html_head_and_body_tags_are_optional to false.
If you need to serialize multiple RcDom or Node objects to the same writer, or need more control, consider using UltraMinifyingHtmlSerializer.
fn minify_to_string(&self, html_head_and_body_tags_are_optional: bool) -> String
Minifies and serializes an instance of an HTML DOM to String.
only_serialize_children should be true only if you do not want to serialize '&self', eg <main><p>...</p>><p>...</p></main> with only_serialize_children set to true would serialize <p>...</p>><p>...</p>.
Note that this has no effect on a RcDom - it will still serialize an entire document, including a DOCTYPE, etc.
If creating AMP pages, set html_head_and_body_tags_are_optional to false.
If you need to serialize multiple RcDom or Node objects to the same writer, or need more control, consider using UltraMinifyingHtmlSerializer.
fn minify_to_bytes(&self, html_head_and_body_tags_are_optional: bool) -> Vec<u8>
Minifies and serializes an instance of an HTML DOM to a vector of bytes.
only_serialize_children should be true only if you do not want to serialize '&self', eg <main><p>...</p>><p>...</p></main> with only_serialize_children set to true would serialize <p>...</p>><p>...</p>.
Note that this has no effect on a RcDom - it will still serialize an entire document, including a DOCTYPE, etc.
If creating AMP pages, set html_head_and_body_tags_are_optional to false.
If you need to serialize multiple RcDom or Node objects to the same writer, or need more control, consider using UltraMinifyingHtmlSerializer.
Implementations on Foreign Types
impl Minify for Rc<Node>[src]
fn debug_fmt<W: Write>(&self, f: &mut W) -> Result[src]
fn minify_to_writer<W: Write>(
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>[src]
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>
fn debug_string(&self) -> String[src]
fn minify_to_file_path<P: AsRef<Path>>(
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>[src]
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>
fn minify_to_string(&self, html_head_and_body_tags_are_optional: bool) -> String[src]
fn minify_to_bytes(&self, html_head_and_body_tags_are_optional: bool) -> Vec<u8>[src]
impl Minify for RefCell<Vec<Rc<Node>>>[src]
fn debug_fmt<W: Write>(&self, f: &mut W) -> Result[src]
fn minify_to_writer<W: Write>(
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>[src]
&self,
html_head_and_body_tags_are_optional: bool,
writer: W
) -> Result<()>
fn debug_string(&self) -> String[src]
fn minify_to_file_path<P: AsRef<Path>>(
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>[src]
&self,
html_head_and_body_tags_are_optional: bool,
html_file_path: P
) -> Result<(), HtmlError>
fn minify_to_string(&self, html_head_and_body_tags_are_optional: bool) -> String[src]
fn minify_to_bytes(&self, html_head_and_body_tags_are_optional: bool) -> Vec<u8>[src]
Implementors
impl Minify for RcDom