# window.Window.get

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/window.rs#L1186
- **Page:** https://libtmux.org/en/rs/latest/reference/window-window-get/

```
window.Window.get(self, field: F) -> Availability<F::Value<'_>>
```

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

Every field in [`WindowFields`] 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`].

## Example

```rust
use libtmux::query::Filterable as _;
use libtmux::{Availability, Window};

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("read").await?;
let window = session.active_window().await?.expect("a session has a window");
let fields = Window::filter_fields();

// The layout as shown, which only differs from the layout while zoomed.
assert_eq!(
    window.get(fields.window_visible_layout),
    Availability::Available(window.layout()),
);
assert_eq!(window.get(fields.window_id), Availability::Available(window.id()));

guard.shutdown().await?;
```
