Changeset View
Changeset View
Standalone View
Standalone View
rust/hg-core/src/revlog/index.rs
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | ) -> Result<Self, HgError> { | ||||
bytes, | bytes, | ||||
offsets: None, | offsets: None, | ||||
}) | }) | ||||
} | } | ||||
} | } | ||||
/// Value of the inline flag. | /// Value of the inline flag. | ||||
pub fn is_inline(&self) -> bool { | pub fn is_inline(&self) -> bool { | ||||
is_inline(&self.bytes) | self.offsets.is_some() | ||||
} | } | ||||
/// Return a slice of bytes if `revlog` is inline. Panic if not. | /// Return a slice of bytes if `revlog` is inline. Panic if not. | ||||
pub fn data(&self, start: usize, end: usize) -> &[u8] { | pub fn data(&self, start: usize, end: usize) -> &[u8] { | ||||
if !self.is_inline() { | if !self.is_inline() { | ||||
panic!("tried to access data in the index of a revlog that is not inline"); | panic!("tried to access data in the index of a revlog that is not inline"); | ||||
} | } | ||||
&self.bytes[start..end] | &self.bytes[start..end] | ||||
▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines |