Skip to main content

Module loader

Module loader 

Source
Expand description

Loader: the ergonomic, thread-safe front door to Inkling.

This is how most programs should use Inkling. Create a Loader with a total, advance it from anywhere with inc or set, and a background thread keeps a living reveal painted at ~30 fps until you finish. It mirrors the idioms people already expect from a progress bar:

  • Drive it by hand with inc/set, determinate or spinner.
  • Wrap an iterator: for x in items.inkling() { .. }.
  • Wrap a reader: loader.wrap_read(file) advances by bytes read.

The handle is cheap to clone (via handle) and Send + Sync, so worker threads can report progress while the render thread owns the terminal, which keeps all drawing on one thread and free of races. When stdout is not a TTY the loader does not animate; it prints the finished art once on finish, so logs and CI still show the result.

Structs§

Builder
Builder for a customised Loader.
Handle
A cheap, clonable updater obtained from Loader::handle. Safe to send to and share across threads.
InklingIter
Iterator adaptor returned by ProgressIteratorExt::inkling.
Loader
A living progress reveal.
ProgressReader
A Read wrapper that advances a loader by the number of bytes read.

Traits§

ProgressIteratorExt
Extension trait that wraps any iterator in a progress reveal.