Show More
@@ -25,6 +25,7 b' use std::ops::Index;' | |||
|
25 | 25 | |
|
26 | 26 | #[derive(Debug, PartialEq)] |
|
27 | 27 | pub enum NodeMapError { |
|
28 | /// A `NodePrefix` matches several [`Revision`]s. | |
|
28 | 29 | MultipleResults, |
|
29 | 30 | /// A `Revision` stored in the nodemap could not be found in the index |
|
30 | 31 | RevisionNotInIndex(Revision), |
@@ -84,7 +85,7 b' pub trait NodeMap {' | |||
|
84 | 85 | /// returns the number of hexadecimal digits that would had sufficed |
|
85 | 86 | /// to find the revision uniquely. |
|
86 | 87 | /// |
|
87 | /// Returns `None` if no `Revision` could be found for the prefix. | |
|
88 | /// Returns `None` if no [`Revision`] could be found for the prefix. | |
|
88 | 89 | /// |
|
89 | 90 | /// If several Revisions match the given prefix, a |
|
90 | 91 | /// [MultipleResults](NodeMapError) error is returned. |
@@ -167,14 +168,14 b' impl From<Element> for RawElement {' | |||
|
167 | 168 | /// |
|
168 | 169 | /// - absent (value -1) |
|
169 | 170 | /// - another `Block` in the same indexable container (value β₯ 0) |
|
170 | /// - a `Revision` leaf (value β€ -2) | |
|
171 | /// - a [`Revision`] leaf (value β€ -2) | |
|
171 | 172 | /// |
|
172 | 173 | /// Endianness has to be fixed for consistency on shared storage across |
|
173 | 174 | /// different architectures. |
|
174 | 175 | /// |
|
175 | 176 | /// A key difference with the C `nodetree` is that we need to be |
|
176 | 177 | /// able to represent the [`Block`] at index 0, hence -1 is the empty marker |
|
177 | /// rather than 0 and the `Revision` range upper limit of -2 instead of -1. | |
|
178 | /// rather than 0 and the [`Revision`] range upper limit of -2 instead of -1. | |
|
178 | 179 | /// |
|
179 | 180 | /// Another related difference is that `NULL_REVISION` (-1) is not |
|
180 | 181 | /// represented at all, because we want an immutable empty nodetree |
@@ -323,7 +324,7 b' impl NodeTree {' | |||
|
323 | 324 | NodeTree::new(Box::new(NodeTreeBytes::new(bytes, amount))) |
|
324 | 325 | } |
|
325 | 326 | |
|
326 | /// Retrieve added `Block` and the original immutable data | |
|
327 | /// Retrieve added [`Block`]s and the original immutable data | |
|
327 | 328 | pub fn into_readonly_and_added( |
|
328 | 329 | self, |
|
329 | 330 | ) -> (Box<dyn Deref<Target = [Block]> + Send>, Vec<Block>) { |
@@ -335,7 +336,7 b' impl NodeTree {' | |||
|
335 | 336 | (readonly, vec) |
|
336 | 337 | } |
|
337 | 338 | |
|
338 |
/// Retrieve added `Blocks |
|
|
339 | /// Retrieve added [`Block]s as bytes, ready to be written to persistent | |
|
339 | 340 | /// storage |
|
340 | 341 | pub fn into_readonly_and_added_bytes( |
|
341 | 342 | self, |
@@ -381,16 +382,17 b' impl NodeTree {' | |||
|
381 | 382 | /// |
|
382 | 383 | /// The first returned value is the result of analysing `NodeTree` data |
|
383 | 384 | /// *alone*: whereas `None` guarantees that the given prefix is absent |
|
384 | /// from the `NodeTree` data (but still could match `NULL_NODE`), with | |
|
385 |
/// `Some(rev)`, it is to be understood that `rev` is the unique |
|
|
386 |
/// that could match the prefix. Actually, all that can |
|
|
385 | /// from the [`NodeTree`] data (but still could match [`NULL_NODE`]), with | |
|
386 | /// `Some(rev)`, it is to be understood that `rev` is the unique | |
|
387 | /// [`Revision`] that could match the prefix. Actually, all that can | |
|
388 | /// be inferred from | |
|
387 | 389 | /// the `NodeTree` data is that `rev` is the revision with the longest |
|
388 | 390 | /// common node prefix with the given prefix. |
|
389 | 391 | /// |
|
390 | 392 | /// The second returned value is the size of the smallest subprefix |
|
391 | 393 | /// of `prefix` that would give the same result, i.e. not the |
|
392 |
/// |
|
|
393 | /// `NodeTree`). | |
|
394 | /// [MultipleResults](NodeMapError) error variant (again, using only the | |
|
395 | /// data of the [`NodeTree`]). | |
|
394 | 396 | fn lookup( |
|
395 | 397 | &self, |
|
396 | 398 | prefix: NodePrefix, |
General Comments 0
You need to be logged in to leave comments.
Login now