pub struct ToStringOptions {
pub pretty: bool,
pub trailing_semicolon: bool,
pub single_statement_on_new_line: bool,
pub include_type_annotations: bool,
pub include_decorators: bool,
pub comments: Comments,
pub indent_with: String,
pub expect_jsx: bool,
pub expect_markers: bool,
pub max_line_length: u8,
}
Expand description
Settings for serializing ASTNodes
Fields§
§pretty: bool
Does not include whitespace minification
trailing_semicolon: bool
Blocks have trailing semicolons. Has no effect if pretty == false
single_statement_on_new_line: bool
Single statements get put on the same line as their parent statement
include_type_annotations: bool
Include type annotations (and additional TypeScript) syntax
include_decorators: bool
TODO unsure about this
comments: Comments
§indent_with: String
§expect_jsx: bool
If false, panics if sees JSX
expect_markers: bool
For partial AST, marker nodes may exist. This allows pretty printing on invalid source
but should be false
for builds
if false
and a marker node is found, printing will panic
max_line_length: u8
has no effect under !pretty
Implementations§
Source§impl ToStringOptions
impl ToStringOptions
pub fn minified() -> Self
Sourcepub fn typescript() -> Self
pub fn typescript() -> Self
With TypeScript type syntax
Trait Implementations§
Source§impl Default for ToStringOptions
impl Default for ToStringOptions
Source§impl<'de> Deserialize<'de> for ToStringOptionswhere
ToStringOptions: Default,
impl<'de> Deserialize<'de> for ToStringOptionswhere
ToStringOptions: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToStringOptions
impl RefUnwindSafe for ToStringOptions
impl Send for ToStringOptions
impl Sync for ToStringOptions
impl Unpin for ToStringOptions
impl UnwindSafe for ToStringOptions
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