Core Library0.xAPI reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

method libtmux-rs

Window.format

Expand a tmux format string in this window's context.

Source and package
Qualified name
libtmux::window::Window::format
Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
pub async fn format(&self, template: &str) -> Result< TmuxText, Error >
Completion
Returns a future that runs when awaited.signature · window.rs:970
Errors
Returns an error when tmux cannot be reached or refuses the format.doc comment · :949

Description

This returns display-message output instead of showing it in front of a person with Self::display(). See crate::Server::format() for the shell boundary around command and recursive formats.

Errors

Returns an error when tmux cannot be reached or refuses the format.

Parameters

Examples

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("shown").await?;
let window = session.active_window().await?.expect("a window");
let expanded = window.format("#{window_id}").await?;
assert_eq!(expanded.to_string_lossy(), window.id().to_string());
guard.shutdown().await?;

Recorded calls

source calls
No call edges in the Rust model.

The Rust reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls window.Window.format.

tmux command

task material

The tmux commands behind format.

tmux C API

task material

The C declarations in tmux that implement these commands.

Esc
Search in

Type to search.

Reference previewOpen reference