pub struct CountUp { /* private fields */ }Expand description
A number that counts up from zero to its value when it first shows on screen, and from where it is to its new value whenever the value changes, even halfway through a count. Its digits keep one width, so the number does not shake as it counts. Under reduced motion it shows the value at once.
Implementations§
Source§impl CountUp
impl CountUp
Sourcepub fn new(value: f64) -> Self
pub fn new(value: f64) -> Self
Counts up to value, shown as a whole number with thousands separators.
Sourcepub fn format(self, format: impl Fn(f64) -> String + 'static) -> Self
pub fn format(self, format: impl Fn(f64) -> String + 'static) -> Self
How each step of the count is written, such as |v| format!("{v:.0}+").
Sourcepub fn easing(self, easing: Easing) -> Self
pub fn easing(self, easing: Easing) -> Self
The pace of the count (fast, then settling, by default).
Sourcepub fn start_at_value(self) -> Self
pub fn start_at_value(self) -> Self
Shows its value from the start: only later changes count, as for a figure on a dashboard that follows a filter.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CountUp
impl !Send for CountUp
impl !Sync for CountUp
impl !UnwindSafe for CountUp
impl Freeze for CountUp
impl Unpin for CountUp
impl UnsafeUnpin for CountUp
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> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.