# server.discovery.Server.session

- **Module:** server.discovery.Server
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/server/discovery.rs#L155
- **Page:** https://libtmux.org/reference/rs/server-discovery-server-session/

```
server.discovery.Server.session(self, name: impl AsRef<[u8]>) -> Result<Option<Session>, Error>
```

Find the session with this exact name.

Names are compared as bytes, because tmux permits names that are not
valid UTF-8.

The comparison happens here rather than through tmux's `-f`, which
would filter server-side but requires building a format string around
the name. A name containing `#`, `}`, or a comma would change the
predicate's meaning, and tmux documents no escaping for those values,
so a lookup would be an injection point.

# Errors

Returns an error when the session listing fails.
