pub struct Stat { /* private fields */ }Expand description
A number with its label: “Students · 1,204 · ↑ 12%”.
let s = Stat![label = "Students", value = "1,204", delta = "12%", trend = Trend::Up];
let html = render_static(s);
assert!(html.contains(r#"<span class="nr-stat-delta nr-stat-up">"#) && html.contains("12%"));Implementations§
Source§impl Stat
impl Stat
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.
pub fn label(self, v: impl Into<String>) -> Self
pub fn value(self, v: impl Into<String>) -> Self
pub fn trend(self, v: Trend) -> Self
Sourcepub fn description(self, v: impl Into<String>) -> Self
pub fn description(self, v: impl Into<String>) -> Self
Small text under the value (“since last week”).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Stat
impl !Sync for Stat
impl !UnwindSafe for Stat
impl Forget for Stat
impl Freeze for Stat
impl Move for Stat
impl Send for Stat
impl Unpin for Stat
impl UnsafeUnpin for Stat
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