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
-
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, givesAvailability::Unprovenfor any field newer than the catalog's recorded tmux 3.2a baseline. Neither is fetched.Availability::Absentmeans tmux was asked and answered with nothing, which for some fields is the ordinary state: a pane outside copy mode has noscroll_position, and a pane straight fromPane::split()can report nopane_current_pathuntil 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);
Variants4#
| Case | Payload | Description |
|---|---|---|
| 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.