# fn-ptr
[](https://github.com/OpenByteDev/fn-ptr/actions/workflows/ci.yml) [](https://crates.io/crates/fn-ptr) [](https://docs.rs/fn-ptr) [](https://deps.rs/repo/github/openbytedev/fn-ptr) [](https://github.com/OpenByteDev/fn-ptr/blob/master/LICENSE)
A small Rust crate that exposes a `FunctionPtr` trait that is implemented for all function pointer types up to arity 12, for multiple calling conventions (ABIs). The trait looks like this:
```rust
pub trait FunctionPtr {
const ARITY: usize;
const SAFE: bool;
const EXTERN: bool;
const ABI: Abi;
type Args;
type Output;
}
```
**Usage**
```rust
fn print_info<F: fn_ptr::FunctionPtr>() {
println!("arity = {}", F::ARITY);
println!("safe = {}", F::SAFE);
println!("extern = {}", F::EXTERN);
println!("ABI = {:?}", F::ABI);
}
fn main() {
print_info::<fn(i32) -> i32>();
// Example output (typical):
// arity = 1
// safe = true
// extern = false
// ABI = Rust
// example(10) = 11
}
```