pub struct Spinner { /* private fields */ }Expand description
A named terminal spinner. Mirrors rich.spinner.Spinner.
Implementations§
Source§impl Spinner
impl Spinner
Sourcepub fn try_new(name: &str) -> Option<Self>
pub fn try_new(name: &str) -> Option<Self>
Look up a built-in spinner by name, or None where upstream’s
constructor raises KeyError("no spinner called 'name'").
new falls back to dots instead.
Sourcepub fn text(self, text: impl Into<String>) -> Self
pub fn text(self, text: impl Into<String>) -> Self
Trailing text after the frame, parsed as console markup (upstream
passes a str through Text.from_markup).
Sourcepub fn with_text(self, text: Text) -> Self
pub fn with_text(self, text: Text) -> Self
Trailing text after the frame, used as it is (upstream’s text=
given a Text).
Sourcepub fn renderable(self, renderable: Box<dyn Renderable + Send>) -> Self
pub fn renderable(self, renderable: Box<dyn Renderable + Send>) -> Self
Any renderable after the frame (upstream’s text= given another
renderable): the frame and the renderable are laid out in a
Table.grid(padding=1).
Sourcepub fn style(self, style: impl Into<StyleType>) -> Self
pub fn style(self, style: impl Into<StyleType>) -> Self
Style applied to the spinner frame (not the trailing text): a style
or a theme name such as "status.spinner".
Sourcepub fn update(
&mut self,
text: Option<&str>,
style: Option<StyleType>,
speed: Option<f64>,
)
pub fn update( &mut self, text: Option<&str>, style: Option<StyleType>, speed: Option<f64>, )
Port of Spinner.update: replace the text or style when given, and
schedule a speed change for the next render. Like upstream, empty text
and a zero speed mean “unchanged”.
Sourcepub fn render(&self, time: f64) -> Text
pub fn render(&self, time: f64) -> Text
Render the spinner as it appears at time seconds. Port of
Spinner.render: the first call fixes the start time, the frame carries
the spinner style and Text.assemble(frame, " ", text) adds the text.
Sourcepub fn render_renderable(&self, time: f64) -> Box<dyn Renderable>
pub fn render_renderable(&self, time: f64) -> Box<dyn Renderable>
render for any trailing renderable: upstream’s
render returns a Table.grid(padding=1) of the frame and the
renderable set with renderable, and the
assembled text otherwise.
Trait Implementations§
Source§impl Renderable for Spinner
impl Renderable for Spinner
Source§fn rich_render(
&self,
console: &Console,
options: &ConsoleOptions,
) -> Vec<Segment>
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Port of Spinner.__rich_console__: the frame for the console’s clock
(Console::get_time), so each redraw inside a Live display moves
the animation on.
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
Port of Spinner.__rich_measure__, which measures self.render(0).
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.