Skip to main content

Module env

Module env 

Source
Expand description

Native env module for environment variable and system info access.

Phase 2b canary: migrated to the typed marshal layer (crate::marshal::register_typed_fn_N). Native function bodies take typed Rust args via [shape_runtime::marshal::FromSlot]; their Rust signatures are the typed signatures. The Rust trait system rejects registration whose body’s parameter types don’t match.

Currently exports the all-scalar-return subset: env.has, env.cwd, env.os, env.arch.

Pending Phase 2c marshal extensions:

  • env.get (Option<string> return — needs ToSlot for Option/None)
  • env.all (HashMap<string, string> return — needs Map marshal)
  • env.args (Array<string> return — needs Array marshal)

Policy gated: requires Env permission at runtime.

See docs/defections.md 2026-05-06 (Phase 2b unified marshal).

Functions§

create_env_module
Create the env module with environment variable and system info functions.