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.

ErrorDetailsWithoutCodePage

Convenience struct only useful when the code page can be inferred from the token

errors.ErrorDetailsWithoutCodePage
pub const ErrorDetailsWithoutCodePage = blk:

File

Code

pub const ErrorDetailsWithoutCodePage = blk: {
    const details_info = @typeInfo(ErrorDetails).@"struct";
    const field_count = details_info.field_names.len;
    var field_names: [field_count - 1][]const u8 = undefined;
    var field_types: [field_count - 1]type = undefined;
    var field_attrs: [field_count - 1]std.builtin.Type.Struct.FieldAttributes = undefined;
    var i: usize = 0;
    for (details_info.field_names, details_info.field_types, details_info.field_attrs) |field_name, field_type, field_attr| {
        if (std.mem.eql(u8, field_name, "code_page")) continue;
        field_names[i] = field_name;
        field_types[i] = field_type;
        field_attrs[i] = field_attr;
        i += 1;
    }
    std.debug.assert(i == field_count - 1);
    break :blk @Struct(.auto, null, &field_names, &field_types, &field_attrs);
}