std/env
import std/env to use it. Source: src/std/env.iyi at v0.18.0.
Provides retrieval, modification, deletion, iteration, and inspection of environment variables without external C libraries.
The environment this reaches is the platform's own. On Linux, darwin and wasm that is the environ table. On Windows it is the Win32 block — GetEnvironmentVariableW, SetEnvironmentVariableW, GetEnvironmentStringsW — because the CRT's _environ table this module used to rebuild there is an ANSI copy of it that nobody else reads: a value read through it came back folded into the process's code page (değer-日本 as deger-??, 13 bytes down to 8), and a value written through it never reached the block a child process inherits.
ENVstruct
pub struct ENV
def self.[](key : String) : String
def self.[]=(key : String, value : String | ::Nil) : String | ::Nil
def self.[]?(key : String) : String | ::Nil
def self.clear : Nil
def self.delete(key : String) : String | ::Nil
def self.each(&block : (String, String -> Nil)) : Nil
def self.each_key(&block : (String -> Nil)) : Nil
def self.each_value(&block : (String -> Nil)) : Nil
def self.empty? : Bool
def self.fetch(key : String, default : T) : String | T forall T
def self.fetch(key : String) : String
def self.fetch(key : String, &block : (String -> T)) : String | T forall T
def self.has_key?(key : String) : Bool
def initialize
def self.keys : Array(String)
def self.size : Int32
def self.to_h : Hash(String, String)
def self.values : Array(String)
endENVmodule, reopened
module ::ENV
def self.[](key : String) : String
def self.[]=(key : String, value : String | ::Nil) : String | ::Nil
def self.[]?(key : String) : String | ::Nil
def self.clear : Nil
def self.delete(key : String) : String | ::Nil
def self.each(&block : (String, String -> Nil)) : Nil
def self.each_key(&block : (String -> Nil)) : Nil
def self.each_value(&block : (String -> Nil)) : Nil
def self.empty? : Bool
def self.fetch(key : String, default : T) : String | T forall T
def self.fetch(key : String) : String
def self.fetch(key : String, &block : (String -> T)) : String | T forall T
def self.has_key?(key : String) : Bool
def self.keys : Array(String)
def self.size : Int32
def self.to_h : Hash(String, String)
def self.values : Array(String)
end
ENV: hash-like accessor for process environment variables.