1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-04-18 16:50:33 +01:00

Hide methods from line_range

This commit is contained in:
sharkdp 2020-03-21 20:50:32 +01:00 committed by David Peter
parent d4a39f99d2
commit a8851e1307

View File

@ -20,7 +20,7 @@ impl LineRange {
LineRange::parse_range(range_raw) LineRange::parse_range(range_raw)
} }
pub fn parse_range(range_raw: &str) -> Result<LineRange> { fn parse_range(range_raw: &str) -> Result<LineRange> {
let mut new_range = LineRange::default(); let mut new_range = LineRange::default();
if range_raw.bytes().nth(0).ok_or("Empty line range")? == b':' { if range_raw.bytes().nth(0).ok_or("Empty line range")? == b':' {
@ -50,7 +50,7 @@ impl LineRange {
} }
} }
pub fn is_inside(&self, line: usize) -> bool { pub(crate) fn is_inside(&self, line: usize) -> bool {
line >= self.lower && line <= self.upper line >= self.lower && line <= self.upper
} }
} }
@ -132,7 +132,7 @@ impl LineRanges {
} }
} }
pub fn check(&self, line: usize) -> RangeCheckResult { pub(crate) fn check(&self, line: usize) -> RangeCheckResult {
if self.ranges.iter().any(|r| r.is_inside(line)) { if self.ranges.iter().any(|r| r.is_inside(line)) {
RangeCheckResult::InRange RangeCheckResult::InRange
} else if line < self.largest_upper_bound { } else if line < self.largest_upper_bound {
@ -149,7 +149,6 @@ impl Default for LineRanges {
} }
} }
/// Similar to LineRanges, but "empty" by default
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct HighlightedLineRanges(pub LineRanges); pub struct HighlightedLineRanges(pub LineRanges);