pub struct Span { /* private fields */ }
Expand description
The source location information from the tree-sitter Node
type. The location is stored as
a start and end position, where the positions are byte indices.
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(start: SpanPosition, end: SpanPosition) -> Self
pub fn new(start: SpanPosition, end: SpanPosition) -> Self
Create a new span from the start
byte and end
byte indices.
Sourcepub fn start(&self) -> SpanPosition
pub fn start(&self) -> SpanPosition
Return the starting byte index of this span.
Sourcepub fn end(&self) -> SpanPosition
pub fn end(&self) -> SpanPosition
Return the ending byte index of this span.
Sourcepub fn byte_range(&self) -> Range<usize>
pub fn byte_range(&self) -> Range<usize>
Return this span as a start..end
range.
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
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