1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::rc::Rc;
#[derive(Clone, Debug, PartialEq)]
pub struct ImmutableString {
inner: Rc<String>,
}
impl ImmutableString {
pub fn as_ref(&self) -> &str {
&self.inner
}
pub(super) fn new(text: String) -> ImmutableString {
ImmutableString {
inner: Rc::new(text),
}
}
#[cfg(test)]
pub(super) fn from(text: &str) -> ImmutableString {
ImmutableString {
inner: Rc::new(String::from(text)),
}
}
}
#[derive(Debug, PartialEq, Clone)]
pub struct Range {
pub start: usize,
pub end: usize,
pub start_line: usize,
pub end_line: usize,
}