Struct SpinnerHandle

Source
pub struct SpinnerHandle { /* private fields */ }
Expand description

A handle to a running spinner.

Can be used to send commands to the render thread.

Implementations§

Source§

impl SpinnerHandle

Source

pub fn done(self)

Stops the spinner and renders a success symbol.

Examples found in repository?
examples/arc.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&ARC).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
More examples
Hide additional examples
examples/dots.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&DOTS).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
examples/dqpb.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&DQPB).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
examples/flip.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&FLIP).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
examples/line.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&LINE).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
examples/moon.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&MOON).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.done();
8}
Source

pub fn error(self)

Stops the spinner and renders an error symbol.

Source

pub fn info(self)

Stops the spinner and renders an information symbol.

Source

pub fn stop(self)

Stops the spinner.

Source

pub fn stop_and_clear(self)

Stops the spinner and clears the line it was printed on.

Examples found in repository?
examples/clear_line.rs (line 7)
3fn main() {
4    let text = "Loading unicorns";
5    let handle = SpinnerBuilder::new().spinner(&DOTS).text(text).start();
6    thread::sleep(Duration::from_secs(3));
7    handle.stop_and_clear();
8}
Source

pub fn text(&self, text: impl Into<Cow<'static, str>>)

Changes the text of the spinner.

Source

pub fn warn(self)

Stops the spinner and renders a warning symbol.

Source

pub fn unknown(self)

Stops the spinner and renders an unknown symbol.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.