Skip to content

Examples ​

Complete working examples for env.zig.

Running Examples ​

bash
# Run all examples (13 total)
zig build example

# Run a specific example
zig-out/bin/basic_example
zig-out/bin/interpolation_example
zig-out/bin/clone_merge_example
zig-out/bin/cache_example
zig-out/bin/iterator_example
zig-out/bin/validation_example
zig-out/bin/serialization_example
zig-out/bin/runtime_example
zig-out/bin/file_io_example
zig-out/bin/error_handling_example
zig-out/bin/type_safe_example
zig-out/bin/unicode_example
zig-out/bin/child_env_example

Available Examples ​

ExampleDescription
BasicSet/get, explicit .env + .env.local creation, loadMany override
InterpolationVariable interpolation with ${VAR} syntax
Clone & MergeIndependent copies and default value merging
CacheStandalone cache for parsed values
IteratorBorrowed iterator with peek, skip, reset, and collect
ValidationSchema validation with built-in validators
SerializationSerialize to .env format with sorting and quoting
RuntimeCross-platform runtime env via env.runtime with scope & snapshot
Child EnvtoEnvironMap/applyToEnvironMap for child processes
UnicodeUTF-8 values, emoji, runtime round-trip
File I/OLoad/save, loadMany, reload, prefix filtering, export
Error HandlingStrict mode, diagnostics, FileNotFound, validation levels
Type-SafegetBool/getInt/getFloat/getEnum/getList/getValue with runtime fallback

Released under the MIT License.