Struct rustfmt_nightly::comment::ItemizedBlock
source · Expand description
Block that is formatted as an item.
An item starts with either a star *
a dash -
or a greater-than >
.
Different level of indentation are handled by shrinking the shape accordingly.
Fields
lines: Vec<String>
the lines that are identified as part of an itemized block
indent: usize
the number of characters (typically whitespaces) up to the item sigil
opener: String
the string that marks the start of an item
line_start: String
sequence of characters (typically whitespaces) to prefix new lines that are part of the item
Implementations
sourceimpl ItemizedBlock
impl ItemizedBlock
sourcefn is_itemized_line(line: &str) -> bool
fn is_itemized_line(line: &str) -> bool
Returns true
if the line is formatted as an item
sourcefn new(line: &str) -> ItemizedBlock
fn new(line: &str) -> ItemizedBlock
Creates a new ItemizedBlock described with the given line.
The is_itemized_line
needs to be called first.
sourcefn create_string_format<'a>(
&'a self,
fmt: &'a StringFormat<'_>
) -> StringFormat<'a>
fn create_string_format<'a>(
&'a self,
fmt: &'a StringFormat<'_>
) -> StringFormat<'a>
Returns a StringFormat
used for formatting the content of an item.
sourcefn add_line(&mut self, line: &str) -> bool
fn add_line(&mut self, line: &str) -> bool
Returns true
if the line is part of the current itemized block.
If it is, then it is added to the internal lines list.
sourcefn trimmed_block_as_string(&self) -> String
fn trimmed_block_as_string(&self) -> String
Returns the block as a string, with each line trimmed at the start.
sourcefn original_block_as_string(&self) -> String
fn original_block_as_string(&self) -> String
Returns the block as a string under its original form.
Auto Trait Implementations
impl RefUnwindSafe for ItemizedBlock
impl Send for ItemizedBlock
impl Sync for ItemizedBlock
impl Unpin for ItemizedBlock
impl UnwindSafe for ItemizedBlock
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: 80 bytes