Struct gluon_base::source::CodeMap
source · pub struct CodeMap { /* private fields */ }
Implementations§
source§impl CodeMap
impl CodeMap
pub fn new() -> Self
pub fn add_filemap(&mut self, filename: String, source: String) -> Arc<FileMap>
pub fn to_usize(&self, pos: BytePos) -> Option<usize>
pub fn find_file(&self, file: &str) -> Option<&Arc<FileMap>>
pub fn get(&self, file_id: FileId) -> Option<&Arc<FileMap>>
pub fn update(&mut self, index: BytePos, src: String) -> Option<Arc<FileMap>>
Trait Implementations§
source§impl<'a> Files<'a> for CodeMap
impl<'a> Files<'a> for CodeMap
§type FileId = ByteIndex
type FileId = ByteIndex
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: FileId, byte_index: usize) -> Result<usize>
fn line_index(&self, file_id: 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: FileId, line_index: usize) -> Result<Range<usize>>
fn line_range(&self, file_id: 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
Auto Trait Implementations§
impl RefUnwindSafe for CodeMap
impl Send for CodeMap
impl Sync for CodeMap
impl Unpin for CodeMap
impl UnwindSafe for CodeMap
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