Skip to main content

try_format_into

Function try_format_into 

pub fn try_format_into<'a>(
    output: &'a mut String,
    args: Arguments<'_>,
) -> Result<&'a str, Error>
Expand description

Clear output, try to format args into it, and return the resulting string.

The allocation owned by output is retained, making this suitable for a scratch string reused across a loop or a sequence of writes.

If formatting fails, output contains the successfully formatted prefix.