pub struct FileSpan { /* private fields */ }
Expand description
A type representing a single line of a [Source
].
Implementations§
Source§impl FileSpan
impl FileSpan
Sourcepub fn new(file: FileID, start: usize, end: usize) -> FileSpan
pub fn new(file: FileID, start: usize, end: usize) -> FileSpan
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn get_range(&self) -> Range<usize>
pub fn get_range(&self) -> Range<usize>
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn get_start(&self) -> usize
pub fn get_start(&self) -> usize
Get the start offset of this span.
Offsets are zero-indexed character offsets from the beginning of the source.
Sourcepub fn get_end(&self) -> usize
pub fn get_end(&self) -> usize
Get the (exclusive) end offset of this span.
The end offset should always be greater than or equal to the start offset as given by [Span::start
].
Offsets are zero-indexed character offsets from the beginning of the source.
Sourcepub fn set_range(&mut self, range: Range<usize>)
pub fn set_range(&mut self, range: Range<usize>)
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn with_range(self, range: Range<usize>) -> FileSpan
pub fn with_range(self, range: Range<usize>) -> FileSpan
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn get_file(&self) -> FileID
pub fn get_file(&self) -> FileID
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn set_file(&mut self, file: FileID)
pub fn set_file(&mut self, file: FileID)
Create a new span with the given start and end offsets, and the given file.
Sourcepub fn with_file(self, file: FileID) -> FileSpan
pub fn with_file(self, file: FileID) -> FileSpan
Create a new span with the given start and end offsets, and the given file.