va_list

Macro to_va_list

Source
macro_rules! to_va_list {
    ($func:expr, $($args:expr),*) => { ... };
    ($func:expr) => { ... };
}
Expand description

This macro is the only thing provided by this crate.

§Arguments

It expects a closure as first argument and then the arguments that’ll be used to build the va_list.

§Example

unsafe {
    to_va_list!(|v: va_list::va_list| {
        vprintf(b"%d %d %s %f\n\0".as_ptr() as *const c_char, v);
    },
    1, 2, b"salut!\0".as_ptr(), 32f32 as c_double);
}

§Warning

It might exist a limit to the number of arguments you can actually pass. A big one, but don’t try to send thousands of them at once.