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

TmuxText

Immutable text bytes returned by tmux.

Source and package
Qualified name
libtmux::formats::text::TmuxText
Module
formats.text
Package
libtmux
Source
crates/libtmux/src/formats/text.rs
struct formats.text.TmuxText

Description#

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]);

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.
Esc

Type to search.

Reference previewOpen reference