#[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 ==.impl StructuralPartialEq for CapabilityBit
Auto Trait Implementations§
impl Freeze for CapabilityBit
impl RefUnwindSafe for CapabilityBit
impl Send for CapabilityBit
impl Sync for CapabilityBit
impl Unpin for CapabilityBit
impl UnsafeUnpin for CapabilityBit
impl UnwindSafe for CapabilityBit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more