Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edits to next_dfs() docstring example. #307

Merged
merged 1 commit into from
Jun 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2053,12 +2053,13 @@ impl<'abbrev, 'unit, R: Reader> EntriesCursor<'abbrev, 'unit, R> {
/// // Move the cursor to the root.
/// assert!(cursor.next_dfs().unwrap().is_some());
///
/// // Keep looping while the cursor is moving deeper into the DIE tree.
/// // Traverse the DIE tree in depth-first search order.
/// let mut depth = 0;
/// while let Some((delta_depth, current)) = cursor.next_dfs().expect("Should parse next dfs") {
/// // 0 means we moved to a sibling, a negative number means we went back
/// // up to a parent's sibling. In either case, bail out of the loop because
/// // we aren't going deeper into the tree anymore.
/// if delta_depth <= 0 {
/// // Update depth value, and break out of the loop when we
/// // return to the original starting position.
/// depth += delta_depth;
/// if depth <= 0 {
/// break;
/// }
///
Expand Down