Skip to content

Commit ff34fcb

Browse files
committed
uefi: handle: add constructor
This is a prerequisite for the next step.
1 parent 0e959b4 commit ff34fcb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

uefi/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# uefi - [Unreleased]
22

3+
## Added
4+
- Added `Handle::new`
35

46
# uefi - 0.31.0 (2024-08-21)
57

uefi/src/data_types/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ 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+
#[must_use]
23+
pub const unsafe fn new(ptr: NonNull<c_void>) -> Self {
24+
Self(ptr)
25+
}
26+
1627
/// Creates a new [`Handle`] from a raw address. The address might
1728
/// come from the Multiboot2 information structure or something similar.
1829
///

0 commit comments

Comments
 (0)