Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Struct

Init

Public Struct
std.process.Init
pub const Init = struct

A standard set of pre-initialized useful APIs for programs to take advantage of. This is the type of the first parameter of the main function. Applications wanting more flexibility can accept Init.Minimal instead.

Completion of https://github.com/ziglang/zig/issues/24510 will also allow the second parameter of the main function to be a custom struct that contain auto-parsed CLI arguments.

Fields

minimal: Minimal

Init is a superset of Minimal; the latter is included here.

arena: *std.heap.ArenaAllocator

Permanent storage for the entire process, cleaned automatically on exit. Threadsafe.

gpa: Allocator

A default-selected general purpose allocator for temporary heap allocations. Debug mode will set up leak checking if possible. Threadsafe.

io: Io

An appropriate default Io implementation based on the target configuration. Debug mode will set up leak checking if possible.

environ_map: *Environ.Map

Environment variables, initialized with gpa. Not threadsafe.

preopens: Preopens

Named files that have been provided by the parent process. This is mainly useful on WASI, but can be used on other systems to mimic the behavior with respect to stdio.

Structs

File

process.zig:31
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pub const Init = struct {
    /// `Init` is a superset of `Minimal`; the latter is included here.
    minimal: Minimal,
    /// Permanent storage for the entire process, cleaned automatically on
    /// exit. Threadsafe.
    arena: *std.heap.ArenaAllocator,
    /// A default-selected general purpose allocator for temporary heap
    /// allocations. Debug mode will set up leak checking if possible.
    /// Threadsafe.
    gpa: Allocator,
    /// An appropriate default Io implementation based on the target
    /// configuration. Debug mode will set up leak checking if possible.
    io: Io,
    /// Environment variables, initialized with `gpa`. Not threadsafe.
    environ_map: *Environ.Map,
    /// Named files that have been provided by the parent process. This is
    /// mainly useful on WASI, but can be used on other systems to mimic the
    /// behavior with respect to stdio.
    preopens: Preopens,

    /// Alternative to `Init` as the first parameter of the main function.
    pub const Minimal = struct {
        /// Environment variables.
        environ: Environ,
        /// Command line arguments.
        args: Args,
    };
}