pub unsafe trait FunctionPtr:
Sized
+ Copy
+ Send
+ Sync
+ 'static {
type Args;
type RefArgs<'a>;
type Output;
type NonExtern: FunctionPtr;
const ARITY: usize;
const ABI: Abi;
// Required methods
unsafe fn from_ptr(ptr: RawFunctionPtr) -> Self;
fn as_ptr(&self) -> RawFunctionPtr;
}Available on Windows only.
Expand description
Trait representing a function.
§Safety
This trait should only be implemented for function pointers and the associated types and constants have to match the function pointer type.
Required Associated Constants§
Required Associated Types§
Sourcetype NonExtern: FunctionPtr
type NonExtern: FunctionPtr
The non-extern version of the function pointer.
Required Methods§
Sourceunsafe fn from_ptr(ptr: RawFunctionPtr) -> Self
unsafe fn from_ptr(ptr: RawFunctionPtr) -> Self
Constructs a FunctionPtr from an untyped function pointer.
§Safety
This function is unsafe because it can not check if the argument points to a function of the correct type.
Sourcefn as_ptr(&self) -> RawFunctionPtr
fn as_ptr(&self) -> RawFunctionPtr
Returns a untyped function pointer for this function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".