Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

formats.text.TmuxText

Rust
  • Python Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
formats.text
Package
libtmux
Source
crates/libtmux/src/formats/text.rs
struct formats.text.TmuxText
structoverload [source]
structoverload [source]
struct formats.text.TmuxText

Immutable text bytes returned by tmux.

TmuxText preserves bytes exactly. Callers choose whether to inspect the raw bytes, require UTF-8, or decode lossily. [`AsRef<[u8]>`] borrows those bytes, including invalid UTF-8, so accessor results can be passed directly to name lookups such as crate::Server::session .

Examples

use libtmux::TmuxText;
let borrowed = TmuxText::from("session");
let owned = TmuxText::from(String::from("window"));
let bytes = TmuxText::from(vec![b'p', 0xff]);
assert_eq!(borrowed.as_bytes(), b"session");
assert_eq!(owned.as_bytes(), b"window");
assert_eq!(bytes.as_bytes(), [b'p', 0xff]);

6 declared, 0 inherited

Members

  • as_bytes method Return the exact stored bytes.
  • as_flag method Interpret these bytes as a tmux flag.
  • as_str method Borrow the stored bytes as UTF-8.
  • from_bytes method Construct a value without validating or changing its bytes.
  • parse method Parse these bytes as any type that reads from a string.
  • to_string_lossy method Decode the stored bytes with replacement characters for invalid UTF-8.
Esc

Type to search.