Skip to main content

Status

Struct Status 

Source
pub struct Status { /* private fields */ }
Expand description

A spinner + message status indicator. Mirrors rich.status.Status.

Implementations§

Source§

impl Status

Source

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).

Source

pub fn from_text(message: Text) -> Self

A status showing message as it is (upstream’s Status(Text(...))).

Source

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.

Source

pub fn refresh_per_second(self, refresh_per_second: f64) -> Self

How often start’s display redraws (upstream refresh_per_second, default 12.5).

Source

pub fn spinner(self, name: &str) -> Self

Choose the spinner animation by name (default dots).

Source

pub fn spinner_style(self, style: impl Into<StyleType>) -> Self

Style applied to the spinner frame (default status.spinner).

Source

pub fn speed(self, speed: f64) -> Self

Set the spinner animation speed multiplier (default 1.0).

Source

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.

Source

pub fn update_text(&mut self, status: Text)

update with the status as a Text, used as it is.

Source

pub fn update_renderable(&mut self, status: Box<dyn Renderable + Send>)

update with the status as any renderable.

Source

pub fn renderable(&self) -> &Spinner

The underlying spinner. Mirrors upstream’s Status.renderable.

Source§

impl Status

Source

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.

Source§

fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>

Source§

fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement

The (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

Whether a top-level 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>

The vertical alignment a 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

Whether a top-level print ends this renderable’s last line. This port’s renderables separate lines, where upstream’s end each line with "\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.

Auto Trait Implementations§

§

impl !Freeze for Status

§

impl !RefUnwindSafe for Status

§

impl !Sync for Status

§

impl Send for Status

§

impl Unpin for Status

§

impl UnsafeUnpin for Status

§

impl UnwindSafe for Status

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.