shaddup

Crates.ioshaddup
lib.rsshaddup
version0.1.0
created_at2025-03-02 16:33:24.309369+00
updated_at2025-03-02 16:33:24.309369+00
descriptionSuppress stdout and stderr of the current program. Works on Unix
homepagehttps://github.com/danya02/shaddup-rs
repositoryhttps://github.com/danya02/shaddup-rs
max_upload_size
id1574724
size16,900
Danya Generalov (danya02)

documentation

README

shaddup-rs

Shut up your Rust program('s stdout and stderr).

Works on Unix only (so far).

Usage

use shaddup::run_quietly;

let result = run_quietly(|| {
    println!("This will not be printed");
    eprintln!("neither will this");
    123
});

assert_eq!(result.unwrap(), 123);

This is similar to gag: that crate has a different API, based around guard handles instead of closures. It supports Unix and Windows targets.

Cargo features

  • allow_unsupported: If this is enabled, and you're building on an unsupported target, then the library will be a no-op. (If this feature is not provided on an unsupported target, then this will fail to compile.)
  • no_op: If this is enabled, then the library will be a no-op, even if the target is supported. This can be useful for debugging.
Commit count: 4

cargo fmt