TmuxText
Immutable text bytes returned by tmux.
Source and package
- Qualified name
-
libtmux::formats:: text:: Tmux Text - Module
- formats.text
- Package
- libtmux
- Source
- crates/libtmux/src/formats/text.rs
-
Description#
TmuxTextpreserves 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 ascrate::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]);
Members6#
- 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.