pub struct RenderOptions {
pub pretty: bool,
pub indent: String,
pub xhtml_self_closing: bool,
}Expand description
How a node tree is turned into markup.
A value passed into the render call, never global state — two threads can render the
same tree with different settings at the same time. Winged-Swift’s deprecated
process-wide HTMLTag.xhtmlSelfClosing switch is deliberately not ported.
§Examples
use winged_rust::core::RenderOptions;
let compact = RenderOptions::compact();
let pretty = RenderOptions::pretty();
let four_spaces = RenderOptions::pretty().with_indent(" ");Fields§
§pretty: boolWhen true, children go on their own lines and are indented.
indent: StringOne indentation level. Only used when pretty is true. Defaults to two spaces.
xhtml_self_closing: boolWhen true, void elements close with /> instead of >.
Implementations§
Source§impl RenderOptions
impl RenderOptions
Sourcepub fn compact() -> Self
pub fn compact() -> Self
Minified output on a single line. The default, and what you should ship.
Sourcepub fn with_indent(self, indent: impl Into<String>) -> Self
pub fn with_indent(self, indent: impl Into<String>) -> Self
Sets the indentation string.
Sourcepub fn with_xhtml_self_closing(self, yes: bool) -> Self
pub fn with_xhtml_self_closing(self, yes: bool) -> Self
Closes void elements with /> instead of >.
Trait Implementations§
Source§impl Clone for RenderOptions
impl Clone for RenderOptions
Source§impl Debug for RenderOptions
impl Debug for RenderOptions
Source§impl Default for RenderOptions
impl Default for RenderOptions
impl Eq for RenderOptions
Source§impl PartialEq for RenderOptions
impl PartialEq for RenderOptions
impl StructuralPartialEq for RenderOptions
Auto Trait Implementations§
impl Freeze for RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnsafeUnpin for RenderOptions
impl UnwindSafe for RenderOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more