QueryIteratorExt
Cardinality and named-predicate operations for native iterators.
Source and package
- Qualified name
-
libtmux::query:: Query Iterator Ext - Module
- query
- Package
- libtmux
- Source
- crates/libtmux/src/query.rs
-
Description#
Self::matching()borrows candidates from a borrowed iterator;Self::matching_owned()moves each selected item from its iterator. Cardinality methods preserve the iterator's item type in either case.Examples#
use libtmux::query::QueryIteratorExt;let values = [1, 2, 3];assert_eq!(values.iter().exactly_one(), Err(libtmux::query::ExactlyOneError::MultipleItems));
Members4#
- exactly_one method Return the only item, or an error for zero or multiple items.
- matching method Lazily yield candidates accepted by
matcher. - one_or_none method Return zero or one item, or an error for multiple items.
- matching_owned method Lazily move items accepted by
matcher, without cloning them.