Expand description
§rusty-vipe
A Rust port of the moreutils vipe utility: pop $EDITOR mid-pipe so the
user can edit the buffered bytes interactively, then resume the pipeline
with the edited output.
§Quick start
use rusty_vipe::{VipeBuilder, EditorSource, CompatibilityMode};
use std::io::Cursor;
let mut input = Cursor::new(b"line1\nline2\nline3\n".to_vec());
let mut output: Vec<u8> = Vec::new();
let mut vipe = VipeBuilder::new()
.editor(EditorSource::Override("fake-editor --transform=passthrough".into()))
.suffix(".txt")
.compat(CompatibilityMode::Default)
.build()?;
vipe.run(&mut input, &mut output)?;§Stability (lockstep SemVer)
Library and binary share a single crate version. Within 0.x, minor
version bumps may introduce breaking changes per standard Cargo
semantics. Every public enum and struct is #[non_exhaustive] so
variant additions are not breaking changes once 1.0 lands.
§Pipeline-safety contract
When the editor exits non-zero, Vipe::run does NOT touch the
caller-supplied writer and returns Err(Error::EditorNonZeroExit(code)).
This matches the CLI invariant — no bytes downstream on abort.
Re-exports§
pub use error::Error;
Modules§
- cli
- Command-line interface stub.
- editor
- Editor resolution + argv parsing.
- error
- Library-level error type for
rusty_vipe. - mode
- Compatibility mode resolution.
- pipeline
- Core vipe pipeline: drain → spawn → write-back.
- signal
- Signal-driven cleanup, mirroring the
rusty-spongearchitecture. - strict
- Strict moreutils-compat mode entry point.
- tty
- Cross-platform controlling-terminal reattachment.
Structs§
- Vipe
- Runtime engine for one vipe invocation. Constructed via
VipeBuilder. - Vipe
Builder - Builder for
Vipe. All chain methods are#[must_use].
Enums§
- Compatibility
Mode - Whether to apply Default-mode ergonomic extensions or Strict moreutils parity.
- Editor
Source - Where the editor command comes from.
Constants§
- DEFAULT_
SUFFIX - Default tempfile suffix (matches moreutils 0.69
--suffixdefault). - MAX_
SUFFIX_ LEN - Maximum permitted length (in bytes) for a
--suffixvalue. Most POSIX and Windows filesystems cap a single filename component at 255 bytes; we reject suffixes that would push the tempfile name past that limit.
Functions§
- run
- Binary entry-point helper used by both
src/main.rsandsrc/bin/vipe.rs. - validate_
suffix - Validate a
--suffix=<ext>value at parse time. Rejects path separators (/,\), NUL bytes (which terminate C strings on every supported OS), and lengths pastMAX_SUFFIX_LEN. Empty suffix is allowed (means literally no extension, per FR-012 Clarification Q2).