mirror of
https://github.com/facebook/sapling.git
synced 2024-12-27 06:52:23 +03:00
manifest: rename Cursor to DfsCursor
Summary: Signal more clearly that the iteration in the cursor is depth first. Reviewed By: quark-zju Differential Revision: D18843135 fbshipit-source-id: 8ee2c612963eaf6fec3ae48f75ebf16bd177fed4
This commit is contained in:
parent
9274fe2661
commit
7cf94a2362
@ -93,7 +93,7 @@ impl<'a> Iterator for BfsIter<'a> {
|
||||
/// Because this structure intends to back iterators, it is designed so that `step()` is called on
|
||||
/// every invocation of `next()`. This should simplify iterator implementations what may want to
|
||||
/// return the root of the subtree that is being iterated.
|
||||
pub struct Cursor<'a> {
|
||||
pub struct DfsCursor<'a> {
|
||||
state: State,
|
||||
store: &'a InnerStore,
|
||||
path: RepoPathBuf,
|
||||
@ -121,10 +121,10 @@ enum State {
|
||||
Done,
|
||||
}
|
||||
|
||||
impl<'a> Cursor<'a> {
|
||||
impl<'a> DfsCursor<'a> {
|
||||
/// Default constructor for Cursor.
|
||||
pub fn new(store: &'a InnerStore, path: RepoPathBuf, link: &'a Link) -> Self {
|
||||
Cursor {
|
||||
DfsCursor {
|
||||
state: State::Init,
|
||||
store,
|
||||
path,
|
||||
@ -172,7 +172,7 @@ impl<'a> Cursor<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Cursor<'a> {
|
||||
impl<'a> DfsCursor<'a> {
|
||||
/// Advances the cursor towards a new [`Link`]. Visiting is done in pre-order.
|
||||
/// Errors are an interesting topic. At the time of this writing errors only appear when
|
||||
/// computing [`DurableEntry`] (which cache their failures). To protect against potential
|
||||
|
@ -31,7 +31,7 @@ pub(crate) use self::link::Link;
|
||||
pub use self::{diff::Diff, store::TreeStore};
|
||||
use crate::{
|
||||
tree::{
|
||||
iter::{BfsIter, Cursor, Step},
|
||||
iter::{BfsIter, DfsCursor, Step},
|
||||
link::{DirLink, Durable, DurableEntry, Ephemeral, Leaf},
|
||||
store::InnerStore,
|
||||
},
|
||||
@ -90,8 +90,8 @@ impl Tree {
|
||||
}
|
||||
}
|
||||
|
||||
fn root_cursor<'a>(&'a self) -> Cursor<'a> {
|
||||
Cursor::new(&self.store, RepoPathBuf::new(), &self.root)
|
||||
fn root_cursor<'a>(&'a self) -> DfsCursor<'a> {
|
||||
DfsCursor::new(&self.store, RepoPathBuf::new(), &self.root)
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ impl Tree {
|
||||
store: &'a InnerStore,
|
||||
path: RepoPathBuf,
|
||||
converted_nodes: Vec<(RepoPathBuf, HgId, Bytes, HgId, HgId)>,
|
||||
parent_trees: Vec<Cursor<'a>>,
|
||||
parent_trees: Vec<DfsCursor<'a>>,
|
||||
};
|
||||
impl<'a> Executor<'a> {
|
||||
fn new(store: &'a InnerStore, parent_trees: &[&'a Tree]) -> Result<Executor<'a>> {
|
||||
@ -1174,7 +1174,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_cursor_skip() {
|
||||
fn step<'a>(cursor: &mut Cursor<'a>) {
|
||||
fn step<'a>(cursor: &mut DfsCursor<'a>) {
|
||||
match cursor.step() {
|
||||
Step::Success => (),
|
||||
Step::End => panic!("reached the end too soon"),
|
||||
|
Loading…
Reference in New Issue
Block a user