How to format output to a byte array with no_std and no allocator?

Let’s start with the standard version: use std::io::Write; fn main() { let x = 123; let mut buf = [0 as u8; 20]; write!(&mut buf[..], “{}”, x).expect(“Can’t write”); assert_eq!(&buf[0..3], b”123″); } If we then remove the standard library: #![feature(lang_items)] #![no_std] use core::panic::PanicInfo; #[lang = “eh_personality”] extern “C” fn eh_personality() {} #[panic_handler] fn panic(info: &PanicInfo) -> … Read more