Macro bump_scope::bump_format
source · macro_rules! bump_format { (in $bump:expr) => { ... }; (in $bump:expr, $($arg:tt)*) => { ... }; (try in $bump:expr) => { ... }; (try in $bump:expr, $($arg:tt)*) => { ... }; }
Expand description
This is like format! but allocates inside a mutable bump allocator, returning a BumpString.
If you don’t need a BumpString you can use alloc_fmt instead, which does not require a mutable $bump.
§Panics
If used without try, panics on allocation failure or if a formatting trait implementation returns an error.
§Errors
If used with try, errors on allocation failure or if a formatting trait implementation returns an error.
§Examples
let greeting = "Hello";
let mut string = bump_format!(in bump, "{greeting} world!");
string.push_str(" How are you?");
assert_eq!(string, "Hello world! How are you?");