Types v0.1.0
c_bool
pub type c_bool = bool8
C's _Bool, which occupies one byte and holds zero or one.
c_char
pub type c_char = int8
C's plain char, whose signedness the standard leaves to the implementation.
Signed on every currently supported target. A binding whose meaning depends on the sign should name c_schar or
c_uchar instead of relying on this.
c_double
pub type c_double = float64
C's double.
c_float
pub type c_float = float32
C's float.
c_int
pub type c_int = int32
C's int, which is 32 bits on every currently supported target.
c_long
// Windows
pub type c_long = int32
// Linux · macOS · FreeBSD
pub type c_long = int64
C's long, 32 bits under this target's LLP64 data model.
| Overload | Summary |
|---|---|
pub type c_long = int32 | C's long, 32 bits under this target's LLP64 data model. |
pub type c_long = int64 | C's long, 64 bits under this target's LP64 data model. |
c_longlong
pub type c_longlong = int64
C's long long.
c_schar
pub type c_schar = int8
C's signed char: the smallest addressable signed integer.
c_short
pub type c_short = int16
C's short.
c_uchar
pub type c_uchar = uint8
C's unsigned char, which is also the type a byte of arbitrary storage is read through.
c_uint
pub type c_uint = uint32
C's unsigned int.
c_ulong
// Windows
pub type c_ulong = uint32
// Linux · macOS · FreeBSD
pub type c_ulong = uint64
C's unsigned long, 32 bits under this target's LLP64 data model.
| Overload | Summary |
|---|---|
pub type c_ulong = uint32 | C's unsigned long, 32 bits under this target's LLP64 data model. |
pub type c_ulong = uint64 | C's unsigned long, 64 bits under this target's LP64 data model. |
c_ulonglong
pub type c_ulonglong = uint64
C's unsigned long long.
c_ushort
pub type c_ushort = uint16
C's unsigned short.
intptr_t
pub type intptr_t = int
C's intptr_t: a signed integer wide enough to hold any pointer.
ptrdiff_t
pub type ptrdiff_t = int
C's ptrdiff_t: the signed difference between two pointers into one object.
size_t
pub type size_t = uint
C's size_t: the type of a size, a count of bytes, and the result of sizeof.
Pointer-sized and unsigned on every supported target.
ssize_t
pub type ssize_t = int
POSIX's ssize_t: a size that can also report -1 for failure.
Declared on every target for the sake of bindings that share a signature, though Windows has no such type of its
own and its C runtime spells the same thing int or __int64 depending on the call.
uintptr_t
pub type uintptr_t = uint
C's uintptr_t: an unsigned integer wide enough to hold any pointer.
wchar_t
// Windows
pub type wchar_t = char16
// Linux · macOS · FreeBSD
pub type wchar_t = char32
C's wchar_t, a 16-bit UTF-16 code unit on Windows rather than a whole scalar value.
| Overload | Summary |
|---|---|
pub type wchar_t = char16 | C's wchar_t, a 16-bit UTF-16 code unit on Windows rather than a whole scalar value. |
pub type wchar_t = char32 | C's wchar_t, a 32-bit Unicode scalar value on this target. |