rust/hg-core/src/revlog.rs
changeset 44181 3fb39dc2e356
parent 44143 7f86426fdd2c
child 44182 9896a8d0d3d2
--- a/rust/hg-core/src/revlog.rs	Fri Jan 24 17:10:45 2020 -0800
+++ b/rust/hg-core/src/revlog.rs	Wed Jan 22 16:35:56 2020 +0100
@@ -40,3 +40,17 @@
     ParentOutOfRange(Revision),
     WorkingDirectoryUnsupported,
 }
+
+/// The Mercurial Revlog Index
+///
+/// This is currently limited to the minimal interface that is needed for
+/// the [`nodemap`](nodemap/index.html) module
+pub trait RevlogIndex {
+    /// Total number of Revisions referenced in this index
+    fn len(&self) -> usize;
+
+    /// Return a reference to the Node or `None` if rev is out of bounds
+    ///
+    /// `NULL_REVISION` is not considered to be out of bounds.
+    fn node(&self, rev: Revision) -> Option<&Node>;
+}