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.

struct libtmux-rs latest

TmuxArg

Text bound for a tmux argument that tmux expands as a format.

Source and package
Qualified name
libtmux::target::TmuxArg
Module
target
Package
libtmux
Source
crates/libtmux/src/target.rs
struct target.TmuxArg

Description#

tmux runs its format machinery over a session or window name, a pane title, and a -c start directory before it uses them, so #(command) in caller text runs a shell. Every such argument in this crate takes this type, and every conversion into it escapes: text a program did not write arrives as itself, and asking for expansion is a visible call to TmuxArg::format().

Examples#

use libtmux::TmuxArg;
// The ordinary path. `From` escapes, so tmux stores what was asked.
let literal = TmuxArg::from("release#1");
assert_eq!(literal.as_os_str(), "release##1");
// Expansion is opt-in and reads as such.
let expanded = TmuxArg::format("#{pane_current_path}");
assert_eq!(expanded.as_os_str(), "#{pane_current_path}");

Members3#

  • as_os_str method Borrow the bytes as they will reach tmux, escaped or not.
  • format method Send template for tmux to expand as a format.
  • literal method Send text literally, escaping what tmux would otherwise expand.
Esc

Type to search.

Reference previewOpen reference