Struct source_cache::SourceSpan
source · 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
§end: u32
§file: SourceID
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 moresource§impl Debug for SourceSpan
impl Debug for SourceSpan
source§impl Default for SourceSpan
impl Default for SourceSpan
source§fn default() -> SourceSpan
fn default() -> SourceSpan
source§impl<'de> Deserialize<'de> for SourceSpan
impl<'de> Deserialize<'de> for SourceSpan
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for SourceSpan
impl Display for SourceSpan
source§impl Hash for SourceSpan
impl Hash for SourceSpan
source§impl PartialEq for SourceSpan
impl PartialEq for SourceSpan
source§fn eq(&self, other: &SourceSpan) -> bool
fn eq(&self, other: &SourceSpan) -> bool
self
and other
values to be equal, and is used
by ==
.