Skip to content

Commit

Permalink
Merge pull request #64 from phimuemue/debug_find
Browse files Browse the repository at this point in the history
Implement `Debug` for `Find` (2)
  • Loading branch information
utkarshkukreti authored Jun 30, 2020
2 parents e280e91 + 880fc33 commit 52f6304
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ pub struct Find<'a, P> {
predicate: P,
}

impl<'a, P: Predicate> std::fmt::Debug for Find<'a, P> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Find")
.field("document", &self.document)
.field("next", &self.next)
// predicate may be closure not implementing Debug
.finish()
}
}

impl<'a, P: Predicate> Find<'a, P> {
pub fn into_selection(self) -> Selection<'a> {
Selection::new(self.document, self.map(|node| node.index()).collect())
Expand Down

0 comments on commit 52f6304

Please sign in to comment.