#[repr(u32)]pub enum CapabilityBit {
ReadsFs = 0,
WritesFs = 1,
Network = 2,
ReadsClock = 3,
ReadsEnv = 4,
UsesRng = 5,
}Expand description
Canonical assignment of capability bits to stable bit positions.
Each variant’s discriminant is the bit index the compiled backends
key on: the cranelift CapabilityVtable slots a host fn at
cap_bit, the LLVM / wasm host boundaries consult the same index,
and the wasm __relon_check_cap import receives it. Hosts registering a
#native function tag the registration with the matching bit.
Discriminants are stable: adding a new capability appends a new variant rather than reshuffling existing values, so previously emitted modules keep validating against the same bit positions.
Variants§
ReadsFs = 0
Filesystem reads. Mirrors Capabilities::reads_fs /
NativeFnGate::reads_fs.
WritesFs = 1
Filesystem writes. Mirrors Capabilities::writes_fs /
NativeFnGate::writes_fs.
Network = 2
Network access (sockets, HTTP, DNS). Mirrors
Capabilities::network / NativeFnGate::network.
ReadsClock = 3
Wall / monotonic clock reads. Mirrors
Capabilities::reads_clock / NativeFnGate::reads_clock.
ReadsEnv = 4
Process environment reads. Mirrors Capabilities::reads_env /
NativeFnGate::reads_env.
UsesRng = 5
Random-number / non-deterministic source reads. Mirrors
Capabilities::uses_rng / NativeFnGate::uses_rng.
Implementations§
Source§impl CapabilityBit
impl CapabilityBit
Sourcepub fn bit_index(self) -> u32
pub fn bit_index(self) -> u32
Stable bit index this capability claims. Used by the cranelift vtable and LLVM / wasm host-boundary checks to key the same capability across backends.
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Stable, audit-visible string label for this capability.
Mirrors the NativeFnGate::missing_bits field-name strings
so historical diagnostics keep the same wording.
Sourcepub fn deny_message(self) -> String
pub fn deny_message(self) -> String
Human-readable denial message for the reason field of
RuntimeError::CapabilityDenied. The dominant (and only
Capabilities-produced) case: the fn declared this bit but the
caller never granted it.
Trait Implementations§
Source§impl Clone for CapabilityBit
impl Clone for CapabilityBit
Source§fn clone(&self) -> CapabilityBit
fn clone(&self) -> CapabilityBit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CapabilityBit
Source§impl Debug for CapabilityBit
impl Debug for CapabilityBit
impl Eq for CapabilityBit
Source§impl PartialEq for CapabilityBit
impl PartialEq for CapabilityBit
Source§fn eq(&self, other: &CapabilityBit) -> bool
fn eq(&self, other: &CapabilityBit) -> bool
self and other values to be equal, and is used by ==.