glib_sys/
manual.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(unix)]
4pub use libc::passwd;
5#[allow(unused_imports)]
6use libc::{c_char, c_int, c_ushort, c_void};
7
8pub type gint16 = i16;
9pub type gint32 = i32;
10pub type gint64 = i64;
11pub type gint8 = i8;
12pub type gssize = isize;
13pub type gintptr = libc::intptr_t;
14pub type gint = libc::c_int;
15pub type gchar = libc::c_char;
16pub type guchar = libc::c_uchar;
17pub type glong = libc::c_long;
18pub type gshort = libc::c_short;
19pub type guint = libc::c_uint;
20pub type gulong = libc::c_ulong;
21pub type gushort = libc::c_ushort;
22pub type guint16 = u16;
23pub type guint32 = u32;
24pub type guint64 = u64;
25pub type guint8 = u8;
26pub type gsize = usize;
27pub type guintptr = libc::uintptr_t;
28pub type gfloat = f32;
29pub type gdouble = f64;
30pub type goffset = libc::off_t;
31
32pub type GType = libc::size_t;
33
34#[cfg(all(not(unix), docsrs))]
35#[repr(C)]
36pub struct passwd {
37    pw_name: *mut c_char,
38    pw_passwd: *mut c_char,
39    pw_uid: u32,
40    pw_gid: u32,
41    pw_gecos: *mut c_char,
42    pw_dir: *mut c_char,
43    pw_shell: *mut c_char,
44}
45
46#[cfg(windows)]
47pub type GPid = *mut c_void;
48
49#[cfg(not(windows))]
50pub type GPid = libc::pid_t;
51
52#[repr(C)]
53#[derive(Copy, Clone)]
54#[cfg(all(windows, target_arch = "x86_64"))]
55pub struct GPollFD {
56    pub fd: i64,
57    pub events: c_ushort,
58    pub revents: c_ushort,
59}
60
61#[repr(C)]
62#[derive(Copy, Clone)]
63#[cfg(not(all(windows, target_arch = "x86_64")))]
64pub struct GPollFD {
65    pub fd: c_int,
66    pub events: c_ushort,
67    pub revents: c_ushort,
68}
69
70// These are all non-NUL terminated strings in C
71pub const G_VARIANT_TYPE_BOOLEAN: &str = "b";
72pub const G_VARIANT_TYPE_BYTE: &str = "y";
73pub const G_VARIANT_TYPE_INT16: &str = "n";
74pub const G_VARIANT_TYPE_UINT16: &str = "q";
75pub const G_VARIANT_TYPE_INT32: &str = "i";
76pub const G_VARIANT_TYPE_UINT32: &str = "u";
77pub const G_VARIANT_TYPE_INT64: &str = "x";
78pub const G_VARIANT_TYPE_UINT64: &str = "t";
79pub const G_VARIANT_TYPE_DOUBLE: &str = "d";
80pub const G_VARIANT_TYPE_STRING: &str = "s";
81pub const G_VARIANT_TYPE_OBJECT_PATH: &str = "o";
82pub const G_VARIANT_TYPE_SIGNATURE: &str = "g";
83pub const G_VARIANT_TYPE_VARIANT: &str = "v";
84pub const G_VARIANT_TYPE_HANDLE: &str = "h";
85pub const G_VARIANT_TYPE_UNIT: &str = "()";
86pub const G_VARIANT_TYPE_ANY: &str = "*";
87pub const G_VARIANT_TYPE_BASIC: &str = "?";
88pub const G_VARIANT_TYPE_MAYBE: &str = "m*";
89pub const G_VARIANT_TYPE_ARRAY: &str = "a*";
90pub const G_VARIANT_TYPE_TUPLE: &str = "r";
91pub const G_VARIANT_TYPE_DICT_ENTRY: &str = "{?*}";
92pub const G_VARIANT_TYPE_DICTIONARY: &str = "a{?*}";
93pub const G_VARIANT_TYPE_STRING_ARRAY: &str = "as";
94pub const G_VARIANT_TYPE_OBJECT_PATH_ARRAY: &str = "ao";
95pub const G_VARIANT_TYPE_BYTE_STRING: &str = "ay";
96pub const G_VARIANT_TYPE_BYTE_STRING_ARRAY: &str = "aay";
97pub const G_VARIANT_TYPE_VARDICT: &str = "a{sv}";
98
99extern "C" {
100    pub fn g_atomic_int_get(atomic: *const c_int) -> c_int;
101}