# server.discovery.SessionTree

- **Module:** server.discovery
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/server/discovery.rs#L321
- **Page:** https://libtmux.org/en/rs/latest/reference/server-discovery-sessiontree/

One session and everything under it, from [`Server::hierarchy`].

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("work").await?;
session.new_window("editor").await?;

// One round of listings for the whole hierarchy, rather than one call per
// session and another per window.
let tree = guard.server().hierarchy().await?;
let found = tree
    .iter()
    .find(|branch| branch.session.name().to_string_lossy() == "work")
    .expect("the session just created");
assert_eq!(found.windows.len(), 2);

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

## Members

- `session` (attribute): The session.
- `windows` (attribute): Its windows, in tmux's order. A window linked into several sessions appears under each of them, as the listings report it.
