pub struct SourceSpan {
pub start: u32,
pub end: u32,
pub file: SourceID,
}
Expand description
A type representing a single line of a [Source
].
Fields§
§start: u32
The start offset of the span
end: u32
The end offset of the span
file: SourceID
The file id of the span
Implementations§
Source§impl SourceSpan
impl SourceSpan
Sourcepub fn new(file: SourceID, start: u32, end: u32) -> Self
pub fn new(file: SourceID, start: u32, end: u32) -> Self
Create a new source_text 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 source_text 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 source_text.
Offsets are zero-indexed character offsets from the beginning of the identifier.
Sourcepub fn get_end(&self) -> u32
pub fn get_end(&self) -> u32
Get the (exclusive) end offset of this source_text.
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 identifier.
Sourcepub fn set_range(&mut self, range: Range<u32>)
pub fn set_range(&mut self, range: Range<u32>)
Create a new source_text with the given start and end offsets, and the given file.
Sourcepub fn with_range(self, range: Range<u32>) -> Self
pub fn with_range(self, range: Range<u32>) -> Self
Create a new source_text with the given start and end offsets, and the given file.
Sourcepub fn get_file(&self) -> SourceID
pub fn get_file(&self) -> SourceID
Create a new source_text with the given start and end offsets, and the given file.
Sourcepub fn set_file(&mut self, file: SourceID)
pub fn set_file(&mut self, file: SourceID)
Create a new source_text with the given start and end offsets, and the given file.
Sourcepub fn with_file(self, file: SourceID) -> Self
pub fn with_file(self, file: SourceID) -> Self
Create a new source_text with the given start and end offsets, and the given file.
Trait Implementations§
Source§impl Clone for SourceSpan
impl Clone for SourceSpan
Source§fn clone(&self) -> SourceSpan
fn clone(&self) -> SourceSpan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more