2 releases

Uses old Rust 2015

0.0.4 Jun 6, 2016
0.0.1 May 19, 2016

#76 in #c

Download history 182/week @ 2023-12-13 61/week @ 2023-12-20 62/week @ 2023-12-27 235/week @ 2024-01-03 258/week @ 2024-01-10 304/week @ 2024-01-17 272/week @ 2024-01-24 347/week @ 2024-01-31 653/week @ 2024-02-07 538/week @ 2024-02-14 804/week @ 2024-02-21 533/week @ 2024-02-28 528/week @ 2024-03-06 358/week @ 2024-03-13 324/week @ 2024-03-20 223/week @ 2024-03-27

1,567 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