pub struct Spinner { /* private fields */ }Implementations§
Source§impl Spinner
impl Spinner
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Examples found in repository?
examples/basic.rs (line 6)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::new("Preparing workspace");
7
8 spinner.start()?;
9 thread::sleep(Duration::from_millis(800));
10
11 spinner.set_text("Fetching dependencies");
12 thread::sleep(Duration::from_millis(800));
13
14 spinner.set_text("Running checks");
15 thread::sleep(Duration::from_millis(800));
16
17 spinner.succeed(Some("Workspace ready"))?;
18 Ok(())
19}Sourcepub fn builder() -> SpinnerBuilder
pub fn builder() -> SpinnerBuilder
Examples found in repository?
examples/custom_style.rs (line 6)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}pub fn with_options(options: SpinnerOptions) -> Self
Sourcepub fn start(&mut self) -> Result<&mut Self>
pub fn start(&mut self) -> Result<&mut Self>
Examples found in repository?
examples/basic.rs (line 8)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::new("Preparing workspace");
7
8 spinner.start()?;
9 thread::sleep(Duration::from_millis(800));
10
11 spinner.set_text("Fetching dependencies");
12 thread::sleep(Duration::from_millis(800));
13
14 spinner.set_text("Running checks");
15 thread::sleep(Duration::from_millis(800));
16
17 spinner.succeed(Some("Workspace ready"))?;
18 Ok(())
19}More examples
examples/custom_style.rs (line 16)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}pub fn stop(&mut self) -> Result<&mut Self>
pub fn clear(&mut self) -> Result<&mut Self>
pub fn stop_and_persist<T>( &mut self, symbol: impl Into<String>, text: Option<T>, ) -> Result<&mut Self>
Sourcepub fn succeed<T>(&mut self, text: Option<T>) -> Result<&mut Self>
pub fn succeed<T>(&mut self, text: Option<T>) -> Result<&mut Self>
Examples found in repository?
examples/basic.rs (line 17)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::new("Preparing workspace");
7
8 spinner.start()?;
9 thread::sleep(Duration::from_millis(800));
10
11 spinner.set_text("Fetching dependencies");
12 thread::sleep(Duration::from_millis(800));
13
14 spinner.set_text("Running checks");
15 thread::sleep(Duration::from_millis(800));
16
17 spinner.succeed(Some("Workspace ready"))?;
18 Ok(())
19}More examples
examples/custom_style.rs (line 24)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}pub fn fail<T>(&mut self, text: Option<T>) -> Result<&mut Self>
pub fn warn<T>(&mut self, text: Option<T>) -> Result<&mut Self>
pub fn info<T>(&mut self, text: Option<T>) -> Result<&mut Self>
pub fn text(&self) -> String
Sourcepub fn set_text(&mut self, text: impl Into<String>) -> &mut Self
pub fn set_text(&mut self, text: impl Into<String>) -> &mut Self
Examples found in repository?
examples/basic.rs (line 11)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::new("Preparing workspace");
7
8 spinner.start()?;
9 thread::sleep(Duration::from_millis(800));
10
11 spinner.set_text("Fetching dependencies");
12 thread::sleep(Duration::from_millis(800));
13
14 spinner.set_text("Running checks");
15 thread::sleep(Duration::from_millis(800));
16
17 spinner.succeed(Some("Workspace ready"))?;
18 Ok(())
19}More examples
examples/custom_style.rs (line 20)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}pub fn set_prefix_text(&mut self, text: impl Into<String>) -> &mut Self
Sourcepub fn set_suffix_text(&mut self, text: impl Into<String>) -> &mut Self
pub fn set_suffix_text(&mut self, text: impl Into<String>) -> &mut Self
Examples found in repository?
examples/custom_style.rs (line 19)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}Sourcepub fn set_color(&mut self, color: Option<Color>) -> &mut Self
pub fn set_color(&mut self, color: Option<Color>) -> &mut Self
Examples found in repository?
examples/custom_style.rs (line 23)
5fn main() -> io::Result<()> {
6 let mut spinner = Spinner::builder()
7 .text("Processing build graph")
8 .prefix_text("pipeline")
9 .suffix_text("phase-1")
10 .color(Color::Yellow)
11 .spinner(SpinnerStyle::arrow())
12 .indent(4)
13 .stream(Stream::Stderr)
14 .build();
15
16 spinner.start()?;
17 thread::sleep(Duration::from_millis(900));
18
19 spinner.set_suffix_text("phase-2");
20 spinner.set_text("Packing release artifacts");
21 thread::sleep(Duration::from_millis(900));
22
23 spinner.set_color(Some(Color::Green));
24 spinner.succeed(Some("Release artifacts ready"))?;
25 Ok(())
26}pub fn set_spinner(&mut self, spinner: SpinnerStyle) -> &mut Self
pub fn snapshot(&self) -> SpinnerSnapshot
pub fn is_spinning(&self) -> bool
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