pub struct SlimOptions {
pub indent_with_tabs: bool,
pub indent: Option<u8>,
}Expand description
Options for the slim function (indentation, etc.).
Fields§
§indent_with_tabs: boolWhether to use tabs instead of spaces for indentation.
indent: Option<u8>Number of spaces per indentation level, or None for flat output.
Implementations§
Source§impl SlimOptions
impl SlimOptions
Sourcepub fn with_indent(self, spaces: u8) -> Self
pub fn with_indent(self, spaces: u8) -> Self
Set the number of spaces for indentation (enables formatting).
Examples found in repository?
examples/c01-simple.rs (line 15)
1fn main() -> Result<(), Box<dyn std::error::Error>> {
2 let fx_html = r#"
3 <!DOCTYPE html>
4 <html>
5 <head>
6 <meta charset="utf-8">
7 <link rel="icon" href="favicon.ico">
8 </head>
9 <body>
10 <p>Content</p>
11 </body>
12 </html>
13 "#;
14
15 let slim = html_helpers::slim(fx_html, html_helpers::SlimOptions::default().with_indent(2))?;
16
17 println!("Slim (formatted):\n\n{slim}");
18
19 Ok(())
20}Sourcepub fn with_indent_with_tabs(self, tabs: bool) -> Self
pub fn with_indent_with_tabs(self, tabs: bool) -> Self
Use tabs instead of spaces for indentation.
Trait Implementations§
Source§impl Clone for SlimOptions
impl Clone for SlimOptions
Source§fn clone(&self) -> SlimOptions
fn clone(&self) -> SlimOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SlimOptions
Source§impl Debug for SlimOptions
impl Debug for SlimOptions
Source§impl Default for SlimOptions
impl Default for SlimOptions
Source§fn default() -> SlimOptions
fn default() -> SlimOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SlimOptions
impl RefUnwindSafe for SlimOptions
impl Send for SlimOptions
impl Sync for SlimOptions
impl Unpin for SlimOptions
impl UnsafeUnpin for SlimOptions
impl UnwindSafe for SlimOptions
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