Macro bump_scope::mut_bump_format
source · macro_rules! mut_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
or BumpScope
, returning a MutBumpString
.
If you don’t need to push to the string after creation you can also use Bump::alloc_fmt_mut
.
§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 = mut_bump_format!(in bump, "{greeting} world!");
string.push_str(" How are you?");
assert_eq!(string, "Hello world! How are you?");