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.

ProtocolInterfaces

boot_services.ProtocolInterfaces
fn ProtocolInterfaces(HandleType: type, Interfaces: type) type

File

lib/std/os/uefi/tables/boot_services.zig:1268

Code

fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
    const interfaces_type_info = @typeInfo(Interfaces);
    if (interfaces_type_info != .@"struct" or !interfaces_type_info.@"struct".is_tuple)
        @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
    const interfaces_info = interfaces_type_info.@"struct";

    var tuple_types: [interfaces_info.field_names.len * 2 + 2]type = undefined;
    tuple_types[0] = HandleType;
    tuple_types[tuple_types.len - 1] = ?*const Guid;

    var idx = 1;
    while (idx < tuple_types.len - 1) : (idx += 2) {
        tuple_types[idx] = *const Guid;
        tuple_types[idx + 1] = *const anyopaque;
    }

    return @Tuple(tuple_types[0..]);
}