Expand description
A no-std and no-alloc version of format!
using ToArrayString
.
§Example
use aformat::{astr, aformat, CapStr};
pub fn say_hello(name: &str, age: u8) {
let name = CapStr::<256>(name);
let formatted = aformat!("Hello {name}, you are {age} years old!");
println!("{}", formatted.as_str());
}
say_hello("Walter White", 50);
§Minimum Supported Rust Version
This is currently 1.79
, and is considered a breaking change to increase.
Re-exports§
pub use to_arraystring::ArrayString;
pub use to_arraystring::ToArrayString;
Macros§
- aformat
- A no-alloc version of
format!
, producing anArrayString
. - aformat_
into aformat!
, but you provide your ownArrayString
.- astr
- A simple and easy way to make a perfectly fitting
ArrayString
from a literal.
Structs§
- CapStr
- A transparent wrapper around
&str
to truncate the byte length to a compile time constant.