# formats.text.TmuxText

- **Module:** formats.text
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/formats/text.rs#L23
- **Page:** https://libtmux.org/reference/rs/formats-text-tmuxtext/

Compare tmux bytes against a string without converting either.

tmux text is bytes, but the thing it is usually compared against is a
literal. Requiring `.as_bytes()` at every comparison put the burden on the
common case to serve the rare one.

Text that is not valid UTF-8 never equals a `str`, which is the honest
answer: a `str` cannot hold those bytes, so nothing it contains can match.

## Example

```rust
use libtmux::TmuxText;

assert_eq!(TmuxText::from("editor"), *"editor");
assert!(TmuxText::from("editor") == "editor");
assert!(TmuxText::from(vec![0xff]) != "\u{fffd}");
```

## Members

- `from_bytes` (method) — Construct a value without validating or changing its bytes.
- `as_bytes` (method)
- `as_str` (method) — Borrow the stored bytes as UTF-8.
- `to_string_lossy` (method)
- `as_flag` (method)
- `parse` (method)
