pub struct DispatchTable<'a> {
pub num_entries: u32,
/* private fields */
}Expand description
Represents a function dispatch table. This is used for runtime linking.
Function signatures and pointers are stored separately for cache efficiency.
Fields§
§num_entries: u32Number of functions
Implementations§
Source§impl<'a> DispatchTable<'a>
impl<'a> DispatchTable<'a>
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&mut *const c_void, &FunctionPrototype<'a>)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&mut *const c_void, &FunctionPrototype<'a>)>
Returns an iterator over pairs of mutable function pointers and signatures.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&*const c_void, &FunctionPrototype<'a>)>
pub fn iter( &self, ) -> impl Iterator<Item = (&*const c_void, &FunctionPrototype<'a>)>
Returns an iterator over pairs of function pointers and signatures.
Sourcepub fn prototypes(&self) -> &[FunctionPrototype<'a>]
pub fn prototypes(&self) -> &[FunctionPrototype<'a>]
Returns function prototypes.
Sourcepub unsafe fn get_ptr_unchecked(&self, idx: u32) -> *const c_void
pub unsafe fn get_ptr_unchecked(&self, idx: u32) -> *const c_void
Returns a function pointer, without doing bounds checking.
This is generally not recommended, use with caution! Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. For a safe alternative see get_ptr.
§Safety
The idx is not bounds checked and should therefor be used with care.
Sourcepub fn get_ptr(&self, idx: u32) -> Option<*const c_void>
pub fn get_ptr(&self, idx: u32) -> Option<*const c_void>
Returns a function pointer at the given index, or None if out of bounds.
Sourcepub unsafe fn get_ptr_unchecked_mut(&mut self, idx: u32) -> &mut *const c_void
pub unsafe fn get_ptr_unchecked_mut(&mut self, idx: u32) -> &mut *const c_void
Returns a mutable reference to a function pointer, without doing bounds checking.
This is generally not recommended, use with caution! Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. For a safe alternative see get_ptr_mut.
§Safety
The idx is not bounds checked and should therefor be used with care.
Auto Trait Implementations§
impl<'a> Freeze for DispatchTable<'a>
impl<'a> RefUnwindSafe for DispatchTable<'a>
impl<'a> !Send for DispatchTable<'a>
impl<'a> !Sync for DispatchTable<'a>
impl<'a> Unpin for DispatchTable<'a>
impl<'a> UnwindSafe for DispatchTable<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more