Skip to main content

treesitter_types/runtime/
span.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub struct Span {
3    pub start: tree_sitter::Point,
4    pub end: tree_sitter::Point,
5    pub start_byte: usize,
6    pub end_byte: usize,
7}
8
9impl From<tree_sitter::Node<'_>> for Span {
10    fn from(node: tree_sitter::Node<'_>) -> Self {
11        Self {
12            start: node.start_position(),
13            end: node.end_position(),
14            start_byte: node.start_byte(),
15            end_byte: node.end_byte(),
16        }
17    }
18}