# session.Session.search_windows

- **Module:** session.Session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/session.rs#L318
- **Page:** https://libtmux.org/en/rs/latest/reference/session-session-search_windows/

```
session.Session.search_windows(self, matcher: M) -> Result<Vec<Window>, Error>
```

The windows under this session that a matcher accepts, reporting why if the listing fails.

# Errors

Returns an error when tmux cannot be reached or refuses the listing.

## Example

```rust
use libtmux::query::Filterable as _;

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("searched").await?;
session.new_window("build").await?;

let fields = libtmux::Window::filter_fields();
let found = session.search_windows(&fields.window_name.eq("build")).await?;
assert_eq!(found.len(), 1);

guard.shutdown().await?;
```
