1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-03 03:42:26 +01:00

Better API for highlighting lines

This commit is contained in:
sharkdp
2020-04-22 19:15:33 +02:00
committed by David Peter
parent 13e6b3fac7
commit ec0ce05455
4 changed files with 31 additions and 11 deletions

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)
}