Module interoptopus::lang::c
source · Expand description
Canonical, almost-C representation of items in an FFI boundary.
The types in here are the crate::Inventory
building blocks with which
a C API can be built. In addition, they contain a few extra, non-C elements
(e.g., namespaces, patterns), all of which however can reasonably be mapped to or ignored in C.
Except for special circumstances (e.g., when implementing CTypeInfo
for a type you don’t own; or when writing your own backend) you will not need any of the items in this module.
In most cases the types here are automatically generated by an attribute; and later consumed
by a backend.
Structs§
- A (C-style)
type[N]
containing a fixed number of elements of the same type. - Used for Rust and C
struct
with named fields, must be#[repr(C)]
. - A Rust
const
definition with a name and value, might become a#define
. - Markdown generated from the
///
you put on Rust code. - A (C-style)
enum
containing numbered variants. - Fields of a
CompositeType
. - Represents
extern "C" fn()
types in Rust and(*f)().
in C. - A named, exported
#[no_mangle] extern "C" fn f()
function. - Represents multiple
in
and a singleout
parameters. - Additional information for user-defined types.
- A named
struct
that becomes a fieldlesstypedef struct S S;
in C. - Parameters of a
FunctionSignature
. - Variant and value of a
EnumType
.
Enums§
- A type that can exist at the FFI boundary.
- The value of a constant.
- A primitive type that natively exists in C and is FFI safe.
- A primitive value expressible on C-level.
- Doesn’t exist in C, but other languages can benefit from accidentally using ‘private’ fields.