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
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more