papergrid::records

Trait Records

Source
pub trait Records {
    // Required methods
    fn count_rows(&self) -> usize;
    fn count_columns(&self) -> usize;
    fn get_text(&self, pos: Position) -> &str;
    fn get_line(&self, pos: Position, i: usize) -> &str;
    fn count_lines(&self, pos: Position) -> usize;
    fn get_width<W>(&self, pos: Position, width_ctrl: W) -> usize
       where W: WidthFunc;
    fn get_line_width<W>(&self, pos: Position, i: usize, width_ctrl: W) -> usize
       where W: WidthFunc;
    fn fmt_text_prefix(&self, f: &mut Formatter<'_>, pos: Position) -> Result;
    fn fmt_text_suffix(&self, f: &mut Formatter<'_>, pos: Position) -> Result;
}
Expand description

The representaion of data, rows and columns of a Grid.

Required Methods§

Source

fn count_rows(&self) -> usize

Returns amount of rows on a grid.

Source

fn count_columns(&self) -> usize

Returns amount of columns on a grid.

Source

fn get_text(&self, pos: Position) -> &str

Returns a text of a cell by an index.

Source

fn get_line(&self, pos: Position, i: usize) -> &str

Returns a line of a text of a cell by an index.

Source

fn count_lines(&self, pos: Position) -> usize

Returns an amount of lines of a text of a cell by an index.

Source

fn get_width<W>(&self, pos: Position, width_ctrl: W) -> usize
where W: WidthFunc,

Returns a width of a text of a cell by an index.

Source

fn get_line_width<W>(&self, pos: Position, i: usize, width_ctrl: W) -> usize
where W: WidthFunc,

Returns a width of line of a text of a cell by an index.

Source

fn fmt_text_prefix(&self, f: &mut Formatter<'_>, pos: Position) -> Result

Prints a prefix of a text of a cell by an index.

Maybe be usefull in order to emit ANSI sequences.

Source

fn fmt_text_suffix(&self, f: &mut Formatter<'_>, pos: Position) -> Result

Prints a suffix of a text of a cell by an index.

Maybe be usefull in order to emit ANSI sequences.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<R> Records for &R
where R: Records,

Source§

fn count_rows(&self) -> usize

Source§

fn count_columns(&self) -> usize

Source§

fn get_text(&self, pos: Position) -> &str

Source§

fn get_line(&self, pos: Position, i: usize) -> &str

Source§

fn count_lines(&self, pos: Position) -> usize

Source§

fn get_width<W>(&self, pos: Position, width_ctrl: W) -> usize
where W: WidthFunc,

Source§

fn get_line_width<W>(&self, pos: Position, i: usize, width_ctrl: W) -> usize
where W: WidthFunc,

Source§

fn fmt_text_prefix(&self, f: &mut Formatter<'_>, pos: Position) -> Result

Source§

fn fmt_text_suffix(&self, f: &mut Formatter<'_>, pos: Position) -> Result

Implementors§