pub struct BorderCorrection {}
Expand description
A correctness function of style for Table
which has Span
s.
Try to fix the style when table contains spans.
By default Style
doesn’t implies any logic to better render split lines when
Span
is used.
So this function can be used to set the split lines in regard of spans used.
§Example
use tabled::{
Table,
settings::{Span, Alignment, themes::BorderCorrection},
assert::assert_table,
};
let data = vec![
("09", "June", "2022"),
("10", "July", "2022"),
];
let mut table = Table::new(data);
table.modify(
(0, 0),
("My callendar", Span::column(3), Alignment::center()),
);
assert_table!(
table,
"+----+------+------+"
"| My callendar |"
"+----+------+------+"
"| 09 | June | 2022 |"
"+----+------+------+"
"| 10 | July | 2022 |"
"+----+------+------+"
);
table.with(BorderCorrection::span());
assert_table!(
table,
"+------------------+"
"| My callendar |"
"+----+------+------+"
"| 09 | June | 2022 |"
"+----+------+------+"
"| 10 | July | 2022 |"
"+----+------+------+"
);
Implementations§
Source§impl BorderCorrection
impl BorderCorrection
Sourcepub fn span() -> Self
pub fn span() -> Self
Constructs an object which will adjust borders affected by spans if any was set.
See BorderCorrection
.
Trait Implementations§
Source§impl Debug for BorderCorrection
impl Debug for BorderCorrection
Source§impl<R, D> TableOption<R, ColoredConfig, D> for BorderCorrectionwhere
R: Records + ExactRecords,
impl<R, D> TableOption<R, ColoredConfig, D> for BorderCorrectionwhere
R: Records + ExactRecords,
Source§fn change(self, records: &mut R, cfg: &mut ColoredConfig, _: &mut D)
fn change(self, records: &mut R, cfg: &mut ColoredConfig, _: &mut D)
The function modificaties of records and a grid configuration.
Source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
A hint whether an
TableOption
is going to change table layout. Read moreAuto Trait Implementations§
impl Freeze for BorderCorrection
impl RefUnwindSafe for BorderCorrection
impl Send for BorderCorrection
impl Sync for BorderCorrection
impl Unpin for BorderCorrection
impl UnwindSafe for BorderCorrection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more