On this page
formats.text.TmuxText
- Module
- formats.text
- Package
- libtmux
- Source
- crates/libtmux/src/formats/text.rs
-
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: astrcannot hold those bytes, so nothing it contains can match.Examples
use libtmux::TmuxText; assert_eq!(TmuxText::from("editor"), *"editor"); assert!(TmuxText::from("editor") == "editor"); assert!(TmuxText::from(vec![0xff]) != "\u{fffd}");
6 declared, 0 inherited
Members
- as_bytes method
- as_flag method
- as_str method Borrow the stored bytes as UTF-8.
- from_bytes method Construct a value without validating or changing its bytes.
- parse method
- to_string_lossy method