closure_ffi/
cc.rs

1//! Defines calling convention marker types for use with `BareFn` variants.
2
3#[cfg(feature = "proc_macros")]
4#[doc(inline)]
5pub use closure_ffi_proc_macros::hrtb_cc as hrtb;
6
7macro_rules! cc_impl {
8    ($ty_name:ident, $lit_name:literal $(,$cfg:meta)?) => {
9        #[doc = "Marker type representing the"]
10        #[doc = $lit_name]
11        #[doc = "calling convention."]
12        #[derive(Debug, Clone, Copy, Default)]
13        $(#[cfg(any($cfg, doc))])?
14        pub struct $ty_name;
15        $(#[cfg($cfg)])?
16        $crate::thunk::cc_thunk_impl!($ty_name, $lit_name);
17    };
18}
19
20cc_impl!(C, "C");
21
22cc_impl!(System, "system");
23
24cc_impl!(Sysv64, "sysv64", all(not(windows), target_arch = "x86_64"));
25
26cc_impl!(Aapcs, "aapcs", target_arch = "arm");
27
28cc_impl!(
29    Fastcall,
30    "fastcall",
31    all(windows, any(target_arch = "x86_64", target_arch = "x86"))
32);
33
34cc_impl!(
35    Stdcall,
36    "stdcall",
37    all(windows, any(target_arch = "x86_64", target_arch = "x86"))
38);
39
40cc_impl!(
41    Cdecl,
42    "cdecl",
43    all(windows, any(target_arch = "x86_64", target_arch = "x86"))
44);
45
46cc_impl!(Thiscall, "thiscall", all(windows, target_arch = "x86"));
47
48cc_impl!(Win64, "win64", all(windows, target_arch = "x86_64"));