24 releases

0.1.23 Apr 16, 2024
0.1.22 Sep 26, 2023
0.1.21 Feb 25, 2023
0.1.20 Jul 28, 2022
0.1.7 Dec 30, 2018

#34 in No standard library

Download history 2935/week @ 2025-10-21 2956/week @ 2025-10-28 3508/week @ 2025-11-04 3667/week @ 2025-11-11 3351/week @ 2025-11-18 2875/week @ 2025-11-25 3178/week @ 2025-12-02 4016/week @ 2025-12-09 4697/week @ 2025-12-16 2649/week @ 2025-12-23 2482/week @ 2025-12-30 3077/week @ 2026-01-06 4795/week @ 2026-01-13 5179/week @ 2026-01-20 5057/week @ 2026-01-27 5074/week @ 2026-02-03

20,656 downloads per month
Used in 59 crates (24 directly)

Apache-2.0 OR MIT

13KB
241 lines

no_std libc print/println/eprint/eprintln/dbg

Build Status docs.rs crates.io

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.

Usage

Exactly as you'd use println!, eprintln! and dbg!.

#![no_std]

// Use the default `libc_`-prefixed macros:
libc_println!("Hello {}!", "stdout");
libc_eprintln!("Hello {}!", "stderr");
let a = 2;
let b = libc_dbg!(a * 2) + 1;
assert_eq!(b, 5);

Or you can import aliases to std names:

use libc_print::std_name::{println, eprintln, dbg};

println!("Hello {}!", "stdout");
eprintln!("Hello {}!", "stderr");
let a = 2;
let b = dbg!(a * 2) + 1;
assert_eq!(b, 5);

Dependencies

~42KB