Skip to main content

format_utf8bytes

Macro format_utf8bytes 

Source
macro_rules! format_utf8bytes {
    ($($tt:tt)*) => { ... };
}
Available on crate features alloc or std only.
Expand description

Formats arguments into the default shared Utf8Bytes.

This is similar to format!, but returns a value that retains heap storage when later shortened. Use format_compact_utf8bytes! when short results should use inline storage.

ยงExamples

use smol_bytes::{format_utf8bytes, Utf8Bytes};

let name = "Ada";
let greeting: Utf8Bytes = format_utf8bytes!("hello, {name}!");
assert_eq!(greeting.as_str(), "hello, Ada!");