Skip to main content

gated_handler

Function gated_handler 

Source
pub fn gated_handler(
    name: &'static str,
    runner: fn(&[VmValue]) -> Result<VmValue, HostlibError>,
) -> Arc<dyn Fn(&[VmValue]) -> Result<VmValue, HostlibError> + Send + Sync> 
Expand description

Wrap a builtin runner so it executes only when the deterministic-tools feature has been enabled on the current thread, returning a descriptive error otherwise.

This is the single gating policy shared by every hostlib builtin that reads or writes arbitrary host filesystem paths — the tools::* file I/O surface plus the fs::* and ast::* edit helpers — so a script denied tools:deterministic cannot mutate the working tree through any of them.