papergrid

Struct GridConfig

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

This structure represents a settings of a grid.

grid: crate::Grid.

Implementations§

Source§

impl GridConfig

Source

pub fn set_column_span(&mut self, pos: Position, span: usize)

Set a column span to a given cells.

Source

pub fn get_column_span( &self, pos: Position, shape: (usize, usize), ) -> Option<usize>

Get a span value of the cell, if any is set.

Source

pub fn has_column_spans(&self) -> bool

Verifies if there’s any spans set.

Source

pub fn iter_column_spans( &self, shape: (usize, usize), ) -> impl Iterator<Item = (Position, usize)> + '_

Get a span value of the cell, if any is set.

Source

pub fn set_row_span(&mut self, pos: Position, span: usize)

Set a column span to a given cells.

Source

pub fn get_row_span( &self, pos: Position, shape: (usize, usize), ) -> Option<usize>

Get a span value of the cell, if any is set.

Source

pub fn has_row_spans(&self) -> bool

Verifies if there’s any spans set.

Source

pub fn iter_row_spans( &self, shape: (usize, usize), ) -> impl Iterator<Item = (Position, usize)> + '_

Get a span value of the cell, if any is set.

Source

pub fn set_margin(&mut self, margin: Margin)

Set a Margin value.

Source

pub fn get_margin(&self) -> &Margin

Returns a Margin value currently set.

Source

pub fn set_margin_offset(&mut self, margin: Sides<Offset>)

Set Margin offset.

Source

pub fn get_margin_offset(&self) -> &Sides<Offset>

Returns a Margin offset.

Source

pub fn clear_theme(&mut self)

Clears all theme changes. And sets it to default.

Source

pub fn set_borders(&mut self, borders: Borders<char>)

Set the Borders value as currect one.

Source

pub fn get_global_border(&self) -> Option<&char>

Gets a global border value if set.

Source

pub fn set_global_border(&mut self, c: char)

Set the all Borders values to a char.

Source

pub fn set_tab_width(&mut self, width: usize)

Set tab width in spaces.

Source

pub fn get_tab_width(&self) -> usize

Get tab width value in spaces.

Source

pub fn get_borders(&self) -> &Borders<char>

Returns a current Borders structure.

Source

pub fn set_horizontal_line(&mut self, row: usize, line: HorizontalLine<char>)

Set the border line by row index.

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn remove_horizontal_line(&mut self, row: usize)

Sets off the border line by row index if any were set

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn get_vertical_line(&self, row: usize) -> Option<&VerticalLine<char>>

Gets a overriden vertical line.

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn set_vertical_line(&mut self, row: usize, line: VerticalLine<char>)

Set the border line by column index.

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn remove_vertical_line(&mut self, row: usize)

Sets off the border line by row index if any were set

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn get_horizontal_line(&self, row: usize) -> Option<&HorizontalLine<char>>

Gets a overriden line.

Row 0 means the top row. Row grid.count_rows() means the bottom row.

Source

pub fn override_split_line( &mut self, row: usize, line: impl Into<String>, offset: Offset, )

Override the split line with a custom text.

If borders are not set the string won’t be rendered.

Source

pub fn get_split_line_text(&self, row: usize) -> Option<&str>

Gets a set text to a border line by index

Source

pub fn get_split_line_offset(&self, row: usize) -> Option<Offset>

Gets a set text to a border line by index

Source

pub fn remove_split_line_text(&mut self, row: usize) -> Option<(String, Offset)>

Removes a split line text if any set.

Source

pub fn override_horizontal_border( &mut self, pos: Position, c: char, offset: Offset, )

Override a character on a horizontal line.

If borders are not set the char won’t be used.

Source

pub fn lookup_overidden_horizontal( &self, pos: Position, offset: usize, end: usize, ) -> Option<char>

Get a list of overriden chars in a horizontal border.

Source

pub fn is_overidden_horizontal(&self, pos: Position) -> bool

Checks if there any char in a horizontal border being overriden.

Source

pub fn remove_overidden_horizontal(&mut self, pos: Position)

Removes a list of overriden chars in a horizontal border.

Source

pub fn override_vertical_border( &mut self, pos: Position, c: char, offset: Offset, )

Override a vertical split line.

If borders are not set the char won’t be used.

Source

pub fn lookup_overidden_vertical( &self, pos: Position, offset: usize, end: usize, ) -> Option<char>

Get a list of overriden chars in a horizontal border.

Source

pub fn is_overidden_vertical(&self, pos: Position) -> bool

Checks if there any char in a horizontal border being overriden.

Source

pub fn remove_overidden_vertical(&mut self, pos: Position)

Removes a list of overriden chars in a horizontal border.

Source

pub fn set_padding(&mut self, entity: Entity, padding: Padding)

Set a padding to a given cells.

Source

pub fn get_padding(&self, entity: Entity) -> &Padding

Get a padding for a given Entity.

Source

pub fn set_formatting(&mut self, entity: Entity, formatting: Formatting)

Set a formatting to a given cells.

Source

pub fn get_formatting(&self, entity: Entity) -> &Formatting

Get a formatting settings for a given Entity.

Source

pub fn set_alignment_vertical( &mut self, entity: Entity, alignment: AlignmentVertical, )

Set a vertical alignment to a given cells.

Source

pub fn get_alignment_vertical(&self, entity: Entity) -> &AlignmentVertical

Get a vertical alignment for a given Entity.

Source

pub fn set_alignment_horizontal( &mut self, entity: Entity, alignment: AlignmentHorizontal, )

Set a horizontal alignment to a given cells.

Source

pub fn get_alignment_horizontal(&self, entity: Entity) -> &AlignmentHorizontal

Get a horizontal alignment for a given Entity.

Source

pub fn is_cell_visible(&self, pos: Position, shape: (usize, usize)) -> bool

The function returns whether the cells will be rendered or it will be hidden because of a span.

Source

pub fn is_cell_covered_by_row_span( &self, pos: Position, shape: (usize, usize), ) -> bool

The function checks if a cell is hidden because of a row span.

Source

pub fn is_cell_covered_by_column_span( &self, pos: Position, shape: (usize, usize), ) -> bool

The function checks if a cell is hidden because of a column span.

Source

pub fn is_cell_covered_by_both_spans( &self, pos: Position, shape: (usize, usize), ) -> bool

The function checks if a cell is hidden indirectly because of a row and column span combination.

Source

pub fn has_vertical(&self, col: usize, count_columns: usize) -> bool

Checks if grid would have a vertical border with the current configuration.

grid: crate::Grid

Source

pub fn has_horizontal(&self, row: usize, count_rows: usize) -> bool

Checks if grid would have a horizontal border with the current configuration.

grid: crate::Grid

Source

pub fn set_border(&mut self, pos: Position, border: Border)

Set border set a border value to all cells in Entity.

Source

pub fn remove_border(&mut self, pos: Position, shape: (usize, usize))

Sets off all borders possible on the Entity.

It doesn’t changes globaly set borders through GridConfig::set_borders.

Source

pub fn set_borders_missing(&mut self, c: char)

Set a character wich will be used in case any missconfiguration of borders.

It will be usde for example when you set a left char for border frame and top but didn’t set a top left corner.

Source

pub fn count_vertical(&self, count_columns: usize) -> usize

Calculates an amount of vertical lines would present on the grid.

grid: crate::Grid

Source

pub fn count_horizontal(&self, count_rows: usize) -> usize

Calculates an amount of horizontal lines would present on the grid.

grid: crate::Grid

Source

pub fn get_border(&self, pos: Position, shape: (usize, usize)) -> Border<char>

Returns a border of a cell.

Source

pub fn get_vertical(&self, pos: Position, count_columns: usize) -> Option<&char>

Gets a vertical character which would be rendered on the grid.

grid: crate::Grid

Source

pub fn get_horizontal(&self, pos: Position, count_rows: usize) -> Option<&char>

Gets a horizontal character which would be rendered on the grid.

grid: crate::Grid

Source

pub fn get_intersection( &self, pos: Position, shape: (usize, usize), ) -> Option<&char>

Gets an intersection character which would be rendered on the grid.

grid: crate::Grid

Trait Implementations§

Source§

impl Clone for GridConfig

Source§

fn clone(&self) -> GridConfig

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GridConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.