1 | use crate::grid::config; |
---|---|
2 | |
3 | /// The structure represents an offset in a text. |
4 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] |
5 | pub enum Offset { |
6 | /// An offset from the start. |
7 | Begin(usize), |
8 | /// An offset from the end. |
9 | End(usize), |
10 | } |
11 | |
12 | impl From<Offset> for config::Offset { |
13 | fn from(o: Offset) -> Self { |
14 | match o { |
15 | Offset::Begin(i: usize) => config::Offset::Begin(i), |
16 | Offset::End(i: usize) => config::Offset::End(i), |
17 | } |
18 | } |
19 | } |
20 |