From 8acfa9c3feb322c7757707751491da1a88475668 Mon Sep 17 00:00:00 2001 From: data-pup Date: Fri, 22 Jun 2018 18:22:29 -0400 Subject: [PATCH] Edits to next_dfs() docstring example. --- src/unit.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/unit.rs b/src/unit.rs index 982a339ec..0b371f7a3 100644 --- a/src/unit.rs +++ b/src/unit.rs @@ -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; /// } ///