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.

method libtmux-rs latest

Pane.get

Read one field of this pane's snapshot, named by the handle that filters it.

Source and package
Qualified name
libtmux::pane::Pane::get
Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane.rs
#[cfg(feature = "query")] impl Pane #[must_use] pub fn get<F: ReadField<Self>>( &self, field: F ) -> Availability<F::Value<'_>>

Description#

Every field a pane listing fetches reads this way, including those with no getter of their own. Nothing is sent to tmux, so the value is as old as the snapshot; Self::refresh() renews it. The result says why a field holds no value: see Availability.

Examples#

use libtmux::query::Filterable as _;
use libtmux::{Availability, Pane, TmuxText};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("read").await?;
let mut pane = session.panes().await?.remove(0);
let fields = Pane::filter_fields();
// Outside copy mode tmux reports no scroll position at all.
assert_eq!(pane.get(fields.scroll_position), Availability::Absent);
pane.copy_mode().await?;
pane.refresh().await?;
assert_eq!(pane.get(fields.scroll_position), Availability::Available(0));
assert_eq!(
pane.get(fields.pane_mode),
Availability::Available(&TmuxText::from("copy-mode")),
);
assert_eq!(pane.get(fields.pane_id), Availability::Available(pane.id()));
guard.shutdown().await?;
Type parameters
Parameters
Esc

Type to search.

Reference previewOpen reference