# server.Server.hierarchy

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

```
server.Server.hierarchy(self) -> Result<Vec<SessionTree>, Error>
```

Fetch the whole hierarchy in three commands.

Walking down with [`Server::sessions`], then each session's windows,
then each window's panes costs one command per object. tmux can answer
the same question with `list-sessions`, `list-windows -a`, and
`list-panes -a`, so this issues three regardless of how much is
running and stitches the result by winlink.

Use it when you want everything. Use the scoped accessors when you
want one branch: they fetch less.

The three listings are separate tmux commands, so this is not an
atomic capture. A window created between them appears in one listing
and not another, and is dropped rather than reported half-formed.

# Errors

Returns an error when any of the three listings fails.
