fn_ptr/
lib.rs

1use core::fmt::Debug;
2
3pub mod abi;
4pub use abi::Abi;
5
6mod r#impl;
7
8/// Trait representing a function.
9///
10/// # Safety
11/// This trait should only be implemented for function pointers and the associated types and constants have to match the function pointer type.
12pub unsafe trait FunctionPtr: Sized + Copy + Debug + Send + Sync + 'static {
13    /// The argument types as a tuple.
14    type Args;
15
16    /// The return type.
17    type Output;
18
19    /// The function's arity (number of arguments).
20    const ARITY: usize;
21
22    /// Whether this function is safe to call.
23    const SAFE: bool;
24
25    /// Whether this function is extern.
26    const EXTERN: bool;
27
28    /// The ABI of this function.
29    const ABI: Abi;
30}