pub struct Padding { /* private fields */ }
Expand description
Padding is responsible for a left/right/top/bottom inner indent of a particular cell.
§Example
use tabled::{
Table,
settings::{Padding, Style, Modify, object::Cell},
};
let table = Table::new("2022".chars())
.with(Style::modern())
.with(Modify::new((2, 0)).with(Padding::new(1, 1, 2, 2)))
.to_string();
assert_eq!(
table,
concat!(
"┌──────┐\n",
"│ char │\n",
"├──────┤\n",
"│ 2 │\n",
"├──────┤\n",
"│ │\n",
"│ │\n",
"│ 0 │\n",
"│ │\n",
"│ │\n",
"├──────┤\n",
"│ 2 │\n",
"├──────┤\n",
"│ 2 │\n",
"└──────┘",
),
);
Implementations§
Source§impl Padding
impl Padding
Sourcepub const fn new(left: usize, right: usize, top: usize, bottom: usize) -> Self
pub const fn new(left: usize, right: usize, top: usize, bottom: usize) -> Self
Construct’s an Padding object.
It uses space(’ ’) as a default fill character.
To set a custom character you can use Padding::fill
function.
Sourcepub const fn zero() -> Self
pub const fn zero() -> Self
Construct’s an Padding object with all sides set to 0.
It uses space(’ ’) as a default fill character.
To set a custom character you can use Padding::fill
function.
Sourcepub const fn fill(
self,
left: char,
right: char,
top: char,
bottom: char,
) -> Self
pub const fn fill( self, left: char, right: char, top: char, bottom: char, ) -> Self
The function, sets a characters for the padding on an each side.
Sourcepub const fn expand(horizontal: bool) -> PaddingExpand
pub const fn expand(horizontal: bool) -> PaddingExpand
Construct’s an PaddingExpand object.
Trait Implementations§
Source§impl<R> CellOption<R, ColoredConfig> for Padding
impl<R> CellOption<R, ColoredConfig> for Padding
Source§fn change(self, _: &mut R, cfg: &mut ColoredConfig, entity: Entity)
fn change(self, _: &mut R, cfg: &mut ColoredConfig, entity: Entity)
Modification function of a certail part of a grid targeted by
Entity
.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 moreSource§impl Ord for Padding
impl Ord for Padding
Source§impl PartialOrd for Padding
impl PartialOrd for Padding
Source§impl<R, D> TableOption<R, ColoredConfig, D> for Padding
impl<R, D> TableOption<R, ColoredConfig, D> for Padding
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 moreSource§impl<R, D> TableOption<R, CompactConfig, D> for Padding
impl<R, D> TableOption<R, CompactConfig, D> for Padding
Source§fn change(self, _: &mut R, cfg: &mut CompactConfig, _: &mut D)
fn change(self, _: &mut R, cfg: &mut CompactConfig, _: &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 moreSource§impl<R, D> TableOption<R, CompactMultilineConfig, D> for Padding
impl<R, D> TableOption<R, CompactMultilineConfig, D> for Padding
Source§fn change(self, _: &mut R, cfg: &mut CompactMultilineConfig, _: &mut D)
fn change(self, _: &mut R, cfg: &mut CompactMultilineConfig, _: &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 moreimpl Copy for Padding
impl Eq for Padding
impl StructuralPartialEq for Padding
Auto Trait Implementations§
impl Freeze for Padding
impl RefUnwindSafe for Padding
impl Send for Padding
impl Sync for Padding
impl Unpin for Padding
impl UnwindSafe for Padding
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