no_std libc print/println/eprint/eprintln/dbg
Implements println!, eprintln! and dbg! on the libc crate without
requiring the use of an allocator.
Allows you to use these macros in a #![no_std] context, or in a
situation where the traditional Rust streams might not be available
(ie: at process shutdown time).
By default this crate provides libc_-prefixed macros, but also allows consumers to
import macros with the same name as the stdlib printing macros via the std_name
module.
Platform Support
For platforms with write in libc, this crate uses libc::write. For unknown
and none OS targets, the user is required to provide a write function via
the linker.
This crate support miri on all platforms, though it may choose different code
paths for compatibility reasons.
Usage
Exactly as you'd use println!, eprintln! and dbg!.
// Use the default `libc_`-prefixed macros:
libc_println!;
libc_eprintln!;
let a = 2;
let b = libc_dbg! + 1;
assert_eq!;
Or you can import aliases to std names:
use ;
println!;
eprintln!;
let a = 2;
let b = dbg! + 1;
assert_eq!;