pub struct ParsedFile { /* private fields */ }Expand description
Owned source, its lossless tree, and lexical/parser diagnostics.
Implementations§
Source§impl ParsedFile
impl ParsedFile
pub fn source(&self) -> &str
Sourcepub fn line_column(&self, byte_offset: usize) -> (usize, usize)
pub fn line_column(&self, byte_offset: usize) -> (usize, usize)
Return the one-based line and Unicode scalar column at a byte offset. CR and LF each end a line; CRLF is one break, including an offset between its two bytes. Line boundaries are indexed on demand and owned by this parsed source. Parsing or formatting alone does not build them.
Panics if the offset exceeds the source length or is not a UTF-8 boundary, just as slicing the source at that offset does.
pub fn tokens(&self) -> &[Token]
pub fn tree(&self) -> &SyntaxNode
pub fn diagnostics(&self) -> &[Diagnostic]
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ParsedFile
impl RefUnwindSafe for ParsedFile
impl Send for ParsedFile
impl Sync for ParsedFile
impl Unpin for ParsedFile
impl UnsafeUnpin for ParsedFile
impl UnwindSafe for ParsedFile
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