Core Library0.xAPI reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

method libtmux-rs

QueryIteratorExt.matching_owned

Lazily move items accepted by matcher, without cloning them.

Source and package
Qualified name
libtmux::query::QueryIteratorExt::matching_owned
Module
query
Declared in
QueryIteratorExt
Package
libtmux
Source
crates/libtmux/src/query.rs
#[allow(clippy::module_name_repetitions)] pub trait QueryIteratorExt: Iterator + Sized fn matching_owned<M: Matcher<Self::Item>>( self, matcher: M, ) -> impl Iterator<Item = Self::Item>
Ownership
The matcher borrows each item for the comparison. Use Self::matching() with iter() to retain a borrow of each item.doc comment · query.rs:533

Description

The matcher borrows each item for the comparison. Use Self::matching() with iter() to retain a borrow of each item. Ordinary Iterator::filter also accepts closures and infers their argument types; closures passed here need an explicit argument type.

Type parameters
Parameters

Examples

use libtmux::query::QueryIteratorExt;
let names = vec![String::from("build"), String::from("test")];
let selected = names
.into_iter()
.matching_owned(|name: &String| name.starts_with('b'))
.exactly_one()?;
assert_eq!(selected, "build");

Same owner

containment 1 of 4 shown

Other members of query.QueryIteratorExt whose names share matching_owned. They sit on the same type; that does not make them behave alike.

All 4 members of QueryIteratorExt

Recorded calls

source calls
No call edges in the Rust model.

The Rust reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls query.QueryIteratorExt.matching_owned.

Esc
Search in

Type to search.

Reference previewOpen reference