Struct BorderCorrection

Source
pub struct BorderCorrection {}
Expand description

A correctness function of style for Table which has Spans.

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

Source

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

Source§

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

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

impl<R, D> TableOption<R, ColoredConfig, D> for BorderCorrection
where R: Records + ExactRecords,

Source§

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>

A hint whether an TableOption is going to change table layout. 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> 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, 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.