Struct Entry

Source
pub struct Entry { /* private fields */ }
Expand description

Description of a terminal and its capabilities.

Note that while this type exposes terminal names and user-defined capability names as strs, X/Open curses only specifies ISO 8859-1:1987 (“latin-1”) as the encoding, and allows any graphical character from that character set to be used for names. In practice however, files only use ASCII, so the parser currently rejects non-ASCII in terminal and capability names.

Implementations§

Source§

impl Entry

Source

pub fn parse(bytes: &[u8]) -> Result<Self, ParseError>

Parse an Entry from a byte slice.

Source

pub fn name(&self) -> &str

Returns the name of this terminal, for example xterm-256color.

Source

pub fn aliases(&self) -> impl Iterator<Item = &str> + '_

Returns an iterator over the aliases of this terminal.

Source

pub fn description(&self) -> Option<&str>

Returns the description of this terminal, for example xterm with 256 colors.

Source

pub fn get_boolean(&self, n: usize) -> bool

Returns the boolean capability with the given index.

Returns false if the capability is not defined for this terminal.

Source

pub fn get_integer(&self, n: usize) -> Option<i32>

Returns the integer capability with the given index.

Returns None if the capability is not defined for this terminal.

Source

pub fn get_string(&self, n: usize) -> Option<&[u8]>

Returns the string capability with the given index.

Returns None if the capability is not defined for this terminal.

Source

pub fn get_user_boolean(&self, name: &str) -> bool

Returns the user-defined boolean capability with the given name.

Returns false if the capability is not defined for this terminal.

Source

pub fn get_user_integer(&self, name: &str) -> Option<i32>

Returns the user-defined integer capability with the given name.

Returns None if the capability is not defined for this terminal.

Source

pub fn get_user_string(&self, name: &str) -> Option<&[u8]>

Returns the user-defined string capability with the given name.

Returns None if the capability is not defined for this terminal.

Source

pub fn booleans(&self) -> impl Iterator<Item = bool> + '_

Returns an iterator over all boolean capabilities of this terminal.

Source

pub fn integers(&self) -> impl Iterator<Item = Option<i32>> + '_

Returns an iterator over all integer capabilities of this terminal.

Source

pub fn strings(&self) -> impl Iterator<Item = Option<&[u8]>> + '_

Returns an iterator over all string capabilities of this terminal.

Source

pub fn user_booleans(&self) -> impl Iterator<Item = (&str, bool)> + '_

Returns an iterator over all user-defined boolean capabilities and their names.

Source

pub fn user_integers(&self) -> impl Iterator<Item = (&str, Option<i32>)> + '_

Returns an iterator over all user-defined integer capabilities and their names.

Source

pub fn user_strings(&self) -> impl Iterator<Item = (&str, Option<&[u8]>)> + '_

Returns an iterator over all user-defined string capabilities and their names.

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.