On this page
server.discovery.Server.sessions_or_empty
- Module
- server.discovery
- Declared in
- Server
- Package
- libtmux
- Source
- crates/libtmux/src/server/discovery.rs
-
List every session on the server, in tmux's own order.
This is the lenient form: a server that is not running, or any other failure of the underlying list operation, yields an empty
Vec. UseServer::sessionswhen the reason matters.Examples
let guard = libtmux::test::TestServer::new().await?; let server = guard.server(); // A fixture starts with no sessions. The lenient form reports that as // an empty listing rather than as the failure it also collapses. assert!(server.sessions_or_empty().await.is_empty()); guard.session("work").await?; let sessions = server.sessions_or_empty().await; assert_eq!(sessions.len(), 1); assert_eq!(sessions[0].name().as_bytes(), b"work"); guard.shutdown().await?;
0 declared, 0 inherited