# target.TmuxArg

- **Module:** target
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/target.rs#L794
- **Page:** https://libtmux.org/en/rs/latest/reference/target-tmuxarg/

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

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`].

## Example

```rust
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}");
```

## Members

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