Skip to main content

fmt_cstr

Macro fmt_cstr 

Source
macro_rules! fmt_cstr {
    ($n:literal, $($arg:tt)*) => { ... };
    ($buf:expr, $($arg:tt)*) => { ... };
}
Expand description

Formats a null-terminated C string.

Two forms:

  • fmt_cstr!(buf, "fmt", args) — writes into buf: &mut [u8], returns Result<&CStr, _>
  • fmt_cstr!(32, "fmt", args) — returns Result<CStrBuf<32>, _> (owned, no separate buffer)