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.

enum libtmux-rs latest

Availability

A snapshot field's value, or the reason the snapshot holds none.

Source and package
Qualified name
libtmux::snapshot::Availability
Module
snapshot
Package
libtmux
Source
crates/libtmux/src/snapshot.rs
enum snapshot.Availability

Description#

A listing asks tmux for every field its snapshot models, except one the running tmux cannot have: a release older than the field gives Availability::Unsupported, and a development build, which names no release to compare, gives Availability::Unproven for any field newer than the catalog's recorded tmux 3.2a baseline. Neither is fetched.

Availability::Absent means tmux was asked and answered with nothing, which for some fields is the ordinary state: a pane outside copy mode has no scroll_position, and a pane straight from Pane::split() can report no pane_current_path until its process has started. tmux prints the same empty string for "no value" and "not yet", so re-reading is the only way to tell them apart.

Every snapshot fetches every field it models, so no variant means "this snapshot did not ask".

Examples#

use libtmux::Availability;
fn describe(scroll: Availability<i32>) -> String {
match scroll {
Availability::Available(lines) => format!("{lines} lines up"),
Availability::Absent => String::from("not in copy mode"),
_ => String::from("this tmux cannot say"),
}
}
assert_eq!(describe(Availability::Available(3)), "3 lines up");
assert_eq!(Availability::Available(3).available(), Some(3));
assert_eq!(Availability::<i32>::Absent.available(), None);
Type parameters

Variants4#

Availability variants
CasePayloadDescription
Absent No payload tmux was asked and reported nothing.
Available (T) tmux reported a value, which for text may be empty.
Unproven No payload A development build names no release to prove the field exists, so it was not fetched.
Unsupported No payload The running tmux release predates the field, so it was not fetched.

Members3#

  • as_ref method Borrow the value, keeping the reason when there is none.
  • available method Return the value, discarding the reason when there is none.
  • is_available method Report whether tmux reported a value.

Guides#

Pages that discuss Availability.

Esc

Type to search.

Reference previewOpen reference