Struct papergrid::GridConfig
source · [−]pub struct GridConfig { /* private fields */ }
Expand description
This structure represents a settings of a grid.
grid: crate::Grid.
Implementations
sourceimpl 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
sourceimpl Clone for GridConfig
impl Clone for GridConfig
sourcefn clone(&self) -> GridConfig
fn clone(&self) -> GridConfig
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more