Enum rustfmt_nightly::string::SnippetState
source · Expand description
Result of breaking a string so it fits in a line and the state it ended in. The state informs about what to do with the snippet and how to continue the breaking process.
Variants
EndOfInput(String)
The input could not be broken and so rewriting the string is finished.
LineEnd(String, usize)
The input could be broken and the returned snippet should be ended with a
[StringFormat::line_end]
. The next snippet needs to be indented.
The returned string is the line to print out and the number is the length that got read in the text being rewritten. That length may be greater than the returned string if trailing whitespaces got trimmed.
EndWithLineFeed(String, usize)
The input could be broken but a newline is present that cannot be trimmed. The next snippet to be rewritten could use more width than what is specified by the given shape. For example with a multiline string, the next snippet does not need to be indented, allowing more characters to be fit within a line.
The returned string is the line to print out and the number is the length that got read in the text being rewritten.
Trait Implementations
sourceimpl Debug for SnippetState
impl Debug for SnippetState
sourceimpl PartialEq<SnippetState> for SnippetState
impl PartialEq<SnippetState> for SnippetState
sourcefn eq(&self, other: &SnippetState) -> bool
fn eq(&self, other: &SnippetState) -> bool
impl StructuralPartialEq for SnippetState
Auto Trait Implementations
impl RefUnwindSafe for SnippetState
impl Send for SnippetState
impl Sync for SnippetState
impl Unpin for SnippetState
impl UnwindSafe for SnippetState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
EndOfInput
: 24 bytesLineEnd
: 32 bytesEndWithLineFeed
: 32 bytes