1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#![cfg_attr(rustfmt, rustfmt::skip)]
//! Tuple types with a guaranteed `#[repr(C)]` layout.
//!
//! Simplified for lighter documentation, but the actual `struct` definitions
//! and impls range from `Tuple1` up to `Tuple6`.

use_prelude!();

mod void {
    #[derive(Clone, Copy)]
    #[allow(missing_debug_implementations)]
    pub
    struct CVoid {
        _0: (),
    }
    // pub const CVoid: CVoid = CVoid { _0: () };
}
pub(in crate) use void::CVoid;

unsafe
impl LegacyCType
    for CVoid
{ __cfg_headers__! {
    fn c_short_name_fmt (fmt: &'_ mut fmt::Formatter<'_>)
      -> fmt::Result
    {
        fmt.write_str("void")
    }

    fn c_var_fmt (
        fmt: &'_ mut fmt::Formatter<'_>,
        var_name: &'_ str,
    ) -> fmt::Result
    {
        write!(fmt,
            "void{sep}{}",
            var_name,
            sep = if var_name.is_empty() { "" } else { " " },
        )
    }

    fn c_define_self (
        _: &'_ mut dyn crate::headers::Definer,
    ) -> io::Result<()>
    {
        Ok(())
    }

    __cfg_csharp__! {
        fn csharp_define_self (
            _: &'_ mut dyn crate::headers::Definer,
        ) -> io::Result<()>
        {
            Ok(())
        }

        fn csharp_ty ()
          -> rust::String
        {
            "void".into()
        }
    }
} type OPAQUE_KIND = crate::layout::OpaqueKind::Concrete; }
from_CType_impl_ReprC! { CVoid }

unsafe
impl ReprC
    for ::core::ffi::c_void
{
    type CLayout = CVoid;

    fn is_valid (_: &'_ CVoid)
      -> bool
    {
        panic!("Trying to construct a `c_void` is a logic error");
    }
}

#[cfg(not(docs))]
ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    /// Simplified for lighter documentation, but the actual impls
    /// range from `Tuple1` up to `Tuple6`.
    pub
    struct Tuple1[T0] {
        pub _0: T0,
    }
}

ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    /// Simplified for lighter documentation, but the actual impls
    /// range from `Tuple1` up to `Tuple6`.
    pub
    struct Tuple2[T0, T1] {
        pub _0: T0,
        pub _1: T1,
    }
}

#[cfg(not(docs))]
ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    pub
    struct Tuple3[T0, T1, T2] {
        pub _0: T0,
        pub _1: T1,
        pub _2: T2,
    }
}

#[cfg(not(docs))]
ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    pub
    struct Tuple4[T0, T1, T2, T3] {
        pub _0: T0,
        pub _1: T1,
        pub _2: T2,
        pub _3: T3,
    }
}
#[cfg(not(docs))]
ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    pub
    struct Tuple5[T0, T1, T2, T3, T4] {
        pub _0: T0,
        pub _1: T1,
        pub _2: T2,
        pub _3: T3,
        pub _4: T4,
    }
}
#[cfg(not(docs))]
ReprC! {
    #[repr(C)]
    #[derive(Debug)]
    pub
    struct Tuple6[T0, T1, T2, T3, T4, T5] {
        pub _0: T0,
        pub _1: T1,
        pub _2: T2,
        pub _3: T3,
        pub _4: T4,
        pub _5: T5,
    }
}