pub enum CodeSpan {
Block {
local_id: usize,
},
Combined(Vec<CodeSpan>),
Range(Range<TextLocation>),
None,
}Expand description
Represents the location of a code element in a source code
Variants§
Block
The location of a block in a diagram
Combined(Vec<CodeSpan>)
An element spanning multiple IDs
Range(Range<TextLocation>)
A location inside a text
None
The location does not point anywhere in the file
Implementations§
Source§impl CodeSpan
impl CodeSpan
Sourcepub fn from_text_info(start: TextLocation, end: TextLocation) -> Self
pub fn from_text_info(start: TextLocation, end: TextLocation) -> Self
Creates a codespan from line, column and range info
Sourcepub fn get_line(&self) -> usize
pub fn get_line(&self) -> usize
Gets the line representation for a source location If the location does not represent a line, the closest equivalent is returned
Sourcepub fn get_line_end(&self) -> usize
pub fn get_line_end(&self) -> usize
Gets the colmumn representation for a source location If the location does not represent a line, 0 is returned
pub fn get_line_plus_one(&self) -> usize
Sourcepub fn get_column(&self) -> usize
pub fn get_column(&self) -> usize
Gets the colmumn representation for a source location If the location does not represent a line, 0 is returned
Sourcepub fn get_column_end(&self) -> usize
pub fn get_column_end(&self) -> usize
Gets the colmumn representation for a source location If the location does not represent a line, 0 is returned
pub fn to_range(&self) -> Option<Range<usize>>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CodeSpan
impl<'de> Deserialize<'de> for CodeSpan
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CodeSpan
impl StructuralPartialEq for CodeSpan
Auto Trait Implementations§
impl Freeze for CodeSpan
impl RefUnwindSafe for CodeSpan
impl Send for CodeSpan
impl Sync for CodeSpan
impl Unpin for CodeSpan
impl UnsafeUnpin for CodeSpan
impl UnwindSafe for CodeSpan
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