pub struct Table {
headers: Vec<Box<str>>,
rows: Vec<Box<[Box<str>]>>,
padding: usize,
}Expand description
Markdown table builder with multiple render modes.
Fields§
§headers: Vec<Box<str>>§rows: Vec<Box<[Box<str>]>>§padding: usizeImplementations§
Source§impl Table
impl Table
pub fn new() -> Self
pub fn headers<I, T>(self, headers: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Display,
pub fn row<I, T>(self, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Display,
pub fn rows<I, R, T>(self, rows: I) -> Self
pub fn padding(self, padding: usize) -> Self
Sourcepub fn build_plain(self) -> String
pub fn build_plain(self) -> String
Render as a plain-text aligned table (no markdown separators).
Sourcepub fn build_markdown(self) -> String
pub fn build_markdown(self) -> String
Render as a proper markdown table with | delimiters and --- separator.
Sourcepub fn build(self) -> String
pub fn build(self) -> String
Render as a fenced code block (for contexts that don’t support markdown tables).
fn column_widths(&self) -> Vec<usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more