pub struct GridConfig { /* private fields */ }
Expand description
This structure represents a settings of a grid.
grid: crate::Grid.
Implementations§
Source§impl GridConfig
impl GridConfig
Sourcepub fn set_column_span(&mut self, pos: Position, span: usize)
pub fn set_column_span(&mut self, pos: Position, span: usize)
Set a column span to a given cells.
Sourcepub fn get_column_span(
&self,
pos: Position,
shape: (usize, usize),
) -> Option<usize>
pub fn get_column_span( &self, pos: Position, shape: (usize, usize), ) -> Option<usize>
Get a span value of the cell, if any is set.
Sourcepub fn has_column_spans(&self) -> bool
pub fn has_column_spans(&self) -> bool
Verifies if there’s any spans set.
Sourcepub fn iter_column_spans(
&self,
shape: (usize, usize),
) -> impl Iterator<Item = (Position, usize)> + '_
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.
Sourcepub fn set_row_span(&mut self, pos: Position, span: usize)
pub fn set_row_span(&mut self, pos: Position, span: usize)
Set a column span to a given cells.
Sourcepub fn get_row_span(
&self,
pos: Position,
shape: (usize, usize),
) -> Option<usize>
pub fn get_row_span( &self, pos: Position, shape: (usize, usize), ) -> Option<usize>
Get a span value of the cell, if any is set.
Sourcepub fn has_row_spans(&self) -> bool
pub fn has_row_spans(&self) -> bool
Verifies if there’s any spans set.
Sourcepub fn iter_row_spans(
&self,
shape: (usize, usize),
) -> impl Iterator<Item = (Position, usize)> + '_
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.
Sourcepub fn set_margin(&mut self, margin: Margin)
pub fn set_margin(&mut self, margin: Margin)
Set a Margin
value.
Sourcepub fn get_margin(&self) -> &Margin
pub fn get_margin(&self) -> &Margin
Returns a Margin
value currently set.
Sourcepub fn set_margin_offset(&mut self, margin: Sides<Offset>)
pub fn set_margin_offset(&mut self, margin: Sides<Offset>)
Set Margin
offset.
Sourcepub fn get_margin_offset(&self) -> &Sides<Offset>
pub fn get_margin_offset(&self) -> &Sides<Offset>
Returns a Margin
offset.
Sourcepub fn clear_theme(&mut self)
pub fn clear_theme(&mut self)
Clears all theme changes. And sets it to default.
Sourcepub fn set_borders(&mut self, borders: Borders<char>)
pub fn set_borders(&mut self, borders: Borders<char>)
Set the Borders
value as currect one.
Sourcepub fn get_global_border(&self) -> Option<&char>
pub fn get_global_border(&self) -> Option<&char>
Gets a global border value if set.
Sourcepub fn set_global_border(&mut self, c: char)
pub fn set_global_border(&mut self, c: char)
Set the all Borders
values to a char.
Sourcepub fn set_tab_width(&mut self, width: usize)
pub fn set_tab_width(&mut self, width: usize)
Set tab width in spaces.
Sourcepub fn get_tab_width(&self) -> usize
pub fn get_tab_width(&self) -> usize
Get tab width value in spaces.
Sourcepub fn get_borders(&self) -> &Borders<char>
pub fn get_borders(&self) -> &Borders<char>
Returns a current Borders
structure.
Sourcepub fn set_horizontal_line(&mut self, row: usize, line: HorizontalLine<char>)
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.
Sourcepub fn remove_horizontal_line(&mut self, row: usize)
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.
Sourcepub fn get_vertical_line(&self, row: usize) -> Option<&VerticalLine<char>>
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.
Sourcepub fn set_vertical_line(&mut self, row: usize, line: VerticalLine<char>)
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.
Sourcepub fn remove_vertical_line(&mut self, row: usize)
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.
Sourcepub fn get_horizontal_line(&self, row: usize) -> Option<&HorizontalLine<char>>
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.
Sourcepub fn override_split_line(
&mut self,
row: usize,
line: impl Into<String>,
offset: Offset,
)
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.
Sourcepub fn get_split_line_text(&self, row: usize) -> Option<&str>
pub fn get_split_line_text(&self, row: usize) -> Option<&str>
Gets a set text to a border line by index
Sourcepub fn get_split_line_offset(&self, row: usize) -> Option<Offset>
pub fn get_split_line_offset(&self, row: usize) -> Option<Offset>
Gets a set text to a border line by index
Sourcepub fn remove_split_line_text(&mut self, row: usize) -> Option<(String, Offset)>
pub fn remove_split_line_text(&mut self, row: usize) -> Option<(String, Offset)>
Removes a split line text if any set.
Sourcepub fn override_horizontal_border(
&mut self,
pos: Position,
c: char,
offset: Offset,
)
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.
Sourcepub fn lookup_overidden_horizontal(
&self,
pos: Position,
offset: usize,
end: usize,
) -> Option<char>
pub fn lookup_overidden_horizontal( &self, pos: Position, offset: usize, end: usize, ) -> Option<char>
Get a list of overriden chars in a horizontal border.
Sourcepub fn is_overidden_horizontal(&self, pos: Position) -> bool
pub fn is_overidden_horizontal(&self, pos: Position) -> bool
Checks if there any char in a horizontal border being overriden.
Sourcepub fn remove_overidden_horizontal(&mut self, pos: Position)
pub fn remove_overidden_horizontal(&mut self, pos: Position)
Removes a list of overriden chars in a horizontal border.
Sourcepub fn override_vertical_border(
&mut self,
pos: Position,
c: char,
offset: Offset,
)
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.
Sourcepub fn lookup_overidden_vertical(
&self,
pos: Position,
offset: usize,
end: usize,
) -> Option<char>
pub fn lookup_overidden_vertical( &self, pos: Position, offset: usize, end: usize, ) -> Option<char>
Get a list of overriden chars in a horizontal border.
Sourcepub fn is_overidden_vertical(&self, pos: Position) -> bool
pub fn is_overidden_vertical(&self, pos: Position) -> bool
Checks if there any char in a horizontal border being overriden.
Sourcepub fn remove_overidden_vertical(&mut self, pos: Position)
pub fn remove_overidden_vertical(&mut self, pos: Position)
Removes a list of overriden chars in a horizontal border.
Sourcepub fn set_padding(&mut self, entity: Entity, padding: Padding)
pub fn set_padding(&mut self, entity: Entity, padding: Padding)
Set a padding to a given cells.
Sourcepub fn get_padding(&self, entity: Entity) -> &Padding
pub fn get_padding(&self, entity: Entity) -> &Padding
Get a padding for a given Entity.
Sourcepub fn set_formatting(&mut self, entity: Entity, formatting: Formatting)
pub fn set_formatting(&mut self, entity: Entity, formatting: Formatting)
Set a formatting to a given cells.
Sourcepub fn get_formatting(&self, entity: Entity) -> &Formatting
pub fn get_formatting(&self, entity: Entity) -> &Formatting
Get a formatting settings for a given Entity.
Sourcepub fn set_alignment_vertical(
&mut self,
entity: Entity,
alignment: AlignmentVertical,
)
pub fn set_alignment_vertical( &mut self, entity: Entity, alignment: AlignmentVertical, )
Set a vertical alignment to a given cells.
Sourcepub fn get_alignment_vertical(&self, entity: Entity) -> &AlignmentVertical
pub fn get_alignment_vertical(&self, entity: Entity) -> &AlignmentVertical
Get a vertical alignment for a given Entity.
Sourcepub fn set_alignment_horizontal(
&mut self,
entity: Entity,
alignment: AlignmentHorizontal,
)
pub fn set_alignment_horizontal( &mut self, entity: Entity, alignment: AlignmentHorizontal, )
Set a horizontal alignment to a given cells.
Sourcepub fn get_alignment_horizontal(&self, entity: Entity) -> &AlignmentHorizontal
pub fn get_alignment_horizontal(&self, entity: Entity) -> &AlignmentHorizontal
Get a horizontal alignment for a given Entity.
Sourcepub fn is_cell_visible(&self, pos: Position, shape: (usize, usize)) -> bool
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.
Sourcepub fn is_cell_covered_by_row_span(
&self,
pos: Position,
shape: (usize, usize),
) -> bool
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.
Sourcepub fn is_cell_covered_by_column_span(
&self,
pos: Position,
shape: (usize, usize),
) -> bool
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.
Sourcepub fn is_cell_covered_by_both_spans(
&self,
pos: Position,
shape: (usize, usize),
) -> bool
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.
Sourcepub fn has_vertical(&self, col: usize, count_columns: usize) -> bool
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
Sourcepub fn has_horizontal(&self, row: usize, count_rows: usize) -> bool
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
Sourcepub fn set_border(&mut self, pos: Position, border: Border)
pub fn set_border(&mut self, pos: Position, border: Border)
Set border set a border value to all cells in Entity
.
Sourcepub fn remove_border(&mut self, pos: Position, shape: (usize, usize))
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
.
Sourcepub fn set_borders_missing(&mut self, c: char)
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.
Sourcepub fn count_vertical(&self, count_columns: usize) -> usize
pub fn count_vertical(&self, count_columns: usize) -> usize
Calculates an amount of vertical lines would present on the grid.
grid: crate::Grid
Sourcepub fn count_horizontal(&self, count_rows: usize) -> usize
pub fn count_horizontal(&self, count_rows: usize) -> usize
Calculates an amount of horizontal lines would present on the grid.
grid: crate::Grid
Sourcepub fn get_border(&self, pos: Position, shape: (usize, usize)) -> Border<char>
pub fn get_border(&self, pos: Position, shape: (usize, usize)) -> Border<char>
Returns a border of a cell.
Sourcepub fn get_vertical(&self, pos: Position, count_columns: usize) -> Option<&char>
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
Trait Implementations§
Source§impl Clone for GridConfig
impl Clone for GridConfig
Source§fn clone(&self) -> GridConfig
fn clone(&self) -> GridConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more