From 700eb9a91dee1f73b7bac4f78bed12b327dd6e74 Mon Sep 17 00:00:00 2001 From: ad4mx Date: Mon, 18 Jul 2022 19:46:59 +0200 Subject: [PATCH] fix: added another example to readme --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e963309..0388b37 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,7 @@ [![Version](https://img.shields.io/crates/v/spinoff.svg)](https://crates.io/crates/spinoff) [![Downloads](https://img.shields.io/crates/d/spinoff)](https://crates.io/crates/spinoff) [![Docs](https://img.shields.io/docsrs/spinoff)](https://docs.rs/spinoff/latest/spinoff) [![License](https://img.shields.io/crates/l/spinoff)](https://crates.io/crates/spinoff) ![Actions](https://img.shields.io/github/workflow/status/ad4mx/spinoff/Rust) -

-
- -
-
-

+![til](assets/index.gif) ## ⚡ Usage @@ -30,13 +25,27 @@ use spinoff::{Spinner, Spinners, Color}; use std::thread::sleep; use std::time::Duration; -let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Some(Color::Blue)); +let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Some(Color::Red)); sleep(Duration::from_secs(3)); spinner.update(Spinners::Dots2, "Loading...", None); sleep(Duration::from_secs(3)); spinner.stop_and_persist("👨‍💻", "Done!"); ``` +### Stop a spinner and persist a symbol and message + +```rust +use spinoff::{Spinner, Spinners, Color}; +use std::thread::sleep; +use std::time::Duration; + +let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Some(Color::Green)); +sleep(Duration::from_secs(3)); +spinner.stop_and_persist("📜", "Task done."); +``` + +Other examples can be found in the [documentation](https://docs.rs/spinoff/latest/spinoff/). + ## 📖 Documentation