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 standard library.
std › Io › Operation › Result Public Constant Result Doc Source Public Constant std.Io.Operation.Result
pub const Result = Result : File Io.zig: 489
489
490
491
492
493
494
495
496
497
498
499 pub const Result = Result : {
const operation_info = @typeInfo (Operation ).@"union" ;
const operation_count = operation_info .field_names .len ;
var field_names : [operation_count ][]const u8 = undefined ;
var field_types : [operation_count ]type = undefined ;
for (operation_info .field_names , operation_info .field_types , &field_names , &field_types ) |f_name , f_type , *field_name , *field_type | {
field_name .* = f_name ;
field_type .* = if (f_type == noreturn ) noreturn else f_type .Result ;
}
break :Result @Union (.auto , Tag , &field_names , &field_types , &@splat (.{}));
}