pub struct Status { /* private fields */ }Expand description
A spinner + message status indicator. Mirrors rich.status.Status.
Implementations§
Source§impl Status
impl Status
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
A status showing message with the default dots spinner, styled
status.spinner (green in the default theme).
Sourcepub fn from_text(message: Text) -> Self
pub fn from_text(message: Text) -> Self
A status showing message as it is (upstream’s Status(Text(...))).
Sourcepub fn from_renderable(renderable: Box<dyn Renderable + Send>) -> Self
pub fn from_renderable(renderable: Box<dyn Renderable + Send>) -> Self
A status showing any renderable beside the spinner (upstream’s
Status(renderable)), in a Table.grid as Spinner::renderable.
Sourcepub fn refresh_per_second(self, refresh_per_second: f64) -> Self
pub fn refresh_per_second(self, refresh_per_second: f64) -> Self
How often start’s display redraws (upstream
refresh_per_second, default 12.5).
Sourcepub fn spinner_style(self, style: impl Into<StyleType>) -> Self
pub fn spinner_style(self, style: impl Into<StyleType>) -> Self
Style applied to the spinner frame (default status.spinner).
Sourcepub fn speed(self, speed: f64) -> Self
pub fn speed(self, speed: f64) -> Self
Set the spinner animation speed multiplier (default 1.0).
Sourcepub fn update(
&mut self,
status: Option<&str>,
spinner: Option<&str>,
spinner_style: Option<StyleType>,
speed: Option<f64>,
)
pub fn update( &mut self, status: Option<&str>, spinner: Option<&str>, spinner_style: Option<StyleType>, speed: Option<f64>, )
Port of Status.update. None (and, as upstream, a zero speed) leaves
a field unchanged. A new spinner name builds a fresh spinner; otherwise
the current one is updated in place, a speed change continuing from its
current frame.
Sourcepub fn update_text(&mut self, status: Text)
pub fn update_text(&mut self, status: Text)
Sourcepub fn update_renderable(&mut self, status: Box<dyn Renderable + Send>)
pub fn update_renderable(&mut self, status: Box<dyn Renderable + Send>)
update with the status as any renderable.
Sourcepub fn renderable(&self) -> &Spinner
pub fn renderable(&self) -> &Spinner
The underlying spinner. Mirrors upstream’s Status.renderable.
Source§impl Status
impl Status
Sourcepub fn start<W: Write + Send + 'static>(
self,
console: Console,
writer: W,
) -> LiveStatus<W>
pub fn start<W: Write + Send + 'static>( self, console: Console, writer: W, ) -> LiveStatus<W>
Start the status animation in a transient live display, redrawn
refresh_per_second times a second on a
background thread. Port of Status.start (upstream’s
Live(transient=True), started without a first refresh, so the first
frame comes with the first tick); stop it with LiveStatus::stop.
Trait Implementations§
Source§impl Renderable for Status
Upstream’s Status.__rich__ returns the spinner, so a status renders (and
measures) exactly as its spinner: the frame for the console’s clock.
impl Renderable for Status
Upstream’s Status.__rich__ returns the spinner, so a status renders (and
measures) exactly as its spinner: the frame for the console’s clock.
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
(minimum, maximum) cell width this renderable wants. Port of
__rich_measure__. The default is what upstream’s Measurement.get
returns for a renderable without one: anything from nothing to the
whole width, (0, max_width).Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.Source§fn vertical(&self) -> Option<VerticalAlign>
fn vertical(&self) -> Option<VerticalAlign>
Table cell holding this renderable uses in
place of its column’s. Upstream reads getattr(renderable, "vertical", None); Align sets it.Source§fn print_end_line(&self, _options: &ConsoleOptions) -> bool
fn print_end_line(&self, _options: &ConsoleOptions) -> bool
"\n", so a print adds the final line break. A renderable
whose upstream output stops without one (Screen, LiveRender, a
Rule whose end has no newline) returns false, and the next
output continues its last line. options are the print’s options.