pub struct StatWidget { /* private fields */ }Expand description
A number on the dashboard, such as this month’s revenue, with what you choose to show around it: how it changed, its recent history, and a link to where it comes from.
Implementations§
Source§impl StatWidget
impl StatWidget
Sourcepub fn new(
id: impl Into<String>,
label: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, label: impl Into<String>, value: impl Into<String>, ) -> Self
A stat with an id that is unique on the dashboard, a label, and the value to show,
already formatted.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Adds a line of context under the value, such as vs. last month.
Sourcepub fn trend(self, trend: impl Into<String>, direction: TrendDirection) -> Self
pub fn trend(self, trend: impl Into<String>, direction: TrendDirection) -> Self
Shows how the value changed, such as +12%, colored by its direction.
Sourcepub fn icon(self, icon: impl Into<String>) -> Self
pub fn icon(self, icon: impl Into<String>) -> Self
Sets the icon in the card’s corner, by name.
Sourcepub fn color(self, color: BadgeColor) -> Self
pub fn color(self, color: BadgeColor) -> Self
Sets the color of the sparkline.
Sourcepub fn sparkline(self, points: impl IntoIterator<Item = f64>) -> Self
pub fn sparkline(self, points: impl IntoIterator<Item = f64>) -> Self
Draws the stat’s recent history as a line across the card, oldest point first.
Sourcepub fn href(self, href: impl Into<String>) -> Self
pub fn href(self, href: impl Into<String>) -> Self
Makes the card a link to a path inside the panel, such as /resources/orders.
Sourcepub fn col_span(self, span: u8) -> Self
pub fn col_span(self, span: u8) -> Self
Sets how many of the dashboard’s four columns the card spans. A stat spans one.
Sourcepub fn build(self) -> DashboardWidgetDto
pub fn build(self) -> DashboardWidgetDto
Finishes the widget.
Trait Implementations§
Source§impl Clone for StatWidget
impl Clone for StatWidget
Source§impl Debug for StatWidget
impl Debug for StatWidget
Source§impl From<StatWidget> for DashboardWidgetDto
impl From<StatWidget> for DashboardWidgetDto
Source§fn from(widget: StatWidget) -> Self
fn from(widget: StatWidget) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for StatWidget
impl Freeze for StatWidget
impl Move for StatWidget
impl RefUnwindSafe for StatWidget
impl Send for StatWidgetwhere
RawVecInner: Send,
impl Sync for StatWidgetwhere
RawVecInner: Sync,
impl Unpin for StatWidget
impl UnsafeUnpin for StatWidget
impl UnwindSafe for StatWidgetwhere
RawVecInner: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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