pub struct Modify<O> { /* private fields */ }
Expand description
Modify structure provide an abstraction, to be able to apply
a set of CellOption
s to the same object.
Be aware that the settings are applied all to a cell at a time.
So sometimes you may need to make a several calls of Modify
in order to achieve the desired affect.
Implementations§
Source§impl<O> Modify<O>
impl<O> Modify<O>
Sourcepub const fn list<M>(obj: O, next: M) -> ModifyList<O, M>
pub const fn list<M>(obj: O, next: M) -> ModifyList<O, M>
A function which combines together Modify::new
and Modify::with
calls.
use tabled::{Table, settings::{Modify, Padding, object::Rows}};
let table = Table::new(&["Year", "2021"])
.with(Modify::list(Rows::first(), Padding::new(1, 1, 1, 1)))
.to_string();
assert_eq!(
table,
"+------+\n\
| |\n\
| &str |\n\
| |\n\
+------+\n\
| Year |\n\
+------+\n\
| 2021 |\n\
+------+"
)
Sourcepub fn with<M>(self, next: M) -> ModifyList<O, M>
pub fn with<M>(self, next: M) -> ModifyList<O, M>
It’s a generic function which stores a CellOption
.
IMPORTANT:
The function doesn’t changes a Table
.
Table
will be changed only after passing Modify
object to Table::with
.
use tabled::{Table, settings::{Modify, Padding, object::Rows}};
let table = Table::new(&["Year", "2021"])
.with(Modify::new(Rows::first()).with(Padding::new(1, 1, 1, 1)))
.to_string();
assert_eq!(
table,
"+------+\n\
| |\n\
| &str |\n\
| |\n\
+------+\n\
| Year |\n\
+------+\n\
| 2021 |\n\
+------+"
)
Trait Implementations§
Source§impl<O: Ord> Ord for Modify<O>
impl<O: Ord> Ord for Modify<O>
Source§impl<O: PartialOrd> PartialOrd for Modify<O>
impl<O: PartialOrd> PartialOrd for Modify<O>
impl<O: Copy> Copy for Modify<O>
impl<O: Eq> Eq for Modify<O>
impl<O> StructuralPartialEq for Modify<O>
Auto Trait Implementations§
impl<O> Freeze for Modify<O>where
O: Freeze,
impl<O> RefUnwindSafe for Modify<O>where
O: RefUnwindSafe,
impl<O> Send for Modify<O>where
O: Send,
impl<O> Sync for Modify<O>where
O: Sync,
impl<O> Unpin for Modify<O>where
O: Unpin,
impl<O> UnwindSafe for Modify<O>where
O: UnwindSafe,
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