BarColumn

Struct BarColumn 

Source
pub struct BarColumn {
    pub bar_width: usize,
    pub complete_char: char,
    pub incomplete_char: char,
    pub edge_char: Option<char>,
    pub complete_style: Style,
    pub finished_style: Option<Style>,
    pub incomplete_style: Style,
    pub pulse_style: Style,
    pub expand: bool,
    pub use_sub_blocks: bool,
}
Expand description

Renders the progress bar with distinct filled/unfilled characters.

Uses Unicode box-drawing characters for clear visual distinction:

  • (U+2501) for filled portion
  • (U+257A) for edge pointer (shows progress position)
  • (U+2500) for unfilled portion

For indeterminate tasks (no total), shows a pulsing animation.

Use expand(true) to make the bar expand to fill available width. Use use_sub_blocks(true) for smoother progress using 8th-block Unicode characters.

Fields§

§bar_width: usize

Width of the bar in characters (used as min_width when expand is true)

§complete_char: char

Character for filled portion (default: ‘━’)

§incomplete_char: char

Character for unfilled portion (default: ‘─’)

§edge_char: Option<char>

Optional edge pointer character (default: Some(‘╸’))

§complete_style: Style

Style for completed portion

§finished_style: Option<Style>

Style for finished tasks

§incomplete_style: Style

Style for unfilled portion

§pulse_style: Style

Style for pulse animation (indeterminate)

§expand: bool

If true, expand to fill available width

§use_sub_blocks: bool

If true, use sub-character (8th-block) Unicode for smoother progress

Implementations§

Source§

impl BarColumn

Source

pub fn new(bar_width: usize) -> Self

Source

pub fn complete_char(self, c: char) -> Self

Set the complete character

Source

pub fn incomplete_char(self, c: char) -> Self

Set the incomplete character

Source

pub fn edge_char(self, c: Option<char>) -> Self

Set the edge pointer character (or None to disable)

Source

pub fn complete_style(self, style: Style) -> Self

Set the style for completed portion

Source

pub fn finished_style(self, style: Option<Style>) -> Self

Set the style for finished tasks

Source

pub fn expand(self, expand: bool) -> Self

Set whether the bar should expand to fill available width.

When expand is true, the bar will use the remaining terminal width after other columns are rendered. The bar_width becomes the minimum width.

Source

pub fn use_sub_blocks(self, enabled: bool) -> Self

Enable sub-character progress using 8th-block Unicode characters.

When enabled, uses characters like ▏▎▍▌▋▊▉█ for smoother progress rendering with 8 levels of precision per character.

Trait Implementations§

Source§

impl Debug for BarColumn

Source§

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

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

impl Default for BarColumn

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ProgressColumn for BarColumn

Source§

fn render(&self, task: &Task) -> Vec<Span>

Render the column for the given task.
Source§

fn render_with_width( &self, task: &Task, available_width: Option<usize>, ) -> Vec<Span>

Render the column with an available width hint. Read more
Source§

fn is_expandable(&self) -> bool

Returns true if this column should expand to fill available width.
Source§

fn min_width(&self) -> usize

Get the minimum width this column needs.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.