2 releases

Uses old Rust 2015

0.0.4 Jun 6, 2016
0.0.1 May 19, 2016

#11 in #itll

Download history 511/week @ 2023-11-03 343/week @ 2023-11-10 206/week @ 2023-11-17 295/week @ 2023-11-24 198/week @ 2023-12-01 266/week @ 2023-12-08 177/week @ 2023-12-15 21/week @ 2023-12-22 130/week @ 2023-12-29 346/week @ 2024-01-05 302/week @ 2024-01-12 242/week @ 2024-01-19 366/week @ 2024-01-26 474/week @ 2024-02-02 679/week @ 2024-02-09 556/week @ 2024-02-16

2,119 downloads per month

MIT license

5KB
72 lines

va_list-rs Build Status Build status

A way to use C va_list from Rust.

Example:

extern crate libc;
#[macro_use] extern crate va_list;

use libc::{c_char, c_int};

// Here we declare the C function with va_list that we'll use.
extern "C" {
    fn vprintf(f: *const c_char, v: va_list::va_list) -> c_int;
}

fn main() {
    // You just have to call this macro and it'll return you the va_list.
    unsafe {
        to_va_list!(|v: va_list::va_list| {
            // And now you can just give the va_list to the C function:
            vprintf(b"%d %d %s\n\0".as_ptr() as *const c_char, v);
        },
        1, 2, b"salut!\0".as_ptr()); // We pass the arguments after the closure.
    }
}

Dependencies

~54KB