devela::text::fmt

Function format_buf_args

Source
pub fn format_buf_args<'a>(
    buf: &'a mut [u8],
    arg: FmtArguments<'_>,
) -> Result<&'a str, FmtError> 
Expand description

Returns a formatted str slice backed by a buffer, non-allocating.

See also the slightly more convenient to use format_buf! macro.

§Example

let mut buf = [0u8; 64];
let s = format_buf_args(&mut buf, format_args!["Test: {} {}", "foo", 42]);
assert_eq!(Ok("Test: foo 42"), s);

§Features

Makes use of the unsafe_str feature if enabled.