{ CStr::from_ptr(output) } .to_string_lossy() .into_owned(); let error .

To define the template inline, or pull it from a file. As usual, place a small snippet into, say.