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 Function

locateHandleLen

Public Function
std.os.uefi.tables.boot_services.BootServices.locateHandleLen
pub fn locateHandleLen(self: *const BootServices, search: LocateSearch) NumHandlesError!usize

Returns the number of handles that match the given search criteria.

Params

File

os/uefi/tables/boot_services.zig:692
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
    pub fn locateHandleLen(self: *const BootServices, search: LocateSearch) NumHandlesError!usize {
        var len: usize = 0;
        switch (self._locateHandle(
            std.meta.activeTag(search),
            if (search == .by_protocol) search.by_protocol else null,
            if (search == .by_register_notify) search.by_register_notify else null,
            &len,
            null,
        )) {
            // If len is zero, it should return not_found, otherwise buffer_too_small.
            // This is because it can/should only return success when a valid buffer is
            // passed with a non zero size, which is not the case.
            // Thus this status is considered unreachable and will return error.Unexpected
            // .success => unreachable,
            .buffer_too_small => return @divExact(len, @sizeOf(uefi.Handle)),
            .not_found => return 0,
            // This function accounts for all possible causes of this error code
            // as per the most recent UEFI spec 2.10A, therefore this branch is
            // considered unreachable and will return error.Unexpected instead
            // .invalid_parameter => unreachable
            else => |status| return uefi.unexpectedStatus(status),
        }
    }