Skip to content

Commit c51e047

Browse files
authored
feat: add is_empty method to check if iterator contains no pairs (#1132)
1 parent d2dd16c commit c51e047

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pest/src/iterators/pairs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ impl<'i, R: RuleType> Pairs<'i, R> {
374374
}
375375
}
376376

377+
/// Returns `true` if the iterator contains no `Pair`s.
378+
pub fn is_empty(&self) -> bool {
379+
self.pairs_count == 0
380+
}
381+
377382
/// Generates a string that stores the lexical information of `self` in
378383
/// a pretty-printed JSON format.
379384
#[cfg(feature = "pretty-print")]

0 commit comments

Comments
 (0)