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.

method libtmux-rs latest

TmuxText.parse

Parse these bytes as any type that reads from a string.

Source and package
Qualified name
libtmux::formats::text::TmuxText::parse
Module
formats.text
Declared in
TmuxText
Package
libtmux
Source
crates/libtmux/src/formats/text.rs
#[must_use] pub fn parse<T: std::str::FromStr>(&self) -> Option<T>

Description#

Returns None when the bytes are not UTF-8 or do not parse, so a caller reading a numeric option does not have to check both.

Examples#

use libtmux::TmuxText;
assert_eq!(TmuxText::from("2000").parse::<u32>(), Some(2000));
assert_eq!(TmuxText::from("many").parse::<u32>(), None);
Type parameters
  • T #

    Bound std::str::FromStr

Esc

Type to search.

Reference previewOpen reference