pub struct TextPosition {
pub line: usize,
pub byte: usize,
}Expand description
A zero-based byte position in source text.
line and byte use Tree-sitter’s native coordinate system: the line is
zero-based and byte is the zero-based UTF-8 byte offset from the beginning
of that line.
let position = achitek_source::TextPosition { line: 2, byte: 4 };
assert_eq!(position.line, 2);
assert_eq!(position.byte, 4);Fields§
§line: usizeZero-based line number.
byte: usizeZero-based UTF-8 byte offset within the line.
Implementations§
Trait Implementations§
Source§impl Clone for TextPosition
impl Clone for TextPosition
impl Copy for TextPosition
Source§impl Debug for TextPosition
impl Debug for TextPosition
Source§impl Default for TextPosition
impl Default for TextPosition
impl Eq for TextPosition
Source§impl From<Point> for TextPosition
impl From<Point> for TextPosition
Source§impl Hash for TextPosition
impl Hash for TextPosition
Source§impl Ord for TextPosition
impl Ord for TextPosition
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for TextPosition
impl PartialEq for TextPosition
Source§impl PartialOrd for TextPosition
impl PartialOrd for TextPosition
impl StructuralPartialEq for TextPosition
Auto Trait Implementations§
impl Forget for TextPosition
impl Freeze for TextPosition
impl Move for TextPosition
impl RefUnwindSafe for TextPosition
impl Send for TextPosition
impl Sync for TextPosition
impl Unpin for TextPosition
impl UnsafeUnpin for TextPosition
impl UnwindSafe for TextPosition
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