Skip to main content

with_abi

Macro with_abi 

Source
macro_rules! with_abi {
    ( $abi:path, $ty:ty ) => { ... };
    ( $lit:tt, $ty:ty ) => { ... };
}
Expand description

Construct a function-pointer type identical to the given one but using the specified abi.

Accepts either:

  • an Abi marker type (e.g. C, SysV64)
  • a string literal (e.g. "C", "system", "stdcall").

ยงExamples

type F = with_abi!(abi::Rust, extern "C" fn(i32) -> i32);
// `F` is `fn(i32) -> i32` (equivalent to `extern "Rust" fn(i32) -> i32`)

type G = with_abi!("C", extern "system" fn());
// `G` is `extern "C" fn()`