pub struct Unit {
pub name: &'static str,
pub kind: UnitKind,
pub identity_path: &'static str,
pub source: &'static str,
pub binding: Binding,
pub id_block: u32,
pub platform: Option<Platform>,
pub env_providers: &'static [&'static str],
pub stability: Stability,
pub experimental: &'static [&'static str],
pub extensible: &'static [&'static str],
pub instantiable: &'static [Instantiable],
}Expand description
One first-party unit, as data (standard-library track, S1 #1945). Adding a
unit to the standard library is an entry in UNITS plus its files; the
checker’s injection reads this table and needs no change.
Fields§
§name: &'static strThe unit’s dotted name, inside the reserved bynk.* prefix.
kind: UnitKindWhether a project consumes it (an adapter) or uses it (a commons).
identity_path: &'static strThe synthetic path the injected unit is parsed under. Diagnostics and emission name the unit by it, so it never changes.
source: &'static strThe unit’s .bynk source.
binding: BindingThe binding the toolchain supplies for it.
id_block: u32Its permanent ExprId block: the checker parses it at
FIRSTPARTY_ID_BASE + id_block * FIRSTPARTY_ID_BLOCK, and injects units
in ascending id_block order. A block is never reused or moved, so ids
and injection order stay stable as units are added; a new unit takes the
next free block.
platform: Option<Platform>The platform that consuming it locks a deployment unit to (decision 0024), if it is platform-native.
env_providers: &'static [&'static str]The provider classes whose constructor takes the Worker env (decisions
0021/0025).
stability: StabilityThe unit’s stability (track D2, S3 #1963): a stable item is under the
1.0 promise, an experimental one carries none and needs an explicit
[unstable] allow to use. Required, so no entry is added without a
choice.
experimental: &'static [&'static str]Items inside a stable unit that are experimental, as paths relative to
the unit: an exported item ("Kv") or a capability operation
("Kv.list"). An experimental item makes its operations experimental.
extensible: &'static [&'static str]The exported enums that may gain variants in a minor release, so a
match covering one needs a wildcard (track §11 Q5).
instantiable: &'static [Instantiable]The capabilities a context may declare named instances of with
capability Sessions = Kv (S4a, #1966): each its own platform resource.
A capability not listed (Workers AI’s single [ai] binding, say) has no
instances.