pub fn get_handle_for_protocol<P: ProtocolPointer + ?Sized>() -> Result<Handle>Expand description
Find an arbitrary handle that supports a particular Protocol. Returns
NOT_FOUND if no handles support the protocol.
This method is a convenient wrapper around locate_handle_buffer for
getting just one handle. This is useful when you don’t care which handle the
protocol is opened on. For example, DevicePathToText isn’t tied to a
particular device, so only a single handle is expected to exist.
§Example
use uefi::proto::device_path::text::DevicePathToText;
use uefi::{boot, Handle};
let handle = boot::get_handle_for_protocol::<DevicePathToText>()?;
let device_path_to_text = boot::open_protocol_exclusive::<DevicePathToText>(handle)?;§Errors
Status::NOT_FOUND: no matching handle.Status::OUT_OF_RESOURCES: out of memory.