Struct nyar_error::FileSpan
source · 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: u32, end: u32) -> FileSpan
pub fn new(file: FileID, start: u32, end: u32) -> FileSpan
Create a new span with the given start and end offsets, and the given file.
sourcepub fn get_range(&self) -> Range<u32>
pub fn get_range(&self) -> Range<u32>
Create a new span with the given start and end offsets, and the given file.
sourcepub fn get_start(&self) -> u32
pub fn get_start(&self) -> u32
Get the start offset of this span.
Offsets are zero-indexed character offsets from the beginning of the source.
sourcepub fn get_end(&self) -> u32
pub fn get_end(&self) -> u32
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<u32>)
pub fn set_range(&mut self, range: Range<u32>)
Create a new span with the given start and end offsets, and the given file.
sourcepub fn with_range(self, range: Range<u32>) -> FileSpan
pub fn with_range(self, range: Range<u32>) -> 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.