pub enum Span {
Direct {
start: usize,
end: usize,
},
Indirect {
start: usize,
end: usize,
},
Unknown,
}
Expand description
Represents a location in the source
Variants§
Direct
Direct code reference through byte offset
Fields
Indirect
Indirect code reference created through ast refactoring
Fields
Unknown
An unknown code reference
Implementations§
Source§impl Span
impl Span
Sourcepub fn is_indirect(&self) -> bool
pub fn is_indirect(&self) -> bool
Return true if the span is indirect.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if the span is unknown.
Sourcepub fn get_bounds(&self) -> (usize, usize)
pub fn get_bounds(&self) -> (usize, usize)
Returns the start and end position of the span. Note: If the span is unknown returns (usize::min, usize::max)
Sourcepub fn to_indirect(self) -> Self
pub fn to_indirect(self) -> Self
Converts a direct span to an indirect one.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
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
Source§impl Ord for Span
impl Ord for Span
Source§impl PartialOrd for Span
impl PartialOrd for Span
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
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