pub struct SourceFile {
pub name: FileName,
pub src: String,
pub absolute_start: u32,
pub absolute_end: u32,
}Expand description
A single source in the SourceMap.
Fields§
§name: FileNameThe name of the file that the source came from.
src: StringThe complete source code.
absolute_start: u32The start position of this source in the SourceMap.
absolute_end: u32The end position of this source in the SourceMap.
Implementations§
Source§impl SourceFile
impl SourceFile
Sourcepub fn relative_offset(&self, absolute_offset: u32) -> u32
pub fn relative_offset(&self, absolute_offset: u32) -> u32
Converts an absolute offset to a file-relative offset
Sourcepub fn contents_of_span(&self, span: Span) -> &str
pub fn contents_of_span(&self, span: Span) -> &str
Returns contents of a span assumed to be within the given file.
pub fn line_col(&self, absolute_offset: u32) -> (u32, u32)
pub fn line_contents(&self, span: Span) -> LineContents<'_>
Auto Trait Implementations§
impl Freeze for SourceFile
impl RefUnwindSafe for SourceFile
impl Send for SourceFile
impl Sync for SourceFile
impl Unpin for SourceFile
impl UnsafeUnpin 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