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 moreSource§impl Debug for SpinnerState
impl Debug for SpinnerState
Source§impl Default for SpinnerState
impl Default for SpinnerState
Source§impl PartialEq for SpinnerState
impl PartialEq for SpinnerState
Source§fn eq(&self, other: &SpinnerState) -> bool
fn eq(&self, other: &SpinnerState) -> bool
self and other values to be equal, and is used by ==.impl Eq for SpinnerState
impl StructuralPartialEq for SpinnerState
Auto Trait Implementations§
impl Freeze for SpinnerState
impl RefUnwindSafe for SpinnerState
impl Send for SpinnerState
impl Sync for SpinnerState
impl Unpin for SpinnerState
impl UnsafeUnpin for SpinnerState
impl UnwindSafe for SpinnerState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.