pub fn update(&mut self, text : &str) {
		if self.step_increased.elapsed().as_millis() >= MS_PER_STEP {
			self.step = match self.step {
				9 => 0,
				_ => self.step + 1,
			};

			self.step_increased = Instant::now();
		}

		self.text_length = cmp::max(text.len(), self.text_length);

		let indicator : &'static str = STEPS[self.step];
		let spacer = " ".repeat(self.text_length - text.len());
		print!("\r  {} {}{}", indicator.cyan(), text, spacer);

		// Try to flush the stdout buffer to update the print line before the
		// process is done, but it's not a problem if it won't flush right away
		// so we can just capture the result without doing anything with it
		let _ = stdout().flush();
	}
/// Updates the spinner with a new message
///
/// # Arguments
/// * `text` - The text message to display after the spinner indicator
Updates the spinner with a new message
Updates the spinner with a new message
pub fn update(&mut self, text : &str) {
		if self.step_increased.elapsed().as_millis() >= MS_PER_STEP {
			self.step = match self.step {
				9 => 0,
				_ => self.step + 1,
			};
			self.step_increased = Instant::now();
		}
		self.text_length = cmp::max(text.len(), self.text_length);
		let indicator : &'static str = STEPS[self.step];
		let spacer = " ".repeat(self.text_length - text.len());
		print!("\r  {} {}{}", indicator.cyan(), text, spacer);
		// Try to flush the stdout buffer to update the print line before the
		// process is done, but it's not a problem if it won't flush right away
		// so we can just capture the result without doing anything with it
		let _ = stdout().flush();
	}
pub fn update ( & mut self , text : & str ) { if self . step_increased . elapsed ( ) . as_millis ( ) >= MS_PER_STEP { self . step = match self . step { 9 => 0 , _ => self . step + 1 , } ; self . step_increased = Instant :: now ( ) ; } self . text_length = cmp :: max ( text . len ( ) , self . text_length ) ; let indicator : & ' static str = STEPS [ self . step ] ; let spacer = " " . repeat ( self . text_length - text . len ( ) ) ; print ! ( " \r " indicator cyan ( ) text spacer ) ; // Try to flush the stdout buffer to update the print line before the // process is done, but it's not a problem if it won't flush right away // so we can just capture the result without doing anything with it let _ = stdout ( ) . flush ( ) ; }
Updates the spinner with a new message
Updates the spinner with a new message
&mut self
text
&str