Zig 0.17.0-dev (Split by item)

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 library itself.

load

Configuration.load
pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration

File

lib/std/Build/Configuration.zig:3455

Code

pub fn load(arena: Allocator, reader: *Io.Reader) LoadError!Configuration {
    const header = try reader.takeStruct(Header, .native);
    const result: Configuration = .{
        .string_bytes = try arena.alloc(u8, header.string_bytes_len),
        .steps = try arena.alloc(Step, header.steps_len),
        .path_deps = try arena.alloc(PathDep, header.path_deps_len),
        .unlazy_deps = try arena.alloc(String, header.unlazy_deps_len),
        .system_integrations = try arena.alloc(SystemIntegration, header.system_integrations_len),
        .available_options = try arena.alloc(AvailableOption, header.available_options_len),
        .search_prefixes = try arena.alloc(String, header.search_prefixes_len),
        .extra = try arena.alloc(u32, header.extra_len),
        .default_step = header.default_step,
        .generated_files_len = header.generated_files_len,
        .poisoned = header.flags.poisoned,
    };
    var vecs = [_][]u8{
        result.string_bytes,
        @ptrCast(result.steps),
        @ptrCast(result.path_deps),
        @ptrCast(result.unlazy_deps),
        @ptrCast(result.system_integrations),
        @ptrCast(result.available_options),
        @ptrCast(result.search_prefixes),
        @ptrCast(result.extra),
    };
    try reader.readVecAll(&vecs);
    return result;
}