Skip to content

Commit 890ae99

Browse files
committed
uefi: handle: add constructor
This is a prerequisite for the next step.
1 parent e508cd9 commit 890ae99

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

uefi/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ details of the new `system`/`boot`/`runtime` modules, and upcoming deprecations.
2020
the implementations `MemoryMapRef`, `MemoryMapRefMut`, and `MemoryMapOwned`.
2121
This comes with some changes. Read below. We recommend to directly use the
2222
implementations instead of the traits.
23+
- Added `Handle::new`
2324

2425
## Changed
2526
- **Breaking:** `uefi::helpers::init` no longer takes an argument.

uefi/src/data_types/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ use core::ptr::{self, NonNull};
1313
pub struct Handle(NonNull<c_void>);
1414

1515
impl Handle {
16+
/// Creates a new [`Handle`].
17+
///
18+
/// # Safety
19+
/// This function is unsafe because the caller must be sure that the pointer
20+
/// is valid. Otherwise, further operations on the object might result in
21+
/// undefined behaviour, even if the methods aren't marked as unsafe.
22+
pub const unsafe fn new(ptr: NonNull<c_void>) -> Self {
23+
Self(ptr)
24+
}
25+
1626
/// Creates a new [`Handle`] from a raw address. The address might
1727
/// come from the Multiboot2 information structure or something similar.
1828
///

0 commit comments

Comments
 (0)