Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion uefi/src/data_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module defines the basic data types that are used throughout uefi-rs

use core::ffi::c_void;
use core::ptr::NonNull;
use core::ptr::{self, NonNull};

/// Opaque handle to an UEFI entity (protocol, image...), guaranteed to be non-null.
///
Expand Down Expand Up @@ -42,6 +42,10 @@ impl Handle {
pub fn as_ptr(&self) -> *mut c_void {
self.0.as_ptr()
}

pub(crate) fn opt_to_ptr(handle: Option<Self>) -> *mut c_void {
handle.map(|h| h.0.as_ptr()).unwrap_or(ptr::null_mut())
}
}

/// Handle to an event structure, guaranteed to be non-null.
Expand Down
Loading