papergrid::records::vec_records

Trait Cell

Source
pub trait Cell: AsRef<str> {
    // Required methods
    fn get_line(&self, i: usize) -> &str;
    fn count_lines(&self) -> usize;
    fn width<W>(&self, width_ctrl: W) -> usize
       where W: WidthFunc;
    fn line_width<W>(&self, i: usize, width_ctrl: W) -> usize
       where W: WidthFunc;

    // Provided methods
    fn fmt_prefix(&self, _: &mut Formatter<'_>) -> Result { ... }
    fn fmt_suffix(&self, _: &mut Formatter<'_>) -> Result { ... }
}
Expand description

Cell imlementation which can be used with VecRecords.

Required Methods§

Source

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

Gets a line by index.

Source

fn count_lines(&self) -> usize

Returns a number of lines cell has.

Source

fn width<W>(&self, width_ctrl: W) -> usize
where W: WidthFunc,

Returns a width of cell.

Source

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

Returns a width of cell line.

Provided Methods§

Source

fn fmt_prefix(&self, _: &mut Formatter<'_>) -> Result

Prints a prefix.

It might be usefull when used for ANSI prefix.

Source

fn fmt_suffix(&self, _: &mut Formatter<'_>) -> Result

Prints a suffix.

It might be usefull when used for ANSI suffix.

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.

Implementors§

Source§

impl Cell for CellInfo<'_>