On this page
client.Client.attached_session
- Module
- client
- Declared in
- Client
- Package
- libtmux
- Source
- crates/libtmux/src/client.rs
-
The session this client is attached to.
Nonewhen the client is attached to nothing, which is an ordinary state rather than a failure.Resolved through
#{session_id}rather than#{client_session}. The latter is what tmux calls the attachment, but it is a *name*, and a name is not a handle: tmux will create a session calleda:band then refuse to address it, because:separates a session from a window in a target. The ID is unambiguous by construction.Errors
Returns an error when tmux cannot be reached, or answers with an ID this crate cannot parse.
Examples
let guard = libtmux::test::TestServer::new().await?; let server = guard.server(); let session = server.new_session("work").await?; // A control-mode connection is a client, so the server has one to find. let control = libtmux::control::ControlMode::attach(server, session.id()).await?; let client = server.clients().await?.into_iter().next().expect("one client"); let attached = client.attached_session().await?.expect("it is attached"); assert_eq!(attached.id(), session.id()); control.shutdown().await?; guard.shutdown().await?;
0 declared, 0 inherited