etui/widgets/progress

Types

pub type ProgressBar {
  ProgressBar(
    mode: ProgressMode,
    label: String,
    filled_char: String,
    empty_char: String,
    segment_width: Int,
    fg: style.Color,
    bg: style.Color,
    filled_modifier: style.Modifier,
    empty_modifier: style.Modifier,
  )
}

Constructors

A bar that reports a percentage, or one that only shows activity.

pub type ProgressMode {
  Determinate(percent: Int)
  Indeterminate
}

Constructors

  • Determinate(percent: Int)

    Clamped to 0–100.

  • Indeterminate

Values

pub fn progress_indeterminate() -> ProgressBar

A bar whose segment bounces back and forth; percent unknown.

pub fn progress_new(percent: Int) -> ProgressBar

A determinate bar at percent (clamped to 0–100).

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  p: ProgressBar,
  frame: Int,
) -> buffer.Buffer

Draw the bar into the first row of area.

pub fn with_chars(
  p: ProgressBar,
  filled: String,
  empty: String,
) -> ProgressBar

Replace the block characters used for filled and empty cells.

pub fn with_colors(
  p: ProgressBar,
  fg: style.Color,
  bg: style.Color,
) -> ProgressBar

Colors of the whole bar.

pub fn with_empty_modifier(
  p: ProgressBar,
  m: style.Modifier,
) -> ProgressBar

Extra modifier for the unfilled portion.

pub fn with_filled_modifier(
  p: ProgressBar,
  m: style.Modifier,
) -> ProgressBar

Extra modifier for the filled portion (or the moving segment).

pub fn with_label(p: ProgressBar, label: String) -> ProgressBar

Text overlaid in the center of the bar.

pub fn with_segment_width(
  p: ProgressBar,
  pct: Int,
) -> ProgressBar

Indeterminate segment size as a percentage of bar width (1–100).

pub fn with_style(p: ProgressBar, s: style.Style) -> ProgressBar

Take only fg/bg from a Style.

✨ Search Document