Struct nixterm::terminfo::TermInfo[][src]

pub struct TermInfo<'a> { /* fields omitted */ }

TermInfo is immutable terminfo data.

To mutate TermInfo use TermInfo::into<TermInfoBuf>() to get a TermInfoBuf struct. Generally, the TermInfo struct is good for quickly peeking at terminfo file. It is fast, and makes no allocations, however it cannot be modified, and is difficult to use over a long period of time, since the buffer it parsed has to live along side it.

Methods

impl<'a> TermInfo<'a>
[src]

Parse a terminfo file from a buffer.

Example

use std::io;
use std::io::prelude::*;
use std::fs::File;
use nixterm::terminfo;

fn main() {
    let mut data = Vec::new();

    File::open("/usr/share/terminfo/x/xterm")
        .unwrap()
        .read_to_end(&mut data);
    let info = terminfo::TermInfo::parse(&data).unwrap();

    assert_eq!(info.boolean(terminfo::AutoLeftMargin), false);
}

Get an iterator over the terminal's name(s)

The first name is generally the primary one, for example XTerm's first name is "xterm". The following names will usually be longer. Sometimes they will describe this terminal (e.g. linux-16color's second name is "linux console with 16 colors"). Other names may expand on the first name if it is an acronym (e.g. kitty's second name is "KovIdTTY").

Get a numeric field.

Not all terminals will include a value for every field enumerated in NumericField.

Get a boolean field.

Not all terminals will include a value for every field enumerated in BooleanField. boolean will return false if a value is missing.

Get a string field.

Not all terminals will include a value for every field enumerated in StringField.

Check if the the terminfo file has an extensions section

If this method returns false then the TermInfo::ext_* methods won't fail. However TermInfo::ext_boolean will always return false, and TermInfo::ext_number and TermInfo::ext_string will always return None.

This method is identical to TermInfo::boolean, except the boolean is identified with a string.

This method is identified to Terminfo::number, except the number is identified by a string.

This method is identified to Terminfo::string, except the string is identified by a string.

Trait Implementations

impl<'a> Debug for TermInfo<'a>
[src]

Formats the value using the given formatter. Read more

impl<'a> Clone for TermInfo<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> From<TermInfo<'a>> for TermInfoBuf
[src]

Performs the conversion.

impl<'a> From<&'a TermInfo<'a>> for TermInfoBuf
[src]

Performs the conversion.

Auto Trait Implementations

impl<'a> Send for TermInfo<'a>

impl<'a> Sync for TermInfo<'a>