DispatchTable

Struct DispatchTable 

Source
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: u32

Number of functions

Implementations§

Source§

impl<'a> DispatchTable<'a>

Source

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.

Source

pub fn iter( &self, ) -> impl Iterator<Item = (&*const c_void, &FunctionPrototype<'a>)>

Returns an iterator over pairs of function pointers and signatures.

Source

pub fn ptrs_mut(&mut self) -> &mut [*const c_void]

Returns mutable functions pointers.

Source

pub fn prototypes(&self) -> &[FunctionPrototype<'a>]

Returns function prototypes.

Source

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.

Source

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.

Source

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.

Source

pub fn get_ptr_mut(&mut self, idx: u32) -> Option<&mut *const c_void>

Returns a mutable reference to a function pointer at the given index, or None if out of bounds.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.