diff --git a/source/ports/rs_port/.vscode/settings.json b/source/ports/rs_port/.vscode/settings.json new file mode 100644 index 000000000..c57b92269 --- /dev/null +++ b/source/ports/rs_port/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "rust-analyzer.checkOnSave": true, + "rust-analyzer.check.command": "clippy" +} diff --git a/source/ports/rs_port/CMakeLists.txt b/source/ports/rs_port/CMakeLists.txt index 62e25e910..109d7df37 100644 --- a/source/ports/rs_port/CMakeLists.txt +++ b/source/ports/rs_port/CMakeLists.txt @@ -46,6 +46,8 @@ if(Rust_BINDGEN_EXECUTABLE) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${Rust_BINDGEN_EXECUTABLE} --no-include-path-detection + --allowlist-function 'metacall.*' + --rustified-enum 'metacall_.*' "${CMAKE_SOURCE_DIR}/source/metacall/include/metacall/metacall.h" -o "${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.rs" -- diff --git a/source/ports/rs_port/README.md b/source/ports/rs_port/README.md index 7c1006a6d..298bf9ab3 100644 --- a/source/ports/rs_port/README.md +++ b/source/ports/rs_port/README.md @@ -29,7 +29,7 @@ export function sum(a: number, b: number): number { use metacall::{switch, metacall, loaders}; fn main() { - // Initialize Metacall at the top + // Initialize MetaCall at the top let _metacall = switch::initialize().unwrap(); // Load the file diff --git a/source/ports/rs_port/src/bindings.rs b/source/ports/rs_port/src/bindings.rs index ceadd6e6e..fdfc35049 100644 --- a/source/ports/rs_port/src/bindings.rs +++ b/source/ports/rs_port/src/bindings.rs @@ -1,4407 +1,412 @@ -/* automatically generated by rust-bindgen 0.65.1 */ +/* automatically generated by rust-bindgen 0.71.1 */ -pub const METACALL_H: u32 = 1; -pub const METACALL_ALLOCATOR_H: u32 = 1; -pub const _STDINT_H: u32 = 1; -pub const _FEATURES_H: u32 = 1; -pub const _DEFAULT_SOURCE: u32 = 1; -pub const __GLIBC_USE_ISOC2X: u32 = 0; -pub const __USE_ISOC11: u32 = 1; -pub const __USE_ISOC99: u32 = 1; -pub const __USE_ISOC95: u32 = 1; -pub const __USE_POSIX_IMPLICITLY: u32 = 1; -pub const _POSIX_SOURCE: u32 = 1; -pub const _POSIX_C_SOURCE: u32 = 200809; -pub const __USE_POSIX: u32 = 1; -pub const __USE_POSIX2: u32 = 1; -pub const __USE_POSIX199309: u32 = 1; -pub const __USE_POSIX199506: u32 = 1; -pub const __USE_XOPEN2K: u32 = 1; -pub const __USE_XOPEN2K8: u32 = 1; -pub const _ATFILE_SOURCE: u32 = 1; -pub const __USE_MISC: u32 = 1; -pub const __USE_ATFILE: u32 = 1; -pub const __USE_FORTIFY_LEVEL: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; -pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; -pub const _STDC_PREDEF_H: u32 = 1; -pub const __STDC_IEC_559__: u32 = 1; -pub const __STDC_IEC_559_COMPLEX__: u32 = 1; -pub const __STDC_ISO_10646__: u32 = 201706; -pub const __GNU_LIBRARY__: u32 = 6; -pub const __GLIBC__: u32 = 2; -pub const __GLIBC_MINOR__: u32 = 33; -pub const _SYS_CDEFS_H: u32 = 1; -pub const __glibc_c99_flexarr_available: u32 = 1; -pub const __WORDSIZE: u32 = 64; -pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; -pub const __SYSCALL_WORDSIZE: u32 = 64; -pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; -pub const __HAVE_GENERIC_SELECTION: u32 = 1; -pub const __GLIBC_USE_LIB_EXT2: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; -pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; -pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; -pub const _BITS_TYPES_H: u32 = 1; -pub const __TIMESIZE: u32 = 64; -pub const _BITS_TYPESIZES_H: u32 = 1; -pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; -pub const __INO_T_MATCHES_INO64_T: u32 = 1; -pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; -pub const __STATFS_MATCHES_STATFS64: u32 = 1; -pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1; -pub const __FD_SETSIZE: u32 = 1024; -pub const _BITS_TIME64_H: u32 = 1; -pub const _BITS_WCHAR_H: u32 = 1; -pub const _BITS_STDINT_INTN_H: u32 = 1; -pub const _BITS_STDINT_UINTN_H: u32 = 1; -pub const INT8_MIN: i32 = -128; -pub const INT16_MIN: i32 = -32768; -pub const INT32_MIN: i32 = -2147483648; -pub const INT8_MAX: u32 = 127; -pub const INT16_MAX: u32 = 32767; -pub const INT32_MAX: u32 = 2147483647; -pub const UINT8_MAX: u32 = 255; -pub const UINT16_MAX: u32 = 65535; -pub const UINT32_MAX: u32 = 4294967295; -pub const INT_LEAST8_MIN: i32 = -128; -pub const INT_LEAST16_MIN: i32 = -32768; -pub const INT_LEAST32_MIN: i32 = -2147483648; -pub const INT_LEAST8_MAX: u32 = 127; -pub const INT_LEAST16_MAX: u32 = 32767; -pub const INT_LEAST32_MAX: u32 = 2147483647; -pub const UINT_LEAST8_MAX: u32 = 255; -pub const UINT_LEAST16_MAX: u32 = 65535; -pub const UINT_LEAST32_MAX: u32 = 4294967295; -pub const INT_FAST8_MIN: i32 = -128; -pub const INT_FAST16_MIN: i64 = -9223372036854775808; -pub const INT_FAST32_MIN: i64 = -9223372036854775808; -pub const INT_FAST8_MAX: u32 = 127; -pub const INT_FAST16_MAX: u64 = 9223372036854775807; -pub const INT_FAST32_MAX: u64 = 9223372036854775807; -pub const UINT_FAST8_MAX: u32 = 255; -pub const UINT_FAST16_MAX: i32 = -1; -pub const UINT_FAST32_MAX: i32 = -1; -pub const INTPTR_MIN: i64 = -9223372036854775808; -pub const INTPTR_MAX: u64 = 9223372036854775807; -pub const UINTPTR_MAX: i32 = -1; -pub const PTRDIFF_MIN: i64 = -9223372036854775808; -pub const PTRDIFF_MAX: u64 = 9223372036854775807; -pub const SIG_ATOMIC_MIN: i32 = -2147483648; -pub const SIG_ATOMIC_MAX: u32 = 2147483647; -pub const SIZE_MAX: i32 = -1; -pub const WINT_MIN: u32 = 0; -pub const WINT_MAX: u32 = 4294967295; -pub const _STDLIB_H: u32 = 1; -pub const WNOHANG: u32 = 1; -pub const WUNTRACED: u32 = 2; -pub const WSTOPPED: u32 = 2; -pub const WEXITED: u32 = 4; -pub const WCONTINUED: u32 = 8; -pub const WNOWAIT: u32 = 16777216; -pub const __WNOTHREAD: u32 = 536870912; -pub const __WALL: u32 = 1073741824; -pub const __WCLONE: u32 = 2147483648; -pub const __W_CONTINUED: u32 = 65535; -pub const __WCOREFLAG: u32 = 128; -pub const __HAVE_FLOAT128: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; -pub const __HAVE_FLOAT64X: u32 = 1; -pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; -pub const __HAVE_FLOAT16: u32 = 0; -pub const __HAVE_FLOAT32: u32 = 1; -pub const __HAVE_FLOAT64: u32 = 1; -pub const __HAVE_FLOAT32X: u32 = 1; -pub const __HAVE_FLOAT128X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; -pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; -pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; -pub const __ldiv_t_defined: u32 = 1; -pub const __lldiv_t_defined: u32 = 1; -pub const RAND_MAX: u32 = 2147483647; -pub const EXIT_FAILURE: u32 = 1; -pub const EXIT_SUCCESS: u32 = 0; -pub const _SYS_TYPES_H: u32 = 1; -pub const __clock_t_defined: u32 = 1; -pub const __clockid_t_defined: u32 = 1; -pub const __time_t_defined: u32 = 1; -pub const __timer_t_defined: u32 = 1; -pub const __BIT_TYPES_DEFINED__: u32 = 1; -pub const _ENDIAN_H: u32 = 1; -pub const _BITS_ENDIAN_H: u32 = 1; -pub const __LITTLE_ENDIAN: u32 = 1234; -pub const __BIG_ENDIAN: u32 = 4321; -pub const __PDP_ENDIAN: u32 = 3412; -pub const _BITS_ENDIANNESS_H: u32 = 1; -pub const __BYTE_ORDER: u32 = 1234; -pub const __FLOAT_WORD_ORDER: u32 = 1234; -pub const LITTLE_ENDIAN: u32 = 1234; -pub const BIG_ENDIAN: u32 = 4321; -pub const PDP_ENDIAN: u32 = 3412; -pub const BYTE_ORDER: u32 = 1234; -pub const _BITS_BYTESWAP_H: u32 = 1; -pub const _BITS_UINTN_IDENTITY_H: u32 = 1; -pub const _SYS_SELECT_H: u32 = 1; -pub const __sigset_t_defined: u32 = 1; -pub const __timeval_defined: u32 = 1; -pub const _STRUCT_TIMESPEC: u32 = 1; -pub const FD_SETSIZE: u32 = 1024; -pub const _BITS_PTHREADTYPES_COMMON_H: u32 = 1; -pub const _THREAD_SHARED_TYPES_H: u32 = 1; -pub const _BITS_PTHREADTYPES_ARCH_H: u32 = 1; -pub const __SIZEOF_PTHREAD_MUTEX_T: u32 = 40; -pub const __SIZEOF_PTHREAD_ATTR_T: u32 = 56; -pub const __SIZEOF_PTHREAD_RWLOCK_T: u32 = 56; -pub const __SIZEOF_PTHREAD_BARRIER_T: u32 = 32; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: u32 = 4; -pub const __SIZEOF_PTHREAD_COND_T: u32 = 48; -pub const __SIZEOF_PTHREAD_CONDATTR_T: u32 = 4; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: u32 = 8; -pub const __SIZEOF_PTHREAD_BARRIERATTR_T: u32 = 4; -pub const _THREAD_MUTEX_INTERNAL_H: u32 = 1; -pub const __PTHREAD_MUTEX_HAVE_PREV: u32 = 1; -pub const __have_pthread_attr_t: u32 = 1; -pub const _ALLOCA_H: u32 = 1; -pub const METACALL_DEF_H: u32 = 1; -pub const METACALL_FORK_SAFE: u32 = 1; -pub const METACALL_ERROR_H: u32 = 1; -pub const METACALL_LOG_H: u32 = 1; -pub const _STDIO_H: u32 = 1; -pub const _____fpos_t_defined: u32 = 1; -pub const ____mbstate_t_defined: u32 = 1; -pub const _____fpos64_t_defined: u32 = 1; -pub const ____FILE_defined: u32 = 1; -pub const __FILE_defined: u32 = 1; -pub const __struct_FILE_defined: u32 = 1; -pub const _IO_EOF_SEEN: u32 = 16; -pub const _IO_ERR_SEEN: u32 = 32; -pub const _IO_USER_LOCK: u32 = 32768; -pub const _IOFBF: u32 = 0; -pub const _IOLBF: u32 = 1; -pub const _IONBF: u32 = 2; -pub const BUFSIZ: u32 = 8192; -pub const EOF: i32 = -1; -pub const SEEK_SET: u32 = 0; -pub const SEEK_CUR: u32 = 1; -pub const SEEK_END: u32 = 2; -pub const P_tmpdir: &[u8; 5usize] = b"/tmp\0"; -pub const _BITS_STDIO_LIM_H: u32 = 1; -pub const L_tmpnam: u32 = 20; -pub const TMP_MAX: u32 = 238328; -pub const FILENAME_MAX: u32 = 4096; -pub const L_ctermid: u32 = 9; -pub const FOPEN_MAX: u32 = 16; -pub const METACALL_VALUE_H: u32 = 1; -pub const METACALL_VERSION_H: u32 = 1; -pub const METACALL_PROJECT_NAME: &[u8; 9usize] = b"MetaCall\0"; -pub const METACALL_PROJECT_DESCRIPTION: &[u8; 72usize] = - b"A library for providing inter-language foreign function interface calls\0"; -pub const METACALL_AUTHOR_ORGANIZATION: &[u8; 14usize] = b"MetaCall Inc.\0"; -pub const METACALL_AUTHOR_DOMAIN: &[u8; 21usize] = b"https://metacall.io/\0"; -pub const METACALL_AUTHOR_MAINTAINER: &[u8; 17usize] = b"vic798@gmail.com\0"; -pub const METACALL_VERSION_MAJOR: &[u8; 2usize] = b"0\0"; -pub const METACALL_VERSION_MAJOR_ID: u32 = 0; -pub const METACALL_VERSION_MINOR: &[u8; 2usize] = b"7\0"; -pub const METACALL_VERSION_MINOR_ID: u32 = 7; -pub const METACALL_VERSION_PATCH: &[u8; 2usize] = b"4\0"; -pub const METACALL_VERSION_PATCH_ID: u32 = 4; -pub const METACALL_VERSION_REVISION: &[u8; 13usize] = b"e89fcbdb09d5\0"; -pub const METACALL_VERSION: &[u8; 6usize] = b"0.7.4\0"; -pub const METACALL_NAME_VERSION: &[u8; 31usize] = b"MetaCall v0.7.4 (e89fcbdb09d5)\0"; -pub const METACALL_FORK_H: u32 = 1; -pub const _UNISTD_H: u32 = 1; -pub const _POSIX_VERSION: u32 = 200809; -pub const __POSIX2_THIS_VERSION: u32 = 200809; -pub const _POSIX2_VERSION: u32 = 200809; -pub const _POSIX2_C_VERSION: u32 = 200809; -pub const _POSIX2_C_BIND: u32 = 200809; -pub const _POSIX2_C_DEV: u32 = 200809; -pub const _POSIX2_SW_DEV: u32 = 200809; -pub const _POSIX2_LOCALEDEF: u32 = 200809; -pub const _XOPEN_VERSION: u32 = 700; -pub const _XOPEN_XCU_VERSION: u32 = 4; -pub const _XOPEN_XPG2: u32 = 1; -pub const _XOPEN_XPG3: u32 = 1; -pub const _XOPEN_XPG4: u32 = 1; -pub const _XOPEN_UNIX: u32 = 1; -pub const _XOPEN_ENH_I18N: u32 = 1; -pub const _XOPEN_LEGACY: u32 = 1; -pub const _BITS_POSIX_OPT_H: u32 = 1; -pub const _POSIX_JOB_CONTROL: u32 = 1; -pub const _POSIX_SAVED_IDS: u32 = 1; -pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809; -pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809; -pub const _POSIX_FSYNC: u32 = 200809; -pub const _POSIX_MAPPED_FILES: u32 = 200809; -pub const _POSIX_MEMLOCK: u32 = 200809; -pub const _POSIX_MEMLOCK_RANGE: u32 = 200809; -pub const _POSIX_MEMORY_PROTECTION: u32 = 200809; -pub const _POSIX_CHOWN_RESTRICTED: u32 = 0; -pub const _POSIX_VDISABLE: u8 = 0u8; -pub const _POSIX_NO_TRUNC: u32 = 1; -pub const _XOPEN_REALTIME: u32 = 1; -pub const _XOPEN_REALTIME_THREADS: u32 = 1; -pub const _XOPEN_SHM: u32 = 1; -pub const _POSIX_THREADS: u32 = 200809; -pub const _POSIX_REENTRANT_FUNCTIONS: u32 = 1; -pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809; -pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809; -pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809; -pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809; -pub const _POSIX_THREAD_PRIO_INHERIT: u32 = 200809; -pub const _POSIX_THREAD_PRIO_PROTECT: u32 = 200809; -pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: u32 = 200809; -pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1; -pub const _POSIX_SEMAPHORES: u32 = 200809; -pub const _POSIX_REALTIME_SIGNALS: u32 = 200809; -pub const _POSIX_ASYNCHRONOUS_IO: u32 = 200809; -pub const _POSIX_ASYNC_IO: u32 = 1; -pub const _LFS_ASYNCHRONOUS_IO: u32 = 1; -pub const _POSIX_PRIORITIZED_IO: u32 = 200809; -pub const _LFS64_ASYNCHRONOUS_IO: u32 = 1; -pub const _LFS_LARGEFILE: u32 = 1; -pub const _LFS64_LARGEFILE: u32 = 1; -pub const _LFS64_STDIO: u32 = 1; -pub const _POSIX_SHARED_MEMORY_OBJECTS: u32 = 200809; -pub const _POSIX_CPUTIME: u32 = 0; -pub const _POSIX_THREAD_CPUTIME: u32 = 0; -pub const _POSIX_REGEXP: u32 = 1; -pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809; -pub const _POSIX_SHELL: u32 = 1; -pub const _POSIX_TIMEOUTS: u32 = 200809; -pub const _POSIX_SPIN_LOCKS: u32 = 200809; -pub const _POSIX_SPAWN: u32 = 200809; -pub const _POSIX_TIMERS: u32 = 200809; -pub const _POSIX_BARRIERS: u32 = 200809; -pub const _POSIX_MESSAGE_PASSING: u32 = 200809; -pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809; -pub const _POSIX_MONOTONIC_CLOCK: u32 = 0; -pub const _POSIX_CLOCK_SELECTION: u32 = 200809; -pub const _POSIX_ADVISORY_INFO: u32 = 200809; -pub const _POSIX_IPV6: u32 = 200809; -pub const _POSIX_RAW_SOCKETS: u32 = 200809; -pub const _POSIX2_CHAR_TERM: u32 = 200809; -pub const _POSIX_SPORADIC_SERVER: i32 = -1; -pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1; -pub const _POSIX_TRACE: i32 = -1; -pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1; -pub const _POSIX_TRACE_INHERIT: i32 = -1; -pub const _POSIX_TRACE_LOG: i32 = -1; -pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1; -pub const _POSIX_V7_LPBIG_OFFBIG: i32 = -1; -pub const _POSIX_V6_LPBIG_OFFBIG: i32 = -1; -pub const _XBS5_LPBIG_OFFBIG: i32 = -1; -pub const _POSIX_V7_LP64_OFF64: u32 = 1; -pub const _POSIX_V6_LP64_OFF64: u32 = 1; -pub const _XBS5_LP64_OFF64: u32 = 1; -pub const __ILP32_OFF32_CFLAGS: &[u8; 5usize] = b"-m32\0"; -pub const __ILP32_OFF32_LDFLAGS: &[u8; 5usize] = b"-m32\0"; -pub const __ILP32_OFFBIG_CFLAGS: &[u8; 48usize] = - b"-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\0"; -pub const __ILP32_OFFBIG_LDFLAGS: &[u8; 5usize] = b"-m32\0"; -pub const __LP64_OFF64_CFLAGS: &[u8; 5usize] = b"-m64\0"; -pub const __LP64_OFF64_LDFLAGS: &[u8; 5usize] = b"-m64\0"; -pub const STDIN_FILENO: u32 = 0; -pub const STDOUT_FILENO: u32 = 1; -pub const STDERR_FILENO: u32 = 2; -pub const R_OK: u32 = 4; -pub const W_OK: u32 = 2; -pub const X_OK: u32 = 1; -pub const F_OK: u32 = 0; -pub const L_SET: u32 = 0; -pub const L_INCR: u32 = 1; -pub const L_XTND: u32 = 2; -pub const _GETOPT_POSIX_H: u32 = 1; -pub const _GETOPT_CORE_H: u32 = 1; -pub const F_ULOCK: u32 = 0; -pub const F_LOCK: u32 = 1; -pub const F_TLOCK: u32 = 2; -pub const F_TEST: u32 = 3; -pub const METACALL_FLAGS_FORK_SAFE: u32 = 1; -pub type __u_char = ::std::os::raw::c_uchar; -pub type __u_short = ::std::os::raw::c_ushort; -pub type __u_int = ::std::os::raw::c_uint; -pub type __u_long = ::std::os::raw::c_ulong; -pub type __int8_t = ::std::os::raw::c_schar; -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __int16_t = ::std::os::raw::c_short; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __int32_t = ::std::os::raw::c_int; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __int64_t = ::std::os::raw::c_long; -pub type __uint64_t = ::std::os::raw::c_ulong; -pub type __int_least8_t = __int8_t; -pub type __uint_least8_t = __uint8_t; -pub type __int_least16_t = __int16_t; -pub type __uint_least16_t = __uint16_t; -pub type __int_least32_t = __int32_t; -pub type __uint_least32_t = __uint32_t; -pub type __int_least64_t = __int64_t; -pub type __uint_least64_t = __uint64_t; -pub type __quad_t = ::std::os::raw::c_long; -pub type __u_quad_t = ::std::os::raw::c_ulong; -pub type __intmax_t = ::std::os::raw::c_long; -pub type __uintmax_t = ::std::os::raw::c_ulong; -pub type __dev_t = ::std::os::raw::c_ulong; -pub type __uid_t = ::std::os::raw::c_uint; -pub type __gid_t = ::std::os::raw::c_uint; -pub type __ino_t = ::std::os::raw::c_ulong; -pub type __ino64_t = ::std::os::raw::c_ulong; -pub type __mode_t = ::std::os::raw::c_uint; -pub type __nlink_t = ::std::os::raw::c_ulong; -pub type __off_t = ::std::os::raw::c_long; -pub type __off64_t = ::std::os::raw::c_long; pub type __pid_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __fsid_t { - pub __val: [::std::os::raw::c_int; 2usize], -} -#[test] -fn bindgen_test_layout___fsid_t() { - const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__fsid_t>(), - 8usize, - concat!("Size of: ", stringify!(__fsid_t)) - ); - assert_eq!( - ::std::mem::align_of::<__fsid_t>(), - 4usize, - concat!("Alignment of ", stringify!(__fsid_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__fsid_t), - "::", - stringify!(__val) - ) - ); -} -pub type __clock_t = ::std::os::raw::c_long; -pub type __rlim_t = ::std::os::raw::c_ulong; -pub type __rlim64_t = ::std::os::raw::c_ulong; -pub type __id_t = ::std::os::raw::c_uint; -pub type __time_t = ::std::os::raw::c_long; -pub type __useconds_t = ::std::os::raw::c_uint; -pub type __suseconds_t = ::std::os::raw::c_long; -pub type __suseconds64_t = ::std::os::raw::c_long; -pub type __daddr_t = ::std::os::raw::c_int; -pub type __key_t = ::std::os::raw::c_int; -pub type __clockid_t = ::std::os::raw::c_int; -pub type __timer_t = *mut ::std::os::raw::c_void; -pub type __blksize_t = ::std::os::raw::c_long; -pub type __blkcnt_t = ::std::os::raw::c_long; -pub type __blkcnt64_t = ::std::os::raw::c_long; -pub type __fsblkcnt_t = ::std::os::raw::c_ulong; -pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt_t = ::std::os::raw::c_ulong; -pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; -pub type __fsword_t = ::std::os::raw::c_long; -pub type __ssize_t = ::std::os::raw::c_long; -pub type __syscall_slong_t = ::std::os::raw::c_long; -pub type __syscall_ulong_t = ::std::os::raw::c_ulong; -pub type __loff_t = __off64_t; -pub type __caddr_t = *mut ::std::os::raw::c_char; -pub type __intptr_t = ::std::os::raw::c_long; -pub type __socklen_t = ::std::os::raw::c_uint; -pub type __sig_atomic_t = ::std::os::raw::c_int; -pub type int_least8_t = __int_least8_t; -pub type int_least16_t = __int_least16_t; -pub type int_least32_t = __int_least32_t; -pub type int_least64_t = __int_least64_t; -pub type uint_least8_t = __uint_least8_t; -pub type uint_least16_t = __uint_least16_t; -pub type uint_least32_t = __uint_least32_t; -pub type uint_least64_t = __uint_least64_t; -pub type int_fast8_t = ::std::os::raw::c_schar; -pub type int_fast16_t = ::std::os::raw::c_long; -pub type int_fast32_t = ::std::os::raw::c_long; -pub type int_fast64_t = ::std::os::raw::c_long; -pub type uint_fast8_t = ::std::os::raw::c_uchar; -pub type uint_fast16_t = ::std::os::raw::c_ulong; -pub type uint_fast32_t = ::std::os::raw::c_ulong; -pub type uint_fast64_t = ::std::os::raw::c_ulong; -pub type intmax_t = __intmax_t; -pub type uintmax_t = __uintmax_t; -pub type wchar_t = ::std::os::raw::c_int; -#[repr(C)] -#[repr(align(16))] -#[derive(Copy, Clone)] -pub union max_align_t { - pub __ll: ::std::os::raw::c_longlong, - pub __ld: u128, -} -#[test] -fn bindgen_test_layout_max_align_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(max_align_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__ll) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__ll) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__ld) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__ld) - ) - ); -} -extern "C" { - pub fn alloca(size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; -} -pub type _Float32 = f32; -pub type _Float64 = f64; -pub type _Float32x = f64; -pub type _Float64x = u128; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct div_t { - pub quot: ::std::os::raw::c_int, - pub rem: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_div_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(div_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(div_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(div_t), - "::", - stringify!(quot) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(div_t), - "::", - stringify!(rem) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ldiv_t { - pub quot: ::std::os::raw::c_long, - pub rem: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_ldiv_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(ldiv_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ldiv_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ldiv_t), - "::", - stringify!(quot) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ldiv_t), - "::", - stringify!(rem) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct lldiv_t { - pub quot: ::std::os::raw::c_longlong, - pub rem: ::std::os::raw::c_longlong, -} -#[test] -fn bindgen_test_layout_lldiv_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(lldiv_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(lldiv_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(lldiv_t), - "::", - stringify!(quot) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(lldiv_t), - "::", - stringify!(rem) - ) - ); -} -extern "C" { - pub fn __ctype_get_mb_cur_max() -> usize; -} -extern "C" { - pub fn atof(__nptr: *const ::std::os::raw::c_char) -> f64; -} -extern "C" { - pub fn atoi(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn atol(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn atoll(__nptr: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; -} -extern "C" { - pub fn strtod( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - ) -> f64; -} -extern "C" { - pub fn strtof( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - ) -> f32; -} -extern "C" { - pub fn strtold( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - ) -> u128; -} -extern "C" { - pub fn strtol( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn strtoul( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_ulong; -} -extern "C" { - pub fn strtoq( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_longlong; -} -extern "C" { - pub fn strtouq( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_ulonglong; -} -extern "C" { - pub fn strtoll( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_longlong; -} -extern "C" { - pub fn strtoull( - __nptr: *const ::std::os::raw::c_char, - __endptr: *mut *mut ::std::os::raw::c_char, - __base: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_ulonglong; -} -extern "C" { - pub fn l64a(__n: ::std::os::raw::c_long) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn a64l(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; -} -pub type u_char = __u_char; -pub type u_short = __u_short; -pub type u_int = __u_int; -pub type u_long = __u_long; -pub type quad_t = __quad_t; -pub type u_quad_t = __u_quad_t; -pub type fsid_t = __fsid_t; -pub type loff_t = __loff_t; -pub type ino_t = __ino_t; -pub type dev_t = __dev_t; -pub type gid_t = __gid_t; -pub type mode_t = __mode_t; -pub type nlink_t = __nlink_t; -pub type uid_t = __uid_t; -pub type off_t = __off_t; -pub type pid_t = __pid_t; -pub type id_t = __id_t; -pub type daddr_t = __daddr_t; -pub type caddr_t = __caddr_t; -pub type key_t = __key_t; -pub type clock_t = __clock_t; -pub type clockid_t = __clockid_t; -pub type time_t = __time_t; -pub type timer_t = __timer_t; -pub type ulong = ::std::os::raw::c_ulong; -pub type ushort = ::std::os::raw::c_ushort; -pub type uint = ::std::os::raw::c_uint; -pub type u_int8_t = __uint8_t; -pub type u_int16_t = __uint16_t; -pub type u_int32_t = __uint32_t; -pub type u_int64_t = __uint64_t; -pub type register_t = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __sigset_t { - pub __val: [::std::os::raw::c_ulong; 16usize], -} -#[test] -fn bindgen_test_layout___sigset_t() { - const UNINIT: ::std::mem::MaybeUninit<__sigset_t> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__sigset_t>(), - 128usize, - concat!("Size of: ", stringify!(__sigset_t)) - ); - assert_eq!( - ::std::mem::align_of::<__sigset_t>(), - 8usize, - concat!("Alignment of ", stringify!(__sigset_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__sigset_t), - "::", - stringify!(__val) - ) - ); -} -pub type sigset_t = __sigset_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timeval { - pub tv_sec: __time_t, - pub tv_usec: __suseconds_t, -} -#[test] -fn bindgen_test_layout_timeval() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(timeval)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(timeval)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_sec) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(timeval), - "::", - stringify!(tv_usec) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct timespec { - pub tv_sec: __time_t, - pub tv_nsec: __syscall_slong_t, -} -#[test] -fn bindgen_test_layout_timespec() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(timespec)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(timespec)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_sec) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(timespec), - "::", - stringify!(tv_nsec) - ) - ); -} -pub type suseconds_t = __suseconds_t; -pub type __fd_mask = ::std::os::raw::c_long; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct fd_set { - pub __fds_bits: [__fd_mask; 16usize], -} -#[test] -fn bindgen_test_layout_fd_set() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 128usize, - concat!("Size of: ", stringify!(fd_set)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(fd_set)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__fds_bits) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(fd_set), - "::", - stringify!(__fds_bits) - ) - ); -} -pub type fd_mask = __fd_mask; -extern "C" { - pub fn select( - __nfds: ::std::os::raw::c_int, - __readfds: *mut fd_set, - __writefds: *mut fd_set, - __exceptfds: *mut fd_set, - __timeout: *mut timeval, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pselect( - __nfds: ::std::os::raw::c_int, - __readfds: *mut fd_set, - __writefds: *mut fd_set, - __exceptfds: *mut fd_set, - __timeout: *const timespec, - __sigmask: *const __sigset_t, - ) -> ::std::os::raw::c_int; -} -pub type blksize_t = __blksize_t; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_internal_list { - pub __prev: *mut __pthread_internal_list, - pub __next: *mut __pthread_internal_list, -} -#[test] -fn bindgen_test_layout___pthread_internal_list() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_internal_list> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_internal_list>(), - 16usize, - concat!("Size of: ", stringify!(__pthread_internal_list)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_internal_list>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_internal_list)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__prev) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_internal_list), - "::", - stringify!(__prev) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__next) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_internal_list), - "::", - stringify!(__next) - ) - ); -} -pub type __pthread_list_t = __pthread_internal_list; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_internal_slist { - pub __next: *mut __pthread_internal_slist, -} -#[test] -fn bindgen_test_layout___pthread_internal_slist() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_internal_slist> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_internal_slist>(), - 8usize, - concat!("Size of: ", stringify!(__pthread_internal_slist)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_internal_slist>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_internal_slist)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__next) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_internal_slist), - "::", - stringify!(__next) - ) - ); -} -pub type __pthread_slist_t = __pthread_internal_slist; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_mutex_s { - pub __lock: ::std::os::raw::c_int, - pub __count: ::std::os::raw::c_uint, - pub __owner: ::std::os::raw::c_int, - pub __nusers: ::std::os::raw::c_uint, - pub __kind: ::std::os::raw::c_int, - pub __spins: ::std::os::raw::c_short, - pub __elision: ::std::os::raw::c_short, - pub __list: __pthread_list_t, -} -#[test] -fn bindgen_test_layout___pthread_mutex_s() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_mutex_s> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_mutex_s>(), - 40usize, - concat!("Size of: ", stringify!(__pthread_mutex_s)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_mutex_s>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_mutex_s)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__lock) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__lock) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__owner) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__owner) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__nusers) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__nusers) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__kind) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__kind) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__spins) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__spins) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__elision) as usize - ptr as usize }, - 22usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__elision) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__list) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(__pthread_mutex_s), - "::", - stringify!(__list) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_rwlock_arch_t { - pub __readers: ::std::os::raw::c_uint, - pub __writers: ::std::os::raw::c_uint, - pub __wrphase_futex: ::std::os::raw::c_uint, - pub __writers_futex: ::std::os::raw::c_uint, - pub __pad3: ::std::os::raw::c_uint, - pub __pad4: ::std::os::raw::c_uint, - pub __cur_writer: ::std::os::raw::c_int, - pub __shared: ::std::os::raw::c_int, - pub __rwelision: ::std::os::raw::c_schar, - pub __pad1: [::std::os::raw::c_uchar; 7usize], - pub __pad2: ::std::os::raw::c_ulong, - pub __flags: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout___pthread_rwlock_arch_t() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_rwlock_arch_t> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_rwlock_arch_t>(), - 56usize, - concat!("Size of: ", stringify!(__pthread_rwlock_arch_t)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_rwlock_arch_t>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_rwlock_arch_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__readers) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__readers) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__writers) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__writers) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wrphase_futex) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__wrphase_futex) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__writers_futex) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__writers_futex) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad3) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__pad3) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__pad4) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__cur_writer) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__cur_writer) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__shared) as usize - ptr as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__shared) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__rwelision) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__rwelision) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad1) as usize - ptr as usize }, - 33usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__pad1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad2) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__pad2) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__flags) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(__pthread_rwlock_arch_t), - "::", - stringify!(__flags) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __pthread_cond_s { - pub __bindgen_anon_1: __pthread_cond_s__bindgen_ty_1, - pub __bindgen_anon_2: __pthread_cond_s__bindgen_ty_2, - pub __g_refs: [::std::os::raw::c_uint; 2usize], - pub __g_size: [::std::os::raw::c_uint; 2usize], - pub __g1_orig_size: ::std::os::raw::c_uint, - pub __wrefs: ::std::os::raw::c_uint, - pub __g_signals: [::std::os::raw::c_uint; 2usize], -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __pthread_cond_s__bindgen_ty_1 { - pub __wseq: ::std::os::raw::c_ulonglong, - pub __wseq32: __pthread_cond_s__bindgen_ty_1__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_cond_s__bindgen_ty_1__bindgen_ty_1 { - pub __low: ::std::os::raw::c_uint, - pub __high: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout___pthread_cond_s__bindgen_ty_1__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s__bindgen_ty_1__bindgen_ty_1> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_cond_s__bindgen_ty_1__bindgen_ty_1>(), - 8usize, - concat!( - "Size of: ", - stringify!(__pthread_cond_s__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_cond_s__bindgen_ty_1__bindgen_ty_1>(), - 4usize, - concat!( - "Alignment of ", - stringify!(__pthread_cond_s__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__low) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(__low) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__high) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_1__bindgen_ty_1), - "::", - stringify!(__high) - ) - ); -} -#[test] -fn bindgen_test_layout___pthread_cond_s__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s__bindgen_ty_1> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_cond_s__bindgen_ty_1>(), - 8usize, - concat!("Size of: ", stringify!(__pthread_cond_s__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_cond_s__bindgen_ty_1>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_cond_s__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wseq) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_1), - "::", - stringify!(__wseq) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wseq32) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_1), - "::", - stringify!(__wseq32) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __pthread_cond_s__bindgen_ty_2 { - pub __g1_start: ::std::os::raw::c_ulonglong, - pub __g1_start32: __pthread_cond_s__bindgen_ty_2__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __pthread_cond_s__bindgen_ty_2__bindgen_ty_1 { - pub __low: ::std::os::raw::c_uint, - pub __high: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout___pthread_cond_s__bindgen_ty_2__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s__bindgen_ty_2__bindgen_ty_1> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_cond_s__bindgen_ty_2__bindgen_ty_1>(), - 8usize, - concat!( - "Size of: ", - stringify!(__pthread_cond_s__bindgen_ty_2__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_cond_s__bindgen_ty_2__bindgen_ty_1>(), - 4usize, - concat!( - "Alignment of ", - stringify!(__pthread_cond_s__bindgen_ty_2__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__low) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(__low) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__high) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_2__bindgen_ty_1), - "::", - stringify!(__high) - ) - ); -} -#[test] -fn bindgen_test_layout___pthread_cond_s__bindgen_ty_2() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s__bindgen_ty_2> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_cond_s__bindgen_ty_2>(), - 8usize, - concat!("Size of: ", stringify!(__pthread_cond_s__bindgen_ty_2)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_cond_s__bindgen_ty_2>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_cond_s__bindgen_ty_2)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g1_start) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_2), - "::", - stringify!(__g1_start) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g1_start32) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s__bindgen_ty_2), - "::", - stringify!(__g1_start32) - ) - ); -} -#[test] -fn bindgen_test_layout___pthread_cond_s() { - const UNINIT: ::std::mem::MaybeUninit<__pthread_cond_s> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__pthread_cond_s>(), - 48usize, - concat!("Size of: ", stringify!(__pthread_cond_s)) - ); - assert_eq!( - ::std::mem::align_of::<__pthread_cond_s>(), - 8usize, - concat!("Alignment of ", stringify!(__pthread_cond_s)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g_refs) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s), - "::", - stringify!(__g_refs) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g_size) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s), - "::", - stringify!(__g_size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g1_orig_size) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s), - "::", - stringify!(__g1_orig_size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wrefs) as usize - ptr as usize }, - 36usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s), - "::", - stringify!(__wrefs) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__g_signals) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(__pthread_cond_s), - "::", - stringify!(__g_signals) - ) - ); -} -pub type __tss_t = ::std::os::raw::c_uint; -pub type __thrd_t = ::std::os::raw::c_ulong; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __once_flag { - pub __data: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout___once_flag() { - const UNINIT: ::std::mem::MaybeUninit<__once_flag> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__once_flag>(), - 4usize, - concat!("Size of: ", stringify!(__once_flag)) - ); - assert_eq!( - ::std::mem::align_of::<__once_flag>(), - 4usize, - concat!("Alignment of ", stringify!(__once_flag)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__once_flag), - "::", - stringify!(__data) - ) - ); -} -pub type pthread_t = ::std::os::raw::c_ulong; -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_mutexattr_t { - pub __size: [::std::os::raw::c_char; 4usize], - pub __align: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_pthread_mutexattr_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_mutexattr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_mutexattr_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutexattr_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutexattr_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_condattr_t { - pub __size: [::std::os::raw::c_char; 4usize], - pub __align: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_pthread_condattr_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_condattr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_condattr_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_condattr_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_condattr_t), - "::", - stringify!(__align) - ) - ); -} -pub type pthread_key_t = ::std::os::raw::c_uint; -pub type pthread_once_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_attr_t { - pub __size: [::std::os::raw::c_char; 56usize], - pub __align: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_pthread_attr_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_attr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_attr_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_attr_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_mutex_t { - pub __data: __pthread_mutex_s, - pub __size: [::std::os::raw::c_char; 40usize], - pub __align: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_pthread_mutex_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_mutex_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__data) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_mutex_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_cond_t { - pub __data: __pthread_cond_s, - pub __size: [::std::os::raw::c_char; 48usize], - pub __align: ::std::os::raw::c_longlong, -} -#[test] -fn bindgen_test_layout_pthread_cond_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(pthread_cond_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_cond_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__data) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_cond_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_rwlock_t { - pub __data: __pthread_rwlock_arch_t, - pub __size: [::std::os::raw::c_char; 56usize], - pub __align: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_pthread_rwlock_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_rwlock_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__data) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__data) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlock_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_rwlockattr_t { - pub __size: [::std::os::raw::c_char; 8usize], - pub __align: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_pthread_rwlockattr_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(pthread_rwlockattr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_rwlockattr_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlockattr_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_rwlockattr_t), - "::", - stringify!(__align) - ) - ); -} -pub type pthread_spinlock_t = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_barrier_t { - pub __size: [::std::os::raw::c_char; 32usize], - pub __align: ::std::os::raw::c_long, -} -#[test] -fn bindgen_test_layout_pthread_barrier_t() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(pthread_barrier_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrier_t), - "::", - stringify!(__align) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union pthread_barrierattr_t { - pub __size: [::std::os::raw::c_char; 4usize], - pub __align: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_pthread_barrierattr_t() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 4usize, - concat!("Size of: ", stringify!(pthread_barrierattr_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(pthread_barrierattr_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__size) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrierattr_t), - "::", - stringify!(__size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__align) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(pthread_barrierattr_t), - "::", - stringify!(__align) - ) - ); -} -extern "C" { - pub fn random() -> ::std::os::raw::c_long; -} -extern "C" { - pub fn srandom(__seed: ::std::os::raw::c_uint); -} -extern "C" { - pub fn initstate( - __seed: ::std::os::raw::c_uint, - __statebuf: *mut ::std::os::raw::c_char, - __statelen: usize, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn setstate(__statebuf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct random_data { - pub fptr: *mut i32, - pub rptr: *mut i32, - pub state: *mut i32, - pub rand_type: ::std::os::raw::c_int, - pub rand_deg: ::std::os::raw::c_int, - pub rand_sep: ::std::os::raw::c_int, - pub end_ptr: *mut i32, -} -#[test] -fn bindgen_test_layout_random_data() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(random_data)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(random_data)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).fptr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(fptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rptr) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(rptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(state) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rand_type) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(rand_type) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rand_deg) as usize - ptr as usize }, - 28usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(rand_deg) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rand_sep) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(rand_sep) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).end_ptr) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(random_data), - "::", - stringify!(end_ptr) - ) - ); -} -extern "C" { - pub fn random_r(__buf: *mut random_data, __result: *mut i32) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn srandom_r( - __seed: ::std::os::raw::c_uint, - __buf: *mut random_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn initstate_r( - __seed: ::std::os::raw::c_uint, - __statebuf: *mut ::std::os::raw::c_char, - __statelen: usize, - __buf: *mut random_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setstate_r( - __statebuf: *mut ::std::os::raw::c_char, - __buf: *mut random_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn rand() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn srand(__seed: ::std::os::raw::c_uint); -} -extern "C" { - pub fn rand_r(__seed: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn drand48() -> f64; -} -extern "C" { - pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; -} -extern "C" { - pub fn lrand48() -> ::std::os::raw::c_long; -} -extern "C" { - pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn mrand48() -> ::std::os::raw::c_long; -} -extern "C" { - pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn srand48(__seedval: ::std::os::raw::c_long); -} -extern "C" { - pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; -} -extern "C" { - pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct drand48_data { - pub __x: [::std::os::raw::c_ushort; 3usize], - pub __old_x: [::std::os::raw::c_ushort; 3usize], - pub __c: ::std::os::raw::c_ushort, - pub __init: ::std::os::raw::c_ushort, - pub __a: ::std::os::raw::c_ulonglong, -} -#[test] -fn bindgen_test_layout_drand48_data() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(drand48_data)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(drand48_data)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__x) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(drand48_data), - "::", - stringify!(__x) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__old_x) as usize - ptr as usize }, - 6usize, - concat!( - "Offset of field: ", - stringify!(drand48_data), - "::", - stringify!(__old_x) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__c) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(drand48_data), - "::", - stringify!(__c) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__init) as usize - ptr as usize }, - 14usize, - concat!( - "Offset of field: ", - stringify!(drand48_data), - "::", - stringify!(__init) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__a) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(drand48_data), - "::", - stringify!(__a) - ) - ); -} -extern "C" { - pub fn drand48_r(__buffer: *mut drand48_data, __result: *mut f64) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn erand48_r( - __xsubi: *mut ::std::os::raw::c_ushort, - __buffer: *mut drand48_data, - __result: *mut f64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lrand48_r( - __buffer: *mut drand48_data, - __result: *mut ::std::os::raw::c_long, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn nrand48_r( - __xsubi: *mut ::std::os::raw::c_ushort, - __buffer: *mut drand48_data, - __result: *mut ::std::os::raw::c_long, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mrand48_r( - __buffer: *mut drand48_data, - __result: *mut ::std::os::raw::c_long, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn jrand48_r( - __xsubi: *mut ::std::os::raw::c_ushort, - __buffer: *mut drand48_data, - __result: *mut ::std::os::raw::c_long, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn srand48_r( - __seedval: ::std::os::raw::c_long, - __buffer: *mut drand48_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn seed48_r( - __seed16v: *mut ::std::os::raw::c_ushort, - __buffer: *mut drand48_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lcong48_r( - __param: *mut ::std::os::raw::c_ushort, - __buffer: *mut drand48_data, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn malloc(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn calloc( - __nmemb: ::std::os::raw::c_ulong, - __size: ::std::os::raw::c_ulong, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn realloc( - __ptr: *mut ::std::os::raw::c_void, - __size: ::std::os::raw::c_ulong, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn reallocarray( - __ptr: *mut ::std::os::raw::c_void, - __nmemb: usize, - __size: usize, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn free(__ptr: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn valloc(__size: usize) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn posix_memalign( - __memptr: *mut *mut ::std::os::raw::c_void, - __alignment: usize, - __size: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn abort() -> !; -} -extern "C" { - pub fn atexit(__func: ::std::option::Option) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn at_quick_exit( - __func: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn on_exit( - __func: ::std::option::Option< - unsafe extern "C" fn( - __status: ::std::os::raw::c_int, - __arg: *mut ::std::os::raw::c_void, - ), - >, - __arg: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn exit(__status: ::std::os::raw::c_int) -> !; -} -extern "C" { - pub fn quick_exit(__status: ::std::os::raw::c_int) -> !; -} -extern "C" { - pub fn _Exit(__status: ::std::os::raw::c_int) -> !; -} -extern "C" { - pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn putenv(__string: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setenv( - __name: *const ::std::os::raw::c_char, - __value: *const ::std::os::raw::c_char, - __replace: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn clearenv() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mkstemps( - __template: *mut ::std::os::raw::c_char, - __suffixlen: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn realpath( - __name: *const ::std::os::raw::c_char, - __resolved: *mut ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_char; -} -pub type __compar_fn_t = ::std::option::Option< - unsafe extern "C" fn( - arg1: *const ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, ->; -extern "C" { - pub fn bsearch( - __key: *const ::std::os::raw::c_void, - __base: *const ::std::os::raw::c_void, - __nmemb: usize, - __size: usize, - __compar: __compar_fn_t, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn qsort( - __base: *mut ::std::os::raw::c_void, - __nmemb: usize, - __size: usize, - __compar: __compar_fn_t, - ); -} -extern "C" { - pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; -} -extern "C" { - pub fn div(__numer: ::std::os::raw::c_int, __denom: ::std::os::raw::c_int) -> div_t; -} -extern "C" { - pub fn ldiv(__numer: ::std::os::raw::c_long, __denom: ::std::os::raw::c_long) -> ldiv_t; -} -extern "C" { - pub fn lldiv( - __numer: ::std::os::raw::c_longlong, - __denom: ::std::os::raw::c_longlong, - ) -> lldiv_t; -} -extern "C" { - pub fn ecvt( - __value: f64, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn fcvt( - __value: f64, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn gcvt( - __value: f64, - __ndigit: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn qecvt( - __value: u128, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn qfcvt( - __value: u128, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn qgcvt( - __value: u128, - __ndigit: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn ecvt_r( - __value: f64, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fcvt_r( - __value: f64, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn qecvt_r( - __value: u128, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn qfcvt_r( - __value: u128, - __ndigit: ::std::os::raw::c_int, - __decpt: *mut ::std::os::raw::c_int, - __sign: *mut ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mbtowc( - __pwc: *mut wchar_t, - __s: *const ::std::os::raw::c_char, - __n: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn wctomb(__s: *mut ::std::os::raw::c_char, __wchar: wchar_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const ::std::os::raw::c_char, __n: usize) -> usize; -} -extern "C" { - pub fn wcstombs(__s: *mut ::std::os::raw::c_char, __pwcs: *const wchar_t, __n: usize) -> usize; -} -extern "C" { - pub fn rpmatch(__response: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getsubopt( - __optionp: *mut *mut ::std::os::raw::c_char, - __tokens: *const *mut ::std::os::raw::c_char, - __valuep: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getloadavg(__loadavg: *mut f64, __nelem: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; -} -pub const metacall_allocator_id_METACALL_ALLOCATOR_STD: metacall_allocator_id = 0; -pub const metacall_allocator_id_METACALL_ALLOCATOR_NGINX: metacall_allocator_id = 1; -pub type metacall_allocator_id = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct ngx_pool_s { - _unused: [u8; 0], -} -pub type metacall_allocator_std = *mut metacall_allocator_std_type; -pub type ngx_pool_t = ngx_pool_s; -pub type metacall_allocator_nginx = *mut metacall_allocator_nginx_type; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_allocator_std_type { - pub malloc: - ::std::option::Option *mut ::std::os::raw::c_void>, - pub realloc: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: usize, - ) -> *mut ::std::os::raw::c_void, - >, - pub free: ::std::option::Option, -} -#[test] -fn bindgen_test_layout_metacall_allocator_std_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(metacall_allocator_std_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_allocator_std_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).malloc) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_std_type), - "::", - stringify!(malloc) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).realloc) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_std_type), - "::", - stringify!(realloc) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).free) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_std_type), - "::", - stringify!(free) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_allocator_nginx_type { - pub pool: *mut ngx_pool_t, - pub palloc: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ngx_pool_t, arg2: usize) -> *mut ::std::os::raw::c_void, - >, - pub pcopy: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_void, - arg3: usize, - ) -> *mut ::std::os::raw::c_void, - >, - pub pfree: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ngx_pool_t, arg2: *mut ::std::os::raw::c_void) -> isize, - >, -} -#[test] -fn bindgen_test_layout_metacall_allocator_nginx_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(metacall_allocator_nginx_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_allocator_nginx_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pool) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_nginx_type), - "::", - stringify!(pool) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).palloc) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_nginx_type), - "::", - stringify!(palloc) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pcopy) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_nginx_type), - "::", - stringify!(pcopy) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pfree) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(metacall_allocator_nginx_type), - "::", - stringify!(pfree) - ) - ); -} -extern "C" { - #[doc = " @brief\n Create an allocator instance\n\n @param[in] allocator_id\n Type of allocator to be created\n\n @param[in] ctx\n Context of the allocator\n\n @return\n Pointer to allocator if success, null otherwise"] - pub fn metacall_allocator_create( - allocator_id: metacall_allocator_id, - ctx: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[doc = " @brief\n Reserve memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] size\n Size in bytes to be allocated\n\n @return\n Pointer to allocated data on success, null otherwise"] - pub fn metacall_allocator_alloc( - allocator: *mut ::std::os::raw::c_void, - size: usize, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[doc = " @brief\n Reallocate memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] data\n Original pointer to data\n\n @param[in] size\n Original size in bytes\n\n @param[in] new_size\n New size in bytes to be reallocated\n\n @return\n Pointer to new reallocated data on success, null otherwise"] - pub fn metacall_allocator_realloc( - allocator: *mut ::std::os::raw::c_void, - data: *mut ::std::os::raw::c_void, - size: usize, - new_size: usize, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[doc = " @brief\n Free memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] data\n Pointer to data to be freed"] - pub fn metacall_allocator_free( - allocator: *mut ::std::os::raw::c_void, - data: *mut ::std::os::raw::c_void, - ); -} -extern "C" { - #[doc = " @brief\n Destroy an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance"] - pub fn metacall_allocator_destroy(allocator: *mut ::std::os::raw::c_void); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_exception_type { - pub message: *const ::std::os::raw::c_char, - pub label: *const ::std::os::raw::c_char, - pub code: i64, - pub stacktrace: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_metacall_exception_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(metacall_exception_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_exception_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).message) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_exception_type), - "::", - stringify!(message) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_exception_type), - "::", - stringify!(label) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).code) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_exception_type), - "::", - stringify!(code) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stacktrace) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(metacall_exception_type), - "::", - stringify!(stacktrace) - ) - ); -} -pub type metacall_exception = *mut metacall_exception_type; -extern "C" { - #[doc = " @brief\n Retrieve the exception from a value, it can be either a throwable value with an exception inside or an exception itself\n\n @param[in] v\n Value that represents the exception to be retrieved\n\n @param[out] ex\n Exception that will be used as out parameter, the lifetime of the struct fields is attached to @v\n\n @return\n Zero if success, different from zero otherwise"] - pub fn metacall_error_from_value( - v: *mut ::std::os::raw::c_void, - ex: metacall_exception, - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[doc = " @brief\n Retrieve last error that has happened after a call to any API from MetaCall\n\n @param[out] ex\n Exception that will be used as out parameter, the lifetime of the struct fields is attached to the internal MetaCall exception\n\n @return\n Zero if success, different from zero otherwise"] - pub fn metacall_error_last(ex: metacall_exception) -> ::std::os::raw::c_int; -} -extern "C" { - #[doc = " @brief\n Clear last error that has happened after a call to any API from MetaCall"] - pub fn metacall_error_clear(); -} -pub type va_list = __builtin_va_list; -pub type __gnuc_va_list = va_list; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct __mbstate_t { - pub __count: ::std::os::raw::c_int, - pub __value: __mbstate_t__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union __mbstate_t__bindgen_ty_1 { - pub __wch: ::std::os::raw::c_uint, - pub __wchb: [::std::os::raw::c_char; 4usize], -} -#[test] -fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wch) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t__bindgen_ty_1), - "::", - stringify!(__wchb) - ) - ); -} -#[test] -fn bindgen_test_layout___mbstate_t() { - const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__mbstate_t>(), - 8usize, - concat!("Size of: ", stringify!(__mbstate_t)) - ); - assert_eq!( - ::std::mem::align_of::<__mbstate_t>(), - 4usize, - concat!("Alignment of ", stringify!(__mbstate_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__count) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__mbstate_t), - "::", - stringify!(__value) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos_t { - pub __pos: __off_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos_t() { - const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<_G_fpos_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos_t), - "::", - stringify!(__state) - ) - ); -} -pub type __fpos_t = _G_fpos_t; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct _G_fpos64_t { - pub __pos: __off64_t, - pub __state: __mbstate_t, -} -#[test] -fn bindgen_test_layout__G_fpos64_t() { - const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<_G_fpos64_t>(), - 16usize, - concat!("Size of: ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - ::std::mem::align_of::<_G_fpos64_t>(), - 8usize, - concat!("Alignment of ", stringify!(_G_fpos64_t)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__pos) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_G_fpos64_t), - "::", - stringify!(__state) - ) - ); -} -pub type __fpos64_t = _G_fpos64_t; -pub type __FILE = _IO_FILE; -pub type FILE = _IO_FILE; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_marker { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_codecvt { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_wide_data { - _unused: [u8; 0], -} -pub type _IO_lock_t = ::std::os::raw::c_void; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct _IO_FILE { - pub _flags: ::std::os::raw::c_int, - pub _IO_read_ptr: *mut ::std::os::raw::c_char, - pub _IO_read_end: *mut ::std::os::raw::c_char, - pub _IO_read_base: *mut ::std::os::raw::c_char, - pub _IO_write_base: *mut ::std::os::raw::c_char, - pub _IO_write_ptr: *mut ::std::os::raw::c_char, - pub _IO_write_end: *mut ::std::os::raw::c_char, - pub _IO_buf_base: *mut ::std::os::raw::c_char, - pub _IO_buf_end: *mut ::std::os::raw::c_char, - pub _IO_save_base: *mut ::std::os::raw::c_char, - pub _IO_backup_base: *mut ::std::os::raw::c_char, - pub _IO_save_end: *mut ::std::os::raw::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: ::std::os::raw::c_int, - pub _flags2: ::std::os::raw::c_int, - pub _old_offset: __off_t, - pub _cur_column: ::std::os::raw::c_ushort, - pub _vtable_offset: ::std::os::raw::c_schar, - pub _shortbuf: [::std::os::raw::c_char; 1usize], - pub _lock: *mut _IO_lock_t, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut ::std::os::raw::c_void, - pub __pad5: usize, - pub _mode: ::std::os::raw::c_int, - pub _unused2: [::std::os::raw::c_char; 20usize], -} -#[test] -fn bindgen_test_layout__IO_FILE() { - const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<_IO_FILE>(), - 216usize, - concat!("Size of: ", stringify!(_IO_FILE)) - ); - assert_eq!( - ::std::mem::align_of::<_IO_FILE>(), - 8usize, - concat!("Alignment of ", stringify!(_IO_FILE)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_ptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_end) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_read_base) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_base) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_ptr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_write_end) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_base) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_buf_end) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, - 72usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_base) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_backup_base) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, - 88usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_IO_save_end) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, - 96usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_markers) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, - 104usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_chain) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, - 112usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_fileno) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_flags2) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, - 120usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_old_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, - 128usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_cur_column) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, - 130usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_vtable_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, - 131usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_shortbuf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, - 136usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_lock) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, - 144usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, - 152usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_codecvt) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, - 160usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_wide_data) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, - 168usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_list) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, - 176usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_freeres_buf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, - 184usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(__pad5) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, - 192usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_mode) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, - 196usize, - concat!( - "Offset of field: ", - stringify!(_IO_FILE), - "::", - stringify!(_unused2) - ) - ); -} -pub type fpos_t = __fpos_t; -extern "C" { - pub static mut stdin: *mut FILE; -} -extern "C" { - pub static mut stdout: *mut FILE; -} -extern "C" { - pub static mut stderr: *mut FILE; -} -extern "C" { - pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn rename( - __old: *const ::std::os::raw::c_char, - __new: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn renameat( - __oldfd: ::std::os::raw::c_int, - __old: *const ::std::os::raw::c_char, - __newfd: ::std::os::raw::c_int, - __new: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn tmpfile() -> *mut FILE; -} -extern "C" { - pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn tempnam( - __dir: *const ::std::os::raw::c_char, - __pfx: *const ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fopen( - __filename: *const ::std::os::raw::c_char, - __modes: *const ::std::os::raw::c_char, - ) -> *mut FILE; -} -extern "C" { - pub fn freopen( - __filename: *const ::std::os::raw::c_char, - __modes: *const ::std::os::raw::c_char, - __stream: *mut FILE, - ) -> *mut FILE; -} -extern "C" { - pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char) - -> *mut FILE; -} -extern "C" { - pub fn fmemopen( - __s: *mut ::std::os::raw::c_void, - __len: usize, - __modes: *const ::std::os::raw::c_char, - ) -> *mut FILE; -} -extern "C" { - pub fn open_memstream( - __bufloc: *mut *mut ::std::os::raw::c_char, - __sizeloc: *mut usize, - ) -> *mut FILE; -} -extern "C" { - pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char); -} -extern "C" { - pub fn setvbuf( - __stream: *mut FILE, - __buf: *mut ::std::os::raw::c_char, - __modes: ::std::os::raw::c_int, - __n: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize); -} -extern "C" { - pub fn setlinebuf(__stream: *mut FILE); -} -extern "C" { - pub fn fprintf( - __stream: *mut FILE, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sprintf( - __s: *mut ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vfprintf( - __s: *mut FILE, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vprintf( - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vsprintf( - __s: *mut ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn snprintf( - __s: *mut ::std::os::raw::c_char, - __maxlen: ::std::os::raw::c_ulong, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vsnprintf( - __s: *mut ::std::os::raw::c_char, - __maxlen: ::std::os::raw::c_ulong, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vdprintf( - __fd: ::std::os::raw::c_int, - __fmt: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn dprintf( - __fd: ::std::os::raw::c_int, - __fmt: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fscanf( - __stream: *mut FILE, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sscanf( - __s: *const ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_fscanf"] - pub fn fscanf1( - __stream: *mut FILE, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_scanf"] - pub fn scanf1(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_sscanf"] - pub fn sscanf1( - __s: *const ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vfscanf( - __s: *mut FILE, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vscanf( - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vsscanf( - __s: *const ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_vfscanf"] - pub fn vfscanf1( - __s: *mut FILE, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_vscanf"] - pub fn vscanf1( - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "\u{1}__isoc99_vsscanf"] - pub fn vsscanf1( - __s: *const ::std::os::raw::c_char, - __format: *const ::std::os::raw::c_char, - __arg: *mut __va_list_tag, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getchar() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getchar_unlocked() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) - -> ::std::os::raw::c_int; -} -extern "C" { - pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fgets( - __s: *mut ::std::os::raw::c_char, - __n: ::std::os::raw::c_int, - __stream: *mut FILE, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn __getdelim( - __lineptr: *mut *mut ::std::os::raw::c_char, - __n: *mut usize, - __delimiter: ::std::os::raw::c_int, - __stream: *mut FILE, - ) -> __ssize_t; -} -extern "C" { - pub fn getdelim( - __lineptr: *mut *mut ::std::os::raw::c_char, - __n: *mut usize, - __delimiter: ::std::os::raw::c_int, - __stream: *mut FILE, - ) -> __ssize_t; -} -extern "C" { - pub fn getline( - __lineptr: *mut *mut ::std::os::raw::c_char, - __n: *mut usize, - __stream: *mut FILE, - ) -> __ssize_t; -} -extern "C" { - pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fread( - __ptr: *mut ::std::os::raw::c_void, - __size: ::std::os::raw::c_ulong, - __n: ::std::os::raw::c_ulong, - __stream: *mut FILE, - ) -> ::std::os::raw::c_ulong; -} -extern "C" { - pub fn fwrite( - __ptr: *const ::std::os::raw::c_void, - __size: ::std::os::raw::c_ulong, - __n: ::std::os::raw::c_ulong, - __s: *mut FILE, - ) -> ::std::os::raw::c_ulong; -} -extern "C" { - pub fn fread_unlocked( - __ptr: *mut ::std::os::raw::c_void, - __size: usize, - __n: usize, - __stream: *mut FILE, - ) -> usize; -} -extern "C" { - pub fn fwrite_unlocked( - __ptr: *const ::std::os::raw::c_void, - __size: usize, - __n: usize, - __stream: *mut FILE, - ) -> usize; -} -extern "C" { - pub fn fseek( - __stream: *mut FILE, - __off: ::std::os::raw::c_long, - __whence: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn rewind(__stream: *mut FILE); -} -extern "C" { - pub fn fseeko( - __stream: *mut FILE, - __off: __off_t, - __whence: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ftello(__stream: *mut FILE) -> __off_t; -} -extern "C" { - pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn clearerr(__stream: *mut FILE); -} -extern "C" { - pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn clearerr_unlocked(__stream: *mut FILE); -} -extern "C" { - pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn perror(__s: *const ::std::os::raw::c_char); -} -extern "C" { - pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn popen( - __command: *const ::std::os::raw::c_char, - __modes: *const ::std::os::raw::c_char, - ) -> *mut FILE; -} -extern "C" { - pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn flockfile(__stream: *mut FILE); -} -extern "C" { - pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn funlockfile(__stream: *mut FILE); +pub type pid_t = __pid_t; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum metacall_allocator_id { + METACALL_ALLOCATOR_STD = 0, + METACALL_ALLOCATOR_NGINX = 1, } -extern "C" { - pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int; +unsafe extern "C" { + #[doc = " @brief\n Create an allocator instance\n\n @param[in] allocator_id\n Type of allocator to be created\n\n @param[in] ctx\n Context of the allocator\n\n @return\n Pointer to allocator if success, null otherwise"] + pub fn metacall_allocator_create( + allocator_id: metacall_allocator_id, + ctx: *mut ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void; } -extern "C" { - pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +unsafe extern "C" { + #[doc = " @brief\n Reserve memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] size\n Size in bytes to be allocated\n\n @return\n Pointer to allocated data on success, null otherwise"] + pub fn metacall_allocator_alloc( + allocator: *mut ::std::os::raw::c_void, + size: usize, + ) -> *mut ::std::os::raw::c_void; } -pub const metacall_log_id_METACALL_LOG_STDIO: metacall_log_id = 0; -pub const metacall_log_id_METACALL_LOG_FILE: metacall_log_id = 1; -pub const metacall_log_id_METACALL_LOG_SOCKET: metacall_log_id = 2; -pub const metacall_log_id_METACALL_LOG_SYSLOG: metacall_log_id = 3; -pub const metacall_log_id_METACALL_LOG_NGINX: metacall_log_id = 4; -pub const metacall_log_id_METACALL_LOG_CUSTOM: metacall_log_id = 5; -pub type metacall_log_id = ::std::os::raw::c_uint; -pub type metacall_log_stdio = *mut metacall_log_stdio_type; -pub type metacall_log_file = *mut metacall_log_file_type; -pub type metacall_log_socket = *mut metacall_log_socket_type; -pub type metacall_log_syslog = *mut metacall_log_syslog_type; -pub type metacall_log_nginx = *mut metacall_log_nginx_type; -pub type metacall_log_custom_va_list = *mut metacall_log_custom_va_list_type; -pub type metacall_log_custom = *mut metacall_log_custom_type; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_stdio_type { - pub stream: *mut FILE, -} -#[test] -fn bindgen_test_layout_metacall_log_stdio_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(metacall_log_stdio_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_stdio_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stream) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_stdio_type), - "::", - stringify!(stream) - ) - ); +unsafe extern "C" { + #[doc = " @brief\n Reallocate memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] data\n Original pointer to data\n\n @param[in] size\n Original size in bytes\n\n @param[in] new_size\n New size in bytes to be reallocated\n\n @return\n Pointer to new reallocated data on success, null otherwise"] + pub fn metacall_allocator_realloc( + allocator: *mut ::std::os::raw::c_void, + data: *mut ::std::os::raw::c_void, + size: usize, + new_size: usize, + ) -> *mut ::std::os::raw::c_void; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_file_type { - pub file_name: *const ::std::os::raw::c_char, - pub mode: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_metacall_log_file_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(metacall_log_file_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_file_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).file_name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_file_type), - "::", - stringify!(file_name) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).mode) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_file_type), - "::", - stringify!(mode) - ) +unsafe extern "C" { + #[doc = " @brief\n Free memory from an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance\n\n @param[in] data\n Pointer to data to be freed"] + pub fn metacall_allocator_free( + allocator: *mut ::std::os::raw::c_void, + data: *mut ::std::os::raw::c_void, ); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_socket_type { - pub ip: *const ::std::os::raw::c_char, - pub port: u16, -} -#[test] -fn bindgen_test_layout_metacall_log_socket_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(metacall_log_socket_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_socket_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).ip) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_socket_type), - "::", - stringify!(ip) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).port) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_socket_type), - "::", - stringify!(port) - ) - ); +unsafe extern "C" { + #[doc = " @brief\n Destroy an allocator instance\n\n @param[in] allocator\n Pointer to allocator instance"] + pub fn metacall_allocator_destroy(allocator: *mut ::std::os::raw::c_void); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct metacall_log_syslog_type { - pub name: *const ::std::os::raw::c_char, -} -#[test] -fn bindgen_test_layout_metacall_log_syslog_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(metacall_log_syslog_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_syslog_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_syslog_type), - "::", - stringify!(name) - ) - ); +pub struct metacall_exception_type { + pub message: *const ::std::os::raw::c_char, + pub label: *const ::std::os::raw::c_char, + pub code: i64, + pub stacktrace: *const ::std::os::raw::c_char, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_nginx_type { - pub log: *mut ::std::os::raw::c_void, - pub log_error: ::std::option::Option, - pub log_level: u16, -} -#[test] -fn bindgen_test_layout_metacall_log_nginx_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(metacall_log_nginx_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_nginx_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).log) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_nginx_type), - "::", - stringify!(log) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).log_error) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_nginx_type), - "::", - stringify!(log_error) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).log_level) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_nginx_type), - "::", - stringify!(log_level) - ) - ); +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of metacall_exception_type"][::std::mem::size_of::() - 32usize]; + ["Alignment of metacall_exception_type"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: metacall_exception_type::message"] + [::std::mem::offset_of!(metacall_exception_type, message) - 0usize]; + ["Offset of field: metacall_exception_type::label"] + [::std::mem::offset_of!(metacall_exception_type, label) - 8usize]; + ["Offset of field: metacall_exception_type::code"] + [::std::mem::offset_of!(metacall_exception_type, code) - 16usize]; + ["Offset of field: metacall_exception_type::stacktrace"] + [::std::mem::offset_of!(metacall_exception_type, stacktrace) - 24usize]; +}; +pub type metacall_exception = *mut metacall_exception_type; +unsafe extern "C" { + #[doc = " @brief\n Retrieve the exception from a value, it can be either a throwable value with an exception inside or an exception itself\n\n @param[in] v\n Value that represents the exception to be retrieved\n\n @param[out] ex\n Exception that will be used as out parameter, the lifetime of the struct fields is attached to @v\n\n @return\n Zero if success, different from zero otherwise"] + pub fn metacall_error_from_value( + v: *mut ::std::os::raw::c_void, + ex: metacall_exception, + ) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_custom_va_list_type { - pub va: va_list, -} -#[test] -fn bindgen_test_layout_metacall_log_custom_va_list_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(metacall_log_custom_va_list_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(metacall_log_custom_va_list_type) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).va) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_va_list_type), - "::", - stringify!(va) - ) - ); +unsafe extern "C" { + #[doc = " @brief\n Retrieve last error that has happened after a call to any API from MetaCall\n\n @param[out] ex\n Exception that will be used as out parameter, the lifetime of the struct fields is attached to the internal MetaCall exception\n\n @return\n Zero if success, different from zero otherwise"] + pub fn metacall_error_last(ex: metacall_exception) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct metacall_log_custom_type { - pub context: *mut ::std::os::raw::c_void, - pub format_size: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_char, - arg3: u64, - arg4: usize, - arg5: *const ::std::os::raw::c_char, - arg6: *const ::std::os::raw::c_char, - arg7: *const ::std::os::raw::c_char, - arg8: *const ::std::os::raw::c_char, - arg9: metacall_log_custom_va_list, - ) -> usize, - >, - pub format_serialize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *mut ::std::os::raw::c_void, - arg3: usize, - arg4: *const ::std::os::raw::c_char, - arg5: u64, - arg6: usize, - arg7: *const ::std::os::raw::c_char, - arg8: *const ::std::os::raw::c_char, - arg9: *const ::std::os::raw::c_char, - arg10: *const ::std::os::raw::c_char, - arg11: metacall_log_custom_va_list, - ) -> usize, - >, - pub format_deserialize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_void, - arg3: usize, - arg4: *const ::std::os::raw::c_char, - arg5: u64, - arg6: usize, - arg7: *const ::std::os::raw::c_char, - arg8: *const ::std::os::raw::c_char, - arg9: *const ::std::os::raw::c_char, - arg10: *const ::std::os::raw::c_char, - arg11: metacall_log_custom_va_list, - ) -> usize, - >, - pub stream_write: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_char, - arg3: usize, - ) -> ::std::os::raw::c_int, - >, - pub stream_flush: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, -} -#[test] -fn bindgen_test_layout_metacall_log_custom_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(metacall_log_custom_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_log_custom_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).context) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(context) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).format_size) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(format_size) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).format_serialize) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(format_serialize) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).format_deserialize) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(format_deserialize) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stream_write) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(stream_write) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stream_flush) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(metacall_log_custom_type), - "::", - stringify!(stream_flush) - ) - ); +unsafe extern "C" { + #[doc = " @brief\n Clear last error that has happened after a call to any API from MetaCall"] + pub fn metacall_error_clear(); } -extern "C" { +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum metacall_log_id { + METACALL_LOG_STDIO = 0, + METACALL_LOG_FILE = 1, + METACALL_LOG_SOCKET = 2, + METACALL_LOG_SYSLOG = 3, + METACALL_LOG_NGINX = 4, + METACALL_LOG_CUSTOM = 5, +} +unsafe extern "C" { #[doc = " @brief\n Create a log instance\n\n @param[in] log_id\n Type of log to be created\n\n @param[in] ctx\n Context of the log (a pointer to metacall_log_{stdio, file, socket, syslog, nginx, custom}_type)\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_log( log_id: metacall_log_id, ctx: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -pub const metacall_value_id_METACALL_BOOL: metacall_value_id = 0; -pub const metacall_value_id_METACALL_CHAR: metacall_value_id = 1; -pub const metacall_value_id_METACALL_SHORT: metacall_value_id = 2; -pub const metacall_value_id_METACALL_INT: metacall_value_id = 3; -pub const metacall_value_id_METACALL_LONG: metacall_value_id = 4; -pub const metacall_value_id_METACALL_FLOAT: metacall_value_id = 5; -pub const metacall_value_id_METACALL_DOUBLE: metacall_value_id = 6; -pub const metacall_value_id_METACALL_STRING: metacall_value_id = 7; -pub const metacall_value_id_METACALL_BUFFER: metacall_value_id = 8; -pub const metacall_value_id_METACALL_ARRAY: metacall_value_id = 9; -pub const metacall_value_id_METACALL_MAP: metacall_value_id = 10; -pub const metacall_value_id_METACALL_PTR: metacall_value_id = 11; -pub const metacall_value_id_METACALL_FUTURE: metacall_value_id = 12; -pub const metacall_value_id_METACALL_FUNCTION: metacall_value_id = 13; -pub const metacall_value_id_METACALL_NULL: metacall_value_id = 14; -pub const metacall_value_id_METACALL_CLASS: metacall_value_id = 15; -pub const metacall_value_id_METACALL_OBJECT: metacall_value_id = 16; -pub const metacall_value_id_METACALL_EXCEPTION: metacall_value_id = 17; -pub const metacall_value_id_METACALL_THROWABLE: metacall_value_id = 18; -pub const metacall_value_id_METACALL_SIZE: metacall_value_id = 19; -pub const metacall_value_id_METACALL_INVALID: metacall_value_id = 20; -pub type metacall_value_id = ::std::os::raw::c_uint; -extern "C" { +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum metacall_value_id { + METACALL_BOOL = 0, + METACALL_CHAR = 1, + METACALL_SHORT = 2, + METACALL_INT = 3, + METACALL_LONG = 4, + METACALL_FLOAT = 5, + METACALL_DOUBLE = 6, + METACALL_STRING = 7, + METACALL_BUFFER = 8, + METACALL_ARRAY = 9, + METACALL_MAP = 10, + METACALL_PTR = 11, + METACALL_FUTURE = 12, + METACALL_FUNCTION = 13, + METACALL_NULL = 14, + METACALL_CLASS = 15, + METACALL_OBJECT = 16, + METACALL_EXCEPTION = 17, + METACALL_THROWABLE = 18, + METACALL_SIZE = 19, + METACALL_INVALID = 20, +} +unsafe extern "C" { #[doc = " @brief\n Create a value from boolean @b\n\n @param[in] b\n Boolean will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_bool(b: ::std::os::raw::c_uchar) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from char @c\n\n @param[in] c\n Character will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_char(c: ::std::os::raw::c_char) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from short @s\n\n @param[in] s\n Short will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_short(s: ::std::os::raw::c_short) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from integer @i\n\n @param[in] i\n Integer will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_int(i: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from long @l\n\n @param[in] l\n Long integer will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_long(l: ::std::os::raw::c_long) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from single precision floating point number @f\n\n @param[in] f\n Float will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_float(f: f32) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from double precision floating point number @d\n\n @param[in] d\n Double will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_double(d: f64) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from a C string @str\n\n @param[in] str\n Constant string will be copied into value (needs to be null terminated)\n\n @param[in] length\n Length of the constant string\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_string( str_: *const ::std::os::raw::c_char, length: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value buffer from array @buffer\n\n @param[in] buffer\n Constant memory block will be copied into value array\n\n @param[in] size\n Size in bytes of data contained in the array\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_buffer( buffer: *const ::std::os::raw::c_void, size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value array from array of values @values\n\n @param[in] values\n Constant array of values will be copied into value list\n\n @param[in] size\n Number of elements contained in the array\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_array( values: *mut *const ::std::os::raw::c_void, size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value map from array of tuples @map\n\n @param[in] tuples\n Constant array of tuples will be copied into value map\n\n @param[in] size\n Number of elements contained in the map\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_map( tuples: *mut *const ::std::os::raw::c_void, size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from pointer @ptr\n\n @param[in] ptr\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_ptr( ptr: *const ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from future @f\n\n @param[in] f\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_future( f: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from function @f\n\n @param[in] f\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_function( f: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from function @f binding a closure @c to it\n\n @param[in] f\n Pointer to constant data will be copied into value\n\n @param[in] c\n Pointer to closure that will be binded into function @f\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_function_closure( f: *mut ::std::os::raw::c_void, c: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value of type null\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_null() -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from class @c\n\n @param[in] c\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_class( c: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from object @o\n\n @param[in] o\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_object( o: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from exception @ex\n\n @param[in] ex\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_exception( ex: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a value from throwable @th\n\n @param[in] th\n Pointer to constant data will be copied into value\n\n @return\n Pointer to value if success, null otherwhise"] pub fn metacall_value_create_throwable( th: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Returns the size of the value\n\n @param[in] v\n Reference to the value\n\n @return\n Size in bytes of the value"] pub fn metacall_value_size(v: *mut ::std::os::raw::c_void) -> usize; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Returns the amount of values this value contains\n\n @param[in] v\n Reference to the value\n\n @return\n Number of values @v represents"] pub fn metacall_value_count(v: *mut ::std::os::raw::c_void) -> usize; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide type id of value\n\n @param[in] v\n Reference to the value\n\n @return\n Return type id assigned to value"] pub fn metacall_value_id(v: *mut ::std::os::raw::c_void) -> metacall_value_id; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide type id in a readable form (as string) of a type id\n\n @param[in] id\n Value type identifier\n\n @return\n Return string related to the type id"] pub fn metacall_value_id_name(id: metacall_value_id) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide type id in a readable form (as string) of value\n\n @param[in] v\n Reference to the value\n\n @return\n Return string related to the type id assigned to value"] pub fn metacall_value_type_name( v: *mut ::std::os::raw::c_void, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Deep copies the value @v, the result copy resets\n the reference counter and ownership, including the finalizer\n\n @param[in] v\n Reference to the value to be copied\n\n @return\n Copy of the value @v on success, null otherwhise"] pub fn metacall_value_copy(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { + #[doc = " @brief\n Creates a new pointer value, with a reference to the\n data contained inside the value @v. For example:\n\n void *v = metacall_value_create_int(20);\n void *ptr = metacall_value_reference(v);\n\n In this case, void *ptr is a value equivalent to int*,\n and it points directly to the integer contained in void *v.\n Note that if we destroy the value @v, the reference will\n point to already freed memory, causing use-after-free when used.\n\n @param[in] v\n Reference to the value to be referenced\n\n @return\n A new value of type pointer, pointing to the @v data"] + pub fn metacall_value_reference(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { + #[doc = " @brief\n If you pass a reference previously created (i.e a value of\n type pointer, pointing to another value), it returns the\n original value. It does not modify the memory of the values\n neither allocates anything. If the value @v is pointing to\n has been deleted, it will cause an use-after-free. For example:\n\n void *v = metacall_value_create_int(20);\n void *ptr = metacall_value_reference(v);\n void *w = metacall_value_dereference(ptr);\n assert(v == w); // Both are the same value\n\n @param[in] v\n Reference to the value to be dereferenced\n\n @return\n The value containing the data which ptr is pointing to"] + pub fn metacall_value_dereference( + v: *mut ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { #[doc = " @brief\n Copies the ownership from @src to @dst, including the finalizer,\n and resets the owner and finalizer of @src\n\n @param[in] src\n Source value which will lose the ownership\n\n @param[in] dst\n Destination value which will recieve the ownership"] pub fn metacall_value_move(src: *mut ::std::os::raw::c_void, dest: *mut ::std::os::raw::c_void); } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to boolean\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to boolean"] pub fn metacall_value_to_bool(v: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uchar; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to char\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to char"] pub fn metacall_value_to_char(v: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to short\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to short"] pub fn metacall_value_to_short(v: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_short; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to integer\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to integer"] pub fn metacall_value_to_int(v: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to long integer\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to long integer"] pub fn metacall_value_to_long(v: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_long; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to single precision floating point\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to float"] pub fn metacall_value_to_float(v: *mut ::std::os::raw::c_void) -> f32; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to double precision floating point\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to dobule"] pub fn metacall_value_to_double(v: *mut ::std::os::raw::c_void) -> f64; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to string\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to C string (null terminated)"] pub fn metacall_value_to_string(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to buffer\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to memory block"] pub fn metacall_value_to_buffer(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to array of values\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to array of values"] pub fn metacall_value_to_array( v: *mut ::std::os::raw::c_void, ) -> *mut *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to map\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to map (array of tuples (array of values))"] pub fn metacall_value_to_map( v: *mut ::std::os::raw::c_void, ) -> *mut *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to pointer\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to pointer"] pub fn metacall_value_to_ptr(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to future\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to future"] pub fn metacall_value_to_future(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to function\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to function"] pub fn metacall_value_to_function( v: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to null\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to null"] pub fn metacall_value_to_null(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to class\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to class"] pub fn metacall_value_to_class(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to object\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to object"] pub fn metacall_value_to_object(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to exception\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to exception"] pub fn metacall_value_to_exception( v: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v to throwable\n\n @param[in] v\n Reference to the value\n\n @return\n Value converted to throwable"] pub fn metacall_value_to_throwable( v: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign boolean @b to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] b\n Boolean to be assigned to value @v\n\n @return\n Value with boolean @b assigned to it"] pub fn metacall_value_from_bool( v: *mut ::std::os::raw::c_void, b: ::std::os::raw::c_uchar, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign character @c to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] c\n Character to be assigned to value @v\n\n @return\n Value with char @c assigned to it"] pub fn metacall_value_from_char( v: *mut ::std::os::raw::c_void, c: ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign short @s to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] s\n Short to be assigned to value @v\n\n @return\n Value with short @s assigned to it"] pub fn metacall_value_from_short( v: *mut ::std::os::raw::c_void, s: ::std::os::raw::c_short, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign integer @i to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] i\n Integer to be assigned to value @v\n\n @return\n Value with integer @i assigned to it"] pub fn metacall_value_from_int( v: *mut ::std::os::raw::c_void, i: ::std::os::raw::c_int, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign long integer @l to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] l\n Long integer to be assigned to value @v\n\n @return\n Value with long @l assigned to it"] pub fn metacall_value_from_long( v: *mut ::std::os::raw::c_void, l: ::std::os::raw::c_long, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign single precision floating point @f to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] f\n Float to be assigned to value @v\n\n @return\n Value with float @f assigned to it"] pub fn metacall_value_from_float( v: *mut ::std::os::raw::c_void, f: f32, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign double precision floating point @d to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] d\n Double to be assigned to value @v\n\n @return\n Value with double @d assigned to it"] pub fn metacall_value_from_double( v: *mut ::std::os::raw::c_void, d: f64, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign string @str to value @v, truncates to @v size if it is smaller\n than @length + 1. It does not add null terminator if truncated.\n\n @param[in] v\n Reference to the value\n\n @param[in] str\n Constant string to be assigned to value @v (it needs to be null terminated)\n\n @param[in] length\n Length of the constant string @str\n\n @return\n Value with string @str assigned to it"] pub fn metacall_value_from_string( v: *mut ::std::os::raw::c_void, @@ -4409,7 +414,7 @@ extern "C" { length: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign array @buffer to value buffer @v\n\n @param[in] v\n Reference to the value\n\n @param[in] buffer\n Constant array to be assigned to value @v\n\n @param[in] size\n Number of elements contained in @buffer\n\n @return\n Value with array @buffer assigned to it"] pub fn metacall_value_from_buffer( v: *mut ::std::os::raw::c_void, @@ -4417,7 +422,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign array of values @values to value array @v\n\n @param[in] v\n Reference to the value\n\n @param[in] values\n Constant array of values to be assigned to value array @v\n\n @param[in] size\n Number of values contained in constant array @values\n\n @return\n Value with array of values @values assigned to it"] pub fn metacall_value_from_array( v: *mut ::std::os::raw::c_void, @@ -4425,7 +430,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign array of values @values to value map @v\n\n @param[in] v\n Reference to the value\n\n @param[in] tuples\n Constant array of tuples to be assigned to value map @v\n\n @param[in] size\n Number of values contained in constant array @tuples\n\n @return\n Value with array of tuples @tuples assigned to it"] pub fn metacall_value_from_map( v: *mut ::std::os::raw::c_void, @@ -4433,970 +438,173 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign pointer reference @ptr to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] ptr\n Pointer to be assigned to value @v\n\n @return\n Value with pointer @ptr assigned to it"] pub fn metacall_value_from_ptr( v: *mut ::std::os::raw::c_void, ptr: *const ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign future @f to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] f\n Future to be assigned to value @v\n\n @return\n Value with future @f assigned to it"] pub fn metacall_value_from_future( v: *mut ::std::os::raw::c_void, f: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign function @f to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] f\n Function to be assigned to value @v\n\n @return\n Value with function @f assigned to it"] pub fn metacall_value_from_function( v: *mut ::std::os::raw::c_void, f: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign null to value @v\n\n @param[in] v\n Reference to the value\n\n @return\n Value with null assigned to it"] pub fn metacall_value_from_null(v: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign class @c to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] c\n Class to be assigned to value @v\n\n @return\n Value with class @c assigned to it"] pub fn metacall_value_from_class( v: *mut ::std::os::raw::c_void, c: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign object @o to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] o\n Object to be assigned to value @v\n\n @return\n Value with object @o assigned to it"] pub fn metacall_value_from_object( v: *mut ::std::os::raw::c_void, o: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign exception @ex to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] ex\n Exception to be assigned to value @v\n\n @return\n Value with exception @ex assigned to it"] pub fn metacall_value_from_exception( v: *mut ::std::os::raw::c_void, ex: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Assign throwable @th to value @v\n\n @param[in] v\n Reference to the value\n\n @param[in] th\n Throwable to be assigned to value @v\n\n @return\n Value with throwable @th assigned to it"] pub fn metacall_value_from_throwable( v: *mut ::std::os::raw::c_void, th: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Casts a value to a new type @id\n\n @param[in] v\n Reference to the value\n\n @param[in] id\n New type id of value to be casted\n\n @return\n Casted value or reference to @v if casting is between equivalent types"] pub fn metacall_value_cast( v: *mut ::std::os::raw::c_void, id: metacall_value_id, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to boolean\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to boolean"] pub fn metacall_value_cast_bool(v: *mut *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uchar; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to char\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to char"] pub fn metacall_value_cast_char(v: *mut *mut ::std::os::raw::c_void) -> ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to short\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to short"] pub fn metacall_value_cast_short( v: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_short; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to int\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to int"] pub fn metacall_value_cast_int(v: *mut *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to long\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to long"] pub fn metacall_value_cast_long(v: *mut *mut ::std::os::raw::c_void) -> ::std::os::raw::c_long; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to float\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to float"] pub fn metacall_value_cast_float(v: *mut *mut ::std::os::raw::c_void) -> f32; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to double\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to double"] pub fn metacall_value_cast_double(v: *mut *mut ::std::os::raw::c_void) -> f64; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to string\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to a C string (null terminated)"] pub fn metacall_value_cast_string( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to buffer\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to buffer"] pub fn metacall_value_cast_buffer( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to array\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to array of values"] pub fn metacall_value_cast_array( v: *mut *mut ::std::os::raw::c_void, ) -> *mut *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to map\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to map"] pub fn metacall_value_cast_map( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to ptr\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to ptr"] pub fn metacall_value_cast_ptr( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to future\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to future"] pub fn metacall_value_cast_future( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to function\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to function"] pub fn metacall_value_cast_function( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to null\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to null"] pub fn metacall_value_cast_null( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to class\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to class"] pub fn metacall_value_cast_class( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to object\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to object"] pub fn metacall_value_cast_object( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to exception\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to exception"] pub fn metacall_value_cast_exception( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert value @v implicitly to throwable\n\n @param[in] v\n Reference to the reference of the value\n\n @return\n Value converted to throwable"] pub fn metacall_value_cast_throwable( v: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Destroy a value from scope stack\n\n @param[in] v\n Reference to the value"] pub fn metacall_value_destroy(v: *mut ::std::os::raw::c_void); } -pub type useconds_t = __useconds_t; -pub type socklen_t = __socklen_t; -extern "C" { - pub fn access( - __name: *const ::std::os::raw::c_char, - __type: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn faccessat( - __fd: ::std::os::raw::c_int, - __file: *const ::std::os::raw::c_char, - __type: ::std::os::raw::c_int, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lseek( - __fd: ::std::os::raw::c_int, - __offset: __off_t, - __whence: ::std::os::raw::c_int, - ) -> __off_t; -} -extern "C" { - pub fn close(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn read( - __fd: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_void, - __nbytes: usize, - ) -> isize; -} -extern "C" { - pub fn write( - __fd: ::std::os::raw::c_int, - __buf: *const ::std::os::raw::c_void, - __n: usize, - ) -> isize; -} -extern "C" { - pub fn pread( - __fd: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_void, - __nbytes: usize, - __offset: __off_t, - ) -> isize; -} -extern "C" { - pub fn pwrite( - __fd: ::std::os::raw::c_int, - __buf: *const ::std::os::raw::c_void, - __n: usize, - __offset: __off_t, - ) -> isize; -} -extern "C" { - pub fn pipe(__pipedes: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn alarm(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint; -} -extern "C" { - pub fn sleep(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint; -} -extern "C" { - pub fn ualarm(__value: __useconds_t, __interval: __useconds_t) -> __useconds_t; -} -extern "C" { - pub fn usleep(__useconds: __useconds_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn pause() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn chown( - __file: *const ::std::os::raw::c_char, - __owner: __uid_t, - __group: __gid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fchown( - __fd: ::std::os::raw::c_int, - __owner: __uid_t, - __group: __gid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn lchown( - __file: *const ::std::os::raw::c_char, - __owner: __uid_t, - __group: __gid_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fchownat( - __fd: ::std::os::raw::c_int, - __file: *const ::std::os::raw::c_char, - __owner: __uid_t, - __group: __gid_t, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn chdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fchdir(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getcwd(__buf: *mut ::std::os::raw::c_char, __size: usize) - -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn getwd(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn dup(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn dup2(__fd: ::std::os::raw::c_int, __fd2: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; -} -extern "C" { - pub static mut __environ: *mut *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn execve( - __path: *const ::std::os::raw::c_char, - __argv: *const *mut ::std::os::raw::c_char, - __envp: *const *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fexecve( - __fd: ::std::os::raw::c_int, - __argv: *const *mut ::std::os::raw::c_char, - __envp: *const *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn execv( - __path: *const ::std::os::raw::c_char, - __argv: *const *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn execle( - __path: *const ::std::os::raw::c_char, - __arg: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn execl( - __path: *const ::std::os::raw::c_char, - __arg: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn execvp( - __file: *const ::std::os::raw::c_char, - __argv: *const *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn execlp( - __file: *const ::std::os::raw::c_char, - __arg: *const ::std::os::raw::c_char, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn nice(__inc: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn _exit(__status: ::std::os::raw::c_int) -> !; -} -pub const _PC_LINK_MAX: _bindgen_ty_1 = 0; -pub const _PC_MAX_CANON: _bindgen_ty_1 = 1; -pub const _PC_MAX_INPUT: _bindgen_ty_1 = 2; -pub const _PC_NAME_MAX: _bindgen_ty_1 = 3; -pub const _PC_PATH_MAX: _bindgen_ty_1 = 4; -pub const _PC_PIPE_BUF: _bindgen_ty_1 = 5; -pub const _PC_CHOWN_RESTRICTED: _bindgen_ty_1 = 6; -pub const _PC_NO_TRUNC: _bindgen_ty_1 = 7; -pub const _PC_VDISABLE: _bindgen_ty_1 = 8; -pub const _PC_SYNC_IO: _bindgen_ty_1 = 9; -pub const _PC_ASYNC_IO: _bindgen_ty_1 = 10; -pub const _PC_PRIO_IO: _bindgen_ty_1 = 11; -pub const _PC_SOCK_MAXBUF: _bindgen_ty_1 = 12; -pub const _PC_FILESIZEBITS: _bindgen_ty_1 = 13; -pub const _PC_REC_INCR_XFER_SIZE: _bindgen_ty_1 = 14; -pub const _PC_REC_MAX_XFER_SIZE: _bindgen_ty_1 = 15; -pub const _PC_REC_MIN_XFER_SIZE: _bindgen_ty_1 = 16; -pub const _PC_REC_XFER_ALIGN: _bindgen_ty_1 = 17; -pub const _PC_ALLOC_SIZE_MIN: _bindgen_ty_1 = 18; -pub const _PC_SYMLINK_MAX: _bindgen_ty_1 = 19; -pub const _PC_2_SYMLINKS: _bindgen_ty_1 = 20; -pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const _SC_ARG_MAX: _bindgen_ty_2 = 0; -pub const _SC_CHILD_MAX: _bindgen_ty_2 = 1; -pub const _SC_CLK_TCK: _bindgen_ty_2 = 2; -pub const _SC_NGROUPS_MAX: _bindgen_ty_2 = 3; -pub const _SC_OPEN_MAX: _bindgen_ty_2 = 4; -pub const _SC_STREAM_MAX: _bindgen_ty_2 = 5; -pub const _SC_TZNAME_MAX: _bindgen_ty_2 = 6; -pub const _SC_JOB_CONTROL: _bindgen_ty_2 = 7; -pub const _SC_SAVED_IDS: _bindgen_ty_2 = 8; -pub const _SC_REALTIME_SIGNALS: _bindgen_ty_2 = 9; -pub const _SC_PRIORITY_SCHEDULING: _bindgen_ty_2 = 10; -pub const _SC_TIMERS: _bindgen_ty_2 = 11; -pub const _SC_ASYNCHRONOUS_IO: _bindgen_ty_2 = 12; -pub const _SC_PRIORITIZED_IO: _bindgen_ty_2 = 13; -pub const _SC_SYNCHRONIZED_IO: _bindgen_ty_2 = 14; -pub const _SC_FSYNC: _bindgen_ty_2 = 15; -pub const _SC_MAPPED_FILES: _bindgen_ty_2 = 16; -pub const _SC_MEMLOCK: _bindgen_ty_2 = 17; -pub const _SC_MEMLOCK_RANGE: _bindgen_ty_2 = 18; -pub const _SC_MEMORY_PROTECTION: _bindgen_ty_2 = 19; -pub const _SC_MESSAGE_PASSING: _bindgen_ty_2 = 20; -pub const _SC_SEMAPHORES: _bindgen_ty_2 = 21; -pub const _SC_SHARED_MEMORY_OBJECTS: _bindgen_ty_2 = 22; -pub const _SC_AIO_LISTIO_MAX: _bindgen_ty_2 = 23; -pub const _SC_AIO_MAX: _bindgen_ty_2 = 24; -pub const _SC_AIO_PRIO_DELTA_MAX: _bindgen_ty_2 = 25; -pub const _SC_DELAYTIMER_MAX: _bindgen_ty_2 = 26; -pub const _SC_MQ_OPEN_MAX: _bindgen_ty_2 = 27; -pub const _SC_MQ_PRIO_MAX: _bindgen_ty_2 = 28; -pub const _SC_VERSION: _bindgen_ty_2 = 29; -pub const _SC_PAGESIZE: _bindgen_ty_2 = 30; -pub const _SC_RTSIG_MAX: _bindgen_ty_2 = 31; -pub const _SC_SEM_NSEMS_MAX: _bindgen_ty_2 = 32; -pub const _SC_SEM_VALUE_MAX: _bindgen_ty_2 = 33; -pub const _SC_SIGQUEUE_MAX: _bindgen_ty_2 = 34; -pub const _SC_TIMER_MAX: _bindgen_ty_2 = 35; -pub const _SC_BC_BASE_MAX: _bindgen_ty_2 = 36; -pub const _SC_BC_DIM_MAX: _bindgen_ty_2 = 37; -pub const _SC_BC_SCALE_MAX: _bindgen_ty_2 = 38; -pub const _SC_BC_STRING_MAX: _bindgen_ty_2 = 39; -pub const _SC_COLL_WEIGHTS_MAX: _bindgen_ty_2 = 40; -pub const _SC_EQUIV_CLASS_MAX: _bindgen_ty_2 = 41; -pub const _SC_EXPR_NEST_MAX: _bindgen_ty_2 = 42; -pub const _SC_LINE_MAX: _bindgen_ty_2 = 43; -pub const _SC_RE_DUP_MAX: _bindgen_ty_2 = 44; -pub const _SC_CHARCLASS_NAME_MAX: _bindgen_ty_2 = 45; -pub const _SC_2_VERSION: _bindgen_ty_2 = 46; -pub const _SC_2_C_BIND: _bindgen_ty_2 = 47; -pub const _SC_2_C_DEV: _bindgen_ty_2 = 48; -pub const _SC_2_FORT_DEV: _bindgen_ty_2 = 49; -pub const _SC_2_FORT_RUN: _bindgen_ty_2 = 50; -pub const _SC_2_SW_DEV: _bindgen_ty_2 = 51; -pub const _SC_2_LOCALEDEF: _bindgen_ty_2 = 52; -pub const _SC_PII: _bindgen_ty_2 = 53; -pub const _SC_PII_XTI: _bindgen_ty_2 = 54; -pub const _SC_PII_SOCKET: _bindgen_ty_2 = 55; -pub const _SC_PII_INTERNET: _bindgen_ty_2 = 56; -pub const _SC_PII_OSI: _bindgen_ty_2 = 57; -pub const _SC_POLL: _bindgen_ty_2 = 58; -pub const _SC_SELECT: _bindgen_ty_2 = 59; -pub const _SC_UIO_MAXIOV: _bindgen_ty_2 = 60; -pub const _SC_IOV_MAX: _bindgen_ty_2 = 60; -pub const _SC_PII_INTERNET_STREAM: _bindgen_ty_2 = 61; -pub const _SC_PII_INTERNET_DGRAM: _bindgen_ty_2 = 62; -pub const _SC_PII_OSI_COTS: _bindgen_ty_2 = 63; -pub const _SC_PII_OSI_CLTS: _bindgen_ty_2 = 64; -pub const _SC_PII_OSI_M: _bindgen_ty_2 = 65; -pub const _SC_T_IOV_MAX: _bindgen_ty_2 = 66; -pub const _SC_THREADS: _bindgen_ty_2 = 67; -pub const _SC_THREAD_SAFE_FUNCTIONS: _bindgen_ty_2 = 68; -pub const _SC_GETGR_R_SIZE_MAX: _bindgen_ty_2 = 69; -pub const _SC_GETPW_R_SIZE_MAX: _bindgen_ty_2 = 70; -pub const _SC_LOGIN_NAME_MAX: _bindgen_ty_2 = 71; -pub const _SC_TTY_NAME_MAX: _bindgen_ty_2 = 72; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: _bindgen_ty_2 = 73; -pub const _SC_THREAD_KEYS_MAX: _bindgen_ty_2 = 74; -pub const _SC_THREAD_STACK_MIN: _bindgen_ty_2 = 75; -pub const _SC_THREAD_THREADS_MAX: _bindgen_ty_2 = 76; -pub const _SC_THREAD_ATTR_STACKADDR: _bindgen_ty_2 = 77; -pub const _SC_THREAD_ATTR_STACKSIZE: _bindgen_ty_2 = 78; -pub const _SC_THREAD_PRIORITY_SCHEDULING: _bindgen_ty_2 = 79; -pub const _SC_THREAD_PRIO_INHERIT: _bindgen_ty_2 = 80; -pub const _SC_THREAD_PRIO_PROTECT: _bindgen_ty_2 = 81; -pub const _SC_THREAD_PROCESS_SHARED: _bindgen_ty_2 = 82; -pub const _SC_NPROCESSORS_CONF: _bindgen_ty_2 = 83; -pub const _SC_NPROCESSORS_ONLN: _bindgen_ty_2 = 84; -pub const _SC_PHYS_PAGES: _bindgen_ty_2 = 85; -pub const _SC_AVPHYS_PAGES: _bindgen_ty_2 = 86; -pub const _SC_ATEXIT_MAX: _bindgen_ty_2 = 87; -pub const _SC_PASS_MAX: _bindgen_ty_2 = 88; -pub const _SC_XOPEN_VERSION: _bindgen_ty_2 = 89; -pub const _SC_XOPEN_XCU_VERSION: _bindgen_ty_2 = 90; -pub const _SC_XOPEN_UNIX: _bindgen_ty_2 = 91; -pub const _SC_XOPEN_CRYPT: _bindgen_ty_2 = 92; -pub const _SC_XOPEN_ENH_I18N: _bindgen_ty_2 = 93; -pub const _SC_XOPEN_SHM: _bindgen_ty_2 = 94; -pub const _SC_2_CHAR_TERM: _bindgen_ty_2 = 95; -pub const _SC_2_C_VERSION: _bindgen_ty_2 = 96; -pub const _SC_2_UPE: _bindgen_ty_2 = 97; -pub const _SC_XOPEN_XPG2: _bindgen_ty_2 = 98; -pub const _SC_XOPEN_XPG3: _bindgen_ty_2 = 99; -pub const _SC_XOPEN_XPG4: _bindgen_ty_2 = 100; -pub const _SC_CHAR_BIT: _bindgen_ty_2 = 101; -pub const _SC_CHAR_MAX: _bindgen_ty_2 = 102; -pub const _SC_CHAR_MIN: _bindgen_ty_2 = 103; -pub const _SC_INT_MAX: _bindgen_ty_2 = 104; -pub const _SC_INT_MIN: _bindgen_ty_2 = 105; -pub const _SC_LONG_BIT: _bindgen_ty_2 = 106; -pub const _SC_WORD_BIT: _bindgen_ty_2 = 107; -pub const _SC_MB_LEN_MAX: _bindgen_ty_2 = 108; -pub const _SC_NZERO: _bindgen_ty_2 = 109; -pub const _SC_SSIZE_MAX: _bindgen_ty_2 = 110; -pub const _SC_SCHAR_MAX: _bindgen_ty_2 = 111; -pub const _SC_SCHAR_MIN: _bindgen_ty_2 = 112; -pub const _SC_SHRT_MAX: _bindgen_ty_2 = 113; -pub const _SC_SHRT_MIN: _bindgen_ty_2 = 114; -pub const _SC_UCHAR_MAX: _bindgen_ty_2 = 115; -pub const _SC_UINT_MAX: _bindgen_ty_2 = 116; -pub const _SC_ULONG_MAX: _bindgen_ty_2 = 117; -pub const _SC_USHRT_MAX: _bindgen_ty_2 = 118; -pub const _SC_NL_ARGMAX: _bindgen_ty_2 = 119; -pub const _SC_NL_LANGMAX: _bindgen_ty_2 = 120; -pub const _SC_NL_MSGMAX: _bindgen_ty_2 = 121; -pub const _SC_NL_NMAX: _bindgen_ty_2 = 122; -pub const _SC_NL_SETMAX: _bindgen_ty_2 = 123; -pub const _SC_NL_TEXTMAX: _bindgen_ty_2 = 124; -pub const _SC_XBS5_ILP32_OFF32: _bindgen_ty_2 = 125; -pub const _SC_XBS5_ILP32_OFFBIG: _bindgen_ty_2 = 126; -pub const _SC_XBS5_LP64_OFF64: _bindgen_ty_2 = 127; -pub const _SC_XBS5_LPBIG_OFFBIG: _bindgen_ty_2 = 128; -pub const _SC_XOPEN_LEGACY: _bindgen_ty_2 = 129; -pub const _SC_XOPEN_REALTIME: _bindgen_ty_2 = 130; -pub const _SC_XOPEN_REALTIME_THREADS: _bindgen_ty_2 = 131; -pub const _SC_ADVISORY_INFO: _bindgen_ty_2 = 132; -pub const _SC_BARRIERS: _bindgen_ty_2 = 133; -pub const _SC_BASE: _bindgen_ty_2 = 134; -pub const _SC_C_LANG_SUPPORT: _bindgen_ty_2 = 135; -pub const _SC_C_LANG_SUPPORT_R: _bindgen_ty_2 = 136; -pub const _SC_CLOCK_SELECTION: _bindgen_ty_2 = 137; -pub const _SC_CPUTIME: _bindgen_ty_2 = 138; -pub const _SC_THREAD_CPUTIME: _bindgen_ty_2 = 139; -pub const _SC_DEVICE_IO: _bindgen_ty_2 = 140; -pub const _SC_DEVICE_SPECIFIC: _bindgen_ty_2 = 141; -pub const _SC_DEVICE_SPECIFIC_R: _bindgen_ty_2 = 142; -pub const _SC_FD_MGMT: _bindgen_ty_2 = 143; -pub const _SC_FIFO: _bindgen_ty_2 = 144; -pub const _SC_PIPE: _bindgen_ty_2 = 145; -pub const _SC_FILE_ATTRIBUTES: _bindgen_ty_2 = 146; -pub const _SC_FILE_LOCKING: _bindgen_ty_2 = 147; -pub const _SC_FILE_SYSTEM: _bindgen_ty_2 = 148; -pub const _SC_MONOTONIC_CLOCK: _bindgen_ty_2 = 149; -pub const _SC_MULTI_PROCESS: _bindgen_ty_2 = 150; -pub const _SC_SINGLE_PROCESS: _bindgen_ty_2 = 151; -pub const _SC_NETWORKING: _bindgen_ty_2 = 152; -pub const _SC_READER_WRITER_LOCKS: _bindgen_ty_2 = 153; -pub const _SC_SPIN_LOCKS: _bindgen_ty_2 = 154; -pub const _SC_REGEXP: _bindgen_ty_2 = 155; -pub const _SC_REGEX_VERSION: _bindgen_ty_2 = 156; -pub const _SC_SHELL: _bindgen_ty_2 = 157; -pub const _SC_SIGNALS: _bindgen_ty_2 = 158; -pub const _SC_SPAWN: _bindgen_ty_2 = 159; -pub const _SC_SPORADIC_SERVER: _bindgen_ty_2 = 160; -pub const _SC_THREAD_SPORADIC_SERVER: _bindgen_ty_2 = 161; -pub const _SC_SYSTEM_DATABASE: _bindgen_ty_2 = 162; -pub const _SC_SYSTEM_DATABASE_R: _bindgen_ty_2 = 163; -pub const _SC_TIMEOUTS: _bindgen_ty_2 = 164; -pub const _SC_TYPED_MEMORY_OBJECTS: _bindgen_ty_2 = 165; -pub const _SC_USER_GROUPS: _bindgen_ty_2 = 166; -pub const _SC_USER_GROUPS_R: _bindgen_ty_2 = 167; -pub const _SC_2_PBS: _bindgen_ty_2 = 168; -pub const _SC_2_PBS_ACCOUNTING: _bindgen_ty_2 = 169; -pub const _SC_2_PBS_LOCATE: _bindgen_ty_2 = 170; -pub const _SC_2_PBS_MESSAGE: _bindgen_ty_2 = 171; -pub const _SC_2_PBS_TRACK: _bindgen_ty_2 = 172; -pub const _SC_SYMLOOP_MAX: _bindgen_ty_2 = 173; -pub const _SC_STREAMS: _bindgen_ty_2 = 174; -pub const _SC_2_PBS_CHECKPOINT: _bindgen_ty_2 = 175; -pub const _SC_V6_ILP32_OFF32: _bindgen_ty_2 = 176; -pub const _SC_V6_ILP32_OFFBIG: _bindgen_ty_2 = 177; -pub const _SC_V6_LP64_OFF64: _bindgen_ty_2 = 178; -pub const _SC_V6_LPBIG_OFFBIG: _bindgen_ty_2 = 179; -pub const _SC_HOST_NAME_MAX: _bindgen_ty_2 = 180; -pub const _SC_TRACE: _bindgen_ty_2 = 181; -pub const _SC_TRACE_EVENT_FILTER: _bindgen_ty_2 = 182; -pub const _SC_TRACE_INHERIT: _bindgen_ty_2 = 183; -pub const _SC_TRACE_LOG: _bindgen_ty_2 = 184; -pub const _SC_LEVEL1_ICACHE_SIZE: _bindgen_ty_2 = 185; -pub const _SC_LEVEL1_ICACHE_ASSOC: _bindgen_ty_2 = 186; -pub const _SC_LEVEL1_ICACHE_LINESIZE: _bindgen_ty_2 = 187; -pub const _SC_LEVEL1_DCACHE_SIZE: _bindgen_ty_2 = 188; -pub const _SC_LEVEL1_DCACHE_ASSOC: _bindgen_ty_2 = 189; -pub const _SC_LEVEL1_DCACHE_LINESIZE: _bindgen_ty_2 = 190; -pub const _SC_LEVEL2_CACHE_SIZE: _bindgen_ty_2 = 191; -pub const _SC_LEVEL2_CACHE_ASSOC: _bindgen_ty_2 = 192; -pub const _SC_LEVEL2_CACHE_LINESIZE: _bindgen_ty_2 = 193; -pub const _SC_LEVEL3_CACHE_SIZE: _bindgen_ty_2 = 194; -pub const _SC_LEVEL3_CACHE_ASSOC: _bindgen_ty_2 = 195; -pub const _SC_LEVEL3_CACHE_LINESIZE: _bindgen_ty_2 = 196; -pub const _SC_LEVEL4_CACHE_SIZE: _bindgen_ty_2 = 197; -pub const _SC_LEVEL4_CACHE_ASSOC: _bindgen_ty_2 = 198; -pub const _SC_LEVEL4_CACHE_LINESIZE: _bindgen_ty_2 = 199; -pub const _SC_IPV6: _bindgen_ty_2 = 235; -pub const _SC_RAW_SOCKETS: _bindgen_ty_2 = 236; -pub const _SC_V7_ILP32_OFF32: _bindgen_ty_2 = 237; -pub const _SC_V7_ILP32_OFFBIG: _bindgen_ty_2 = 238; -pub const _SC_V7_LP64_OFF64: _bindgen_ty_2 = 239; -pub const _SC_V7_LPBIG_OFFBIG: _bindgen_ty_2 = 240; -pub const _SC_SS_REPL_MAX: _bindgen_ty_2 = 241; -pub const _SC_TRACE_EVENT_NAME_MAX: _bindgen_ty_2 = 242; -pub const _SC_TRACE_NAME_MAX: _bindgen_ty_2 = 243; -pub const _SC_TRACE_SYS_MAX: _bindgen_ty_2 = 244; -pub const _SC_TRACE_USER_EVENT_MAX: _bindgen_ty_2 = 245; -pub const _SC_XOPEN_STREAMS: _bindgen_ty_2 = 246; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: _bindgen_ty_2 = 247; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: _bindgen_ty_2 = 248; -pub type _bindgen_ty_2 = ::std::os::raw::c_uint; -pub const _CS_PATH: _bindgen_ty_3 = 0; -pub const _CS_V6_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 1; -pub const _CS_GNU_LIBC_VERSION: _bindgen_ty_3 = 2; -pub const _CS_GNU_LIBPTHREAD_VERSION: _bindgen_ty_3 = 3; -pub const _CS_V5_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 4; -pub const _CS_V7_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 5; -pub const _CS_LFS_CFLAGS: _bindgen_ty_3 = 1000; -pub const _CS_LFS_LDFLAGS: _bindgen_ty_3 = 1001; -pub const _CS_LFS_LIBS: _bindgen_ty_3 = 1002; -pub const _CS_LFS_LINTFLAGS: _bindgen_ty_3 = 1003; -pub const _CS_LFS64_CFLAGS: _bindgen_ty_3 = 1004; -pub const _CS_LFS64_LDFLAGS: _bindgen_ty_3 = 1005; -pub const _CS_LFS64_LIBS: _bindgen_ty_3 = 1006; -pub const _CS_LFS64_LINTFLAGS: _bindgen_ty_3 = 1007; -pub const _CS_XBS5_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1100; -pub const _CS_XBS5_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1101; -pub const _CS_XBS5_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1102; -pub const _CS_XBS5_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1103; -pub const _CS_XBS5_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1104; -pub const _CS_XBS5_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1105; -pub const _CS_XBS5_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1106; -pub const _CS_XBS5_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1107; -pub const _CS_XBS5_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1108; -pub const _CS_XBS5_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1109; -pub const _CS_XBS5_LP64_OFF64_LIBS: _bindgen_ty_3 = 1110; -pub const _CS_XBS5_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1111; -pub const _CS_XBS5_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1112; -pub const _CS_XBS5_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1113; -pub const _CS_XBS5_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1114; -pub const _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1115; -pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1116; -pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1117; -pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1118; -pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1119; -pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1120; -pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1121; -pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1122; -pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1123; -pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1124; -pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1125; -pub const _CS_POSIX_V6_LP64_OFF64_LIBS: _bindgen_ty_3 = 1126; -pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1127; -pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1128; -pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1129; -pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1130; -pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1131; -pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1132; -pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1133; -pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1134; -pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1135; -pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1136; -pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1137; -pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1138; -pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1139; -pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1140; -pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1141; -pub const _CS_POSIX_V7_LP64_OFF64_LIBS: _bindgen_ty_3 = 1142; -pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1143; -pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1144; -pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1145; -pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1146; -pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1147; -pub const _CS_V6_ENV: _bindgen_ty_3 = 1148; -pub const _CS_V7_ENV: _bindgen_ty_3 = 1149; -pub type _bindgen_ty_3 = ::std::os::raw::c_uint; -extern "C" { - pub fn pathconf( - __path: *const ::std::os::raw::c_char, - __name: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn fpathconf( - __fd: ::std::os::raw::c_int, - __name: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn sysconf(__name: ::std::os::raw::c_int) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn confstr( - __name: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> usize; -} -extern "C" { - pub fn getpid() -> __pid_t; -} -extern "C" { - pub fn getppid() -> __pid_t; -} -extern "C" { - pub fn getpgrp() -> __pid_t; -} -extern "C" { - pub fn __getpgid(__pid: __pid_t) -> __pid_t; -} -extern "C" { - pub fn getpgid(__pid: __pid_t) -> __pid_t; -} -extern "C" { - pub fn setpgid(__pid: __pid_t, __pgid: __pid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setpgrp() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setsid() -> __pid_t; -} -extern "C" { - pub fn getsid(__pid: __pid_t) -> __pid_t; -} -extern "C" { - pub fn getuid() -> __uid_t; -} -extern "C" { - pub fn geteuid() -> __uid_t; -} -extern "C" { - pub fn getgid() -> __gid_t; -} -extern "C" { - pub fn getegid() -> __gid_t; -} -extern "C" { - pub fn getgroups(__size: ::std::os::raw::c_int, __list: *mut __gid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setuid(__uid: __uid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setreuid(__ruid: __uid_t, __euid: __uid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn seteuid(__uid: __uid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setgid(__gid: __gid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setregid(__rgid: __gid_t, __egid: __gid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setegid(__gid: __gid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fork() -> __pid_t; -} -extern "C" { - pub fn vfork() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ttyname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn ttyname_r( - __fd: ::std::os::raw::c_int, - __buf: *mut ::std::os::raw::c_char, - __buflen: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn isatty(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ttyslot() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn link( - __from: *const ::std::os::raw::c_char, - __to: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn linkat( - __fromfd: ::std::os::raw::c_int, - __from: *const ::std::os::raw::c_char, - __tofd: ::std::os::raw::c_int, - __to: *const ::std::os::raw::c_char, - __flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn symlink( - __from: *const ::std::os::raw::c_char, - __to: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn readlink( - __path: *const ::std::os::raw::c_char, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> isize; -} -extern "C" { - pub fn symlinkat( - __from: *const ::std::os::raw::c_char, - __tofd: ::std::os::raw::c_int, - __to: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn readlinkat( - __fd: ::std::os::raw::c_int, - __path: *const ::std::os::raw::c_char, - __buf: *mut ::std::os::raw::c_char, - __len: usize, - ) -> isize; -} -extern "C" { - pub fn unlink(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn unlinkat( - __fd: ::std::os::raw::c_int, - __name: *const ::std::os::raw::c_char, - __flag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn rmdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn tcgetpgrp(__fd: ::std::os::raw::c_int) -> __pid_t; -} -extern "C" { - pub fn tcsetpgrp(__fd: ::std::os::raw::c_int, __pgrp_id: __pid_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getlogin() -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn getlogin_r( - __name: *mut ::std::os::raw::c_char, - __name_len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setlogin(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub static mut optarg: *mut ::std::os::raw::c_char; -} -extern "C" { - pub static mut optind: ::std::os::raw::c_int; -} -extern "C" { - pub static mut opterr: ::std::os::raw::c_int; -} -extern "C" { - pub static mut optopt: ::std::os::raw::c_int; -} -extern "C" { - pub fn getopt( - ___argc: ::std::os::raw::c_int, - ___argv: *const *mut ::std::os::raw::c_char, - __shortopts: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn gethostname(__name: *mut ::std::os::raw::c_char, __len: usize) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sethostname( - __name: *const ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sethostid(__id: ::std::os::raw::c_long) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getdomainname( - __name: *mut ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn setdomainname( - __name: *const ::std::os::raw::c_char, - __len: usize, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn vhangup() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn revoke(__file: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn profil( - __sample_buffer: *mut ::std::os::raw::c_ushort, - __size: usize, - __offset: usize, - __scale: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn acct(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getusershell() -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn endusershell(); -} -extern "C" { - pub fn setusershell(); -} -extern "C" { - pub fn daemon( - __nochdir: ::std::os::raw::c_int, - __noclose: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn chroot(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getpass(__prompt: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn fsync(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn gethostid() -> ::std::os::raw::c_long; -} -extern "C" { - pub fn sync(); -} -extern "C" { - pub fn getpagesize() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn getdtablesize() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn truncate( - __file: *const ::std::os::raw::c_char, - __length: __off_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn ftruncate(__fd: ::std::os::raw::c_int, __length: __off_t) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn brk(__addr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sbrk(__delta: isize) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn syscall(__sysno: ::std::os::raw::c_long, ...) -> ::std::os::raw::c_long; -} -extern "C" { - pub fn lockf( - __fd: ::std::os::raw::c_int, - __cmd: ::std::os::raw::c_int, - __len: __off_t, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn fdatasync(__fildes: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn crypt( - __key: *const ::std::os::raw::c_char, - __salt: *const ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn getentropy( - __buffer: *mut ::std::os::raw::c_void, - __length: usize, - ) -> ::std::os::raw::c_int; -} pub type metacall_pid = pid_t; pub type metacall_pre_fork_callback_ptr = ::std::option::Option< unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, @@ -5407,18 +615,18 @@ pub type metacall_post_fork_callback_ptr = ::std::option::Option< arg2: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int, >; -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Initialize fork detours and allocate shared memory\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_fork_initialize() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Set fork hook callback\n\n @param[in] pre_callback\n Callback to be called before fork detour is executed\n\n @param[in] post_callback\n Callback to be called after fork detour is executed"] pub fn metacall_fork( pre_callback: metacall_pre_fork_callback_ptr, post_callback: metacall_post_fork_callback_ptr, ); } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Unregister fork detours and destroy shared memory\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_fork_destroy() -> ::std::os::raw::c_int; } @@ -5428,48 +636,17 @@ pub struct metacall_initialize_configuration_type { pub tag: *mut ::std::os::raw::c_char, pub options: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_metacall_initialize_configuration_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!( - "Size of: ", - stringify!(metacall_initialize_configuration_type) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(metacall_initialize_configuration_type) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_initialize_configuration_type), - "::", - stringify!(tag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).options) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_initialize_configuration_type), - "::", - stringify!(options) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of metacall_initialize_configuration_type"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of metacall_initialize_configuration_type"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: metacall_initialize_configuration_type::tag"] + [::std::mem::offset_of!(metacall_initialize_configuration_type, tag) - 0usize]; + ["Offset of field: metacall_initialize_configuration_type::options"] + [::std::mem::offset_of!(metacall_initialize_configuration_type, options) - 8usize]; +}; pub type metacall_await_callback = ::std::option::Option< unsafe extern "C" fn( arg1: *mut ::std::os::raw::c_void, @@ -5482,42 +659,17 @@ pub struct metacall_await_callbacks_type { pub resolve: metacall_await_callback, pub reject: metacall_await_callback, } -#[test] -fn bindgen_test_layout_metacall_await_callbacks_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(metacall_await_callbacks_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_await_callbacks_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).resolve) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_await_callbacks_type), - "::", - stringify!(resolve) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reject) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_await_callbacks_type), - "::", - stringify!(reject) - ) - ); -} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of metacall_await_callbacks_type"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of metacall_await_callbacks_type"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: metacall_await_callbacks_type::resolve"] + [::std::mem::offset_of!(metacall_await_callbacks_type, resolve) - 0usize]; + ["Offset of field: metacall_await_callbacks_type::reject"] + [::std::mem::offset_of!(metacall_await_callbacks_type, reject) - 8usize]; +}; pub type metacall_await_callbacks = metacall_await_callbacks_type; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -5529,138 +681,77 @@ pub struct metacall_version_type { pub str_: *const ::std::os::raw::c_char, pub name: *const ::std::os::raw::c_char, } -#[test] -fn bindgen_test_layout_metacall_version_type() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(metacall_version_type)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(metacall_version_type)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).major) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(major) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).minor) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(minor) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).patch) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(patch) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).revision) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(revision) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).str_) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(str_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(metacall_version_type), - "::", - stringify!(name) - ) - ); -} -extern "C" { - pub static mut metacall_null_args: [*mut ::std::os::raw::c_void; 1usize]; -} -extern "C" { +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of metacall_version_type"][::std::mem::size_of::() - 40usize]; + ["Alignment of metacall_version_type"] + [::std::mem::align_of::() - 8usize]; + ["Offset of field: metacall_version_type::major"] + [::std::mem::offset_of!(metacall_version_type, major) - 0usize]; + ["Offset of field: metacall_version_type::minor"] + [::std::mem::offset_of!(metacall_version_type, minor) - 4usize]; + ["Offset of field: metacall_version_type::patch"] + [::std::mem::offset_of!(metacall_version_type, patch) - 8usize]; + ["Offset of field: metacall_version_type::revision"] + [::std::mem::offset_of!(metacall_version_type, revision) - 16usize]; + ["Offset of field: metacall_version_type::str_"] + [::std::mem::offset_of!(metacall_version_type, str_) - 24usize]; + ["Offset of field: metacall_version_type::name"] + [::std::mem::offset_of!(metacall_version_type, name) - 32usize]; +}; +unsafe extern "C" { #[doc = " @brief\n Returns default serializer used by MetaCall\n\n @return\n Name of the serializer to be used with serialization methods"] pub fn metacall_serial() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Disables MetaCall logs, must be called before @metacall_initialize.\n\n When initializing MetaCall, it initializes a default logs to stdout\n if none was defined. If you want to benchmark or simply disable this\n default logs, you can call to this function before @metacall_initialize."] pub fn metacall_log_null(); } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Flags to be set in MetaCall library\n\n @param[in] flags\n Combination of flags referring to definitions METACALL_FLAGS_*"] pub fn metacall_flags(flags: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Initialize MetaCall library\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_initialize() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Initialize MetaCall library with configuration arguments\n\n @param[in] initialize_config\n Extension of the script to be loaded in memory with data to be injected\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_initialize_ex( initialize_config: *mut metacall_initialize_configuration_type, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Initialize MetaCall application arguments\n\n @param[in] argc\n Number of additional parameters to be passed to the runtime when initializing\n\n @param[in] argv\n Additional parameters to be passed to the runtime when initializing (when using MetaCall as an application)"] pub fn metacall_initialize_args( argc: ::std::os::raw::c_int, argv: *mut *mut ::std::os::raw::c_char, ); } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the number of arguments in which MetaCall was initialized\n\n @return\n An integer equal or greater than zero"] pub fn metacall_argc() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the arguments in which MetaCall was initialized\n\n @return\n A pointer to an array of strings with the additional arguments"] pub fn metacall_argv() -> *mut *mut ::std::os::raw::c_char; } -extern "C" { - #[doc = " @brief\n Check if script context is loaded by @tag\n\n @param[in] tag\n Extension of the script\n\n @return\n Zero if context is initialized, different from zero otherwise"] +unsafe extern "C" { + #[doc = " @brief\n Check if script context is loaded by @tag\n\n @param[in] tag\n Extension of the script (if tag is NULL, it returns the status of the whole MetaCall instance)\n\n @return\n Zero if context is initialized, different from zero otherwise"] pub fn metacall_is_initialized(tag: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Amount of function call arguments supported by MetaCall\n\n @return\n Number of arguments suported"] pub fn metacall_args_size() -> usize; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Set a execution path defined by @path to the extension script @tag\n\n @param[in] tag\n Extension of the script\n\n @param[in] path\n Path to be loaded\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_execution_path( tag: *const ::std::os::raw::c_char, path: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Set a execution path defined by @path to the extension script @tag with length\n\n @param[in] tag\n Extension of the script\n\n @param[in] tag_length\n Length of the extension of the tag\n\n @param[in] path\n Path to be loaded\n\n @param[in] path_length\n Length of the path\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_execution_path_s( tag: *const ::std::os::raw::c_char, @@ -5669,7 +760,7 @@ extern "C" { path_length: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Loads a script from file specified by @path\n\n @param[in] tag\n Extension of the script\n\n @param[in] paths\n Path array of files\n\n @param[in] size\n Size of the array @paths\n\n @param[inout] handle\n Optional pointer to reference of loaded handle. If the parameter is NULL, the symbols loaded are\n propagated to the loader scope (i.e they will share the scope between all previously loaded files and they can collide).\n Otherwise, if we pass a void* pointer set to NULL, it will behave as output parameter, obtaining the reference to the\n created handle, which can be later on used for calling to functions of that handle. The symbols will not be propagated\n to the loader scope and they will be private (this prevents collisions). The last case is if we pass an already allocated\n handle (i.e a void* pointer pointing to an previously loaded handle), then in this case, the symbols loaded will be propagated\n to the previously allocated handle, and it will behave as a in parameter.\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_load_from_file( tag: *const ::std::os::raw::c_char, @@ -5678,7 +769,7 @@ extern "C" { handle: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Loads a script from memory\n\n @param[in] tag\n Extension of the script\n\n @param[in] buffer\n Memory block representing the string of the script\n\n @param[in] size\n Memory block representing the string of the script\n\n @param[inout] handle\n Optional pointer to reference of loaded handle. If the parameter is NULL, the symbols loaded are\n propagated to the loader scope (i.e they will share the scope between all previously loaded files and they can collide).\n Otherwise, if we pass a void* pointer set to NULL, it will behave as output parameter, obtaining the reference to the\n created handle, which can be later on used for calling to functions of that handle. The symbols will not be propagated\n to the loader scope and they will be private (this prevents collisions). The last case is if we pass an already allocated\n handle (i.e a void* pointer pointing to an previously loaded handle), then in this case, the symbols loaded will be propagated\n to the previously allocated handle, and it will behave as a in parameter.\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_load_from_memory( tag: *const ::std::os::raw::c_char, @@ -5687,7 +778,7 @@ extern "C" { handle: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Loads a package of scrips from file specified by @path into loader defined by @extension\n\n @param[in] tag\n Extension of the script\n\n @param[in] path\n Path of the package\n\n @param[inout] handle\n Optional pointer to reference of loaded handle. If the parameter is NULL, the symbols loaded are\n propagated to the loader scope (i.e they will share the scope between all previously loaded files and they can collide).\n Otherwise, if we pass a void* pointer set to NULL, it will behave as output parameter, obtaining the reference to the\n created handle, which can be later on used for calling to functions of that handle. The symbols will not be propagated\n to the loader scope and they will be private (this prevents collisions). The last case is if we pass an already allocated\n handle (i.e a void* pointer pointing to an previously loaded handle), then in this case, the symbols loaded will be propagated\n to the previously allocated handle, and it will behave as a in parameter.\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_load_from_package( tag: *const ::std::os::raw::c_char, @@ -5695,7 +786,7 @@ extern "C" { handle: *mut *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Loads a a list of scrips from configuration specified by @path into loader\n with the following format:\n {\n \"language_id\": \"\",\n \"path\": \"\",\n \"scripts\": [ \"\", \"\", ..., \"\" ]\n }\n\n @param[in] path\n Path of the configuration\n\n @param[inout] handle\n Optional pointer to reference of loaded handle. If the parameter is NULL, the symbols loaded are\n propagated to the loader scope (i.e they will share the scope between all previously loaded files and they can collide).\n Otherwise, if we pass a void* pointer set to NULL, it will behave as output parameter, obtaining the reference to the\n created handle, which can be later on used for calling to functions of that handle. The symbols will not be propagated\n to the loader scope and they will be private (this prevents collisions). The last case is if we pass an already allocated\n handle (i.e a void* pointer pointing to an previously loaded handle), then in this case, the symbols loaded will be propagated\n to the previously allocated handle, and it will behave as a in parameter.\n\n @param[in] allocator\n Pointer to allocator will allocate the configuration\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_load_from_configuration( path: *const ::std::os::raw::c_char, @@ -5703,14 +794,14 @@ extern "C" { allocator: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by value array @args\n\n @param[in] name\n Name of the function\n\n @param[in] args\n Array of pointers to data\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallv( name: *const ::std::os::raw::c_char, args: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by value array @args\n\n @param[in] name\n Name of the function\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of the call\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallv_s( name: *const ::std::os::raw::c_char, @@ -5718,7 +809,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by handle @handle value array @args\n This function allows to avoid name collisions when calling functions by name\n\n @param[in] handle\n Handle where the function belongs\n\n @param[in] name\n Name of the function\n\n @param[in] args\n Array of pointers to data\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallhv( handle: *mut ::std::os::raw::c_void, @@ -5726,7 +817,7 @@ extern "C" { args: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by handle @handle value array @args\n This function allows to avoid name collisions when calling functions by name\n Includes @size in order to allow variadic arguments or safe calls\n\n @param[in] handle\n Handle where the function belongs\n\n @param[in] name\n Name of the function\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of the call\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallhv_s( handle: *mut ::std::os::raw::c_void, @@ -5735,11 +826,11 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by variable arguments @va_args\n\n @param[in] name\n Name of the function\n\n @param[in] va_args\n Varidic function parameters\n\n @return\n Pointer to value containing the result of the call"] pub fn metacall(name: *const ::std::os::raw::c_char, ...) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by type array @ids and variable arguments @va_args\n\n @param[in] name\n Name of the function\n\n @param[in] ids\n Array of types refered to @va_args\n\n @param[in] va_args\n Varidic function parameters\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallt( name: *const ::std::os::raw::c_char, @@ -5747,7 +838,7 @@ extern "C" { ... ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by type array @ids and variable arguments @va_args\n\n @param[in] name\n Name of the function\n\n @param[in] ids\n Array of types refered to @va_args\n\n @param[in] size\n Number of elements of the call\n\n @param[in] va_args\n Varidic function parameters\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallt_s( name: *const ::std::os::raw::c_char, @@ -5756,7 +847,7 @@ extern "C" { ... ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by type array @ids and variable arguments @va_args\n\n @param[in] handle\n Pointer to the handle returned by metacall_load_from_{file, memory, package}\n\n @param[in] name\n Name of the function\n\n @param[in] ids\n Array of types refered to @va_args\n\n @param[in] size\n Number of elements of the call\n\n @param[in] va_args\n Varidic function parameters\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallht_s( handle: *mut ::std::os::raw::c_void, @@ -5766,18 +857,33 @@ extern "C" { ... ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the function by @name\n\n @param[in] name\n Name of the function\n\n @return\n Function reference, null if the function does not exist"] pub fn metacall_function(name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { + #[doc = " @brief\n Create an empty handler into a loader with name @name\n\n @param[in] loader\n Pointer to the loader which the handle belongs to\n\n @param[in] name\n Name of the handle\n\n @param[out] handle_ptr\n On success, returns the pointer to the handle created, otherwise NULL\n\n @return\n Return zero on success, different from zero on error"] + pub fn metacall_handle_initialize( + loader: *mut ::std::os::raw::c_void, + name: *const ::std::os::raw::c_char, + handle_ptr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + #[doc = " @brief\n Populate the objects of @handle_src into @handle_dest\n\n @param[inout] handle_dest\n Handle where the objects from @handle_src will be stored\n\n @param[in] handle_src\n Handle from where the objects will be copied\n\n @return\n Return zero on success, different from zero on error"] + pub fn metacall_handle_populate( + handle_dest: *mut ::std::os::raw::c_void, + handle_src: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { #[doc = " @brief\n Get the function by @name from @handle\n\n @param[in] handle\n Pointer to the handle returned by metacall_load_from_{file, memory, package}\n\n @param[in] name\n Name of the function\n\n @return\n Function reference, null if the function does not exist"] pub fn metacall_handle_function( handle: *mut ::std::os::raw::c_void, name: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the function parameter type id\n\n @param[in] func\n The pointer to the function obtained from metacall_function\n\n @param[in] parameter\n The index of the parameter to be retrieved\n\n @param[out] id\n The parameter type id that will be returned\n\n @return\n Return 0 if the @parameter index exists and @func is valid, 1 otherwhise"] pub fn metacall_function_parameter_type( func: *mut ::std::os::raw::c_void, @@ -5785,47 +891,47 @@ extern "C" { id: *mut metacall_value_id, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the function return type id\n\n @param[in] func\n The pointer to the function obtained from metacall_function\n\n\n @param[out] id\n The value id of the return type of the function @func\n\n @return\n Return 0 if the @func is valid, 1 otherwhise"] pub fn metacall_function_return_type( func: *mut ::std::os::raw::c_void, id: *mut metacall_value_id, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get minimun mumber of arguments accepted by function @func\n\n @param[in] func\n Function reference\n\n @return\n Return mumber of arguments"] pub fn metacall_function_size(func: *mut ::std::os::raw::c_void) -> usize; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Check if the function @func is asynchronous or synchronous\n\n @param[in] func\n Function reference\n\n @return\n Return 0 if it is syncrhonous, 1 if it is asynchronous and -1 if the function is NULL"] pub fn metacall_function_async(func: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the handle by @name\n\n @param[in] tag\n Extension of the script\n\n @param[in] name\n Name of the handle\n\n @return\n Handle reference, null if the function does not exist"] pub fn metacall_handle( tag: *const ::std::os::raw::c_char, name: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get name of a @handle\n\n @param[in] handle\n Pointer to the handle to be retrieved\n\n @return\n String that references the handle"] pub fn metacall_handle_id(handle: *mut ::std::os::raw::c_void) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Return a value representing the handle as a map of functions (or values)\n\n @param[in] handle\n Reference to the handle to be described\n\n @return\n A value of type map on success, null otherwise"] pub fn metacall_handle_export( handle: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by value array @args and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] args\n Array of pointers to data\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallfv( func: *mut ::std::os::raw::c_void, args: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by value array @args and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of function arguments\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallfv_s( func: *mut ::std::os::raw::c_void, @@ -5833,11 +939,11 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by variable arguments @va_args and function @func\n\n @param[in] func\n Reference to function to be called\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallf(func: *mut ::std::os::raw::c_void, ...) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by function @func and serial @buffer of size @size\n\n @param[in] func\n Reference to function to be called\n\n @param[in] buffer\n String representing an array to be deserialized into arguments of the function\n\n @param[in] size\n Size of string @buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the value\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallfs( func: *mut ::std::os::raw::c_void, @@ -5846,7 +952,7 @@ extern "C" { allocator: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by value map (@keys -> @values) and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] keys\n Array of values representing argument keys\n\n @param[in] values\n Array of values representing argument values data\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallfmv( func: *mut ::std::os::raw::c_void, @@ -5854,7 +960,7 @@ extern "C" { values: *mut *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a function anonymously by function @func and serial @buffer of size @size\n\n @param[in] func\n Reference to function to be called\n\n @param[in] buffer\n String representing a map to be deserialized into arguments of the function\n\n @param[in] size\n Size of string @buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the value\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallfms( func: *mut ::std::os::raw::c_void, @@ -5863,7 +969,7 @@ extern "C" { allocator: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Register a function by name @name and arguments @va_args\n\n @param[in] name\n Name of the function (if it is NULL, function is not registered into host scope)\n\n @param[in] invoke\n Pointer to function invoke interface (argc, argv, data)\n\n @param[out] func\n Will set the pointer to the function if the parameter is not null\n\n @param[in] return_type\n Type of return value\n\n @param[in] size\n Number of function arguments\n\n @param[in] va_args\n Varidic function parameter types\n\n @return\n Pointer to value containing the result of the call"] pub fn metacall_register( name: *const ::std::os::raw::c_char, @@ -5880,7 +986,7 @@ extern "C" { ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Register a function by name @name and arguments @types\n\n @param[in] name\n Name of the function (if it is NULL, function is not registered into host scope)\n\n @param[in] invoke\n Pointer to function invoke interface (argc, argv, data)\n\n @param[out] func\n Will set the pointer to the function if the parameter is not null\n\n @param[in] return_type\n Type of return value\n\n @param[in] size\n Number of function arguments\n\n @param[in] types\n List of parameter types\n\n @return\n Pointer to value containing the result of the call"] pub fn metacall_registerv( name: *const ::std::os::raw::c_char, @@ -5897,11 +1003,15 @@ extern "C" { types: *mut metacall_value_id, ) -> ::std::os::raw::c_int; } -extern "C" { - #[doc = " @brief\n Register a function by name @name and arguments @types\n\n @param[in] loader\n Opaque pointer to the loader in which you want to register the function (this allows to register the function into a different loader than the host)\n\n @param[in] context\n Opaque pointer to the context in which you want to register the function (if it is NULL, it will be defined on the global scope of the loader)\n\n @param[in] name\n Name of the function (if it is NULL, function is not registered into host scope)\n\n @param[in] invoke\n Pointer to function invoke interface (argc, argv, data)\n\n @param[in] return_type\n Type of return value\n\n @param[in] size\n Number of function arguments\n\n @param[in] types\n List of parameter types\n\n @return\n Pointer to value containing the result of the call"] +unsafe extern "C" { + #[doc = " @brief\n Obtain the loader instance by @tag\n\n @param[in] tag\n Tag in which the loader is identified, normally it is the extension of the script\n\n @return\n Pointer the loader by @tag"] + pub fn metacall_loader(tag: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { + #[doc = " @brief\n Register a function by name @name and arguments @types\n\n @param[in] loader\n Opaque pointer to the loader in which you want to register the function (this allows to register the function into a different loader than the host)\n\n @param[in] handle\n Opaque pointer to the handle in which you want to register the function (if it is NULL, it will be defined on the global scope of the loader)\n\n @param[in] name\n Name of the function (if it is NULL, function is not registered into host scope)\n\n @param[in] invoke\n Pointer to function invoke interface (argc, argv, data)\n\n @param[in] return_type\n Type of return value\n\n @param[in] size\n Number of function arguments\n\n @param[in] types\n List of parameter types\n\n @return\n Zero if the function was registered properly, distinct from zero otherwise"] pub fn metacall_register_loaderv( loader: *mut ::std::os::raw::c_void, - context: *mut ::std::os::raw::c_void, + handle: *mut ::std::os::raw::c_void, name: *const ::std::os::raw::c_char, invoke: ::std::option::Option< unsafe extern "C" fn( @@ -5915,7 +1025,7 @@ extern "C" { types: *mut metacall_value_id, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Executes an asynchronous call to the function and registers a callback to be executed when a future is resolved (it does block)\n\n @param[in] name\n The name of the function to be called asynchronously\n\n @param[in] args\n Array of pointers to the values to be passed to the function\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacall_await( name: *const ::std::os::raw::c_char, @@ -5935,7 +1045,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Awaits for a promise and registers a callback to be executed when a future is resolved\n\n @param[in] f\n The pointer to the future\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacall_await_future( f: *mut ::std::os::raw::c_void, @@ -5954,7 +1064,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Executes an asynchronous call to the function and registers a callback to be executed when a future is resolved (it does block)\n\n @param[in] name\n The name of the function to be called asynchronously\n\n @param[in] args\n Array of pointers to the values to be passed to the function\n\n @param[in] size\n Number of elements of the array @args\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacall_await_s( name: *const ::std::os::raw::c_char, @@ -5975,7 +1085,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by value array @args and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] args\n Array of pointers to values\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfv_await( func: *mut ::std::os::raw::c_void, @@ -5995,7 +1105,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by value array @args and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] args\n Array of pointers to values\n\n @param[in] size\n Number of elements of the array @args\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfv_await_s( func: *mut ::std::os::raw::c_void, @@ -6016,7 +1126,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by value array @args and function @func (offered without function pointers for languages without support to function pointers)\n\n @param[in] func\n Reference to function to be called\n\n @param[in] args\n Array of pointers to values\n\n @param[in] size\n Number of elements of the array @args\n\n @param[in] cb\n Pointer to struct containing the function pointers to reject and resolve that will be executed when task completion or error\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfv_await_struct_s( func: *mut ::std::os::raw::c_void, @@ -6026,7 +1136,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by value map (@keys -> @values) and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] keys\n Array of values representing argument keys\n\n @param[in] values\n Array of values representing argument values data\n\n @param[in] size\n Number of elements of the arrays @keys and @values\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfmv_await( func: *mut ::std::os::raw::c_void, @@ -6047,7 +1157,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by value map (@keys -> @values) and function @func\n\n @param[in] func\n Reference to function to be called\n\n @param[in] keys\n Array of values representing argument keys\n\n @param[in] values\n Array of values representing argument values data\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfmv_await_s( func: *mut ::std::os::raw::c_void, @@ -6069,7 +1179,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by function @func and serial @buffer of size @size\n\n @param[in] func\n Reference to function to be called\n\n @param[in] buffer\n String representing an array to be deserialized into arguments of the function\n\n @param[in] size\n Size of string @buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the value\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfs_await( func: *mut ::std::os::raw::c_void, @@ -6091,7 +1201,7 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an asynchronous function anonymously by function @func and serial @buffer of size @size\n\n @param[in] func\n Reference to function to be called\n\n @param[in] buffer\n String representing a map to be deserialized into arguments of the function\n\n @param[in] size\n Size of string @buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the value\n\n @param[in] resolve_callback\n Pointer to function that will be executed when task completion\n @param[in] void *\n Value representing the result of the future resolution\n @param[in] void *\n A reference to @data that will be used as a closure for the chain\n @return\n Value containing the result of the operation,\n it will be wrapped into a future later on to be returned by the function\n\n @param[in] reject_callback\n Pointer to function that will be executed when task error (signature is identical as resolve_callback)\n\n @param[in] data\n Pointer to a context that will act as a closure for the chain\n\n @return\n Pointer to value containing the result of the call returned by @resolve_callback or @reject_callback wrapped in a future"] pub fn metacallfms_await( func: *mut ::std::os::raw::c_void, @@ -6113,11 +1223,11 @@ extern "C" { data: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the class by @name\n\n @param[in] name\n Name of the class\n\n @return\n Class reference, null if the class does not exist"] pub fn metacall_class(name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a class method anonymously by value array @args (this procedure assumes there's no overloaded methods and does type conversion on values)\n\n @param[in] cls\n Pointer to the class\n\n @param[in] name\n Name of the method\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of args array\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallv_class( cls: *mut ::std::os::raw::c_void, @@ -6126,7 +1236,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a class method anonymously by value array @args and return value type @ret (helps to resolve overloading methods)\n\n @param[in] cls\n Pointer to the class\n\n @param[in] name\n Name of the method\n\n @param[in] ret\n Type of the return value of the method\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of args array\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallt_class( cls: *mut ::std::os::raw::c_void, @@ -6136,7 +1246,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Create a new object instance from @cls by value array @args\n\n @param[in] cls\n Pointer to the class\n\n @param[in] name\n Name of the new object\n\n @param[in] args\n Array of pointers constructor parameters\n\n @param[in] size\n Number of elements of constructor parameters\n\n @return\n Pointer to the new object value instance"] pub fn metacall_class_new( cls: *mut ::std::os::raw::c_void, @@ -6145,14 +1255,14 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get an attribute from @cls by @key name\n\n @param[in] cls\n Pointer to the class\n\n @param[in] key\n Name of the attribute to get\n\n @return\n Pointer to the class attribute value or NULL if an error occurred"] pub fn metacall_class_static_get( cls: *mut ::std::os::raw::c_void, key: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Set an attribute to @cls by @key name\n\n @param[in] cls\n Pointer to the class\n\n @param[in] key\n Name of the attribute to set\n\n @param[in] value\n Value to set\n\n @return\n Non-zero integer if an error ocurred"] pub fn metacall_class_static_set( cls: *mut ::std::os::raw::c_void, @@ -6160,7 +1270,7 @@ extern "C" { v: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call an object method anonymously by value array @args\n\n @param[in] obj\n Pointer to the object\n\n @param[in] name\n Name of the method\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of args array\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallv_object( obj: *mut ::std::os::raw::c_void, @@ -6169,7 +1279,7 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Call a object method anonymously by value array @args and return value type @ret (helps to resolve overloading methods)\n\n @param[in] obj\n Pointer to the object\n\n @param[in] name\n Name of the method\n\n @param[in] ret\n Type of the return value of the method\n\n @param[in] args\n Array of pointers to data\n\n @param[in] size\n Number of elements of args array\n\n @return\n Pointer to value containing the result of the call"] pub fn metacallt_object( obj: *mut ::std::os::raw::c_void, @@ -6179,14 +1289,14 @@ extern "C" { size: usize, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get an attribute from @obj by @key name\n\n @param[in] obj\n Pointer to the object\n\n @param[in] key\n Name of the attribute to get\n\n @return\n Pointer to the object attribute value or NULL if an error occurred"] pub fn metacall_object_get( obj: *mut ::std::os::raw::c_void, key: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Set an attribute to @obj by @key name\n\n @param[in] obj\n Pointer to the object\n\n @param[in] key\n Name of the attribute to set\n\n @param[in] value\n Value to set\n\n @return\n Non-zero integer if an error ocurred"] pub fn metacall_object_set( obj: *mut ::std::os::raw::c_void, @@ -6194,19 +1304,23 @@ extern "C" { v: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the value contained by throwable object @th\n\n @param[in] th\n Pointer to the throwable object\n\n @return\n Pointer to the value inside of the throwable or NULL in case of error"] pub fn metacall_throwable_value(th: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide information about all loaded objects\n\n @param[out] size\n Size in bytes of return buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the string\n\n @return\n String containing introspection information"] pub fn metacall_inspect( size: *mut usize, allocator: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { + #[doc = " @brief\n Provide information about all loaded objects as a value\n\n @return\n Value containing introspection information"] + pub fn metacall_inspect_value() -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { #[doc = " @brief\n Convert the value @v to serialized string\n\n @param[in] name\n Name of the serial to be used\n\n @param[in] v\n Reference to the value\n\n @param[out] size\n Size of new allocated string\n\n @param[in] allocator\n Pointer to allocator will allocate the string\n\n @return\n New allocated string containing stringified value"] pub fn metacall_serialize( name: *const ::std::os::raw::c_char, @@ -6215,7 +1329,7 @@ extern "C" { allocator: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Convert the string @buffer to value\n\n @param[in] name\n Name of the serial to be used\n\n @param[in] buffer\n String to be deserialized\n\n @param[in] size\n Size of string @buffer\n\n @param[in] allocator\n Pointer to allocator will allocate the value\n\n @return\n New allocated value representing the string (must be freed)"] pub fn metacall_deserialize( name: *const ::std::os::raw::c_char, @@ -6224,27 +1338,31 @@ extern "C" { allocator: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Clear handle from memory and unload related resources\n\n @param[in] handle\n Reference to the handle to be unloaded\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_clear(handle: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Get the plugin extension handle to be used for loading plugins\n\n @return\n Pointer to the extension handle, or null if it failed to load"] pub fn metacall_plugin_extension() -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { + #[doc = " @brief\n Get the handle containing all the functionality of the plugins from core\n\n @return\n Pointer to the core plugin handle, or null if it failed to load"] + pub fn metacall_plugin_core() -> *mut ::std::os::raw::c_void; +} +unsafe extern "C" { #[doc = " @brief\n Get the plugin extension path to be used for accessing the plugins folder\n\n @return\n String containing the core plugin path, or null if it failed to load the plugin extension"] pub fn metacall_plugin_path() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Destroy MetaCall library\n\n @return\n Zero if success, different from zero otherwise"] pub fn metacall_destroy() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version struct\n\n @return\n Static struct containing unpacked version"] pub fn metacall_version() -> *const metacall_version_type; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version hexadecimal value\n with format 0xMMIIPPPP where M is @major,\n I is @minor and P is @patch\n\n @param[in] major\n Unsigned integer representing major version\n\n @param[in] minor\n Unsigned integer representing minor version\n\n @param[in] patch\n Unsigned integer representing patch version\n\n @return\n Hexadecimal integer containing packed version"] pub fn metacall_version_hex_make( major: ::std::os::raw::c_uint, @@ -6252,87 +1370,23 @@ extern "C" { patch: ::std::os::raw::c_uint, ) -> u32; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version hexadecimal value\n with format 0xMMIIPPPP where M is major,\n I is minor and P is patch\n\n @return\n Hexadecimal integer containing packed version"] pub fn metacall_version_hex() -> u32; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version string\n\n @return\n Static string containing module version"] pub fn metacall_version_str() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version revision string\n\n @return\n Static string containing module version revision"] pub fn metacall_version_revision() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module version name\n\n @return\n Static string containing module version name"] pub fn metacall_version_name() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[doc = " @brief\n Provide the module information\n\n @return\n Static string containing module information"] pub fn metacall_print_info() -> *const ::std::os::raw::c_char; } -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: ::std::os::raw::c_uint, - pub fp_offset: ::std::os::raw::c_uint, - pub overflow_arg_area: *mut ::std::os::raw::c_void, - pub reg_save_area: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout___va_list_tag() { - const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__va_list_tag>(), - 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) - ); - assert_eq!( - ::std::mem::align_of::<__va_list_tag>(), - 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) - ); -} diff --git a/source/ports/rs_port/src/helpers.rs b/source/ports/rs_port/src/helpers.rs index 68941d180..8dc754416 100644 --- a/source/ports/rs_port/src/helpers.rs +++ b/source/ports/rs_port/src/helpers.rs @@ -1,12 +1,12 @@ -use crate::types::MetacallValue; +use crate::types::MetaCallValue; use std::any::Any; -pub trait MetacallDowncast: Any { +pub trait MetaCallDowncast: Any { fn into_any(self: Box) -> Box; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; } -impl MetacallDowncast for T { +impl MetaCallDowncast for T { fn into_any(self: Box) -> Box { self } @@ -17,40 +17,40 @@ impl MetacallDowncast for T { self } } -impl dyn MetacallValue { +impl dyn MetaCallValue { /// Checks if the trait object is having the given type. - pub fn is(&self) -> bool { - MetacallDowncast::as_any(self).is::() + pub fn is(&self) -> bool { + MetaCallDowncast::as_any(self).is::() } /// Downcasts the inner value of the trait object and returns the ownership. - pub fn downcast(self: Box) -> Result> { + pub fn downcast(self: Box) -> Result> { if self.is::() { - Ok(*MetacallDowncast::into_any(self).downcast::().unwrap()) + Ok(*MetaCallDowncast::into_any(self).downcast::().unwrap()) } else { Err(self) } } /// Downcasts the inner value of the trait object and returns a reference. - pub fn downcast_ref(&self) -> Option<&T> { - MetacallDowncast::as_any(self).downcast_ref::() + pub fn downcast_ref(&self) -> Option<&T> { + MetaCallDowncast::as_any(self).downcast_ref::() } /// Downcasts the inner value of the trait object and returns a mutable reference. - pub fn downcast_mut(&mut self) -> Option<&mut T> { - MetacallDowncast::as_any_mut(self).downcast_mut::() + pub fn downcast_mut(&mut self) -> Option<&mut T> { + MetaCallDowncast::as_any_mut(self).downcast_mut::() } } -pub trait MetacallSealed {} -impl MetacallSealed for T {} -impl MetacallSealed for str {} -impl MetacallSealed for [T] {} +pub trait MetaCallSealed {} +impl MetaCallSealed for T {} +impl MetaCallSealed for str {} +impl MetaCallSealed for [T] {} pub fn clone_box(t: &T) -> Box where - T: ?Sized + MetacallClone, + T: ?Sized + MetaCallClone, { unsafe { let mut fat_ptr = t as *const T; @@ -58,16 +58,16 @@ where assert_eq!(*data_ptr as *const (), t as *const T as *const ()); - *data_ptr = ::clone_box(t); + *data_ptr = ::clone_box(t); Box::from_raw(fat_ptr as *mut T) } } -pub trait MetacallClone: MetacallSealed { +pub trait MetaCallClone: MetaCallSealed { fn clone_box(&self) -> *mut (); } -impl MetacallClone for T +impl MetaCallClone for T where T: Clone, { @@ -76,12 +76,12 @@ where } } -impl MetacallClone for str { +impl MetaCallClone for str { fn clone_box(&self) -> *mut () { Box::::into_raw(Box::from(self)) as *mut () } } -impl MetacallClone for [T] +impl MetaCallClone for [T] where T: Clone, { @@ -89,27 +89,27 @@ where Box::<[T]>::into_raw(self.iter().cloned().collect()) as *mut () } } -impl<'c> Clone for Box { +impl<'c> Clone for Box { fn clone(&self) -> Self { clone_box(&**self) } } -impl<'c> Clone for Box { +impl<'c> Clone for Box { fn clone(&self) -> Self { clone_box(&**self) } } -impl<'c> Clone for Box { +impl<'c> Clone for Box { fn clone(&self) -> Self { clone_box(&**self) } } -impl<'c> Clone for Box { +impl<'c> Clone for Box { fn clone(&self) -> Self { clone_box(&**self) } } -pub fn metacall_implementer_to_traitobj(v: impl MetacallValue) -> Box { - Box::new(v) as Box +pub fn metacall_implementer_to_traitobj(v: impl MetaCallValue) -> Box { + Box::new(v) as Box } diff --git a/source/ports/rs_port/src/lib.rs b/source/ports/rs_port/src/lib.rs index bc4241007..796d89b2e 100644 --- a/source/ports/rs_port/src/lib.rs +++ b/source/ports/rs_port/src/lib.rs @@ -44,7 +44,7 @@ //! use metacall::{switch, metacall, loaders}; //! //! fn main() { -//! // Initialize Metacall at the top +//! // Initialize MetaCall at the top //! let _metacall = switch::initialize().unwrap(); //! //! // Load the file (Checkout the loaders module for loading multiple files @@ -63,7 +63,7 @@ pub(crate) mod helpers; pub(crate) mod parsers; pub(crate) use macros::private_macros::*; -/// Contains Metacall loaders from file and memory. Usage example: ... +/// Contains MetaCall loaders from file and memory. Usage example: ... /// ``` /// // Loading a single file with Nodejs. /// metacall::loaders::from_single_file("node", "index.js").unwrap(); @@ -91,7 +91,7 @@ pub use types::*; mod metacall_mod; pub use metacall_mod::*; -/// Contains Metacall language inliners. Usage example: ... +/// Contains MetaCall language inliners. Usage example: ... /// ``` /// // Python /// py! { diff --git a/source/ports/rs_port/src/loaders.rs b/source/ports/rs_port/src/loaders.rs index eb691acbb..bf5f4fb11 100644 --- a/source/ports/rs_port/src/loaders.rs +++ b/source/ports/rs_port/src/loaders.rs @@ -1,7 +1,7 @@ use crate::{ bindings::{metacall_load_from_file, metacall_load_from_memory}, cstring_enum, - types::MetacallLoaderError, + types::MetaCallLoaderError, }; use std::{ ffi::CString, @@ -17,7 +17,7 @@ use std::{ pub fn from_single_file( tag: impl ToString, script: impl AsRef, -) -> Result<(), MetacallLoaderError> { +) -> Result<(), MetaCallLoaderError> { from_file(tag, [script]) } /// Loads a script from file. Usage example: ... @@ -28,8 +28,8 @@ pub fn from_single_file( pub fn from_file( tag: impl ToString, scripts: impl IntoIterator>, -) -> Result<(), MetacallLoaderError> { - let c_tag = cstring_enum!(tag, MetacallLoaderError)?; +) -> Result<(), MetaCallLoaderError> { + let c_tag = cstring_enum!(tag, MetaCallLoaderError)?; let mut c_script: CString; let mut new_scripts: Vec<*const i8> = Vec::new(); @@ -38,15 +38,15 @@ pub fn from_file( let script_as_str = script_as_pathbuf.to_str().unwrap(); if !script_as_pathbuf.exists() { - return Err(MetacallLoaderError::FileNotFound(script_as_pathbuf)); + return Err(MetaCallLoaderError::FileNotFound(script_as_pathbuf)); } if !script_as_pathbuf.is_file() { - return Err(MetacallLoaderError::NotAFileOrPermissionDenied( + return Err(MetaCallLoaderError::NotAFileOrPermissionDenied( script_as_pathbuf, )); } - c_script = cstring_enum!(script_as_str, MetacallLoaderError)?; + c_script = cstring_enum!(script_as_str, MetaCallLoaderError)?; new_scripts.push(c_script.as_ptr()); } @@ -60,7 +60,7 @@ pub fn from_file( ) } != 0 { - return Err(MetacallLoaderError::FromFileFailure); + return Err(MetaCallLoaderError::FromFileFailure); } Ok(()) @@ -73,10 +73,10 @@ pub fn from_file( /// // A Nodejs script /// metacall::loaders::from_memory("node", script).unwrap(); /// ``` -pub fn from_memory(tag: impl ToString, script: impl ToString) -> Result<(), MetacallLoaderError> { +pub fn from_memory(tag: impl ToString, script: impl ToString) -> Result<(), MetaCallLoaderError> { let script = script.to_string(); - let c_tag = cstring_enum!(tag, MetacallLoaderError)?; - let c_script = cstring_enum!(script, MetacallLoaderError)?; + let c_tag = cstring_enum!(tag, MetaCallLoaderError)?; + let c_script = cstring_enum!(script, MetaCallLoaderError)?; if unsafe { metacall_load_from_memory( @@ -87,7 +87,7 @@ pub fn from_memory(tag: impl ToString, script: impl ToString) -> Result<(), Meta ) } != 0 { - return Err(MetacallLoaderError::FromMemoryFailure); + return Err(MetaCallLoaderError::FromMemoryFailure); } Ok(()) diff --git a/source/ports/rs_port/src/macros.rs b/source/ports/rs_port/src/macros.rs index 2604455fd..fd24a00f0 100644 --- a/source/ports/rs_port/src/macros.rs +++ b/source/ports/rs_port/src/macros.rs @@ -1,6 +1,6 @@ // Used for documentation. #[allow(unused_imports)] -use crate::MetacallValue; +use crate::MetaCallValue; pub(crate) mod private_macros { macro_rules! cstring_enum { @@ -9,7 +9,7 @@ pub(crate) mod private_macros { match ::std::ffi::CString::new(var.clone()) { Ok(str) => Ok(str), Err(err) => Err($enum::UnexpectedCStringConversionErr( - $crate::MetacallStringConversionError::new(var, err), + $crate::MetaCallStringConversionError::new(var, err), )), } }}; @@ -25,7 +25,7 @@ pub(crate) mod private_macros { let var = $var.to_string(); match ::std::ffi::CString::new(var.clone()) { Ok(str) => Ok(str), - Err(err) => Err($crate::MetacallStringConversionError::new(var, err)), + Err(err) => Err($crate::MetaCallStringConversionError::new(var, err)), } }}; @@ -40,7 +40,7 @@ pub(crate) mod private_macros { } #[macro_export] -/// Matches [MetacallValue](MetacallValue) trait object. For example: ... +/// Matches [MetaCallValue](MetaCallValue) trait object. For example: ... /// ``` /// use metacall::{metacall_untyped_no_arg, match_metacall_value}; /// diff --git a/source/ports/rs_port/src/metacall.rs b/source/ports/rs_port/src/metacall.rs index 72d7eb234..b05c8f851 100644 --- a/source/ports/rs_port/src/metacall.rs +++ b/source/ports/rs_port/src/metacall.rs @@ -1,7 +1,7 @@ use crate::{ bindings::{metacall_function, metacall_value_destroy, metacallfv_s}, cstring_enum, parsers, - types::{MetacallError, MetacallNull, MetacallValue}, + types::{MetaCallError, MetaCallNull, MetaCallValue}, }; use std::ffi::c_void; @@ -11,13 +11,13 @@ use crate::match_metacall_value; fn metacall_inner( func: impl ToString, - args: impl IntoIterator, -) -> Result<*mut c_void, MetacallError> { - let c_function = cstring_enum!(func, MetacallError)?; + args: impl IntoIterator, +) -> Result<*mut c_void, MetaCallError> { + let c_function = cstring_enum!(func, MetaCallError)?; let c_func = unsafe { metacall_function(c_function.as_ptr()) }; if c_func.is_null() { - return Err(MetacallError::FunctionNotFound); + return Err(MetaCallError::FunctionNotFound); } let mut c_args = parsers::metacallobj_to_raw_args(args); @@ -32,7 +32,7 @@ fn metacall_inner( Ok(ret) } /// Calls a function same as [metacall](metacall) but returns a trait object -/// of [MetacallValue](MetacallValue). This is useful when you don't know the return +/// of [MetaCallValue](MetaCallValue). This is useful when you don't know the return /// type of that function or the function may return multiple types. Checkout /// [match_metacall_value](match_metacall_value) for unwrapping the inner value. For example: ... /// ``` @@ -40,8 +40,8 @@ fn metacall_inner( /// ``` pub fn metacall_untyped( func: impl ToString, - args: impl IntoIterator, -) -> Result, MetacallError> { + args: impl IntoIterator, +) -> Result, MetaCallError> { Ok(parsers::raw_to_metacallobj_untyped(metacall_inner( func, args, )?)) @@ -52,28 +52,28 @@ pub fn metacall_untyped( /// ``` pub fn metacall_untyped_no_arg( func: impl ToString, -) -> Result, MetacallError> { - metacall_untyped(func, [] as [MetacallNull; 0]) +) -> Result, MetaCallError> { + metacall_untyped(func, [] as [MetaCallNull; 0]) } /// Calls a function with arguments. The generic parameter is the return type of the function -/// you're calling. Checkout [MetacallValue](MetacallValue) for possible types. +/// you're calling. Checkout [MetaCallValue](MetaCallValue) for possible types. /// For example: ... /// ``` /// let sum = metacall::metacall::("sum", [1, 2]).unwrap(); /// ``` -pub fn metacall( +pub fn metacall( func: impl ToString, - args: impl IntoIterator, -) -> Result { + args: impl IntoIterator, +) -> Result { match parsers::raw_to_metacallobj::(metacall_inner(func, args)?) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallError::FailedCasting(original)), + Err(original) => Err(MetaCallError::FailedCasting(original)), } } /// Calls a function same as [metacall](metacall) without passing any arguments. For example: ... /// ``` /// let greet = metacall::metacall_no_arg::("greet").unwrap(); /// ``` -pub fn metacall_no_arg(func: impl ToString) -> Result { - metacall::(func, [] as [MetacallNull; 0]) +pub fn metacall_no_arg(func: impl ToString) -> Result { + metacall::(func, [] as [MetaCallNull; 0]) } diff --git a/source/ports/rs_port/src/parsers.rs b/source/ports/rs_port/src/parsers.rs index 06dd1cde7..597af56a6 100644 --- a/source/ports/rs_port/src/parsers.rs +++ b/source/ports/rs_port/src/parsers.rs @@ -1,26 +1,26 @@ use crate::{ bindings::metacall_value_id, types::{ - MetacallClass, MetacallException, MetacallFunction, MetacallFuture, MetacallNull, - MetacallObject, MetacallPointer, MetacallThrowable, MetacallValue, + MetaCallClass, MetaCallException, MetaCallFunction, MetaCallFuture, MetaCallNull, + MetaCallObject, MetaCallPointer, MetaCallThrowable, MetaCallValue, }, }; use std::{collections::HashMap, ffi::c_void}; -fn metacallobj_result_wrap( - v: Result>, -) -> Box { +fn metacallobj_result_wrap( + v: Result>, +) -> Box { match v { - Ok(obj) => Box::new(obj) as Box, + Ok(obj) => Box::new(obj) as Box, Err(original) => original, } } -pub fn raw_to_metacallobj(ret: *mut c_void) -> Result> { - let null = MetacallNull(); +pub fn raw_to_metacallobj(ret: *mut c_void) -> Result> { + let null = MetaCallNull(); if ret.is_null() { - if ::get_metacall_id() != 14 { + if ::get_metacall_id() != metacall_value_id::METACALL_NULL { return Err(metacallobj_result_wrap(Ok(null))); } else { return Ok(::from_metacall_raw(ret).unwrap()); @@ -33,13 +33,13 @@ pub fn raw_to_metacallobj(ret: *mut c_void) -> Result( +pub fn raw_to_metacallobj_leak( ret: *mut c_void, -) -> Result> { - let null = MetacallNull(); +) -> Result> { + let null = MetaCallNull(); if ret.is_null() { - if ::get_metacall_id() != 14 { + if ::get_metacall_id() != metacall_value_id::METACALL_NULL { return Err(metacallobj_result_wrap(Ok(null))); } else { return Ok(::from_metacall_raw(ret).unwrap()); @@ -53,64 +53,62 @@ pub fn raw_to_metacallobj_leak( } } -pub fn raw_to_metacallobj_untyped(ret: *mut c_void) -> Box { +pub fn raw_to_metacallobj_untyped(ret: *mut c_void) -> Box { match (ret.is_null(), unsafe { metacall_value_id(ret) }) { - (true, _) => metacallobj_result_wrap(MetacallNull::from_metacall_raw(ret)), - (_, 0) => metacallobj_result_wrap(bool::from_metacall_raw(ret)), - (_, 1) => metacallobj_result_wrap(char::from_metacall_raw(ret)), - (_, 2) => metacallobj_result_wrap(i16::from_metacall_raw(ret)), - (_, 3) => metacallobj_result_wrap(i32::from_metacall_raw(ret)), - (_, 4) => metacallobj_result_wrap(i64::from_metacall_raw(ret)), - (_, 5) => metacallobj_result_wrap(f32::from_metacall_raw(ret)), - (_, 6) => metacallobj_result_wrap(f64::from_metacall_raw(ret)), - (_, 7) => metacallobj_result_wrap(String::from_metacall_raw(ret)), - (_, 8) => metacallobj_result_wrap(>::from_metacall_raw(ret)), - (_, 9) => metacallobj_result_wrap(>::from_metacall_raw(ret)), - (_, 10) => metacallobj_result_wrap(>::from_metacall_raw(ret)), - (_, 11) => metacallobj_result_wrap(::from_metacall_raw(ret)), - (_, 12) => metacallobj_result_wrap(MetacallFuture::from_metacall_raw(ret)), - (_, 13) => metacallobj_result_wrap(MetacallFunction::from_metacall_raw(ret)), - (_, 14) => metacallobj_result_wrap(MetacallNull::from_metacall_raw(ret)), - (_, 15) => metacallobj_result_wrap(MetacallClass::from_metacall_raw(ret)), - (_, 16) => metacallobj_result_wrap(MetacallObject::from_metacall_raw(ret)), - (_, 17) => metacallobj_result_wrap(MetacallException::from_metacall_raw(ret)), - (_, 18) => metacallobj_result_wrap(MetacallThrowable::from_metacall_raw(ret)), - _ => metacallobj_result_wrap(MetacallNull::from_metacall_raw(ret)), + (true, _) => metacallobj_result_wrap(MetaCallNull::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_BOOL) => metacallobj_result_wrap(bool::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_CHAR) => metacallobj_result_wrap(char::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_SHORT) => metacallobj_result_wrap(i16::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_INT) => metacallobj_result_wrap(i32::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_LONG) => metacallobj_result_wrap(i64::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_FLOAT) => metacallobj_result_wrap(f32::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_DOUBLE) => metacallobj_result_wrap(f64::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_STRING) => metacallobj_result_wrap(String::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_BUFFER) => metacallobj_result_wrap(>::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_ARRAY) => metacallobj_result_wrap(>::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_MAP) => metacallobj_result_wrap(>::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_PTR) => metacallobj_result_wrap(::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_FUTURE) => metacallobj_result_wrap(MetaCallFuture::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_FUNCTION) => metacallobj_result_wrap(MetaCallFunction::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_NULL) => metacallobj_result_wrap(MetaCallNull::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_CLASS) => metacallobj_result_wrap(MetaCallClass::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_OBJECT) => metacallobj_result_wrap(MetaCallObject::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_EXCEPTION) => metacallobj_result_wrap(MetaCallException::from_metacall_raw(ret)), + (_, metacall_value_id::METACALL_THROWABLE) => metacallobj_result_wrap(MetaCallThrowable::from_metacall_raw(ret)), + _ => metacallobj_result_wrap(MetaCallNull::from_metacall_raw(ret)), } } -pub fn raw_to_metacallobj_untyped_leak(ret: *mut c_void) -> Box { +pub fn raw_to_metacallobj_untyped_leak(ret: *mut c_void) -> Box { match (ret.is_null(), unsafe { metacall_value_id(ret) }) { - (true, _) => metacallobj_result_wrap(MetacallNull::from_metacall_raw_leak(ret)), - (_, 0) => metacallobj_result_wrap(bool::from_metacall_raw_leak(ret)), - (_, 1) => metacallobj_result_wrap(char::from_metacall_raw_leak(ret)), - (_, 2) => metacallobj_result_wrap(i16::from_metacall_raw_leak(ret)), - (_, 3) => metacallobj_result_wrap(i32::from_metacall_raw_leak(ret)), - (_, 4) => metacallobj_result_wrap(i64::from_metacall_raw_leak(ret)), - (_, 5) => metacallobj_result_wrap(f32::from_metacall_raw_leak(ret)), - (_, 6) => metacallobj_result_wrap(f64::from_metacall_raw_leak(ret)), - (_, 7) => metacallobj_result_wrap(String::from_metacall_raw_leak(ret)), - (_, 8) => metacallobj_result_wrap(>::from_metacall_raw_leak(ret)), - (_, 9) => metacallobj_result_wrap(>::from_metacall_raw_leak(ret)), - (_, 10) => { - metacallobj_result_wrap(>::from_metacall_raw_leak(ret)) - } - (_, 11) => metacallobj_result_wrap(::from_metacall_raw_leak(ret)), - (_, 12) => metacallobj_result_wrap(MetacallFuture::from_metacall_raw_leak(ret)), - (_, 13) => metacallobj_result_wrap(MetacallFunction::from_metacall_raw_leak(ret)), - (_, 14) => metacallobj_result_wrap(MetacallNull::from_metacall_raw_leak(ret)), - (_, 15) => metacallobj_result_wrap(MetacallClass::from_metacall_raw_leak(ret)), - (_, 16) => metacallobj_result_wrap(MetacallObject::from_metacall_raw_leak(ret)), - (_, 17) => metacallobj_result_wrap(MetacallException::from_metacall_raw_leak(ret)), - (_, 18) => metacallobj_result_wrap(MetacallThrowable::from_metacall_raw_leak(ret)), - _ => metacallobj_result_wrap(MetacallNull::from_metacall_raw_leak(ret)), + (true, _) => metacallobj_result_wrap(MetaCallNull::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_BOOL) => metacallobj_result_wrap(bool::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_CHAR) => metacallobj_result_wrap(char::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_SHORT) => metacallobj_result_wrap(i16::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_INT) => metacallobj_result_wrap(i32::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_LONG) => metacallobj_result_wrap(i64::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_FLOAT) => metacallobj_result_wrap(f32::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_DOUBLE) => metacallobj_result_wrap(f64::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_STRING) => metacallobj_result_wrap(String::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_BUFFER) => metacallobj_result_wrap(>::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_ARRAY) => metacallobj_result_wrap(>::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_MAP) => { metacallobj_result_wrap(>::from_metacall_raw_leak(ret)) } + (_, metacall_value_id::METACALL_PTR) => metacallobj_result_wrap(::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_FUTURE) => metacallobj_result_wrap(MetaCallFuture::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_FUNCTION) => metacallobj_result_wrap(MetaCallFunction::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_NULL) => metacallobj_result_wrap(MetaCallNull::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_CLASS) => metacallobj_result_wrap(MetaCallClass::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_OBJECT) => metacallobj_result_wrap(MetaCallObject::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_EXCEPTION) => metacallobj_result_wrap(MetaCallException::from_metacall_raw_leak(ret)), + (_, metacall_value_id::METACALL_THROWABLE) => metacallobj_result_wrap(MetaCallThrowable::from_metacall_raw_leak(ret)), + _ => metacallobj_result_wrap(MetaCallNull::from_metacall_raw_leak(ret)), } } -pub fn metacallobj_to_raw(arg: impl MetacallValue) -> *mut c_void { +pub fn metacallobj_to_raw(arg: impl MetaCallValue) -> *mut c_void { arg.into_metacall_raw() } pub fn metacallobj_to_raw_args( - args: impl IntoIterator, + args: impl IntoIterator, ) -> Vec<*mut c_void> { args.into_iter() .map(|arg| arg.into_metacall_raw()) diff --git a/source/ports/rs_port/src/switch.rs b/source/ports/rs_port/src/switch.rs index e99d96e02..d249a35c8 100644 --- a/source/ports/rs_port/src/switch.rs +++ b/source/ports/rs_port/src/switch.rs @@ -1,6 +1,6 @@ use crate::{ bindings::{metacall_destroy, metacall_initialize}, - types::MetacallInitError, + types::MetaCallInitError, }; use std::ffi::c_int; @@ -11,14 +11,14 @@ pub fn initialize_manually() -> c_int { unsafe { metacall_initialize() } } -pub struct MetacallAutoDestroy(pub fn() -> c_int); -impl Drop for MetacallAutoDestroy { +pub struct MetaCallAutoDestroy(pub fn() -> c_int); +impl Drop for MetaCallAutoDestroy { fn drop(&mut self) { self.0(); } } -/// Initializes Metacall. Always remember to store the output in a variable to avoid instant drop. +/// Initializes MetaCall. Always remember to store the output in a variable to avoid instant drop. /// For example: ... /// ``` /// // Initialize metacall at the top of your main function before loading your codes or @@ -27,10 +27,10 @@ impl Drop for MetacallAutoDestroy { /// /// /// ``` -pub fn initialize() -> Result { +pub fn initialize() -> Result { if initialize_manually() != 0 { - return Err(MetacallInitError::new()); + return Err(MetaCallInitError::new()); } - Ok(MetacallAutoDestroy(destroy_manually)) + Ok(MetaCallAutoDestroy(destroy_manually)) } diff --git a/source/ports/rs_port/src/types/metacall_class.rs b/source/ports/rs_port/src/types/metacall_class.rs index 97170b7a4..4f50faceb 100644 --- a/source/ports/rs_port/src/types/metacall_class.rs +++ b/source/ports/rs_port/src/types/metacall_class.rs @@ -1,6 +1,6 @@ use super::{ - MetacallClassFromNameError, MetacallError, MetacallGetAttributeError, MetacallNull, - MetacallObject, MetacallSetAttributeError, MetacallStringConversionError, MetacallValue, + MetaCallClassFromNameError, MetaCallError, MetaCallGetAttributeError, MetaCallNull, + MetaCallObject, MetaCallSetAttributeError, MetaCallStringConversionError, MetaCallValue, }; use crate::{bindings::*, cstring, cstring_enum, parsers}; use std::{ @@ -8,16 +8,16 @@ use std::{ fmt::{self, Debug, Formatter}, }; -/// Represents Metacall Class. You can get this type when returned by a function or get a class by its +/// Represents MetaCall Class. You can get this type when returned by a function or get a class by its /// name with [from_name](#method.from_name). -pub struct MetacallClass { +pub struct MetaCallClass { found_by_name: bool, leak: bool, value: *mut c_void, } -unsafe impl Send for MetacallClass {} -unsafe impl Sync for MetacallClass {} -impl Clone for MetacallClass { +unsafe impl Send for MetaCallClass {} +unsafe impl Sync for MetaCallClass {} +impl Clone for MetaCallClass { fn clone(&self) -> Self { Self { found_by_name: self.found_by_name, @@ -26,13 +26,13 @@ impl Clone for MetacallClass { } } } -impl Debug for MetacallClass { +impl Debug for MetaCallClass { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "MetacallClass {{ ... }}") + write!(f, "MetaCallClass {{ ... }}") } } -impl MetacallClass { +impl MetaCallClass { #[doc(hidden)] pub fn new_raw(value: *mut c_void) -> Self { Self { @@ -52,12 +52,12 @@ impl MetacallClass { } /// Gets a class by its name. - pub fn from_name(name: impl ToString) -> Result { - let c_name = cstring_enum!(name, MetacallClassFromNameError)?; + pub fn from_name(name: impl ToString) -> Result { + let c_name = cstring_enum!(name, MetaCallClassFromNameError)?; let class = unsafe { metacall_class(c_name.as_ptr()) }; if class.is_null() { - return Err(MetacallClassFromNameError::ClassNotFound); + return Err(MetaCallClassFromNameError::ClassNotFound); } Ok(Self { @@ -75,12 +75,12 @@ impl MetacallClass { } } - /// Creates an [object](MetacallObject) of the class wtih constructor arguments. - pub fn create_object( + /// Creates an [object](MetaCallObject) of the class wtih constructor arguments. + pub fn create_object( &self, name: impl ToString, constructor_args: impl IntoIterator, - ) -> Result { + ) -> Result { let c_name = cstring!(name)?; let mut c_args = parsers::metacallobj_to_raw_args(constructor_args); let obj = unsafe { @@ -96,41 +96,41 @@ impl MetacallClass { unsafe { metacall_value_destroy(c_arg) }; } - Ok(MetacallObject::new_raw(obj)) + Ok(MetaCallObject::new_raw(obj)) } - /// Creates an [object](MetacallObject) of the class wtihout constructor arguments. + /// Creates an [object](MetaCallObject) of the class wtihout constructor arguments. pub fn create_object_no_arg( &self, name: impl ToString, - ) -> Result { - self.create_object::(name, []) + ) -> Result { + self.create_object::(name, []) } fn get_attribute_inner( &self, name: impl ToString, - ) -> Result<*mut c_void, MetacallGetAttributeError> { - let c_name = cstring_enum!(name, MetacallGetAttributeError)?; + ) -> Result<*mut c_void, MetaCallGetAttributeError> { + let c_name = cstring_enum!(name, MetaCallGetAttributeError)?; Ok(unsafe { metacall_class_static_get(self.value_to_class(), c_name.as_ptr()) }) } - /// Gets static attribute from a class without type casting([MetacallValue](MetacallValue)). + /// Gets static attribute from a class without type casting([MetaCallValue](MetaCallValue)). pub fn get_attribute_untyped( &self, name: impl ToString, - ) -> Result, MetacallGetAttributeError> { + ) -> Result, MetaCallGetAttributeError> { Ok(parsers::raw_to_metacallobj_untyped( self.get_attribute_inner(name)?, )) } /// Gets static attribute from a class. - pub fn get_attribute( + pub fn get_attribute( &self, name: impl ToString, - ) -> Result { + ) -> Result { match parsers::raw_to_metacallobj::(self.get_attribute_inner(name)?) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallGetAttributeError::FailedCasting(original)), + Err(original) => Err(MetaCallGetAttributeError::FailedCasting(original)), } } @@ -138,13 +138,13 @@ impl MetacallClass { pub fn set_attribute( &self, key: impl ToString, - value: impl MetacallValue, - ) -> Result<(), MetacallSetAttributeError> { - let c_key = cstring_enum!(key, MetacallSetAttributeError)?; + value: impl MetaCallValue, + ) -> Result<(), MetaCallSetAttributeError> { + let c_key = cstring_enum!(key, MetaCallSetAttributeError)?; let c_arg = parsers::metacallobj_to_raw(value); if unsafe { metacall_class_static_set(self.value_to_class(), c_key.as_ptr(), c_arg) } != 0 { - return Err(MetacallSetAttributeError::SetAttributeFailure); + return Err(MetaCallSetAttributeError::SetAttributeFailure); } unsafe { metacall_value_destroy(c_arg) }; @@ -152,12 +152,12 @@ impl MetacallClass { Ok(()) } - fn call_method_inner( + fn call_method_inner( &self, name: impl ToString, args: impl IntoIterator, - ) -> Result<*mut c_void, MetacallError> { - let c_key = cstring_enum!(name, MetacallError)?; + ) -> Result<*mut c_void, MetaCallError> { + let c_key = cstring_enum!(name, MetaCallError)?; let mut c_args = parsers::metacallobj_to_raw_args(args); let ret = unsafe { metacallv_class( @@ -174,43 +174,43 @@ impl MetacallClass { Ok(ret) } - /// Calls a static class method witout type casting([MetacallValue](MetacallValue)). - pub fn call_method_untyped( + /// Calls a static class method witout type casting([MetaCallValue](MetaCallValue)). + pub fn call_method_untyped( &self, name: impl ToString, args: impl IntoIterator, - ) -> Result, MetacallError> { + ) -> Result, MetaCallError> { Ok(parsers::raw_to_metacallobj_untyped( self.call_method_inner::(name, args)?, )) } - /// Calls a static class method witout type casting([MetacallValue](MetacallValue)) and + /// Calls a static class method witout type casting([MetaCallValue](MetaCallValue)) and /// without passing arguments. - pub fn call_method_untyped_no_arg( + pub fn call_method_untyped_no_arg( &self, name: impl ToString, - ) -> Result, MetacallError> { + ) -> Result, MetaCallError> { Ok(parsers::raw_to_metacallobj_untyped( self.call_method_inner::(name, [])?, )) } /// Calls a static class method. - pub fn call_method( + pub fn call_method( &self, name: impl ToString, args: impl IntoIterator, - ) -> Result { + ) -> Result { match parsers::raw_to_metacallobj::(self.call_method_inner::(name, args)?) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallError::FailedCasting(original)), + Err(original) => Err(MetaCallError::FailedCasting(original)), } } /// Calls a static class method without passing arguments. - pub fn call_method_no_arg( + pub fn call_method_no_arg( &self, name: impl ToString, - ) -> Result { - self.call_method::(name, []) + ) -> Result { + self.call_method::(name, []) } #[doc(hidden)] @@ -221,7 +221,7 @@ impl MetacallClass { } } -impl Drop for MetacallClass { +impl Drop for MetaCallClass { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) } diff --git a/source/ports/rs_port/src/types/metacall_error.rs b/source/ports/rs_port/src/types/metacall_error.rs index 690b9c16d..51b5e6006 100644 --- a/source/ports/rs_port/src/types/metacall_error.rs +++ b/source/ports/rs_port/src/types/metacall_error.rs @@ -1,35 +1,35 @@ -use super::MetacallValue; +use super::MetaCallValue; use std::{ffi::NulError, path::PathBuf}; #[derive(Debug, Clone)] -/// This error happens when it's not possible to initialize the Metacall core. You can check +/// This error happens when it's not possible to initialize the MetaCall core. You can check /// your logs for more information. -pub struct MetacallInitError; -impl MetacallInitError { +pub struct MetaCallInitError; +impl MetaCallInitError { #[doc(hidden)] pub fn new() -> Self { Self } } -impl Default for MetacallInitError { +impl Default for MetaCallInitError { fn default() -> Self { - MetacallInitError::new() + MetaCallInitError::new() } } -impl ToString for MetacallInitError { +impl ToString for MetaCallInitError { fn to_string(&self) -> String { - String::from("Failed to initialize Metacall!") + String::from("Failed to initialize MetaCall!") } } #[derive(Debug, Clone)] /// This error may happen when passing contains a null character. You can access the /// original string and the NulError throughout this struct. -pub struct MetacallStringConversionError { +pub struct MetaCallStringConversionError { pub original_string: String, pub nul_error: NulError, } -impl MetacallStringConversionError { +impl MetaCallStringConversionError { #[doc(hidden)] pub fn new(original_string: impl ToString, nul_error: NulError) -> Self { Self { @@ -38,7 +38,7 @@ impl MetacallStringConversionError { } } } -impl ToString for MetacallStringConversionError { +impl ToString for MetaCallStringConversionError { fn to_string(&self) -> String { self.original_string.clone() } @@ -46,38 +46,38 @@ impl ToString for MetacallStringConversionError { #[derive(Debug, Clone)] /// This error may happen when trying to call a function. -pub enum MetacallError { +pub enum MetaCallError { /// Function not found. FunctionNotFound, /// Failed to cast the return type as the type requested. - FailedCasting(Box), + FailedCasting(Box), /// Null character detected. - UnexpectedCStringConversionErr(MetacallStringConversionError), + UnexpectedCStringConversionErr(MetaCallStringConversionError), } #[derive(Debug, Clone)] /// This error may happen when trying to set a class/object attribute. Check your logs /// if you get `SetAttributeFailure` error variant. -pub enum MetacallSetAttributeError { +pub enum MetaCallSetAttributeError { /// Failed to set the attribute. SetAttributeFailure, /// Null character detected. - UnexpectedCStringConversionErr(MetacallStringConversionError), + UnexpectedCStringConversionErr(MetaCallStringConversionError), } #[derive(Debug, Clone)] /// This error may happen when trying to get a class/object attribute. -pub enum MetacallGetAttributeError { +pub enum MetaCallGetAttributeError { /// Failed to cast the attribute as the type requested. - FailedCasting(Box), + FailedCasting(Box), /// Null character detected. - UnexpectedCStringConversionErr(MetacallStringConversionError), + UnexpectedCStringConversionErr(MetaCallStringConversionError), } #[derive(Debug, Clone)] /// This error may happen when loading a code. Check your logs for more information if you /// get `FromFileFailure` or `FromMemoryFailure` error variant. -pub enum MetacallLoaderError { +pub enum MetaCallLoaderError { /// File not found. FileNotFound(PathBuf), /// Failed to load from file. @@ -87,14 +87,14 @@ pub enum MetacallLoaderError { /// Not a file or permission denied. NotAFileOrPermissionDenied(PathBuf), /// Null character detected. - UnexpectedCStringConversionErr(MetacallStringConversionError), + UnexpectedCStringConversionErr(MetaCallStringConversionError), } #[derive(Debug, Clone)] /// This error may happen when trying to get a class by its name. -pub enum MetacallClassFromNameError { +pub enum MetaCallClassFromNameError { /// Class not found. ClassNotFound, /// Null character detected. - UnexpectedCStringConversionErr(MetacallStringConversionError), + UnexpectedCStringConversionErr(MetaCallStringConversionError), } diff --git a/source/ports/rs_port/src/types/metacall_exception.rs b/source/ports/rs_port/src/types/metacall_exception.rs index eca20ef45..67a34e15a 100644 --- a/source/ports/rs_port/src/types/metacall_exception.rs +++ b/source/ports/rs_port/src/types/metacall_exception.rs @@ -1,4 +1,4 @@ -use super::{MetacallStringConversionError, MetacallValue}; +use super::{MetaCallStringConversionError, MetaCallValue}; use crate::{ bindings::{ metacall_exception_type, metacall_throwable_value, metacall_value_create_exception, @@ -12,15 +12,15 @@ use std::{ sync::Arc, }; -/// Represents Metacall exception. You can create an exception with [new](#method.new). -pub struct MetacallException { +/// Represents MetaCall exception. You can create an exception with [new](#method.new). +pub struct MetaCallException { exception_struct: Arc, leak: bool, value: *mut c_void, } -unsafe impl Send for MetacallException {} -unsafe impl Sync for MetacallException {} -impl Clone for MetacallException { +unsafe impl Send for MetaCallException {} +unsafe impl Sync for MetaCallException {} +impl Clone for MetaCallException { fn clone(&self) -> Self { Self { exception_struct: self.exception_struct.clone(), @@ -29,24 +29,24 @@ impl Clone for MetacallException { } } } -impl Debug for MetacallException { +impl Debug for MetaCallException { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!( f, - "MetacallException {}", + "MetaCallException {}", format!("{{ {} }}", self.to_string()) ) } } -impl MetacallException { +impl MetaCallException { /// Creates a new exception. pub fn new( message: impl ToString, label: impl ToString, stacktrace: impl ToString, code: i64, - ) -> Result { + ) -> Result { let message = cstring!(message)?.into_raw(); let label = cstring!(label)?.into_raw(); let stacktrace = cstring!(stacktrace)?.into_raw(); @@ -118,24 +118,24 @@ impl MetacallException { #[derive(Debug, Clone)] /// Different types of Throwable value. -pub enum MetacallThrowableValue { +pub enum MetaCallThrowableValue { /// Exception. - Exception(MetacallException), + Exception(MetaCallException), /// Other types. - Other(Box), + Other(Box), /// Specified. Specified(T), } -/// Represents Metacall throwable. Keep in mind that it's not supported to pass a throwable as an argument. -pub struct MetacallThrowable { +/// Represents MetaCall throwable. Keep in mind that it's not supported to pass a throwable as an argument. +pub struct MetaCallThrowable { leak: bool, value_ptr: *mut c_void, value: *mut c_void, } -unsafe impl Send for MetacallThrowable {} -unsafe impl Sync for MetacallThrowable {} -impl Clone for MetacallThrowable { +unsafe impl Send for MetaCallThrowable {} +unsafe impl Sync for MetaCallThrowable {} +impl Clone for MetaCallThrowable { fn clone(&self) -> Self { Self { leak: true, @@ -144,17 +144,17 @@ impl Clone for MetacallThrowable { } } } -impl Debug for MetacallThrowable { +impl Debug for MetaCallThrowable { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!( f, - "MetacallThrowable {}", + "MetaCallThrowable {}", format!("{{ {} }}", self.to_string()) ) } } -impl MetacallThrowable { +impl MetaCallThrowable { #[doc(hidden)] pub fn new_raw(value_ptr: *mut c_void) -> Self { let throwable_value = @@ -177,9 +177,9 @@ impl MetacallThrowable { } } - /// Gets the throwable value without type casting([MetacallValue](MetacallValue)). - pub fn get_value_untyped(&self) -> Box { - match parsers::raw_to_metacallobj::(self.value) { + /// Gets the throwable value without type casting([MetaCallValue](MetaCallValue)). + pub fn get_value_untyped(&self) -> Box { + match parsers::raw_to_metacallobj::(self.value) { Ok(mut value) => { value.leak = true; @@ -189,7 +189,7 @@ impl MetacallThrowable { } } /// Gets the throwable value. - pub fn get_value(&self) -> Result> { + pub fn get_value(&self) -> Result> { match self.get_value_untyped().downcast::() { Ok(value) => Ok(value), Err(original) => Err(original), @@ -201,11 +201,11 @@ impl MetacallThrowable { // It's not implemented in any loader as the time of writing this block of code. // Feel free to implement as any loader adopted accepting Throwable as an argument. - panic!("Passing MetacallThrowable as an argument is not supported!"); + panic!("Passing MetaCallThrowable as an argument is not supported!"); } } -impl ToString for MetacallException { +impl ToString for MetaCallException { fn to_string(&self) -> String { format!( "[Exception(code: `{}`)]: {}", @@ -214,21 +214,21 @@ impl ToString for MetacallException { ) } } -impl ToString for MetacallThrowable { +impl ToString for MetaCallThrowable { fn to_string(&self) -> String { let throwable_value = self.get_value_untyped(); format!("[Throwable]: {:#?}", throwable_value) } } -impl Drop for MetacallException { +impl Drop for MetaCallException { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) } } } } -impl Drop for MetacallThrowable { +impl Drop for MetaCallThrowable { fn drop(&mut self) { unsafe { if !self.leak { diff --git a/source/ports/rs_port/src/types/metacall_function.rs b/source/ports/rs_port/src/types/metacall_function.rs index 6ce4489fd..4d5154e8c 100644 --- a/source/ports/rs_port/src/types/metacall_function.rs +++ b/source/ports/rs_port/src/types/metacall_function.rs @@ -1,4 +1,4 @@ -use super::{MetacallError, MetacallNull, MetacallValue}; +use super::{MetaCallError, MetaCallNull, MetaCallValue}; use crate::{ bindings::{metacall_value_destroy, metacall_value_to_function, metacallfv_s}, parsers, @@ -8,14 +8,14 @@ use std::{ fmt::{self, Debug, Formatter}, }; -/// Represents Metacall function. -pub struct MetacallFunction { +/// Represents MetaCall function. +pub struct MetaCallFunction { leak: bool, value: *mut c_void, } -unsafe impl Send for MetacallFunction {} -unsafe impl Sync for MetacallFunction {} -impl Clone for MetacallFunction { +unsafe impl Send for MetaCallFunction {} +unsafe impl Sync for MetaCallFunction {} +impl Clone for MetaCallFunction { fn clone(&self) -> Self { Self { leak: true, @@ -23,13 +23,13 @@ impl Clone for MetacallFunction { } } } -impl Debug for MetacallFunction { +impl Debug for MetaCallFunction { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "MetacallFunction {{ ... }}") + write!(f, "MetaCallFunction {{ ... }}") } } -impl MetacallFunction { +impl MetaCallFunction { #[doc(hidden)] pub fn new_raw(value: *mut c_void) -> Self { Self { leak: false, value } @@ -44,7 +44,7 @@ impl MetacallFunction { unsafe { metacall_value_to_function(self.value) } } - fn call_inner(&self, args: impl IntoIterator) -> *mut c_void { + fn call_inner(&self, args: impl IntoIterator) -> *mut c_void { let mut c_args = parsers::metacallobj_to_raw_args(args); let ret: *mut c_void = unsafe { metacallfv_s(self.value_to_function(), c_args.as_mut_ptr(), 0) }; @@ -55,31 +55,31 @@ impl MetacallFunction { ret } - /// Calls the function with arguments and witout type casting([MetacallValue](MetacallValue)). - pub fn call_untyped( + /// Calls the function with arguments and witout type casting([MetaCallValue](MetaCallValue)). + pub fn call_untyped( &self, args: impl IntoIterator, - ) -> Box { + ) -> Box { parsers::raw_to_metacallobj_untyped(self.call_inner(args)) } /// Calls the function without passing arguments and witout type - /// casting([MetacallValue](MetacallValue)). - pub fn call_untyped_no_arg(&self) -> Box { - parsers::raw_to_metacallobj_untyped(self.call_inner([] as [MetacallNull; 0])) + /// casting([MetaCallValue](MetaCallValue)). + pub fn call_untyped_no_arg(&self) -> Box { + parsers::raw_to_metacallobj_untyped(self.call_inner([] as [MetaCallNull; 0])) } /// Calls the function with arguments. - pub fn call( + pub fn call( &self, args: impl IntoIterator, - ) -> Result { + ) -> Result { match parsers::raw_to_metacallobj::(self.call_inner(args)) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallError::FailedCasting(original)), + Err(original) => Err(MetaCallError::FailedCasting(original)), } } /// Calls the function without arguments. - pub fn call_no_arg(&self) -> Result { - self.call::([]) + pub fn call_no_arg(&self) -> Result { + self.call::([]) } #[doc(hidden)] @@ -90,7 +90,7 @@ impl MetacallFunction { } } -impl Drop for MetacallFunction { +impl Drop for MetaCallFunction { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) } diff --git a/source/ports/rs_port/src/types/metacall_future.rs b/source/ports/rs_port/src/types/metacall_future.rs index 46a8c436c..fa911d134 100644 --- a/source/ports/rs_port/src/types/metacall_future.rs +++ b/source/ports/rs_port/src/types/metacall_future.rs @@ -1,4 +1,4 @@ -use super::{MetacallNull, MetacallValue}; +use super::{MetaCallNull, MetaCallValue}; use crate::{ bindings::{metacall_await_future, metacall_value_destroy, metacall_value_to_future}, helpers, parsers, @@ -9,13 +9,13 @@ use std::{ ptr, }; -/// Function pointer type used for resolving/rejecting Metacall futures. The first argument is the result +/// Function pointer type used for resolving/rejecting MetaCall futures. The first argument is the result /// and the second argument is the data that you may want to access when the function gets called. -/// Checkout [MetacallFuture resolve](MetacallFuture#method.then) or -/// [MetacallFuture reject](MetacallFuture#method.catch) for usage. -pub type MetacallFutureHandler = fn(Box, Box); +/// Checkout [MetaCallFuture resolve](MetaCallFuture#method.then) or +/// [MetaCallFuture reject](MetaCallFuture#method.catch) for usage. +pub type MetaCallFutureHandler = fn(Box, Box); -/// Represents MetacallFuture. Keep in mind that it's not supported to pass a future as an argument. +/// Represents MetaCallFuture. Keep in mind that it's not supported to pass a future as an argument. /// /// ## **Usage example:** /// @@ -36,32 +36,32 @@ pub type MetacallFutureHandler = fn(Box, Box("doubleValueAfterTime", [1, 2000]).unwrap(); +/// let future = metacall::("doubleValueAfterTime", [1, 2000]).unwrap(); /// future.then(resolve).catch(reject).await_fut(); /// } /// ``` #[repr(C)] -pub struct MetacallFuture { - data: *mut dyn MetacallValue, +pub struct MetaCallFuture { + data: *mut dyn MetaCallValue, leak: bool, - reject: Option, - resolve: Option, + reject: Option, + resolve: Option, value: *mut c_void, } -unsafe impl Send for MetacallFuture {} -unsafe impl Sync for MetacallFuture {} -impl Clone for MetacallFuture { +unsafe impl Send for MetaCallFuture {} +unsafe impl Sync for MetaCallFuture {} +impl Clone for MetaCallFuture { fn clone(&self) -> Self { Self { data: self.data, @@ -72,10 +72,10 @@ impl Clone for MetacallFuture { } } } -impl Debug for MetacallFuture { +impl Debug for MetaCallFuture { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let boxed_data = unsafe { Box::from_raw(self.data) }; - let data = if boxed_data.is::() { + let data = if boxed_data.is::() { None } else { Some(format!("{:#?}", boxed_data)) @@ -93,7 +93,7 @@ impl Debug for MetacallFuture { "Some" }; - f.debug_struct("MetacallFuture") + f.debug_struct("MetaCallFuture") .field("data", &data) .field("resolve", &resolve) .field("reject", &reject) @@ -101,17 +101,17 @@ impl Debug for MetacallFuture { } } -type MetacallFutureFFIData = ( +type MetaCallFutureFFIData = ( // Resolve - Option, + Option, // Reject - Option, + Option, // User data - *mut dyn MetacallValue, + *mut dyn MetaCallValue, ); unsafe extern "C" fn resolver(resolve_data: *mut c_void, upper_data: *mut c_void) -> *mut c_void { - let (resolve, _, data) = *Box::from_raw(upper_data as *mut MetacallFutureFFIData); + let (resolve, _, data) = *Box::from_raw(upper_data as *mut MetaCallFutureFFIData); let user_data = Box::from_raw(data); (resolve.unwrap())( @@ -122,7 +122,7 @@ unsafe extern "C" fn resolver(resolve_data: *mut c_void, upper_data: *mut c_void ptr::null_mut() } unsafe extern "C" fn rejecter(reject_data: *mut c_void, upper_data: *mut c_void) -> *mut c_void { - let (_, reject, data) = *Box::from_raw(upper_data as *mut MetacallFutureFFIData); + let (_, reject, data) = *Box::from_raw(upper_data as *mut MetaCallFutureFFIData); let user_data = Box::from_raw(data); (reject.unwrap())( @@ -133,9 +133,9 @@ unsafe extern "C" fn rejecter(reject_data: *mut c_void, upper_data: *mut c_void) ptr::null_mut() } -impl MetacallFuture { - fn create_null_data() -> *mut dyn MetacallValue { - Box::into_raw(helpers::metacall_implementer_to_traitobj(MetacallNull())) +impl MetaCallFuture { + fn create_null_data() -> *mut dyn MetaCallValue { + Box::into_raw(helpers::metacall_implementer_to_traitobj(MetaCallNull())) } #[doc(hidden)] @@ -177,17 +177,17 @@ impl MetacallFuture { /// **Calling Example:** /// /// ```rust - /// use metacall::{MetacallValue, MetacallFuture, metacall_no_args}; + /// use metacall::{MetaCallValue, MetaCallFuture, metacall_no_args}; /// fn calling() { - /// fn reject(result: impl MetacallValue, _: impl MetacallValue) { + /// fn reject(result: impl MetaCallValue, _: impl MetaCallValue) { /// println!("Resolve:: {:#?}", result); // Resolve:: "Resolve message" /// } /// - /// let future = metacall_no_args::("func_always_resolve").unwrap(); + /// let future = metacall_no_args::("func_always_resolve").unwrap(); /// future.then(resolve).catch(reject).await_fut(); /// } /// ``` - pub fn then(mut self, resolve: MetacallFutureHandler) -> Self { + pub fn then(mut self, resolve: MetaCallFutureHandler) -> Self { self.resolve = Some(resolve); self @@ -207,17 +207,17 @@ impl MetacallFuture { /// ``` /// **Calling Example:** /// ```rust - /// use metacall::{MetacallValue, MetacallFuture, metacall_no_args}; + /// use metacall::{MetaCallValue, MetaCallFuture, metacall_no_args}; /// fn calling() { - /// fn reject(error: impl MetacallValue, _: impl MetacallValue) { + /// fn reject(error: impl MetaCallValue, _: impl MetaCallValue) { /// println!("Reject:: error: {:#?}", error); // Reject:: error: "Error: Reject message" /// } /// - /// let future = metacall_no_args::("func_always_rejects").unwrap(); + /// let future = metacall_no_args::("func_always_rejects").unwrap(); /// future.then(resolve).catch(reject).await_fut(); /// } /// ``` - pub fn catch(mut self, reject: MetacallFutureHandler) -> Self { + pub fn catch(mut self, reject: MetaCallFutureHandler) -> Self { self.reject = Some(reject); self @@ -227,26 +227,26 @@ impl MetacallFuture { /// /// Example: /// ```rust - /// use metacall::{MetacallValue, MetacallFuture, metacall}; + /// use metacall::{MetaCallValue, MetaCallFuture, metacall}; /// /// fn run() { /// let x = 10; - /// fn resolve(result: impl MetacallValue, data: impl MetacallValue) { + /// fn resolve(result: impl MetaCallValue, data: impl MetaCallValue) { /// println!("X = {data}"); /// } /// - /// fn reject(result: impl MetacallValue, data: impl MetacallValue) { + /// fn reject(result: impl MetaCallValue, data: impl MetaCallValue) { /// println!("X = {data}"); /// } /// - /// let future = metacall::("async_function", [1]).unwrap(); + /// let future = metacall::("async_function", [1]).unwrap(); /// future.then(resolve).catch(reject),data(x).await_fut(); /// } /// ``` - pub fn data(mut self, data: impl MetacallValue) -> Self { + pub fn data(mut self, data: impl MetaCallValue) -> Self { unsafe { drop(Box::from_raw(self.data)) }; - self.data = Box::into_raw(Box::new(data) as Box); + self.data = Box::into_raw(Box::new(data) as Box); self } @@ -275,8 +275,8 @@ impl MetacallFuture { // ==20664== by 0x17B549: alloc::alloc::Global::alloc_impl (alloc.rs:175) // ==20664== by 0x17B342: allocate (alloc.rs:235) // ==20664== by 0x17B342: alloc::alloc::exchange_malloc (alloc.rs:324) - // ==20664== by 0x1873D0: new<(core::option::Option, alloc::boxed::Box)>, core::option::Option, alloc::boxed::Box)>, *mut dyn metacall::types::metacall_value::MetacallValue)> (boxed.rs:217) - // ==20664== by 0x1873D0: metacall::types::metacall_future::MetacallFuture::await_fut (metacall_future.rs:182) + // ==20664== by 0x1873D0: new<(core::option::Option, alloc::boxed::Box)>, core::option::Option, alloc::boxed::Box)>, *mut dyn metacall::types::metacall_value::MetaCallValue)> (boxed.rs:217) + // ==20664== by 0x1873D0: metacall::types::metacall_future::MetaCallFuture::await_fut (metacall_future.rs:182) // ==20664== by 0x1296E6: metacall_test::test_future::{{closure}} (metacall_test.rs:202) // ==20664== by 0x1286A2: metacall_test::generate_test_custom_validation (metacall_test.rs:42) // ==20664== by 0x12625A: metacall_test::test_future (metacall_test.rs:193) @@ -298,11 +298,11 @@ impl MetacallFuture { // It's not implemented in any loader as the time of writing this block of code. // Feel free to implement as any loader adopted accepting Future as an argument. - panic!("Passing MetacallFuture as an argument is not supported!"); + panic!("Passing MetaCallFuture as an argument is not supported!"); } } -impl Drop for MetacallFuture { +impl Drop for MetaCallFuture { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) }; diff --git a/source/ports/rs_port/src/types/metacall_null.rs b/source/ports/rs_port/src/types/metacall_null.rs index 32c7bb462..51ae70d40 100644 --- a/source/ports/rs_port/src/types/metacall_null.rs +++ b/source/ports/rs_port/src/types/metacall_null.rs @@ -8,16 +8,16 @@ use std::{ /// Represents NULL. // This is a zero-sized struct. It doesn't allocate any memory and will only create a null pointer // when needed. -pub struct MetacallNull(); -unsafe impl Send for MetacallNull {} -unsafe impl Sync for MetacallNull {} -impl Debug for MetacallNull { +pub struct MetaCallNull(); +unsafe impl Send for MetaCallNull {} +unsafe impl Sync for MetaCallNull {} +impl Debug for MetaCallNull { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "MetacallNull {{ }}") + write!(f, "MetaCallNull {{ }}") } } -impl MetacallNull { +impl MetaCallNull { #[doc(hidden)] pub fn into_raw(self) -> *mut c_void { unsafe { metacall_value_create_null() } diff --git a/source/ports/rs_port/src/types/metacall_object.rs b/source/ports/rs_port/src/types/metacall_object.rs index cdad1ba50..6ae3d9892 100644 --- a/source/ports/rs_port/src/types/metacall_object.rs +++ b/source/ports/rs_port/src/types/metacall_object.rs @@ -1,6 +1,6 @@ use super::{ - MetacallError, MetacallGetAttributeError, MetacallNull, MetacallSetAttributeError, - MetacallValue, + MetaCallError, MetaCallGetAttributeError, MetaCallNull, MetaCallSetAttributeError, + MetaCallValue, }; use crate::{ bindings::{ @@ -16,17 +16,17 @@ use std::{ // Used for documentation. #[allow(unused_imports)] -use super::MetacallClass; +use super::MetaCallClass; -/// Represents Metacall Object. You can get this type when returned by a function or create one from -/// a class with [create_object](MetacallClass#method.create_object). -pub struct MetacallObject { +/// Represents MetaCall Object. You can get this type when returned by a function or create one from +/// a class with [create_object](MetaCallClass#method.create_object). +pub struct MetaCallObject { value: *mut c_void, leak: bool, } -unsafe impl Send for MetacallObject {} -unsafe impl Sync for MetacallObject {} -impl Clone for MetacallObject { +unsafe impl Send for MetaCallObject {} +unsafe impl Sync for MetaCallObject {} +impl Clone for MetaCallObject { fn clone(&self) -> Self { Self { leak: true, @@ -34,13 +34,13 @@ impl Clone for MetacallObject { } } } -impl Debug for MetacallObject { +impl Debug for MetaCallObject { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "MetacallObject {{ ... }}") + write!(f, "MetaCallObject {{ ... }}") } } -impl MetacallObject { +impl MetaCallObject { #[doc(hidden)] pub fn new_raw(value: *mut c_void) -> Self { Self { value, leak: false } @@ -54,28 +54,28 @@ impl MetacallObject { fn get_attribute_inner( &self, name: impl ToString, - ) -> Result<*mut c_void, MetacallGetAttributeError> { - let c_name = cstring_enum!(name, MetacallGetAttributeError)?; + ) -> Result<*mut c_void, MetaCallGetAttributeError> { + let c_name = cstring_enum!(name, MetaCallGetAttributeError)?; Ok(unsafe { metacall_object_get(metacall_value_to_object(self.value), c_name.as_ptr()) }) } - /// Gets attribute from an object without type casting([MetacallValue](MetacallValue)). + /// Gets attribute from an object without type casting([MetaCallValue](MetaCallValue)). pub fn get_attribute_untyped( &self, name: impl ToString, - ) -> Result, MetacallGetAttributeError> { + ) -> Result, MetaCallGetAttributeError> { Ok(parsers::raw_to_metacallobj_untyped( self.get_attribute_inner(name)?, )) } /// Gets attribute from an object. - pub fn get_attribute( + pub fn get_attribute( &self, name: impl ToString, - ) -> Result { + ) -> Result { match parsers::raw_to_metacallobj::(self.get_attribute_inner(name)?) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallGetAttributeError::FailedCasting(original)), + Err(original) => Err(MetaCallGetAttributeError::FailedCasting(original)), } } @@ -83,15 +83,15 @@ impl MetacallObject { pub fn set_attribute( &self, key: impl ToString, - value: impl MetacallValue, - ) -> Result<(), MetacallSetAttributeError> { - let c_key = cstring_enum!(key, MetacallSetAttributeError)?; + value: impl MetaCallValue, + ) -> Result<(), MetaCallSetAttributeError> { + let c_key = cstring_enum!(key, MetaCallSetAttributeError)?; let c_arg = parsers::metacallobj_to_raw(value); if unsafe { metacall_object_set(metacall_value_to_object(self.value), c_key.as_ptr(), c_arg) } != 0 { - return Err(MetacallSetAttributeError::SetAttributeFailure); + return Err(MetaCallSetAttributeError::SetAttributeFailure); } unsafe { metacall_value_destroy(c_arg) }; @@ -99,12 +99,12 @@ impl MetacallObject { Ok(()) } - fn call_method_inner( + fn call_method_inner( &self, key: impl ToString, args: impl IntoIterator, - ) -> Result<*mut c_void, MetacallError> { - let c_key = cstring_enum!(key, MetacallError)?; + ) -> Result<*mut c_void, MetaCallError> { + let c_key = cstring_enum!(key, MetaCallError)?; let mut c_args = parsers::metacallobj_to_raw_args(args); let ret = unsafe { metacallv_object( @@ -121,43 +121,43 @@ impl MetacallObject { Ok(ret) } - /// Calls an object method witout type casting([MetacallValue](MetacallValue)). - pub fn call_method_untyped( + /// Calls an object method witout type casting([MetaCallValue](MetaCallValue)). + pub fn call_method_untyped( &self, key: impl ToString, args: impl IntoIterator, - ) -> Result, MetacallError> { + ) -> Result, MetaCallError> { Ok(parsers::raw_to_metacallobj_untyped( self.call_method_inner::(key, args)?, )) } - /// Calls an object method witout type casting([MetacallValue](MetacallValue)) and + /// Calls an object method witout type casting([MetaCallValue](MetaCallValue)) and /// without passing arguments. - pub fn call_method_untyped_no_arg( + pub fn call_method_untyped_no_arg( &self, key: impl ToString, - ) -> Result, MetacallError> { + ) -> Result, MetaCallError> { Ok(parsers::raw_to_metacallobj_untyped( self.call_method_inner::(key, [])?, )) } /// Calls an object method. - pub fn call_method( + pub fn call_method( &self, key: impl ToString, args: impl IntoIterator, - ) -> Result { + ) -> Result { match parsers::raw_to_metacallobj::(self.call_method_inner::(key, args)?) { Ok(ret) => Ok(ret), - Err(original) => Err(MetacallError::FailedCasting(original)), + Err(original) => Err(MetaCallError::FailedCasting(original)), } } /// Calls an object method without passing arguments. - pub fn call_method_no_arg( + pub fn call_method_no_arg( &self, key: impl ToString, - ) -> Result { - self.call_method::(key, []) + ) -> Result { + self.call_method::(key, []) } #[doc(hidden)] @@ -168,7 +168,7 @@ impl MetacallObject { } } -impl Drop for MetacallObject { +impl Drop for MetaCallObject { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) } diff --git a/source/ports/rs_port/src/types/metacall_pointer.rs b/source/ports/rs_port/src/types/metacall_pointer.rs index fc2f62088..802aa153a 100644 --- a/source/ports/rs_port/src/types/metacall_pointer.rs +++ b/source/ports/rs_port/src/types/metacall_pointer.rs @@ -1,24 +1,24 @@ -use super::MetacallValue; +use super::MetaCallValue; use crate::{ bindings::{metacall_value_create_ptr, metacall_value_destroy, metacall_value_to_ptr}, - MetacallNull, + MetaCallNull, }; use std::{ ffi::c_void, fmt::{self, Debug, Formatter}, }; -/// Represents Metacall pointer. This type cannot be used in other languages. This type is highly +/// Represents MetaCall pointer. This type cannot be used in other languages. This type is highly /// unsafe so be careful! -pub struct MetacallPointer { +pub struct MetaCallPointer { leak: bool, - rust_value: *mut Box, + rust_value: *mut Box, rust_value_leak: bool, value: *mut c_void, } -unsafe impl Send for MetacallPointer {} -unsafe impl Sync for MetacallPointer {} -impl Clone for MetacallPointer { +unsafe impl Send for MetaCallPointer {} +unsafe impl Sync for MetaCallPointer {} +impl Clone for MetaCallPointer { fn clone(&self) -> Self { Self { leak: true, @@ -28,29 +28,29 @@ impl Clone for MetacallPointer { } } } -impl Debug for MetacallPointer { +impl Debug for MetaCallPointer { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let boxed_value = unsafe { Box::from_raw(self.rust_value) }; - let value = if (*boxed_value).is::() { + let value = if (*boxed_value).is::() { None } else { Some(format!("{:#?}", boxed_value)) }; Box::leak(boxed_value); - f.debug_struct("MetacallPointer") + f.debug_struct("MetaCallPointer") .field("value", &value) .finish() } } -impl MetacallPointer { - fn get_rust_value_ptr(value: *mut c_void) -> *mut Box { - unsafe { metacall_value_to_ptr(value) as *mut Box } +impl MetaCallPointer { + fn get_rust_value_ptr(value: *mut c_void) -> *mut Box { + unsafe { metacall_value_to_ptr(value) as *mut Box } } #[doc(hidden)] - pub fn new_raw(value: *mut c_void) -> Result> { + pub fn new_raw(value: *mut c_void) -> Result> { Ok(Self { leak: false, rust_value: Self::get_rust_value_ptr(value), @@ -60,7 +60,7 @@ impl MetacallPointer { } #[doc(hidden)] - pub fn new_raw_leak(value: *mut c_void) -> Result> { + pub fn new_raw_leak(value: *mut c_void) -> Result> { Ok(Self { leak: true, rust_value: Self::get_rust_value_ptr(value), @@ -69,9 +69,9 @@ impl MetacallPointer { }) } - /// Creates a new Metacall pointer and casts it to T. - pub fn new(ptr: impl MetacallValue) -> Self { - let rust_value = Box::into_raw(Box::new(Box::new(ptr) as Box)); + /// Creates a new MetaCall pointer and casts it to T. + pub fn new(ptr: impl MetaCallValue) -> Self { + let rust_value = Box::into_raw(Box::new(Box::new(ptr) as Box)); Self { leak: false, @@ -81,15 +81,15 @@ impl MetacallPointer { } } - /// Consumes the Metacall pointer and returns ownership of the value without type - /// casting([MetacallValue](MetacallValue)). - pub fn get_value_untyped(mut self) -> Box { + /// Consumes the MetaCall pointer and returns ownership of the value without type + /// casting([MetaCallValue](MetaCallValue)). + pub fn get_value_untyped(mut self) -> Box { self.rust_value_leak = true; unsafe { *Box::from_raw(self.rust_value) } } - /// Consumes the Metacall pointer and returns ownership of the value. - pub fn get_value(self) -> Result> { + /// Consumes the MetaCall pointer and returns ownership of the value. + pub fn get_value(self) -> Result> { match self.get_value_untyped().downcast::() { Ok(rust_value) => Ok(rust_value), Err(original) => Err(original), @@ -105,7 +105,7 @@ impl MetacallPointer { } } -impl Drop for MetacallPointer { +impl Drop for MetaCallPointer { fn drop(&mut self) { if !self.leak { unsafe { metacall_value_destroy(self.value) } diff --git a/source/ports/rs_port/src/types/metacall_value.rs b/source/ports/rs_port/src/types/metacall_value.rs index a1ee9775e..e6b914a50 100644 --- a/source/ports/rs_port/src/types/metacall_value.rs +++ b/source/ports/rs_port/src/types/metacall_value.rs @@ -1,11 +1,11 @@ use super::{ - MetacallClass, MetacallException, MetacallFunction, MetacallFuture, MetacallNull, - MetacallObject, MetacallPointer, MetacallThrowable, + MetaCallClass, MetaCallException, MetaCallFunction, MetaCallFuture, MetaCallNull, + MetaCallObject, MetaCallPointer, MetaCallThrowable, }; use crate::{ bindings::*, cstring, - helpers::{MetacallClone, MetacallDowncast}, + helpers::{MetaCallClone, MetaCallDowncast}, match_metacall_value, parsers, }; use std::{ @@ -15,7 +15,7 @@ use std::{ slice, }; -/// Trait of any possible object in Metacall. +/// Trait of any possible object in MetaCall. /// Checkout [match_metacall_value](match_metacall_value) macro for /// matching trait objects of this trait. Let' see what types we can use with an example: ... /// ``` @@ -50,31 +50,31 @@ use std::{ /// hashmap.insert(String::from("hi"), String::from("there!")); /// metacall::metacall_untyped("x", [hashmap]); /// // pointer -/// metacall::metacall_untyped("x", [metacall::MetacallPointer::new(String::from("hi"))]); +/// metacall::metacall_untyped("x", [metacall::MetaCallPointer::new(String::from("hi"))]); /// // future? /// // nope! you can't pass a future! /// // function /// metacall::metacall_untyped("x", [ -/// metacall::metacall_no_arg::("my_async_function").unwrap() +/// metacall::metacall_no_arg::("my_async_function").unwrap() /// ]); /// // null -/// metacall::metacall_untyped("x", [metacall::MetacallNull()]); +/// metacall::metacall_untyped("x", [metacall::MetaCallNull()]); /// // class -/// metacall::metacall_untyped("x", [metacall::MetacallClass::from_name("MyClass").unwrap()]); +/// metacall::metacall_untyped("x", [metacall::MetaCallClass::from_name("MyClass").unwrap()]); /// // object -/// let class = metacall::MetacallClass::from_name("MyClass").unwrap(); +/// let class = metacall::MetaCallClass::from_name("MyClass").unwrap(); /// metacall::metacall_untyped("x", [class.create_object_no_arg("myObject").unwrap()]); /// // exception /// metacall::metacall_untyped("x", [ -/// metacall::metacall_no_arg::("my_function").unwrap() +/// metacall::metacall_no_arg::("my_function").unwrap() /// ]); /// // throwable? /// // nope! you can't pass a throwable! /// ``` -pub trait MetacallValue: MetacallClone + MetacallDowncast + Debug { +pub trait MetaCallValue: MetaCallClone + MetaCallDowncast + Debug { // It tries to convert the raw pointer to the value or return a trait object on failure. #[doc(hidden)] - fn from_metacall_raw(v: *mut c_void) -> Result> + fn from_metacall_raw(v: *mut c_void) -> Result> where Self: Sized, { @@ -86,24 +86,24 @@ pub trait MetacallValue: MetacallClone + MetacallDowncast + Debug { } // Same as `from_metacall_raw` but doesn't free the memory on drop and leaks. #[doc(hidden)] - fn from_metacall_raw_leak(v: *mut c_void) -> Result> + fn from_metacall_raw_leak(v: *mut c_void) -> Result> where Self: Sized; - // It returns the enum index of Metacall Protocol in the core. It's used for faster type matching. + // It returns the enum index of MetaCall Protocol in the core. It's used for faster type matching. #[doc(hidden)] - fn get_metacall_id() -> u32 + fn get_metacall_id() -> metacall_value_id where Self: Sized; // It converts the value to a raw value known by the metacall core. #[doc(hidden)] fn into_metacall_raw(self) -> *mut c_void; } -/// Equivalent to Metacall boolean type. -impl MetacallValue for bool { - fn get_metacall_id() -> u32 { - 0 +/// Equivalent to MetaCall boolean type. +impl MetaCallValue for bool { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_BOOL } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_bool(v) != 0 }; Ok(value) @@ -112,12 +112,12 @@ impl MetacallValue for bool { unsafe { metacall_value_create_bool((self as c_int).try_into().unwrap()) } } } -/// Equivalent to Metacall char type. -impl MetacallValue for char { - fn get_metacall_id() -> u32 { - 1 +/// Equivalent to MetaCall char type. +impl MetaCallValue for char { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_CHAR } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_char(v) as u8 as char }; Ok(value) @@ -126,12 +126,12 @@ impl MetacallValue for char { unsafe { metacall_value_create_char(self as c_char) } } } -/// Equivalent to Metacall short type. -impl MetacallValue for i16 { - fn get_metacall_id() -> u32 { - 2 +/// Equivalent to MetaCall short type. +impl MetaCallValue for i16 { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_SHORT } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_short(v) }; Ok(value) @@ -140,12 +140,12 @@ impl MetacallValue for i16 { unsafe { metacall_value_create_short(self) } } } -/// Equivalent to Metacall int type. -impl MetacallValue for i32 { - fn get_metacall_id() -> u32 { - 3 +/// Equivalent to MetaCall int type. +impl MetaCallValue for i32 { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_INT } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_int(v) }; Ok(value) @@ -154,12 +154,12 @@ impl MetacallValue for i32 { unsafe { metacall_value_create_int(self) } } } -/// Equivalent to Metacall long type. -impl MetacallValue for i64 { - fn get_metacall_id() -> u32 { - 4 +/// Equivalent to MetaCall long type. +impl MetaCallValue for i64 { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_LONG } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_long(v) }; Ok(value) @@ -168,12 +168,12 @@ impl MetacallValue for i64 { unsafe { metacall_value_create_long(self) } } } -/// Equivalent to Metacall float type. -impl MetacallValue for f32 { - fn get_metacall_id() -> u32 { - 5 +/// Equivalent to MetaCall float type. +impl MetaCallValue for f32 { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_FLOAT } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_float(v) }; Ok(value) @@ -182,12 +182,12 @@ impl MetacallValue for f32 { unsafe { metacall_value_create_float(self) } } } -/// Equivalent to Metacall double type. -impl MetacallValue for f64 { - fn get_metacall_id() -> u32 { - 6 +/// Equivalent to MetaCall double type. +impl MetaCallValue for f64 { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_DOUBLE } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let value = unsafe { metacall_value_to_double(v) }; Ok(value) @@ -196,12 +196,12 @@ impl MetacallValue for f64 { unsafe { metacall_value_create_double(self) } } } -/// Equivalent to Metacall string type. -impl MetacallValue for String { - fn get_metacall_id() -> u32 { - 7 +/// Equivalent to MetaCall string type. +impl MetaCallValue for String { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_STRING } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let c_str = unsafe { CStr::from_ptr(metacall_value_to_string(v)) }; let value = String::from(c_str.to_str().unwrap()); @@ -213,12 +213,12 @@ impl MetacallValue for String { unsafe { metacall_value_create_string(raw.as_ptr(), self.len()) } } } -/// Equivalent to Metacall buffer type. -impl MetacallValue for Vec { - fn get_metacall_id() -> u32 { - 8 +/// Equivalent to MetaCall buffer type. +impl MetaCallValue for Vec { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_BUFFER } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(unsafe { slice::from_raw_parts( metacall_value_to_buffer(v) as *mut c_char, @@ -231,17 +231,17 @@ impl MetacallValue for Vec { unsafe { metacall_value_create_buffer(self.as_mut_ptr() as *mut c_void, self.len()) } } } -/// Equivalent to Metacall array type. -impl MetacallValue for Vec { - fn get_metacall_id() -> u32 { - 9 +/// Equivalent to MetaCall array type. +impl MetaCallValue for Vec { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_ARRAY } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { let count = unsafe { metacall_value_count(v) }; let vec = unsafe { slice::from_raw_parts(metacall_value_to_array(v), count) } .iter() .map(|element| parsers::raw_to_metacallobj_leak(*element)) - .collect::, Box>>()?; + .collect::, Box>>()?; Ok(vec) } @@ -254,12 +254,12 @@ impl MetacallValue for Vec { unsafe { metacall_value_create_array(array.as_mut_ptr(), array.len()) } } } -/// Equivalent to Metacall map type. -impl MetacallValue for HashMap { - fn get_metacall_id() -> u32 { - 10 +/// Equivalent to MetaCall map type. +impl MetaCallValue for HashMap { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_MAP } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { unsafe { let mut hashmap = HashMap::new(); for map_value in @@ -307,122 +307,122 @@ impl MetacallValue for HashMap { unsafe { metacall_value_create_map(hashmap.as_mut_ptr(), hashmap.len()) } } } -/// Equivalent to Metacall pointer type. -impl MetacallValue for MetacallPointer { - fn get_metacall_id() -> u32 { - 11 +/// Equivalent to MetaCall pointer type. +impl MetaCallValue for MetaCallPointer { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_PTR } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Self::new_raw_leak(v) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Self::new_raw(v) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall future type. -impl MetacallValue for MetacallFuture { - fn get_metacall_id() -> u32 { - 12 +/// Equivalent to MetaCall future type. +impl MetaCallValue for MetaCallFuture { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_FUTURE } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall function type. -impl MetacallValue for MetacallFunction { - fn get_metacall_id() -> u32 { - 13 +/// Equivalent to MetaCall function type. +impl MetaCallValue for MetaCallFunction { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_FUNCTION } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall null type. -impl MetacallValue for MetacallNull { - fn get_metacall_id() -> u32 { - 14 +/// Equivalent to MetaCall null type. +impl MetaCallValue for MetaCallNull { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_NULL } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { unsafe { metacall_value_destroy(v) }; - Ok(MetacallNull()) + Ok(MetaCallNull()) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Self::from_metacall_raw_leak(v) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall class type. -impl MetacallValue for MetacallClass { - fn get_metacall_id() -> u32 { - 15 +/// Equivalent to MetaCall class type. +impl MetaCallValue for MetaCallClass { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_CLASS } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall object type. -impl MetacallValue for MetacallObject { - fn get_metacall_id() -> u32 { - 16 +/// Equivalent to MetaCall object type. +impl MetaCallValue for MetaCallObject { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_OBJECT } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall exception type. -impl MetacallValue for MetacallException { - fn get_metacall_id() -> u32 { - 17 +/// Equivalent to MetaCall exception type. +impl MetaCallValue for MetaCallException { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_EXCEPTION } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { self.into_raw() } } -/// Equivalent to Metacall throwable type. -impl MetacallValue for MetacallThrowable { - fn get_metacall_id() -> u32 { - 18 +/// Equivalent to MetaCall throwable type. +impl MetaCallValue for MetaCallThrowable { + fn get_metacall_id() -> metacall_value_id { + metacall_value_id::METACALL_THROWABLE } - fn from_metacall_raw_leak(v: *mut c_void) -> Result> { + fn from_metacall_raw_leak(v: *mut c_void) -> Result> { Ok(Self::new_raw_leak(v)) } - fn from_metacall_raw(v: *mut c_void) -> Result> { + fn from_metacall_raw(v: *mut c_void) -> Result> { Ok(Self::new_raw(v)) } fn into_metacall_raw(self) -> *mut c_void { diff --git a/source/ports/rs_port/tests/invalid_loaders_test.rs b/source/ports/rs_port/tests/invalid_loaders_test.rs index e98418c23..80c8fc7e2 100644 --- a/source/ports/rs_port/tests/invalid_loaders_test.rs +++ b/source/ports/rs_port/tests/invalid_loaders_test.rs @@ -1,4 +1,4 @@ -use metacall::{loaders, switch, MetacallLoaderError}; +use metacall::{loaders, switch, MetaCallLoaderError}; use std::env; #[test] @@ -9,7 +9,7 @@ fn invalid_loaders() { let inavlid_file = scripts_dir.join("whatever.yeet"); let valid_file = scripts_dir.join("script.js"); - if let Err(MetacallLoaderError::FileNotFound(_)) = + if let Err(MetaCallLoaderError::FileNotFound(_)) = loaders::from_single_file("random", inavlid_file) { // Everything Ok @@ -17,7 +17,7 @@ fn invalid_loaders() { panic!("Expected the loader fail with `FileNotFound` error variant!"); } - if let Err(MetacallLoaderError::FromFileFailure) = + if let Err(MetaCallLoaderError::FromFileFailure) = loaders::from_single_file("random", valid_file) { // Everything Ok @@ -25,7 +25,7 @@ fn invalid_loaders() { panic!("Expected the loader fail with `FromFileFailure` error variant!"); } - if let Err(MetacallLoaderError::FromMemoryFailure) = + if let Err(MetaCallLoaderError::FromMemoryFailure) = loaders::from_memory("random", "Invalid code!") { // Everything Ok diff --git a/source/ports/rs_port/tests/loaders_test.rs b/source/ports/rs_port/tests/loaders_test.rs index 0ed57931b..b0f65392f 100644 --- a/source/ports/rs_port/tests/loaders_test.rs +++ b/source/ports/rs_port/tests/loaders_test.rs @@ -13,14 +13,7 @@ const SCRIPT2: &str = "function greet2() { return 'hi there!' } \nmodule.exports const SCRIPT3: &str = "console.log('Hello world')"; fn call_greet(test: &str, num: u32) { let out = metacall_no_arg::(format!("greet{}", num)).unwrap(); - if out.as_str() == "hi there!" { - return (); - } else { - panic!( - "Invalid output of the function! Expected `hi there!` but received `{}`.", - test - ); - } + assert_eq!(out.as_str(), "hi there!", "Testing {}", test); } fn load_from_memory_test() { diff --git a/source/ports/rs_port/tests/metacall_exception_test.rs b/source/ports/rs_port/tests/metacall_exception_test.rs index 5933b59c0..975ec96fe 100644 --- a/source/ports/rs_port/tests/metacall_exception_test.rs +++ b/source/ports/rs_port/tests/metacall_exception_test.rs @@ -8,10 +8,10 @@ fn inlines() { let tests_dir = env::current_dir().unwrap().join("tests/scripts"); let js_test_file = tests_dir.join("script.js"); - if let Ok(_) = loaders::from_single_file("node", js_test_file) { + if loaders::from_single_file("node", js_test_file).is_ok() { // This should not generate a segmentation fault let val = - metacall::metacall_no_arg::("test_exception").unwrap(); + metacall::metacall_no_arg::("test_exception").unwrap(); let cloned_val_1 = val.clone(); let cloned_val_2 = val.clone(); @@ -25,7 +25,7 @@ fn inlines() { // Neither this should not generate a segmentation fault let val = - metacall::metacall_no_arg::("test_exception").unwrap(); + metacall::metacall_no_arg::("test_exception").unwrap(); let cloned_val_1 = val.clone(); let cloned_val_2 = val.clone(); diff --git a/source/ports/rs_port/tests/metacall_test.rs b/source/ports/rs_port/tests/metacall_test.rs index 82c0b2229..8a0940b6b 100644 --- a/source/ports/rs_port/tests/metacall_test.rs +++ b/source/ports/rs_port/tests/metacall_test.rs @@ -1,14 +1,14 @@ use metacall::{ - loaders, switch, MetacallClass, MetacallException, MetacallFunction, MetacallFuture, - MetacallNull, MetacallObject, MetacallPointer, MetacallThrowable, MetacallValue, + loaders, switch, MetaCallClass, MetaCallException, MetaCallFunction, MetaCallFuture, + MetaCallNull, MetaCallObject, MetaCallPointer, MetaCallThrowable, MetaCallValue, }; use std::{collections::HashMap, env, fmt::Debug}; -fn generate_test( +fn generate_test( name: impl ToString, expected: T, ) -> T { - let test = if !(Box::new(expected.clone()) as Box).is::() { + let test = if !(Box::new(expected.clone()) as Box).is::() { ::metacall::metacall::(name, [expected.clone()]) } else { ::metacall::metacall_no_arg::(name) @@ -25,14 +25,14 @@ fn generate_test( expected } -fn generate_test_custom_validation( +fn generate_test_custom_validation( name: impl ToString, expected_type: impl ToString, - expected_value: impl MetacallValue + Clone, + expected_value: impl MetaCallValue + Clone, validator: impl FnOnce(T), ) { - let expected_value_boxed = Box::new(expected_value.clone()) as Box; - let test = if !expected_value_boxed.is::() { + let expected_value_boxed = Box::new(expected_value.clone()) as Box; + let test = if !expected_value_boxed.is::() { ::metacall::metacall::(name, [expected_value]) } else { ::metacall::metacall_no_arg::(name) @@ -66,19 +66,19 @@ fn test_char() { generate_test::("test_char", 'Z'); } fn test_short() { - generate_test::("test_short", 12345 as i16); + generate_test::("test_short", 12345_i16); } fn test_int() { - generate_test::("test_int", 12345 as i32); + generate_test::("test_int", 12345_i32); } fn test_long() { - generate_test::("test_long", 12345 as i64); + generate_test::("test_long", 12345_i64); } fn test_float() { - generate_test::("test_float", 1.2345 as f32); + generate_test::("test_float", 1.2345_f32); } fn test_double() { - generate_test::("test_double", 1.2345 as f64); + generate_test::("test_double", 1.2345_f64); } fn test_string() { generate_test::( @@ -140,10 +140,10 @@ fn test_array() { fn test_pointer() { let expected_value = String::from("hi there!"); - generate_test_custom_validation::( + generate_test_custom_validation::( "return_the_argument_py", "pointer", - MetacallPointer::new(expected_value.clone()), + MetaCallPointer::new(expected_value.clone()), |pointer| { let receieved_value = pointer.get_value::().unwrap(); @@ -154,7 +154,7 @@ fn test_pointer() { ); } fn test_future() { - fn validate(upper_result: Box, upper_data: Box) { + fn validate(upper_result: Box, upper_data: Box) { match upper_data.downcast::() { Ok(ret) => { if ret.as_str() != "data" { @@ -178,24 +178,24 @@ fn test_future() { } } - generate_test_custom_validation::( + generate_test_custom_validation::( "test_future_resolve", "future", - MetacallNull(), + MetaCallNull(), move |future| { - fn resolve(result: Box, data: Box) { + fn resolve(result: Box, data: Box) { validate(result, data); } future.then(resolve).data(String::from("data")).await_fut(); }, ); - generate_test_custom_validation::( + generate_test_custom_validation::( "test_future_reject", "future", - MetacallNull(), + MetaCallNull(), move |future| { - fn reject(result: Box, data: Box) { + fn reject(result: Box, data: Box) { validate(result, data); } @@ -204,12 +204,12 @@ fn test_future() { ); } fn test_function() { - generate_test_custom_validation::( + generate_test_custom_validation::( "test_function", "function", - MetacallNull(), + MetaCallNull(), |upper_function| { - generate_test_custom_validation::( + generate_test_custom_validation::( "return_the_argument_py", "function", upper_function, @@ -225,9 +225,9 @@ fn test_function() { ); } fn test_null() { - metacall::metacall::("return_the_argument_py", [MetacallNull()]).unwrap(); + metacall::metacall::("return_the_argument_py", [MetaCallNull()]).unwrap(); } -fn class_test_inner(class: MetacallClass) { +fn class_test_inner(class: MetaCallClass) { let attr = class.get_attribute::("hi").unwrap(); if attr.as_str() != "there!" { invalid_return_value("there!", attr); @@ -250,12 +250,12 @@ fn class_test_inner(class: MetacallClass) { object_test_inner(new_obj); } fn test_class() { - generate_test_custom_validation::( + generate_test_custom_validation::( "test_class", "class", - MetacallNull(), + MetaCallNull(), |upper_class| { - generate_test_custom_validation::( + generate_test_custom_validation::( "return_the_argument_py", "class", upper_class, @@ -264,9 +264,9 @@ fn test_class() { }, ); - class_test_inner(MetacallClass::from_name("TestClass").unwrap()); + class_test_inner(MetaCallClass::from_name("TestClass").unwrap()); } -fn object_test_inner(object: MetacallObject) { +fn object_test_inner(object: MetaCallObject) { object .set_attribute("hi2", String::from("there!2!")) .unwrap(); @@ -282,12 +282,12 @@ fn object_test_inner(object: MetacallObject) { } } fn test_object() { - generate_test_custom_validation::( + generate_test_custom_validation::( "test_object", "object", - MetacallNull(), + MetaCallNull(), |upper_object| { - generate_test_custom_validation::( + generate_test_custom_validation::( "return_the_argument_py", "object", upper_object, @@ -297,12 +297,12 @@ fn test_object() { ); } fn test_exception() { - generate_test_custom_validation::( + generate_test_custom_validation::( "test_exception", "exception", - MetacallNull(), + MetaCallNull(), |upper_exception| { - generate_test_custom_validation::( + generate_test_custom_validation::( "return_the_argument_js", "exception", upper_exception, @@ -317,13 +317,13 @@ fn test_exception() { ); } fn test_throwable() { - generate_test_custom_validation::( + generate_test_custom_validation::( "test_throwable", "throwable", - MetacallNull(), + MetaCallNull(), |throwable| { let exception_message = throwable - .get_value::() + .get_value::() .unwrap() .get_message(); if exception_message.as_str() != "hi there!" { @@ -342,13 +342,13 @@ fn metacall() { let c_test_file = tests_dir.join("script.c"); let py_test_file = tests_dir.join("script.py"); - if let Ok(_) = loaders::from_single_file("py", py_test_file) { + if loaders::from_single_file("py", py_test_file).is_ok() { test_buffer(); test_class(); test_object(); test_pointer(); } - if let Ok(_) = loaders::from_single_file("c", c_test_file) { + if loaders::from_single_file("c", c_test_file).is_ok() { test_char(); test_double(); test_float(); @@ -356,7 +356,7 @@ fn metacall() { test_long(); test_short(); } - if let Ok(_) = loaders::from_single_file("node", js_test_file) { + if loaders::from_single_file("node", js_test_file).is_ok() { test_array(); test_bool(); test_exception();