pub struct FunctionPointer(/* private fields */);
Expand description
FunctionPointer serves entirely as a safer way to work with function pointers than as raw u64
or usize values. It also avoids the need to write them as fn
types, which cannot be freely
cast from one to another with as
. If you need to call a FunctionPointer
, use as_usize()
and transmute the resulting usize to a fn
type with appropriate signature.
Implementations§
Source§impl FunctionPointer
impl FunctionPointer
pub fn from_usize(ptr: usize) -> FunctionPointer
pub fn as_usize(&self) -> usize
Trait Implementations§
Source§impl Clone for FunctionPointer
impl Clone for FunctionPointer
Source§fn clone(&self) -> FunctionPointer
fn clone(&self) -> FunctionPointer
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FunctionPointer
impl Debug for FunctionPointer
Source§impl<'de> Deserialize<'de> for FunctionPointer
impl<'de> Deserialize<'de> for FunctionPointer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for FunctionPointer
impl Hash for FunctionPointer
Source§impl Ord for FunctionPointer
impl Ord for FunctionPointer
Source§fn cmp(&self, other: &FunctionPointer) -> Ordering
fn cmp(&self, other: &FunctionPointer) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FunctionPointer
impl PartialEq for FunctionPointer
Source§impl PartialOrd for FunctionPointer
impl PartialOrd for FunctionPointer
Source§impl Serialize for FunctionPointer
impl Serialize for FunctionPointer
impl Copy for FunctionPointer
impl Eq for FunctionPointer
impl StructuralPartialEq for FunctionPointer
Auto Trait Implementations§
impl Freeze for FunctionPointer
impl RefUnwindSafe for FunctionPointer
impl Send for FunctionPointer
impl Sync for FunctionPointer
impl Unpin for FunctionPointer
impl UnwindSafe for FunctionPointer
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