enum SnippetState {
EndOfInput(String),
LineEnd(String, usize),
EndWithLineFeed(String, usize),
}
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§
source§impl Debug for SnippetState
impl Debug for SnippetState
source§impl PartialEq for SnippetState
impl PartialEq for SnippetState
impl StructuralPartialEq for SnippetState
Auto Trait Implementations§
impl Freeze for SnippetState
impl RefUnwindSafe for SnippetState
impl Send for SnippetState
impl Sync for SnippetState
impl Unpin for SnippetState
impl UnwindSafe for SnippetState
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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