4040 crate :: proto:: device_path:: DevicePath ,
4141 crate :: proto:: driver:: ComponentName2 ,
4242} ;
43+ use uefi_raw:: Status ;
4344
4445/// Opaque handle to an UEFI entity (protocol, image...), guaranteed to be non-null.
4546///
@@ -103,6 +104,8 @@ impl Handle {
103104
104105 /// Opens the underlying [`ComponentName2`], if it exists.
105106 ///
107+ /// Returns [`Status::UNSUPPORTED`] if the protocol doesn't exist.
108+ ///
106109 /// # Example
107110 /// ```rust,no_run
108111 /// # use uefi::Handle;
@@ -118,10 +121,10 @@ impl Handle {
118121 /// );
119122 /// ```
120123 #[ cfg( feature = "alloc" ) ]
121- pub fn component_name2 ( & self ) -> Result < Option < ScopedProtocol < ComponentName2 > > > {
124+ pub fn component_name2 ( & self ) -> Result < ScopedProtocol < ComponentName2 > > {
122125 // SAFETY: The protocol is only used for reading data.
123126 unsafe {
124- boot:: open_protocol_if_exists :: < ComponentName2 > (
127+ boot:: open_protocol :: < ComponentName2 > (
125128 OpenProtocolParams {
126129 handle : * self ,
127130 agent : boot:: image_handle ( ) ,
@@ -132,7 +135,9 @@ impl Handle {
132135 }
133136 }
134137
135- /// Opens the underlying [`DevicePath`] protocol, if it exists.
138+ /// Opens the underlying [`DevicePath`] protocol.
139+ ///
140+ /// Returns [`Status::UNSUPPORTED`] if the protocol doesn't exist.
136141 ///
137142 /// # Example
138143 /// ```rust,no_run
@@ -145,10 +150,10 @@ impl Handle {
145150 /// log::info!("device path: {device_path}");
146151 /// ```
147152 #[ cfg( feature = "alloc" ) ]
148- pub fn device_path ( & self ) -> Result < Option < ScopedProtocol < DevicePath > > > {
153+ pub fn device_path ( & self ) -> Result < ScopedProtocol < DevicePath > > {
149154 // SAFETY: The protocol is only used for reading data.
150155 unsafe {
151- boot:: open_protocol_if_exists :: < DevicePath > (
156+ boot:: open_protocol :: < DevicePath > (
152157 OpenProtocolParams {
153158 handle : * self ,
154159 agent : boot:: image_handle ( ) ,
0 commit comments