Crate format_no_std

source ·
Expand description

Implements write_str to get write_fmt, which is used in the format!() and format_args!() macros. For no_std formatting in a bare metal environment.

This code is based on https://stackoverflow.com/questions/50200268/how-can-i-use-the-format-macro-in-a-no-std-environment

let mut buf = [0u8; 64];
let s = format_no_std::show(
    &mut buf,
    format_args!("Test String {}: {}", "foo", 42),
).unwrap();

assert_eq!("Test String foo: 42", s);

Structs§

  • A struct representing a writer that appends formatted data to a byte buffer.

Functions§

  • Formats data using format_args! (arg argument) and writes it to a byte buffer buf.