Struct uefi::data_types::Handle
source · #[repr(transparent)]pub struct Handle(_);
Expand description
Opaque handle to an UEFI entity (protocol, image…), guaranteed to be non-null.
If you need to have a nullable handle (for a custom UEFI FFI for example) use Option<Handle>
.
Implementations§
source§impl Handle
impl Handle
sourcepub unsafe fn from_ptr(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_ptr(ptr: *mut c_void) -> Option<Self>
Creates a new Handle
from a raw address. The address might
come from the Multiboot2 information structure or something similar.
Example
use core::ffi::c_void;
use uefi::Handle;
let image_handle_addr = 0xdeadbeef as *mut c_void;
let uefi_image_handle = unsafe {
Handle::from_ptr(image_handle_addr).expect("Pointer must not be null!")
};
Safety
This function is unsafe because the caller must be sure that the pointer is valid. Otherwise, further operations on the object might result in undefined behaviour, even if the methods aren’t marked as unsafe.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Handle
impl !Send for Handle
impl !Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more