katex_parser/
source_location.rs1use std::sync::Arc;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct SourceLocation {
6 pub input: Arc<str>,
7 pub start: usize,
8 pub end: usize,
9}
10
11impl SourceLocation {
12 pub fn new(input: impl Into<Arc<str>>, start: usize, end: usize) -> Self {
13 SourceLocation {
14 input: input.into(),
15 start,
16 end,
17 }
18 }
19
20 pub fn range(start_loc: &SourceLocation, end_loc: &SourceLocation) -> Self {
21 SourceLocation {
22 input: start_loc.input.clone(),
23 start: start_loc.start,
24 end: end_loc.end,
25 }
26 }
27}