Struct gluon_base::source::FileMap
source · pub struct FileMap { /* private fields */ }
Implementations§
Trait Implementations§
source§impl<'a> Files<'a> for FileMap
impl<'a> Files<'a> for FileMap
§type FileId = ()
type FileId = ()
A unique identifier for files in the file provider. This will be used
for rendering
diagnostic::Label
s in the corresponding source files.source§fn line_index(&self, file_id: Self::FileId, byte_index: usize) -> Result<usize>
fn line_index(&self, file_id: Self::FileId, byte_index: usize) -> Result<usize>
The index of the line at the given byte index.
If the byte index is past the end of the file, returns the maximum line index in the file.
This means that this function only fails if the file is not present. Read more
source§fn line_range(
&self,
file_id: Self::FileId,
line_index: usize
) -> Result<Range<usize>>
fn line_range( &self, file_id: Self::FileId, line_index: usize ) -> Result<Range<usize>>
The byte range of line in the source of the file.
§fn line_number(
&'a self,
id: Self::FileId,
line_index: usize
) -> Result<usize, Error>
fn line_number( &'a self, id: Self::FileId, line_index: usize ) -> Result<usize, Error>
The user-facing line number at the given line index.
It is not necessarily checked that the specified line index
is actually in the file. Read more
source§impl Source for FileMap
impl Source for FileMap
source§fn location(&self, byte: BytePos) -> Option<Location>
fn location(&self, byte: BytePos) -> Option<Location>
Returns the line and column location of byte
source§fn comment_start_before(&self, end: BytePos) -> BytePos
fn comment_start_before(&self, end: BytePos) -> BytePos
Returns the starting position of any comments and whitespace before end
fn new(s: &str) -> Selfwhere
Self: Sized,
fn span(&self) -> Span<BytePos>
fn src(&self) -> &str
fn src_slice(&self, span: Span<BytePos>) -> &str
fn byte_index(&self, line: Line, column: Column) -> Option<BytePos>
fn line_number_at_byte(&self, pos: BytePos) -> Option<Line>
fn comments_between(&self, span: Span<BytePos>) -> CommentIter<'_> ⓘ
Auto Trait Implementations§
impl RefUnwindSafe for FileMap
impl Send for FileMap
impl Sync for FileMap
impl Unpin for FileMap
impl UnwindSafe for FileMap
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