#write #buffer #no-std #fmt #writable #writebuf #uwrite

no-std writebuf-core

A writable buffer that implements fmt::Write or ufmt::uWrite

2 releases

0.1.1 Jun 17, 2024
0.1.0 Mar 20, 2023

#1874 in Algorithms

MIT/Apache

5KB
86 lines

A writeable buffer that implements fmt::Write or ufmt::uWrite.

Example

use writebuf_core::WriteBuf;
use ufmt::{uwrite, uWrite};

// write to buffer
let mut buf: WriteBuf<10> = WriteBuf::from("123");
uwrite!(&mut buf, "{}", "456").ok();
uwrite!(&mut buf, "{}", 789).ok();
buf.write_str("0").ok();
buf.write_str("E").err();

// convert to ASCII string
buf.into_ascii_lossy().as_str();

ufmt

ufmt is more compact than core::fmt. By default, ufmt feature is enabled.

Dependencies

~2.5MB
~50K SLoC