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
//! The table a component `.so` exports, and the callback shapes its slots hold.
//!
//! [`ComponentDescriptor`] is the whole of what a run reads out of your
//! library: its name, the subsystems it cannot run without, how to construct
//! and drop it, and one block of event slots per subsystem. A populated slot
//! *is* the subscription — there is no runtime register call.
//!
//! Writing `#[component("name")]` over an `impl` block builds all of this and
//! exports it, so most components never name a type in this module. Reach for
//! it when you are filling a descriptor by hand, or writing the component in
//! another language against the same layout.
//!
//! [`BARYL_COMPONENT_ABI_VERSION`] and [`BARYL_COMPONENT_MIN_ABI_VERSION`] are
//! the revision this build speaks; a run refuses a descriptor outside its own
//! window rather than reading fields that have moved.
use c_void;
use crateControl;
// Bindgen output cannot satisfy the workspace lints; the allow stops here.
pub use *;
/// A lifecycle event handler: your component's own state pointer — whatever
/// `new_` returned — and the [`Control`] for this event.
///
/// `ControlFn` in the descriptor is this wrapped in an `Option`, since an
/// unsubscribed slot is null. This alias is the unwrapped form, so a
/// hand-written block can write `Some(my_handler)` without a cast.
pub type GenericCb = unsafe extern "C" fn;
/// [`GenericCb`] plus the 48-bit vmcall body, which [`crate::abi::VMCall`]
/// decodes.
pub type VmcallCb = unsafe extern "C" fn;
// SAFETY: an exported descriptor is immutable after link and the core only ever
// reads it; the raw `name` pointer that makes it `!Sync` targets another
// immutable static in the same binary.
unsafe
const _: = ;