# snapshot.Availability

- **Module:** snapshot
- **Package:** libtmux
- **Language:** Rust
- **Kind:** enum
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/snapshot.rs#L60
- **Page:** https://libtmux.org/en/rs/latest/reference/snapshot-availability/

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

A listing asks tmux for every field its snapshot models, except one the
running tmux cannot have: a release older than the field gives
[`Unsupported`](Self::Unsupported), and a development build, which names no
release to compare, gives [`Unproven`](Self::Unproven) for any field newer
than the oldest supported release. Neither is fetched.

[`Absent`](Self::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`](crate::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".

## Example

```rust
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);
```

## Members

- `Unsupported` (constant): The running tmux release predates the field, so it was not fetched.
- `Unproven` (constant): A development build names no release to prove the field exists, so it was not fetched.
- `Absent` (constant): tmux was asked and reported nothing.
- `Available` (constant): tmux reported a value, which for text may be empty.
- `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.
