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.

trait libtmux-rs latest

ReadField

A field handle whose value a Target snapshot holds.

Source and package
Qualified name
libtmux::snapshot::ReadField
Module
snapshot
Package
libtmux
Source
crates/libtmux/src/snapshot.rs
trait snapshot.ReadField

Description#

Every handle in PaneFields, WindowFields, SessionFields and ClientFields implements it for the handle type it filters, so the name that filters a field also reads it: pass the handle to Pane::get(), Window::get(), Session::get() or Client::get(). A read never asks tmux. The trait is sealed.

Examples#

use libtmux::query::{Filterable as _, ReadField};
use libtmux::{Availability, Pane};
// Any field of a pane, read the same way.
fn read<F: ReadField<Pane>>(pane: &Pane, field: F) -> Availability<F::Value<'_>> {
pane.get(field)
}
let fields = Pane::filter_fields();
let column: Availability<u32> = read(pane, fields.cursor_x);
Type parameters
Esc

Type to search.

Reference previewOpen reference