pub struct Statement {
pub first_line: usize,
pub last_line: usize,
pub text: String,
pub comments: bool,
/* private fields */
}Expand description
One statement and where its text came from.
Fields§
§first_line: usize0-based physical line the statement starts on.
last_line: usize0-based physical line it ends on (the same for most statements).
text: StringThe joined text, comments removed. The first line keeps its indentation, so offsets on it are that line’s own byte columns.
comments: boolWhether a comment was written anywhere inside it. Re-flowing such a statement would drop the comment, so a formatter leaves it alone.
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn locate(&self, offset: usize) -> (usize, usize)
pub fn locate(&self, offset: usize) -> (usize, usize)
The physical (line, byte column) of byte offset in Self::text.
An offset on a joining space maps to the end of the piece before it.
Trait Implementations§
impl Eq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
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