pub struct Session { /* private fields */ }Expand description
Opaque handle for one live daemon session.
The handle stores the daemon transport and exact protocol-owned session name. It never stores process environment supplied while creating the session.
Implementations§
Source§impl Session
impl Session
Sourcepub fn name(&self) -> &SessionName
pub fn name(&self) -> &SessionName
Returns the exact protocol-owned session name addressed by this handle.
Sourcepub fn endpoint(&self) -> &RmuxEndpoint
pub fn endpoint(&self) -> &RmuxEndpoint
Returns the endpoint that was resolved when this handle was created.
Sourcepub const fn configured_default_timeout(&self) -> Option<Duration>
pub const fn configured_default_timeout(&self) -> Option<Duration>
Returns the default timeout configured on the parent facade.
Sourcepub const fn was_created(&self) -> bool
pub const fn was_created(&self) -> bool
Returns whether the ensure operation created the session.
false means the handle was bound to a session that already existed
before the ensure request completed.
Returns caller-supplied creation tag intent, preserving explicit empty tag sets.
Sourcepub async fn is_listed(&self) -> Result<bool>
pub async fn is_listed(&self) -> Result<bool>
Checks whether this session appears in the daemon’s list-sessions
projection.
Sourcepub async fn list_session_names(&self) -> Result<Vec<SessionName>>
pub async fn list_session_names(&self) -> Result<Vec<SessionName>>
Lists exact session names currently reported by the daemon.
Sourcepub fn window(&self, window_index: u32) -> Window
pub fn window(&self, window_index: u32) -> Window
Returns a handle for a window slot in this session.
The handle is intentionally lazy: it records the exact target and
verifies liveness only when an operation such as split, panes,
info, or close is invoked. Linked windows and grouped sessions are
still resolved by the daemon on each operation rather than cached by the
handle.
Sourcepub fn pane(&self, window_index: u32, pane_index: u32) -> Pane
pub fn pane(&self, window_index: u32, pane_index: u32) -> Pane
Returns a handle for one pane slot inside a window of this session.
The handle records the exact (session, window, pane) triple and
resolves it through the daemon on every operation, so linked windows
and grouped sessions keep returning the same stable pane identity
across sibling views.
Sourcepub async fn pane_by_id(&self, pane_id: PaneId) -> Result<Pane>
pub async fn pane_by_id(&self, pane_id: PaneId) -> Result<Pane>
Returns a pane handle addressed by stable pane id.
The returned Pane has the same public type as a slot-based pane,
but input, resize, lifecycle, title, and snapshot operations use the
daemon’s stable pane-id targeting path. PaneId is stable only for
one daemon lifetime; callers that persist ids across reconnects must
re-validate them.
Sourcepub async fn new_window(&self) -> Result<Window>
pub async fn new_window(&self) -> Result<Window>
Creates a new window in this session and returns a live window handle.
This is an eager daemon mutation. Use Self::window when you only
need a lazy handle for an existing or future window slot.
Sourcepub fn new_window_with(&self) -> NewWindowBuilder<'_>
pub fn new_window_with(&self) -> NewWindowBuilder<'_>
Starts building a configurable new-window request for this session.
The default builder behavior matches tmux new-window: the created
window becomes active unless NewWindowBuilder::detached is set.
Sourcepub fn layout(&self) -> SessionLayoutBuilder<'_>
pub fn layout(&self) -> SessionLayoutBuilder<'_>
Starts a declarative SDK layout builder for this session.
Layouts are SDK-side composition over the existing pane split, spawn, title, and daemon spread-layout primitives. They do not add a daemon-native transaction; if an intermediate split or spawn fails, already-created panes remain visible for inspection and cleanup by the caller.