pub struct ExpandedDisplay { /* private fields */ }
Expand description
ExpandedDisplay
display data in a ‘expanded display mode’ from postgresql.
It may be useful for a large data sets with a lot of fields.
See ‘Examples’ in https://www.postgresql.org/docs/current/app-psql.html..
It escapes strings to resolve a multi-line ones. Because of that ANSI sequences will be not be rendered too so colores will not be showed.
use tabled::{display::ExpandedDisplay};
let data = vec!["Hello", "2021"];
let table = ExpandedDisplay::new(&data);
assert_eq!(
table.to_string(),
concat!(
"-[ RECORD 0 ]-\n",
"&str | Hello\n",
"-[ RECORD 1 ]-\n",
"&str | 2021",
)
);
Implementations§
Source§impl ExpandedDisplay
impl ExpandedDisplay
Sourcepub fn new<T>(iter: impl IntoIterator<Item = T>) -> Selfwhere
T: Tabled,
pub fn new<T>(iter: impl IntoIterator<Item = T>) -> Selfwhere
T: Tabled,
Creates a new instance of ExpandedDisplay
Sourcepub fn truncate(&mut self, max: usize, suffix: &str) -> bool
pub fn truncate(&mut self, max: usize, suffix: &str) -> bool
Truncates table to a set width value for a table.
It returns a success inticator, where false
means it’s not possible to set the table width,
because of the given arguments.
It tries to not affect fields, but if there’s no enough space all records will be deleted and fields will be cut.
The minimum width is 14.
Trait Implementations§
Source§impl Clone for ExpandedDisplay
impl Clone for ExpandedDisplay
Source§fn clone(&self) -> ExpandedDisplay
fn clone(&self) -> ExpandedDisplay
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ExpandedDisplay
impl Debug for ExpandedDisplay
Auto Trait Implementations§
impl Freeze for ExpandedDisplay
impl RefUnwindSafe for ExpandedDisplay
impl Send for ExpandedDisplay
impl Sync for ExpandedDisplay
impl Unpin for ExpandedDisplay
impl UnwindSafe for ExpandedDisplay
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