Types v0.1.0

Source
C's scalar types under their C names, sized for the current target.

c_bool

pub type c_bool = bool8

C's _Bool, which occupies one byte and holds zero or one.

Source

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.

Source

c_double

pub type c_double = float64

C's double.

Source

c_float

pub type c_float = float32

C's float.

Source

c_int

pub type c_int = int32

C's int, which is 32 bits on every currently supported target.

Source

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.

OverloadSummary
pub type c_long = int32C's long, 32 bits under this target's LLP64 data model.
pub type c_long = int64C's long, 64 bits under this target's LP64 data model.

Source

c_longlong

pub type c_longlong = int64

C's long long.

Source

c_schar

pub type c_schar = int8

C's signed char: the smallest addressable signed integer.

Source

c_short

pub type c_short = int16

C's short.

Source

c_uchar

pub type c_uchar = uint8

C's unsigned char, which is also the type a byte of arbitrary storage is read through.

Source

c_uint

pub type c_uint = uint32

C's unsigned int.

Source

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.

OverloadSummary
pub type c_ulong = uint32C's unsigned long, 32 bits under this target's LLP64 data model.
pub type c_ulong = uint64C's unsigned long, 64 bits under this target's LP64 data model.

Source

c_ulonglong

pub type c_ulonglong = uint64

C's unsigned long long.

Source

c_ushort

pub type c_ushort = uint16

C's unsigned short.

Source

intptr_t

pub type intptr_t = int

C's intptr_t: a signed integer wide enough to hold any pointer.

Source

ptrdiff_t

pub type ptrdiff_t = int

C's ptrdiff_t: the signed difference between two pointers into one object.

Source

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.

Source

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.

Source

uintptr_t

pub type uintptr_t = uint

C's uintptr_t: an unsigned integer wide enough to hold any pointer.

Source

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.

OverloadSummary
pub type wchar_t = char16C's wchar_t, a 16-bit UTF-16 code unit on Windows rather than a whole scalar value.
pub type wchar_t = char32C's wchar_t, a 32-bit Unicode scalar value on this target.

Source