macro_rules! progress {
    ( $(None)? ; $($item:tt)+ ) => { ... };
    ( $total:expr $( ; $($item:tt)* )? ) => { ... };
}
Expand description

Creates Progress with default configuration.

Usage

This macro takes total and/or items as arguments and returns Result<Progress,Error> using default configuration.

  • If total is Some, it’s given as expression which returns impl TryInto<u64>.
  • If total is None, it’s given as None or empty.
  • If items are given, they must be preceded by ; after which actual items are given using special syntax documented at items.
  • Default items: bar_fill " " pos "/" total " (" eta ")"
progress!(EXPR)          // total is `Some(EXPR)`, default items
progress!(EXPR ; ITEMS)  // total is `Some(EXPR)`, given items
progress!(None ; ITEMS)  // total is `None`, given items
progress!(     ; ITEMS)  // - same

Examples

See crate index for usage and examples in larger context. Following examples are only about this macro.

use ml_progress::progress;

// Total is `Some(10)`, default items.
let progress = progress!(10)?;

// Total is `Some(10)`, given items.
let progress = progress!(10; pos "/" total " " bar_fill)?;

// Total is `None`, given items.
let progress = progress!(None; pos "/" total " " bar_fill)?;
let progress = progress!(    ; pos "/" total " " bar_fill)?;