# Libtmux.Query

- **Package:** libtmux
- **Language:** OCaml
- **Kind:** module
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/lib/libtmux.mli#L694
- **Public owner:** Libtmux
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux-query/

```ocaml
module Query
```

Sequence adapters and bounded cardinality checks over captured values. Matching preserves order and duplicates. Expected absence and ambiguity remain ordinary result values.

## Members

### Common operations

- [`exactly_one`](/en/ocaml/latest/reference/libtmux-query-exactly_one/) (function): Return the unique value. Stop when a second value is found; proving uniqueness requires exhausting the remaining sequence. The input's effects and exceptions propagate. This does not execute a mutation.
- [`matching`](/en/ocaml/latest/reference/libtmux-query-matching/) (function): `matching expression` compiles once when the adapter is constructed. Filtering preserves order and duplicates. Snapshot-derived sequences replay captured values; arbitrary input sequences retain their effects, exceptions and replay semantics. No tmux acquisition occurs.
- [`one_or_none`](/en/ocaml/latest/reference/libtmux-query-one_or_none/) (function): As {!exactly_one}, with `Ok None` for an empty sequence. Order and duplicate entries count toward cardinality; values are not deduplicated.
