macro_rules! format_compact_utf8bytes {
($($tt:tt)*) => { ... };
}Available on crate features
alloc or std only.Expand description
Formats arguments into compact Utf8Bytes.
This is similar to format!, but returns a value that uses inline storage
when its contents fit, including after a larger value is later shortened.
Use format_utf8bytes! when retaining heap storage after shrinking is preferred.
ยงExamples
use smol_bytes::{compact, format_compact_utf8bytes};
let name = "Ada";
let greeting: compact::Utf8Bytes = format_compact_utf8bytes!("hello, {name}!");
assert_eq!(greeting.as_str(), "hello, Ada!");