pub struct SourceFile { /* private fields */ }Expand description
The representation of a source file in the database.
Implementations§
Source§impl SourceFile
impl SourceFile
Sourcepub fn name(&self) -> &FileName
pub fn name(&self) -> &FileName
Returns the FileName associated with this SourceFile
Sourcepub fn id(&self) -> SourceId
pub fn id(&self) -> SourceId
Returns the SourceId associated with this SourceFile
Sourcepub fn parent(&self) -> Option<SourceSpan>
pub fn parent(&self) -> Option<SourceSpan>
Returns the parent SourceSpan for this SourceFile
Sourcepub fn line_start(&self, line_index: LineIndex) -> Result<ByteIndex, Error>
pub fn line_start(&self, line_index: LineIndex) -> Result<ByteIndex, Error>
Computes the ByteIndex at which the line corresponding to line_index begins
Sourcepub fn last_line_index(&self) -> LineIndex
pub fn last_line_index(&self) -> LineIndex
Returns the LineIndex of the last line in this file
Sourcepub fn location<I: Into<ByteIndex>>(
&self,
byte_index: I,
) -> Result<Location, Error>
pub fn location<I: Into<ByteIndex>>( &self, byte_index: I, ) -> Result<Location, Error>
Returns a Location corresponding to the given byte index in this file.
Sourcepub fn source_span(&self) -> SourceSpan
pub fn source_span(&self) -> SourceSpan
Returns a SourceSpan covering all of the content in this file
Trait Implementations§
Source§impl Clone for SourceFile
impl Clone for SourceFile
Source§fn clone(&self) -> SourceFile
fn clone(&self) -> SourceFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceFile
impl RefUnwindSafe for SourceFile
impl Send for SourceFile
impl Sync for SourceFile
impl Unpin for SourceFile
impl UnwindSafe for SourceFile
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