Struct rustfmt_nightly::FormattedSnippet
source · pub(crate) struct FormattedSnippet {
pub(crate) snippet: String,
pub(crate) non_formatted_ranges: Vec<(usize, usize)>,
}
Expand description
Result of formatting a snippet of code along with ranges of lines that didn’t get formatted, i.e., that got returned as they were originally.
Fields
snippet: String
non_formatted_ranges: Vec<(usize, usize)>
Implementations
sourceimpl FormattedSnippet
impl FormattedSnippet
sourcepub(crate) fn unwrap_code_block(&mut self)
pub(crate) fn unwrap_code_block(&mut self)
In case the snippet needed to be wrapped in a function, this shifts down the ranges of non-formatted code.
sourcepub(crate) fn is_line_non_formatted(&self, n: usize) -> bool
pub(crate) fn is_line_non_formatted(&self, n: usize) -> bool
Returns true
if the line n did not get formatted.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FormattedSnippet
impl Send for FormattedSnippet
impl Sync for FormattedSnippet
impl Unpin for FormattedSnippet
impl UnwindSafe for FormattedSnippet
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
Mutably borrows from an owned value. Read more
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: 48 bytes