pub struct Spinner { /* private fields */ }Available on crate feature
spinner only.Expand description
A single-line terminal spinner with a live message.
Implementations§
Source§impl Spinner
impl Spinner
Sourcepub fn start(message: impl Into<String>) -> Self
pub fn start(message: impl Into<String>) -> Self
Start the spinner with an initial message.
When stderr is not a TTY no thread is spawned and ticks are
suppressed; terminal completion lines (success/failure)
are still printed, as plain text, so logs remain informative.
The first TTY-bound call also installs a process-wide SIGINT /
SIGTERM / SIGHUP handler and a panic hook that restore the
cursor before letting the process die: Drop is skipped on
signal-induced termination and on panic = abort, so without
these hooks cursor::Hide from the render loop would leak
past process exit.
Sourcepub fn set_message(&self, message: impl Into<String>)
pub fn set_message(&self, message: impl Into<String>)
Replace the message displayed next to the spinner frame.
Sourcepub fn success(self, message: impl AsRef<str>)
pub fn success(self, message: impl AsRef<str>)
Stop the spinner and print ✓ (green on a TTY) and message.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Spinner
impl !UnwindSafe for Spinner
impl Forget for Spinner
impl Freeze for Spinner
impl Move for Spinner
impl Send for Spinner
impl Sync for Spinner
impl Unpin for Spinner
impl UnsafeUnpin 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