[][src]Macro gstuff::gstring

macro_rules! gstring {
    ($array: ident, $code: block) => { ... };
}

A helper to build a string on the stack.

Given an array it makes a writeable cursor available to the passed code block.

Returns a &str slice pointing at memory between the array start and the cursor.

Example:

use std::io::Write;
let mut foobar: [u8; 128] = unsafe {std::mem::uninitialized()};
let foobar = gstring! (foobar, {
    write! (foobar, "foo") .expect ("!write");
    write! (foobar, "bar") .expect ("!write");
});

Alternatives: https://crates.io/crates/stack.