Better API for highlighting lines

This commit is contained in:
sharkdp authored and David Peter committed 2020-04-22 23:55:28 +02:00
1 parent 13e6b3fac7
commit ec0ce05455
4 files changed
+31 -11

No files matched your search

+9 -2
View File
@@ -2,8 +2,8 @@ use crate::errors::*;
#[derive(Debug, Clone)]
pub struct LineRange {
pub lower: usize,
pub upper: usize,
lower: usize,
upper: usize,
}
impl Default for LineRange {
@@ -16,6 +16,13 @@ impl Default for LineRange {
}
impl LineRange {
pub fn new(from: usize, to: usize) -> Self {
LineRange {
lower: from,
upper: to,
}
}
pub fn from(range_raw: &str) -> Result<LineRange> {
LineRange::parse_range(range_raw)
}