use std::ops::Range;
#[derive(Clone, Debug, PartialEq)]
pub struct TemexMatch {
pub(crate) start: usize,
pub(crate) end: usize,
}
impl From<TemexMatch> for Range<usize> {
fn from(m: TemexMatch) -> Self {
m.range()
}
}
impl TemexMatch {
pub fn start(&self) -> usize {
self.start
}
pub fn end(&self) -> usize {
self.end
}
pub fn len(&self) -> usize {
self.end - self.start
}
pub fn is_empty(&self) -> bool {
self.end == self.start
}
pub fn range(&self) -> Range<usize> {
self.start..self.end
}
pub(crate) fn new(start: usize, end: usize) -> TemexMatch {
TemexMatch { start, end }
}
}