| Crates.io | shaddup |
| lib.rs | shaddup |
| version | 0.1.0 |
| created_at | 2025-03-02 16:33:24.309369+00 |
| updated_at | 2025-03-02 16:33:24.309369+00 |
| description | Suppress stdout and stderr of the current program. Works on Unix |
| homepage | https://github.com/danya02/shaddup-rs |
| repository | https://github.com/danya02/shaddup-rs |
| max_upload_size | |
| id | 1574724 |
| size | 16,900 |
Shut up your Rust program('s stdout and stderr).
Works on Unix only (so far).
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.
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.