rusty-pv
Pipe viewer. A Rust port of Andrew Wood's pv(1) — show progress, elapsed time, ETA, rate, and bytes transferred while data flows through a pipe.
Part of the Rusty portfolio.
Install
# or, with prebuilt binaries:
Usage
# Show progress copying a file
# Throttle to 5 MiB/s
# Pipe through with a labelled progress line
| |
# Numeric mode for dialog --gauge integration
Cargo Features
| Feature | Default | What it gates |
|---|---|---|
cli |
yes | clap + clap_complete + anyhow + crossterm + signal-hook (Unix) + fd-lock |
Library consumers can use rusty-pv = { version = "0.1", default-features = false } to get the throttle, EMA, and unit-suffix math without any CLI dependencies.
Library API
use ;
use Cursor;
let pv = new
.total_bytes
.rate_limit // 500 kB/s
.build;
let mut reader = new;
let mut writer = Vecnew;
let n = pv.copy.unwrap;
assert_eq!;
Compatibility
rusty-pv has two modes:
- Default — clap-styled flag parser; rejects conflicting flag pairs at parse time; adds
--help,--version,completionssubcommand. - Strict (
--strict, envRUSTY_PV_STRICT=1, or argv[0] =pv/pv-alias) — byte-equal stderr against upstream v1.10.5 for documented diagnostics; last-wins flag resolution; no subcommands.
v0.1.0 excludes: -F (custom format strings), -T (buffer percentage), -A (peek window), --bits, --remote/--query inter-instance control, SIGUSR2 (deprecated by upstream).
The EMA smoothing constant α = 0.3 is locked at v0.1.0 to preserve byte-equal Strict-mode compatibility; future versions may expose it via an additive library method.
Display modes
- Single-line redraw (default) — carriage-return + erase-to-EOL ANSI sequence; works on every terminal that supports basic ANSI.
- Cursor mode (
-c) — Unix-only in v0.1.0. Coordinates multiplerusty-pvinstances in a pipeline so each writes to its own row. Windows emits a stderr diagnostic and falls back to single-line redraw.
Concurrency
The -c per-tty file lock guarantees only one rusty-pv instance writes ANSI cursor escapes at a time, but the cursor-mode design is not crash-safe — if a rusty-pv instance is killed mid-redraw the next surviving instance may briefly overwrite its row. This matches upstream pv behavior.
MSRV
Rust 1.85 (edition 2024). Re-verified against stable-minus-two policy at each release.
License
Dual-licensed under MIT or Apache-2.0.