pub struct SpinnerState { /* private fields */ }Expand description
State for an animated spinner widget.
Create with a named constructor such as SpinnerState::dots or
SpinnerState::line (or from a SpinnerPreset via
SpinnerState::preset), then pass to Context::spinner each frame. The
frame advances automatically with the tick counter.
Implementations§
Source§impl SpinnerState
impl SpinnerState
Sourcepub fn dots() -> Self
pub fn dots() -> Self
Create a dots-style spinner using braille characters.
Cycles through: ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
Sourcepub fn line() -> Self
pub fn line() -> Self
Create a line-style spinner using ASCII characters.
Cycles through: | / - \
Sourcepub fn moon() -> Self
pub fn moon() -> Self
Create a moon-phase spinner.
Cycles through: 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘
Available since 0.21.1.
Sourcepub fn bounce() -> Self
pub fn bounce() -> Self
Create a bouncing single-dot spinner.
Cycles through ⠁ ⠂ ⠄ ⠂, giving a dot that rises and falls in place.
Available since 0.21.1.
Sourcepub fn circle() -> Self
pub fn circle() -> Self
Create a quarter-circle arc spinner.
Cycles through: ◜ ◠ ◝ ◞ ◡ ◟
Available since 0.21.1.
Sourcepub fn points() -> Self
pub fn points() -> Self
Create a travelling braille-dot (“points”) spinner.
Cycles through: ⠁ ⠂ ⠄ ⡀ ⢀ ⠠ ⠐ ⠈
Available since 0.21.1.
Sourcepub fn arc() -> Self
pub fn arc() -> Self
Create a half-circle arc spinner.
Cycles through: ◜ ◠ ◝ ◞ ◡ ◟
Available since 0.21.1.
Sourcepub fn toggle() -> Self
pub fn toggle() -> Self
Create a two-frame toggle/pulse spinner.
Cycles through: ⊶ ⊷
Available since 0.21.1.
Sourcepub fn arrow() -> Self
pub fn arrow() -> Self
Create a rotating-arrow spinner.
Cycles clockwise through: ← ↖ ↑ ↗ → ↘ ↓ ↙
Available since 0.21.1.
Sourcepub fn preset(preset: SpinnerPreset) -> Self
pub fn preset(preset: SpinnerPreset) -> Self
Create a spinner from a named SpinnerPreset.
Equivalent to calling the matching named constructor.
§Example
let s = SpinnerState::preset(SpinnerPreset::Moon);
assert_eq!(s, SpinnerState::moon());Available since 0.21.1.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Number of distinct frames in this spinner’s cycle.
Useful for tests and for detecting wrap-around.
§Example
assert_eq!(SpinnerState::line().frame_count(), 4);Available since 0.21.1.
Trait Implementations§
Source§impl Clone for SpinnerState
impl Clone for SpinnerState
Source§fn clone(&self) -> SpinnerState
fn clone(&self) -> SpinnerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more