Struct tinf::Desc [] [src]

pub struct Desc { /* fields omitted */ }

The names and capabilities that make up a terminal description.

Predefined capabilities are read by indexing a Desc object with a Boolean, Number, or String capability name. For example, desc[bw] returns a bool, desc[cols] returns a u16, and &desc[setaf] returns a &[u8]. User-defined capabilities are queried using the get_*_ext() methods.

An absent capability will be false, 0xffff, or an empty slice, for booleans, numbers, and strings respectively.

The desc! macro provides syntax for Desc literals.

Examples

Read the description for xterm-256color and look up the rs1 capability:

use tinf::Desc;
use tinf::cap::rs1;

let mut file = Desc::file("xterm-256color")?;
let desc = Desc::parse(&mut file)?;
assert_eq!(&desc[rs1], b"\x1bc\x1b]104\x07");

Methods

impl Desc
[src]

Finds and opens the compiled terminfo description for the terminal named by term_name.

This assumes that the local terminfo database uses a directory tree format for storing compiled descriptions, and it searches in these directories:

  1. The directory named by the TERMINFO environment variable.
  2. $HOME/.terminfo
  3. The list of directories named by the TERMINFO_DIRS environment variable (with empty entries replaced by /usr/share/terminfo).
  4. /etc/terminfo
  5. /lib/terminfo
  6. /usr/share/terminfo

For each directory, file checks for a description named term_name in a subdirectory named by the first letter of term_name as a character or hex representation, for example /x/xterm or /78/xterm. (Note that if term_name has more than one path component, only the last one is used).

Errors

This returns an error if file could not find and open a description for term_name, or if term_name is invalid.

Creates a Desc from a compiled terminfo description.

Errors

This returns an error if the input is not a valid terminfo description.

The description for the terminal type from the TERM environment variable, or the "dumb terminal" description if TERM is empty.

The terminal's names.

Query a user-defined boolean capability.

If the capability is absent, returns false.

List the names of any user-defined boolean capabilities.

Query a user-defined numeric capability.

If the capability is absent, returns 0xffff.

List the names of any user-defined numeric capabilities.

Query a user-defined string capability.

If the capability is absent, returns an empty slice.

List the names of any user-defined string capabilities.

Trait Implementations

impl Index<Boolean> for Desc
[src]

The returned type after indexing

The value of the boolean capability named by index.

impl Index<Number> for Desc
[src]

The returned type after indexing

The value of the numeric capability named by index.

impl Index<String> for Desc
[src]

The returned type after indexing

The value of the string capability named by index.

impl Clone for Desc
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Desc
[src]

Formats the value using the given formatter.