pub struct Table { /* private fields */ }Expand description
A data table. columns become the header; the children are the rows
(tr![td![..], ..]), placed in the body. Wide tables scroll sideways
inside their box instead of breaking the page.
let t = Table![columns = ["Name", "Score"], striped = true,
tr![td!["Ada"], td!["98"]],
tr![td!["Grace"], td!["95"]],
];
let html = render_static(t);
assert!(html.contains(r#"<table class="nr-table nr-table-striped">"#), "{html}");
assert!(html.contains(r#"<th scope="col">Name</th>"#) && html.contains("<tbody><tr><td>Ada</td>"));Implementations§
Source§impl Table
impl Table
pub fn new() -> Self
Sourcepub fn class(self, v: impl Into<String>) -> Self
pub fn class(self, v: impl Into<String>) -> Self
Extra classes for the outer element. They win over the defaults.
Sourcepub fn with(self, part: impl Part) -> Self
pub fn with(self, part: impl Part) -> Self
Add an attribute (class(..), id(..), aria(..), …) or a child.
Sourcepub fn caption(self, v: impl Into<String>) -> Self
pub fn caption(self, v: impl Into<String>) -> Self
A visible <caption> (also the table’s accessible name).
pub fn striped(self, v: bool) -> Self
pub fn compact(self, v: bool) -> Self
Sourcepub fn sticky_header(self, v: bool) -> Self
pub fn sticky_header(self, v: bool) -> Self
The header stays visible while the body scrolls.
pub fn radius(self, v: Radius) -> Self
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Table
impl !Sync for Table
impl !UnwindSafe for Table
impl Forget for Table
impl Freeze for Table
impl Move for Table
impl Send for Table
impl Unpin for Table
impl UnsafeUnpin 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