Skip to main content

StatusItem

Enum StatusItem 

Source
pub enum StatusItem {
    Text(String),
    Hints(usize),
    Spinner {
        name: String,
        text: String,
    },
    Badge {
        text: String,
        style: Style,
    },
    Icon {
        icon: Vec<Segment>,
        text: String,
    },
}
Expand description

One part of a StatusBar.

Variants§

§

Text(String)

Console markup: [bold]main.rs[/] · 12 lines.

§

Hints(usize)

Up to this many key hints (ctrl+s save · esc cancel), read from the keymap the bar is given, or the component’s under Overlays.

§

Spinner

A spinner (one of core’s, by name: dots, line, …) and markup after it. Its frame is picked by the time since the bar was made, as core’s Spinner picks it, and the bar ticks while one shows.

Fields

§name: String
§text: String
§

Badge

A short label in a style of its own, padded by a space each side: a mode, a count, a state.

Fields

§text: String
§style: Style
§

Icon

An icon, then markup: a micro asset’s badge (✅ deployed). The icon is one line of cells (kit::icon) with its style metadata, so a micro asset’s placeholder is drawn over by the painter’s graphics where the terminal can show images, and shows its emoji or text fallback anywhere else.

Fields

§icon: Vec<Segment>
§text: String

Implementations§

Source§

impl StatusItem

Source

pub fn text(markup: impl Into<String>) -> StatusItem

Source

pub fn hints(max: usize) -> StatusItem

Source

pub fn spinner(name: impl Into<String>, markup: impl Into<String>) -> StatusItem

Source

pub fn icon(icon: &Text, markup: impl Into<String>) -> StatusItem

icon (one line of text, such as a micro asset’s placeholder), then markup.

Source

pub fn badge(text: impl Into<String>, style_definition: &str) -> StatusItem

A badge in style, a style definition (bold white on blue); one that does not parse leaves the badge unstyled.

Trait Implementations§

Source§

impl Clone for StatusItem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StatusItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for StatusItem

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StatusItem

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.