nobb

Crates.ionobb
lib.rsnobb
version0.1.0
created_at2025-10-17 16:00:38.292539+00
updated_at2025-10-17 16:00:38.292539+00
descriptionSilence all console output by redirecting stdout and stderr to null device.
homepagehttps://gitee.com/luzhihaoTestingLab/useful-cargo-packages
repositoryhttps://gitee.com/luzhihaoTestingLab/useful-cargo-packages.git
max_upload_size
id1887852
size5,001
luzhihaoTestingLab (luzhihaoTestingLab)

documentation

https://docs.rs/nobb

README

nobb

Silence all console output by redirecting stdout and stderr to the null device.

Usage

Add to your Cargo.toml:

[dependencies]
nobb = "0.1"

Example:

fn main() {
    println!("This will be shown");
    nobb::silence();
    println!("This will NOT be shown");
    eprintln!("Errors also silenced");
}

Notes

  • Works by calling libc::freopen to redirect OS-level streams to the null device.
  • On Unix, uses /dev/null; on Windows, uses NUL.
  • This affects the entire process; subsequent println!/eprintln! from any crate will be silenced.

License

MIT © 2025

Commit count: 0

cargo fmt