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 › os › uefi › tables › boot_services › BootServices › handleProtocol Public Function handleProtocol Doc Source Public Function std.os.uefi.tables.boot_services.BootServices.handleProtocol
pub fn handleProtocol (
self : *BootServices ,
Protocol : type ,
handle : Handle ,
) HandleProtocolError !?*Protocol Params File os/uefi/tables/boot_services.zig: 647
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668 pub fn handleProtocol (
self : *BootServices ,
Protocol : type ,
handle : Handle ,
) HandleProtocolError !?*Protocol {
// per https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#efi-boot-services-handleprotocol
// handleProtocol is basically `openProtocol` where:
// 1. agent_handle is `uefi.handle` (aka handle passed to `EfiMain`)
// 2. controller_handle is `null`
// 3. attributes is `EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL`
return self .openProtocol (
Protocol ,
handle ,
.{ .by_handle_protocol = .{ .agent = uefi .handle } },
) catch |err | switch (err ) {
error .AlreadyStarted => return uefi .unexpectedStatus (.already_started ),
error .AccessDenied => return uefi .unexpectedStatus (.access_denied ),
error .InvalidParameter => return uefi .unexpectedStatus (.invalid_parameter ),
else => return @errorCast (err ),
};
}
Returns a pointer to the
Protocolinterface if it's supported by the handle.Note that UEFI implementations are no longer required to implement this function, so it's implemented using
openProtocolinstead.