libtmux Reference MCP Search
On this page

window.Window.with_pane

View as Markdown

Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
with_pane ( self , options : impl Into<SplitOptions> , operation : impl AsyncFnOnce(&Pane) -> Result<T, E> ) Result<T, E>
method [source]
method [source]
with_pane

Create a pane, run an operation with it, then kill it.

Once this future is polled, the scope owns creation and cleanup. Cancellation or unwinding can let an in-flight creation finish, but a pane whose creation yields a handle is killed while the Tokio runtime remains active. Ordinary handle Drop remains non-destructive.

Setup and teardown failures convert into the operation's own error type, so a caller writes one ? rather than unwrapping twice. When both the operation and cleanup fail, the cleanup error is returned as Error::AfterEffect , because tmux had already accepted the scope's creation; the operation error is discarded. When the operation fails and cleanup succeeds, its generic error is returned unchanged: the scope cannot certify replay safety for arbitrary callback work. A canceled caller cannot receive a cleanup error, so tracing is its only report.

Errors

Returns the operation's error, or a converted [Error] when the pane could not be created or could not be killed after creation.

0 declared, 0 inherited

Esc

Type to search.