pub struct IndeterminateSpinner { /* private fields */ }Expand description
A spinner for operations with unknown total count or duration.
Shows activity with elapsed time, useful for:
- Establishing database connections
- Running complex queries
- Waiting for locks
- Initial data discovery
§Rendering Modes
- Rich mode: Animated spinner with message and elapsed time
- Plain mode: Static
[...] message (elapsed)format for agents - JSON mode: Structured data for programmatic consumption
§Example
use sqlmodel_console::renderables::{IndeterminateSpinner, SpinnerStyle};
let spinner = IndeterminateSpinner::new("Loading data")
.style(SpinnerStyle::Braille);
// Can convert to progress bar when total becomes known
let progress = spinner.into_progress(1000);Implementations§
Source§impl IndeterminateSpinner
impl IndeterminateSpinner
Sourcepub fn style(self, style: SpinnerStyle) -> Self
pub fn style(self, style: SpinnerStyle) -> Self
Set the animation style.
Sourcepub fn set_message(&mut self, message: impl Into<String>)
pub fn set_message(&mut self, message: impl Into<String>)
Update the status message.
Sourcepub fn current_style(&self) -> SpinnerStyle
pub fn current_style(&self) -> SpinnerStyle
Get the current style.
Sourcepub fn reset_timer(&mut self)
pub fn reset_timer(&mut self)
Reset the start time.
Sourcepub fn elapsed_secs(&self) -> f64
pub fn elapsed_secs(&self) -> f64
Get elapsed time in seconds.
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Get elapsed time in milliseconds.
Sourcepub fn current_frame(&self) -> &'static str
pub fn current_frame(&self) -> &'static str
Get the current animation frame.
Sourcepub fn into_progress(self, total: u64) -> OperationProgress
pub fn into_progress(self, total: u64) -> OperationProgress
Convert to a progress bar when total becomes known.
The progress bar inherits the spinner’s message as the operation name and starts with 0 completed items.
§Arguments
total: The total number of items to process
Sourcepub fn render_plain(&self) -> String
pub fn render_plain(&self) -> String
Render as plain text for agents.
Format: [...] message (elapsed)
Sourcepub fn render_styled(&self) -> String
pub fn render_styled(&self) -> String
Render with ANSI styling and animation.
Shows the current animation frame with colors.
Trait Implementations§
Source§impl Clone for IndeterminateSpinner
impl Clone for IndeterminateSpinner
Source§fn clone(&self) -> IndeterminateSpinner
fn clone(&self) -> IndeterminateSpinner
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IndeterminateSpinner
impl RefUnwindSafe for IndeterminateSpinner
impl Send for IndeterminateSpinner
impl Sync for IndeterminateSpinner
impl Unpin for IndeterminateSpinner
impl UnsafeUnpin for IndeterminateSpinner
impl UnwindSafe for IndeterminateSpinner
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