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

Session.get

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

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

Description#

Every field in SessionFields 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. The result says why a field holds no value: see Availability.

Examples#

use libtmux::query::Filterable as _;
use libtmux::{Availability, Session};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("read").await?;
let fields = Session::filter_fields();
// Nobody is attached, so nobody is attached twice.
assert_eq!(session.get(fields.session_many_attached), Availability::Available(false));
assert_eq!(session.get(fields.session_id), Availability::Available(session.id()));
guard.shutdown().await?;
Type parameters
Parameters
Esc

Type to search.

Reference previewOpen reference