pub struct Spinner { /* private fields */ }Expand description
Spinner component for displaying loading animations
The spinner consists of:
- A rotating character animation
- A label displayed next to the spinner
Implementations§
Source§impl Spinner
impl Spinner
Sourcepub fn with_frames(label: &str, frames: Vec<String>) -> Self
pub fn with_frames(label: &str, frames: Vec<String>) -> Self
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Advance the spinner to the next frame
Call this method at your desired frame rate. For a smooth
10 FPS animation, call tick() every 100ms.
§Example
use limit_tui::components::Spinner;
use std::thread;
use std::time::Duration;
let mut spinner = Spinner::new("Loading...");
loop {
spinner.tick();
// render spinner
thread::sleep(Duration::from_millis(100)); // 10 FPS
}Sourcepub fn current_frame(&self) -> &str
pub fn current_frame(&self) -> &str
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Spinner
impl RefUnwindSafe for Spinner
impl Send for Spinner
impl Sync for Spinner
impl Unpin for Spinner
impl UnsafeUnpin for Spinner
impl UnwindSafe for Spinner
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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