12use super::imp;
34/// Rust version of C's `va_list` type from the `stdarg.h` header
5#[repr(transparent)]
6pub struct VaList<'a> {
7 internal: imp::VaList<'a>,
8}
910/// Core type as passed though the FFI
11impl<'a> VaList<'a> {
12/// Read a value from the VaList.
13 ///
14 /// Users should take care that they are reading the correct type
15pub unsafe fn get<T: VaPrimitive>(&mut self) -> T {
16 T::get(&mut self.internal)
17 }
18}
1920/// Trait implemented on types that can be read from a va_list
21pub trait VaPrimitive: 'static {
22#[doc(hidden)]
23unsafe fn get(_: &mut imp::VaList) -> Self;
24}
2526#[allow(dead_code)]
27mod check_core_types {
28struct Foo<T: super::VaPrimitive>([T;0]);
2930struct Checks {
31 _ptr: Foo<*const u8>,
32 _usize: Foo<usize>,
33 _isize: Foo<isize>,
34 }
35}
36