use libffi_sys::{ffi_abi_FFI_GNUW64, ffi_abi_FFI_UNIX64, ffi_abi_FFI_WIN64};
#[cfg(not(docsrs))]
use super::Abi;
#[cfg(docsrs)]
pub struct Abi(libffi_sys::ffi_abi);
impl Abi {
pub const UNIX64: Self = Abi(ffi_abi_FFI_UNIX64);
pub const WIN64: Self = Abi(ffi_abi_FFI_WIN64);
pub const GNUW64: Self = Abi(ffi_abi_FFI_GNUW64);
pub const EFI64: Self = Self::WIN64;
#[cfg(test)]
#[doc(hidden)]
pub const ABIS: [Self; 4] = [Self::UNIX64, Self::WIN64, Self::GNUW64, Self::EFI64];
}
impl Default for Abi {
fn default() -> Self {
Self::UNIX64
}
}
#[cfg(test)]
mod tests {
use super::super::test_utils::test_create_closure_and_call_with_abi;
use super::Abi;
#[test]
#[cfg_attr(miri, ignore)]
fn test_unix64_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::UNIX64);
}
#[test]
#[cfg_attr(miri, ignore)]
fn test_win64_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::WIN64);
}
#[test]
#[cfg_attr(miri, ignore)]
fn test_gnuw64_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::GNUW64);
}
#[test]
#[cfg_attr(miri, ignore)]
fn test_efi64_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::EFI64);
}
}