/* @generated by `//build/rust/gni_impl/run_bindgen.py` v2025-12-22 */
/* automatically generated by rust-bindgen 0.72.1 */

pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _ISOC95_SOURCE: u32 = 1;
pub const _ISOC99_SOURCE: u32 = 1;
pub const _ISOC11_SOURCE: u32 = 1;
pub const _ISOC23_SOURCE: u32 = 1;
pub const _ISOC2Y_SOURCE: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const _XOPEN_SOURCE: u32 = 700;
pub const _XOPEN_SOURCE_EXTENDED: u32 = 1;
pub const _LARGEFILE64_SOURCE: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const _DYNAMIC_STACK_SIZE_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2Y: u32 = 1;
pub const __GLIBC_USE_ISOC23: u32 = 1;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
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 __USE_XOPEN: u32 = 1;
pub const __USE_XOPEN_EXTENDED: u32 = 1;
pub const __USE_UNIX98: u32 = 1;
pub const _LARGEFILE_SOURCE: u32 = 1;
pub const __USE_XOPEN2K8XSI: u32 = 1;
pub const __USE_XOPEN2KXSI: u32 = 1;
pub const __USE_LARGEFILE: u32 = 1;
pub const __USE_LARGEFILE64: u32 = 1;
pub const __USE_FILE_OFFSET64: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __TIMESIZE: u32 = 64;
pub const __USE_TIME_BITS64: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_DYNAMIC_STACK_SIZE: u32 = 1;
pub const __USE_GNU: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 2;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const __GLIBC_USE_C23_STRTOL: u32 = 1;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_60559_BFP__: u32 = 201404;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 42;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __fortify_use_clang: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __USE_EXTERN_INLINES: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 1;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 1;
pub const __GLIBC_USE_IEC_60559_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 1;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 1;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 1;
pub const _BITS_TYPES_H: u32 = 1;
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 _BITS_STDINT_LEAST_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 INT8_WIDTH: u32 = 8;
pub const UINT8_WIDTH: u32 = 8;
pub const INT16_WIDTH: u32 = 16;
pub const UINT16_WIDTH: u32 = 16;
pub const INT32_WIDTH: u32 = 32;
pub const UINT32_WIDTH: u32 = 32;
pub const INT64_WIDTH: u32 = 64;
pub const UINT64_WIDTH: u32 = 64;
pub const INT_LEAST8_WIDTH: u32 = 8;
pub const UINT_LEAST8_WIDTH: u32 = 8;
pub const INT_LEAST16_WIDTH: u32 = 16;
pub const UINT_LEAST16_WIDTH: u32 = 16;
pub const INT_LEAST32_WIDTH: u32 = 32;
pub const UINT_LEAST32_WIDTH: u32 = 32;
pub const INT_LEAST64_WIDTH: u32 = 64;
pub const UINT_LEAST64_WIDTH: u32 = 64;
pub const INT_FAST8_WIDTH: u32 = 8;
pub const UINT_FAST8_WIDTH: u32 = 8;
pub const INT_FAST16_WIDTH: u32 = 64;
pub const UINT_FAST16_WIDTH: u32 = 64;
pub const INT_FAST32_WIDTH: u32 = 64;
pub const UINT_FAST32_WIDTH: u32 = 64;
pub const INT_FAST64_WIDTH: u32 = 64;
pub const UINT_FAST64_WIDTH: u32 = 64;
pub const INTPTR_WIDTH: u32 = 64;
pub const UINTPTR_WIDTH: u32 = 64;
pub const INTMAX_WIDTH: u32 = 64;
pub const UINTMAX_WIDTH: u32 = 64;
pub const PTRDIFF_WIDTH: u32 = 64;
pub const SIG_ATOMIC_WIDTH: u32 = 32;
pub const SIZE_WIDTH: u32 = 64;
pub const WCHAR_WIDTH: u32 = 32;
pub const WINT_WIDTH: u32 = 32;
pub const _ASSERT_H: u32 = 1;
pub const __alignas_is_defined: u32 = 1;
pub const __alignof_is_defined: u32 = 1;
pub type wchar_t = ::std::os::raw::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
    pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
    pub __bindgen_padding_0: u64,
    pub __clang_max_align_nonce2: u128,
}
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],
}
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;
/// |MojoTimeTicks|: A time delta, in microseconds, the meaning of which is
/// source-dependent.
pub type MojoTimeTicks = i64;
/// |MojoHandle|: Handles to Mojo objects.
///   |MOJO_HANDLE_INVALID| - A value that is never a valid handle.
pub type MojoHandle = usize;
/// |MojoResult|: Result codes for Mojo operations. The only success code is zero
/// (|MOJO_RESULT_OK|); all non-zero values should be considered as error/failure
/// codes (even if the value is not recognized).
///   |MOJO_RESULT_OK| - Not an error; returned on success.
///   |MOJO_RESULT_CANCELLED| - Operation was cancelled, typically by the caller.
///   |MOJO_RESULT_UNKNOWN| - Unknown error (e.g., if not enough information is
///       available for a more specific error).
///   |MOJO_RESULT_INVALID_ARGUMENT| - Caller specified an invalid argument. This
///       differs from |MOJO_RESULT_FAILED_PRECONDITION| in that the former
///       indicates arguments that are invalid regardless of the state of the
///       system.
///   |MOJO_RESULT_DEADLINE_EXCEEDED| - Deadline expired before the operation
///       could complete.
///   |MOJO_RESULT_NOT_FOUND| - Some requested entity was not found (i.e., does
///       not exist).
///   |MOJO_RESULT_ALREADY_EXISTS| - Some entity or condition that we attempted
///       to create already exists.
///   |MOJO_RESULT_PERMISSION_DENIED| - The caller does not have permission to
///       for the operation (use |MOJO_RESULT_RESOURCE_EXHAUSTED| for rejections
///       caused by exhausting some resource instead).
///   |MOJO_RESULT_RESOURCE_EXHAUSTED| - Some resource required for the call
///       (possibly some quota) has been exhausted.
///   |MOJO_RESULT_FAILED_PRECONDITION| - The system is not in a state required
///       for the operation (use this if the caller must do something to rectify
///       the state before retrying).
///   |MOJO_RESULT_ABORTED| - The operation was aborted by the system, possibly
///       due to a concurrency issue (use this if the caller may retry at a
///       higher level).
///   |MOJO_RESULT_OUT_OF_RANGE| - The operation was attempted past the valid
///       range. Unlike |MOJO_RESULT_INVALID_ARGUMENT|, this indicates that the
///       operation may be/become valid depending on the system state. (This
///       error is similar to |MOJO_RESULT_FAILED_PRECONDITION|, but is more
///       specific.)
///   |MOJO_RESULT_UNIMPLEMENTED| - The operation is not implemented, supported,
///       or enabled.
///   |MOJO_RESULT_INTERNAL| - Internal error: this should never happen and
///       indicates that some invariant expected by the system has been broken.
///   |MOJO_RESULT_UNAVAILABLE| - The operation is (temporarily) currently
///       unavailable. The caller may simply retry the operation (possibly with a
///       backoff).
///   |MOJO_RESULT_DATA_LOSS| - Unrecoverable data loss or corruption.
///   |MOJO_RESULT_BUSY| - One of the resources involved is currently being used
///       (possibly on another thread) in a way that prevents the current
///       operation from proceeding, e.g., if the other operation may result in
///       the resource being invalidated.
///   |MOJO_RESULT_SHOULD_WAIT| - The request cannot currently be completed
///       (e.g., if the data requested is not yet available). The caller should
///       wait for it to be feasible using a trap.
///
/// The codes from |MOJO_RESULT_OK| to |MOJO_RESULT_DATA_LOSS| come from
/// Google3's canonical error codes.
///
/// LINT.IfChange(MojoResult)
pub type MojoResult = u32;
/// Flags passed to |MojoInitialize()| via |MojoInitializeOptions|.
pub type MojoInitializeFlags = u32;
/// Options passed to |MojoInitialize()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoInitializeOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoInitializeFlags|.
    pub flags: MojoInitializeFlags,
    /// Address and length of the UTF8-encoded path of a mojo_core shared library
    /// to load. If the |mojo_core_path| is null then |mojo_core_path_length| is
    /// ignored and Mojo will fall back first onto the |MOJO_CORE_LIBRARY_PATH|
    /// environment variable, and then onto the current working directory.
    ///
    /// NOTE: These fields are only observed during the first successful call to
    /// |MojoInitialize()| in a process.
    pub mojo_core_path: *const ::std::os::raw::c_char,
    pub mojo_core_path_length: u32,
    /// For POSIX and Fuchsia systems only, this is the |argc| and |argv| from
    /// the calling process's main() entry point. These fields are ignored on
    /// Windows, but we define them anyway for the sake of ABI consistency.
    ///
    /// NOTE: These fields are only observed during the first successful call to
    /// |MojoInitialize()| within a process.
    pub argc: i32,
    pub argv: *const *const ::std::os::raw::c_char,
}
/// Flags passed to |MojoShutdown()| via |MojoShutdownOptions|.
pub type MojoShutdownFlags = u32;
/// Options passed to |MojoShutdown()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoShutdownOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoShutdownFlags|.
    pub flags: MojoShutdownFlags,
}
/// |MojoHandleSignals|: Used to specify signals that can be watched for on a
/// handle (and which can be triggered), e.g., the ability to read or write to
/// the handle.
///   |MOJO_HANDLE_SIGNAL_NONE| - No flags. A registered watch will always fail
///       to arm with |MOJO_RESULT_FAILED_PRECONDITION| when watching for this.
///   |MOJO_HANDLE_SIGNAL_READABLE| - Can read (e.g., a message) from the handle.
///   |MOJO_HANDLE_SIGNAL_WRITABLE| - Can write (e.g., a message) to the handle.
///   |MOJO_HANDLE_SIGNAL_PEER_CLOSED| - The peer handle is closed.
///   |MOJO_HANDLE_SIGNAL_NEW_DATA_READABLE| - Can read data from a data pipe
///       consumer handle (implying MOJO_HANDLE_SIGNAL_READABLE is also set),
///       AND there is some nonzero quantity of new data available on the pipe
///       since the last |MojoReadData()| or |MojoBeginReadData()| call on the
///       handle.
///   |MOJO_HANDLE_SIGNAL_PEER_REMOTE| - The peer handle exists in a remote
///       execution context (e.g. in another process.) Note that this signal is
///       maintained with best effort but may at any time be slightly out of sync
///       with the actual location of the peer handle.
///   |MOJO_HANDLE_SIGNAL_QUOTA_EXCEEDED| - One or more quotas set on the handle
///       is currently exceeded.
pub type MojoHandleSignals = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoHandleSignalsState {
    pub satisfied_signals: MojoHandleSignals,
    pub satisfiable_signals: MojoHandleSignals,
}
/// Flags passed to |MojoCreateSharedBuffer()| via
/// |MojoCreateSharedBufferOptions|. See values defined below.
pub type MojoCreateSharedBufferFlags = u32;
/// Options passed to |MojoCreateSharedBuffer()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateSharedBufferOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoCreateSharedBufferFlags|.
    pub flags: MojoCreateSharedBufferFlags,
}
/// Flags passed to |MojoGetBufferInfo()| via |MojoGetBufferInfoOptions|. See
/// values defined below.
pub type MojoGetBufferInfoFlags = u32;
/// Options passed to |MojoGetBufferInfo()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoGetBufferInfoOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoGetBufferInfoFlags|.
    pub flags: MojoGetBufferInfoFlags,
}
/// Structure used to receive information about a shared buffer via
/// |MojoGetBufferInfo()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoSharedBufferInfo {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// The size of the shared buffer.
    pub size: u64,
}
/// Flags passed to |MojoDuplicateBufferHandle()| via
/// |MojoDuplicateBufferHandleOptions|. See values defined below.
pub type MojoDuplicateBufferHandleFlags = u32;
/// Options passed to |MojoDuplicateBufferHandle()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoDuplicateBufferHandleOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoDuplicateBufferHandleFlags|.
    pub flags: MojoDuplicateBufferHandleFlags,
}
/// Flags passed to |MojoMapBuffer()| via |MojoMapBufferOptions|. See values
/// defined below.
pub type MojoMapBufferFlags = u32;
/// Options passed to |MojoMapBuffer()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoMapBufferOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoMapBufferFlags|.
    pub flags: MojoMapBufferFlags,
}
unsafe extern "C" {
    /// Creates a buffer of size |num_bytes| bytes that can be shared between
    /// processes. The returned handle may be duplicated any number of times by
    /// |MojoDuplicateBufferHandle()|.
    ///
    /// To access the buffer's storage, one must call |MojoMapBuffer()|.
    ///
    /// |options| may be set to null for a shared buffer with the default options.
    ///
    /// On success, |*shared_buffer_handle| will be set to the handle for the shared
    /// buffer. On failure it is not modified.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |*options| is invalid).
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a process/system/quota/etc. limit has
    ///       been reached (e.g., if the requested size was too large, or if the
    ///       maximum number of handles was exceeded).
    ///   |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|.
    pub fn MojoCreateSharedBuffer(
        num_bytes: u64,
        options: *const MojoCreateSharedBufferOptions,
        shared_buffer_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Duplicates the handle |buffer_handle| as a new shared buffer handle. On
    /// success this returns the new handle in |*new_buffer_handle|. A shared buffer
    /// remains allocated as long as there is at least one shared buffer handle
    /// referencing it in at least one process in the system.
    ///
    /// |options| may be set to null to duplicate the buffer handle with the default
    /// options.
    ///
    /// Access rights to mapped memory from the duplicated handle may be controlled
    /// by flags in |*options|, with some limitations. See notes on
    /// |MOJO_DUPLICATE_BUFFER_HANDLE_FLAG_NONE| and
    /// |MOJO_DUPLICATE_BUFFER_HANDLE_FLAG_READ_ONLY| regarding restrictions on
    /// duplication with respect to these flags.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |buffer_handle| is not a valid buffer handle or |*options| is invalid).
    ///   |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if
    ///       |MOJO_DUPLICATE_BUFFER_HANDLE_FLAG_READ_ONLY| was set but the handle
    ///       was already previously duplicated without that flag; or if
    ///       |MOJO_DUPLICATE_BUFFER_HANDLE_FLAG_READ_ONLY| was not set but the
    ///       handle was already previously duplicated with that flag.
    pub fn MojoDuplicateBufferHandle(
        buffer_handle: MojoHandle,
        options: *const MojoDuplicateBufferHandleOptions,
        new_buffer_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Maps the part (at offset |offset| of length |num_bytes|) of the buffer given
    /// by |buffer_handle| into memory, with options specified by |options|.
    /// |offset+num_bytes| must be less than or equal to the size of the buffer. On
    /// success, |*buffer| points to memory with the requested part of the buffer. On
    /// failure |*buffer| it is not modified.
    ///
    /// A single buffer handle may have multiple active mappings. The permissions
    /// (e.g., writable or executable) of the returned memory depend on the
    /// properties of the buffer and properties attached to the buffer handle, as
    /// well as |flags|.
    ///
    /// A mapped buffer must eventually be unmapped by calling |MojoUnmapBuffer()|
    /// with the value of |*buffer| returned by this function.
    ///
    /// |options| may be null to map the buffer with default behavior.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |buffer_handle| is not a valid buffer handle, the range specified by
    ///       |offset| and |num_bytes| is not valid, or |*options| is invalid).
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if the mapping operation itself failed
    ///       (e.g., due to not having appropriate address space available).
    pub fn MojoMapBuffer(
        buffer_handle: MojoHandle,
        offset: u64,
        num_bytes: u64,
        options: *const MojoMapBufferOptions,
        buffer: *mut *mut ::std::os::raw::c_void,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Unmaps a buffer pointer that was mapped by |MojoMapBuffer()|. |buffer| must
    /// have been the result of |MojoMapBuffer()| (not some other pointer inside
    /// the mapped memory), and the entire mapping will be removed.
    ///
    /// A mapping may only be unmapped once.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |buffer| is invalid (e.g., is not the
    ///       result of |MojoMapBuffer()| or has already been unmapped).
    pub fn MojoUnmapBuffer(buffer: *mut ::std::os::raw::c_void) -> MojoResult;
}
unsafe extern "C" {
    /// Retrieve information about |buffer_handle| into |info|.
    ///
    /// Callers must initialize |info->struct_size| to |sizeof(MojoSharedBufferInfo)|
    /// before calling this function.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |buffer_handle| is invalid, |info| is
    ///       null, or |*options| is invalid.
    ///
    /// On success, |info->size| will be set to the size of the buffer. On failure it
    /// is not modified.
    pub fn MojoGetBufferInfo(
        buffer_handle: MojoHandle,
        options: *const MojoGetBufferInfoOptions,
        info: *mut MojoSharedBufferInfo,
    ) -> MojoResult;
}
/// Flags passed to |MojoCreateDataPipe()| via |MojoCreateDataPipeOptions|. See
/// values defined below.
pub type MojoCreateDataPipeFlags = u32;
/// Options passed to |MojoCreateDataPipe()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateDataPipeOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoCreateDataPipeFlags|.
    pub flags: MojoCreateDataPipeFlags,
    /// The size of an element in bytes. All transactions and buffer sizes must
    /// consist of an integral number of elements. Must be non-zero.
    pub element_num_bytes: u32,
    /// The capacity of the data pipe in bytes. Must be a multiple of
    /// |element_num_bytes|. If successfully created, the pipe will always be able
    /// to queue at least this much data. If zero, the pipe buffer will be of a
    /// system-dependent capacity of at least one element in size.
    pub capacity_num_bytes: u32,
}
/// Flags passed to |MojoWriteData()| via |MojoWriteDataOptions|. See values
/// defined below.
pub type MojoWriteDataFlags = u32;
/// Options passed to |MojoWriteData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoWriteDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoWriteDataFlags|.
    pub flags: MojoWriteDataFlags,
}
/// Flags passed to |MojoBeginWriteData()| via |MojoBeginWriteDataOptions|. See
/// values defined below.
pub type MojoBeginWriteDataFlags = u32;
/// Options passed to |MojoBeginWriteData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoBeginWriteDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoBeginWriteDataFlags|.
    pub flags: MojoBeginWriteDataFlags,
}
/// Flags passed to |MojoEndWriteData()| via |MojoEndWriteDataOptions|. See
/// values defined below.
pub type MojoEndWriteDataFlags = u32;
/// Options passed to |MojoEndWriteData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoEndWriteDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoEndWriteDataFlags|.
    pub flags: MojoEndWriteDataFlags,
}
/// Flags passed to |MojoReadData()| via |MojoReadDataOptions|.
pub type MojoReadDataFlags = u32;
/// Options passed to |MojoReadData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoReadDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoReadDataFlags|.
    pub flags: MojoReadDataFlags,
}
/// Flags passed to |MojoBeginReadData()| via |MojoBeginReadDataOptions|. See
/// values defined below.
pub type MojoBeginReadDataFlags = u32;
/// Options passed to |MojoBeginReadData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoBeginReadDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoBeginReadDataFlags|.
    pub flags: MojoBeginReadDataFlags,
}
/// Flags passed to |MojoEndReadData()| via |MojoEndReadDataOptions|. See
/// values defined below.
pub type MojoEndReadDataFlags = u32;
/// Options passed to |MojoEndReadData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoEndReadDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoEndReadDataFlags|.
    pub flags: MojoEndReadDataFlags,
}
unsafe extern "C" {
    /// Creates a data pipe, which is a unidirectional communication channel for
    /// unframed data. Data must be read and written in multiples of discrete
    /// discrete elements of size given in |options|.
    ///
    /// See |MojoCreateDataPipeOptions| for a description of the different options
    /// available for data pipes.
    ///
    /// |options| may be set to null for a data pipe with the default options (which
    /// will have an element size of one byte and have some system-dependent
    /// capacity).
    ///
    /// On success, |*data_pipe_producer_handle| will be set to the handle for the
    /// producer and |*data_pipe_consumer_handle| will be set to the handle for the
    /// consumer. On failure they are not modified.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid, e.g.,
    ///       |*options| is invalid, specified capacity or element size is zero, or
    ///       the specified element size exceeds the specified capacity.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a process/system/quota/etc. limit has
    ///       been reached (e.g., if the requested capacity was too large, or if the
    ///       maximum number of handles was exceeded).
    ///   |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|.
    pub fn MojoCreateDataPipe(
        options: *const MojoCreateDataPipeOptions,
        data_pipe_producer_handle: *mut MojoHandle,
        data_pipe_consumer_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Writes the data pipe producer given by |data_pipe_producer_handle|.
    ///
    /// |elements| points to data of size |*num_bytes|; |*num_bytes| must be a
    /// multiple of the data pipe's element size.
    ///
    /// On success |*num_bytes| is set to the amount of data that was actually
    /// written. On failure it is unmodified.
    ///
    /// |options| may be null for default options. See |MojoWriteDataOptions| for
    /// the effect of various options on the behavior of this function.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_producer_dispatcher| is not a handle to a data pipe
    ///       producer or |*num_bytes| is not a multiple of the data pipe's element
    ///       size.)
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer handle has been
    ///       closed.
    ///   |MOJO_RESULT_OUT_OF_RANGE| if |options->flags| has
    ///       |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set and the required amount of data
    ///       (specified by |*num_bytes|) could not be written.
    ///   |MOJO_RESULT_BUSY| if there is a two-phase write ongoing with
    ///       |data_pipe_producer_handle| (i.e., |MojoBeginWriteData()| has been
    ///       called, but not yet the matching |MojoEndWriteData()|).
    ///   |MOJO_RESULT_SHOULD_WAIT| if no data can currently be written (and the
    ///       consumer is still open) and |options->flags| does *not* have
    ///       |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set.
    pub fn MojoWriteData(
        data_pipe_producer_handle: MojoHandle,
        elements: *const ::std::os::raw::c_void,
        num_bytes: *mut u32,
        options: *const MojoWriteDataOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Begins a two-phase write to the data pipe producer given by
    /// |data_pipe_producer_handle|. On success |*buffer| will be a pointer to which
    /// the caller can write up to |*buffer_num_bytes| bytes of data.
    ///
    /// `*buffer_num_bytes` must be initialized on input. If non-zero it provides a
    /// hint about the number of data bytes the producer is readily able to supply if
    /// if the operation succeeds. If zero, no such hint is assumed and the value is
    /// ignored.
    ///
    /// If MOJO_RESULT_BEGIN_WRITE_DATA_FLAG_ALL_OR_NONE is provided in
    /// `options->flags`, then this hint is a minimum requirement for the operation
    /// to succeed, and on success the output value of `*buffer_num_bytes` will be
    /// at least as large as the input value.
    ///
    /// During a two-phase write, |data_pipe_producer_handle| is *not* writable.
    /// If another caller tries to write to it by calling |MojoWriteData()| or
    /// |MojoBeginWriteData()|, their request will fail with |MOJO_RESULT_BUSY|.
    ///
    /// If |MojoBeginWriteData()| returns MOJO_RESULT_OK and once the caller has
    /// finished writing data to |*buffer|, |MojoEndWriteData()| must be called to
    /// indicate the amount of data actually written and to complete the two-phase
    /// write operation. |MojoEndWriteData()| need not be called when
    /// |MojoBeginWriteData()| fails.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_producer_handle| is not a handle to a data pipe producer or
    ///       |*options| is invalid.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer handle has been
    ///       closed.
    ///   |MOJO_RESULT_BUSY| if there is already a two-phase write ongoing with
    ///       |data_pipe_producer_handle| (i.e., |MojoBeginWriteData()| has been
    ///       called, but not yet the matching |MojoEndWriteData()|).
    ///   |MOJO_RESULT_SHOULD_WAIT| if no data can currently be written (and the
    ///       consumer is still open).
    pub fn MojoBeginWriteData(
        data_pipe_producer_handle: MojoHandle,
        options: *const MojoBeginWriteDataOptions,
        buffer: *mut *mut ::std::os::raw::c_void,
        buffer_num_bytes: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Ends a two-phase write that was previously initiated by
    /// |MojoBeginWriteData()| for the same |data_pipe_producer_handle|.
    ///
    /// |num_bytes_written| must indicate the number of bytes actually written into
    /// the two-phase write buffer. It must be less than or equal to the value of
    /// |*buffer_num_bytes| output by |MojoBeginWriteData()|, and it must be a
    /// multiple of the data pipe's element size.
    ///
    /// On failure, the two-phase write (if any) is ended (so the handle may become
    /// writable again if there's space available) but no data written to |*buffer|
    /// is "put into" the data pipe.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_producer_handle| is not a handle to a data pipe producer or
    ///       |num_bytes_written| is invalid (greater than the maximum value provided
    ///       by |MojoBeginWriteData()| or not a multiple of the element size).
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer is not in a
    ///       two-phase write (e.g., |MojoBeginWriteData()| was not called or
    ///       |MojoEndWriteData()| has already been called).
    pub fn MojoEndWriteData(
        data_pipe_producer_handle: MojoHandle,
        num_bytes_written: u32,
        options: *const MojoEndWriteDataOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Reads data from the data pipe consumer given by |data_pipe_consumer_handle|.
    /// May also be used to discard data or query the amount of data available.
    ///
    /// If |options->flags| has neither |MOJO_READ_DATA_FLAG_DISCARD| nor
    /// |MOJO_READ_DATA_FLAG_QUERY| set, this tries to read up to |*num_bytes| (which
    /// must be a multiple of the data pipe's element size) bytes of data to
    /// |elements| and set |*num_bytes| to the amount actually read. If flags has
    /// |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set, it will either read exactly
    /// |*num_bytes| bytes of data or none. Additionally, if flags has
    /// |MOJO_READ_DATA_FLAG_PEEK| set, the data read will remain in the pipe and be
    /// available to future reads.
    ///
    /// If flags has |MOJO_READ_DATA_FLAG_DISCARD| set, it discards up to
    /// |*num_bytes| (which again must be a multiple of the element size) bytes of
    /// data, setting |*num_bytes| to the amount actually discarded. If flags has
    /// |MOJO_READ_DATA_FLAG_ALL_OR_NONE|, it will either discard exactly
    /// |*num_bytes| bytes of data or none. In this case, |MOJO_READ_DATA_FLAG_QUERY|
    /// must not be set, and |elements| is ignored (and should typically be set to
    /// null).
    ///
    /// If flags has |MOJO_READ_DATA_FLAG_QUERY| set, it queries the amount of data
    /// available, setting |*num_bytes| to the number of bytes available. In this
    /// case, |MOJO_READ_DATA_FLAG_DISCARD| must not be set, and
    /// |MOJO_READ_DATA_FLAG_ALL_OR_NONE| is ignored, as are |elements| and the input
    /// value of |*num_bytes|.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success (see above for a description of the different
    ///       operations).
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_consumer_handle| is invalid, the combination of flags in
    ///       |options->flags| is invalid, or |*options| itself is invalid).
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer handle has been
    ///       closed and data (or the required amount of data) was not available to
    ///       be read or discarded.
    ///   |MOJO_RESULT_OUT_OF_RANGE| if |options->flags| has
    ///       |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set and the required amount of data
    ///       is not available to be read or discarded and the producer is still
    ///       open.
    ///   |MOJO_RESULT_BUSY| if there is a two-phase read ongoing with
    ///       |data_pipe_consumer_handle| (i.e., |MojoBeginReadData()| has been
    ///       called, but not yet the matching |MojoEndReadData()|).
    ///   |MOJO_RESULT_SHOULD_WAIT| if there is no data to be read or discarded (and
    ///       the producer is still open) and |options->flags| does *not* have
    ///       |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set.
    pub fn MojoReadData(
        data_pipe_consumer_handle: MojoHandle,
        options: *const MojoReadDataOptions,
        elements: *mut ::std::os::raw::c_void,
        num_bytes: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Begins a two-phase read from the data pipe consumer given by
    /// |data_pipe_consumer_handle|. On success, |*buffer| will be a pointer from
    /// which the caller can read up to |*buffer_num_bytes| bytes of data.
    ///
    /// During a two-phase read, |data_pipe_consumer_handle| is *not* readable.
    /// If another caller tries to read from it by calling |MojoReadData()| or
    /// |MojoBeginReadData()|, their request will fail with |MOJO_RESULT_BUSY|.
    ///
    /// Once the caller has finished reading data from |*buffer|, |MojoEndReadData()|
    /// must be called to indicate the number of bytes read and to complete the
    /// two-phase read operation.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_consumer_handle| is not a handle to a data pipe consumer,
    ///       or |*options| is invalid.)
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer handle has been
    ///       closed.
    ///   |MOJO_RESULT_BUSY| if there is already a two-phase read ongoing with
    ///       |data_pipe_consumer_handle| (i.e., |MojoBeginReadData()| has been
    ///       called, but not yet the matching |MojoEndReadData()|).
    ///   |MOJO_RESULT_SHOULD_WAIT| if no data can currently be read (and the
    ///       producer is still open).
    pub fn MojoBeginReadData(
        data_pipe_consumer_handle: MojoHandle,
        options: *const MojoBeginReadDataOptions,
        buffer: *mut *const ::std::os::raw::c_void,
        buffer_num_bytes: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Ends a two-phase read from the data pipe consumer given by
    /// |data_pipe_consumer_handle| that was begun by a call to |MojoBeginReadData()|
    /// on the same handle. |num_bytes_read| should indicate the amount of data
    /// actually read; it must be less than or equal to the value of
    /// |*buffer_num_bytes| output by |MojoBeginReadData()| and must be a multiple of
    /// the element size.
    ///
    /// On failure, the two-phase read (if any) is ended (so the handle may become
    /// readable again) but no data is "removed" from the data pipe.
    ///
    /// |options| may be null for default options.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |data_pipe_consumer_handle| is not a handle to a data pipe consumer or
    ///       |num_bytes_written| is greater than the maximum value provided by
    ///       |MojoBeginReadData()| or not a multiple of the element size).
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer is not in a
    ///       two-phase read (e.g., |MojoBeginReadData()| was not called or
    ///       |MojoEndReadData()| has already been called).
    pub fn MojoEndReadData(
        data_pipe_consumer_handle: MojoHandle,
        num_bytes_read: u32,
        options: *const MojoEndReadDataOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Initializes Mojo in the calling application.
    ///
    /// With the exception of Mojo Core embedders, applications using Mojo APIs must
    /// call this function before any others.
    ///
    /// |options| may be null.
    ///
    /// If the |MOJO_INITIALIZE_FLAG_LOAD_ONLY| flag is given in |options|, this only
    /// partially initializes the library. Other Mojo APIs will remain unavailable
    /// until the library is fully initialized by a subsequent call to
    /// |MojoInitialize()| WITHOUT the flag. See documentation on
    /// |MOJO_INITIALIZE_FLAG_LOAD_ONLY| in types.h for details.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if Mojo initialization was successful.
    ///   |MOJO_RESULT_NOT_FOUND| if the Mojo Core library could not be loaded or
    ///       appears to be malformed.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the Mojo Core library AND full IPC
    ///       support has already been initialized by some prior call(s) to
    ///       |MojoInitialize()|.
    ///   |MOJO_RESULT_ALREADY_EXISTS| if |MOJO_INITIALIZE_FLAG_LOAD_ONLY| was
    ///       specified for this call but the library has already been successfully
    ///       loaded and partially initialized by a previous call with the same flag.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |options| was non-null and invalid.
    pub fn MojoInitialize(options: *const MojoInitializeOptions) -> MojoResult;
}
unsafe extern "C" {
    /// Shuts down Mojo in the calling application.
    ///
    /// This should only be called if |MojoInitialize()| was also called at some
    /// point in the calling process. It therefore only applies to consumers of Mojo
    /// as a shared library, not Mojo Core embedders.
    ///
    /// |options| may be null.
    ///
    /// NOTE: It is NOT safe to attempt to call |MojoInitialize()| again (or any
    /// other Mojo APIs, for that matter) after calling |MojoShutdown()|.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if shutdown was successful.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |options| was non-null and invalid.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if |MojoInitialize()| was never called.
    ///   |MOJO_RESULT_UNIMPLEMENTED| if the caller is a Mojo Core embedder and is
    ///       therefore not loading Mojo Core as a shared library.
    pub fn MojoShutdown(options: *const MojoShutdownOptions) -> MojoResult;
}
unsafe extern "C" {
    /// Returns the time, in microseconds, since some undefined point in the past.
    /// The values are only meaningful relative to other values that were obtained
    /// from the same device without an intervening system restart. Such values are
    /// guaranteed to be monotonically non-decreasing with the passage of real time.
    /// Although the units are microseconds, the resolution of the clock may vary and
    /// is typically in the range of ~1-15 ms.
    pub fn MojoGetTimeTicksNow() -> MojoTimeTicks;
}
unsafe extern "C" {
    /// Closes the given |handle|.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle.
    ///
    /// Concurrent operations on |handle| may succeed (or fail as usual) if they
    /// happen before the close, be cancelled with result |MOJO_RESULT_CANCELLED| if
    /// they properly overlap (this is likely the case with traps), or fail with
    /// |MOJO_RESULT_INVALID_ARGUMENT| if they happen after.
    pub fn MojoClose(handle: MojoHandle) -> MojoResult;
}
unsafe extern "C" {
    /// Queries the last known signals state of a handle.
    ///
    /// Note that no guarantees can be made about the accuracy of the returned
    /// signals state by the time this returns, as other threads in the system may
    /// change the handle's state at any time. Use with appropriate discretion.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success. |*signals_state| is populated with the
    ///       last known signals state of |handle|.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle or
    ///       |signals_state| is null.
    pub fn MojoQueryHandleSignalsState(
        handle: MojoHandle,
        signals_state: *mut MojoHandleSignalsState,
    ) -> MojoResult;
}
/// The type of handle value contained in a |MojoPlatformHandle| structure.
pub type MojoPlatformHandleType = u32;
/// Represents a native platform handle value for coersion to or from a wrapping
/// Mojo handle.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoPlatformHandle {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// The type of platform handle represented by |value|.
    pub type_: MojoPlatformHandleType,
    /// An opaque representation of the native platform handle. Interpretation and
    /// treatment of this value by Mojo depends on the value of |type|.
    pub value: u64,
}
/// Flags passed to |MojoWrapPlatformHandle()| via
/// |MojoWrapPlatformHandleOptions|.
pub type MojoWrapPlatformHandleFlags = u32;
/// Options passed to |MojoWrapPlatformHandle()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoWrapPlatformHandleOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoWrapPlatformHandleFlags|.
    pub flags: MojoWrapPlatformHandleFlags,
}
/// Flags passed to |MojoUnwrapPlatformHandle()| via
/// |MojoUnwrapPlatformHandleOptions|.
pub type MojoUnwrapPlatformHandleFlags = u32;
/// Options passed to |MojoUnwrapPlatformHandle()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoUnwrapPlatformHandleOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoUnwrapPlatformHandleFlags|.
    pub flags: MojoUnwrapPlatformHandleFlags,
}
/// A GUID value used to identify the shared memory region backing a Mojo shared
/// buffer handle.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoSharedBufferGuid {
    pub high: u64,
    pub low: u64,
}
/// The access type of shared memory region wrapped by a Mojo shared buffer
/// handle. See values defined below.
pub type MojoPlatformSharedMemoryRegionAccessMode = u32;
/// Flags passed to |MojoWrapPlatformSharedMemoryRegion()| via
/// |MojoWrapPlatformSharedMemoryRegionOptions|.
pub type MojoWrapPlatformSharedMemoryRegionFlags = u32;
/// Options passed to |MojoWrapPlatformSharedMemoryRegion()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoWrapPlatformSharedMemoryRegionOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoWrapPlatformSharedMemoryRegionFlags|.
    pub flags: MojoWrapPlatformSharedMemoryRegionFlags,
}
/// Flags passed to |MojoUnwrapPlatformSharedMemoryRegion()| via
/// |MojoUnwrapPlatformSharedMemoryRegionOptions|.
pub type MojoUnwrapPlatformSharedMemoryRegionFlags = u32;
/// Options passed to |MojoUnwrapPlatformSharedMemoryRegion()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoUnwrapPlatformSharedMemoryRegionOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoUnwrapPlatformSharedMemoryRegionFlags|.
    pub flags: MojoUnwrapPlatformSharedMemoryRegionFlags,
}
unsafe extern "C" {
    /// Wraps a native platform handle as a Mojo handle which can be transferred
    /// over a message pipe. Takes ownership of the underlying native platform
    /// object. i.e. if you wrap a POSIX file descriptor or Windows HANDLE and then
    /// call |MojoClose()| on the resulting MojoHandle, the underlying file
    /// descriptor or HANDLE will be closed.
    ///
    /// |platform_handle|: The platform handle to wrap.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///     |MOJO_RESULT_OK| if the handle was successfully wrapped. In this case
    ///         |*mojo_handle| contains the Mojo handle of the wrapped object.
    ///     |MOJO_RESULT_RESOURCE_EXHAUSTED| if the system is out of handles.
    ///     |MOJO_RESULT_INVALID_ARGUMENT| if |platform_handle| was not a valid
    ///          platform handle.
    ///
    /// NOTE: It is not always possible to detect if |platform_handle| is valid,
    /// particularly when |platform_handle->type| is valid but
    /// |platform_handle->value| does not represent a valid platform object.
    pub fn MojoWrapPlatformHandle(
        platform_handle: *const MojoPlatformHandle,
        options: *const MojoWrapPlatformHandleOptions,
        mojo_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Unwraps a native platform handle from a Mojo handle. If this call succeeds,
    /// ownership of the underlying platform object is assumed by the caller. The
    /// The Mojo handle is always closed regardless of success or failure.
    ///
    /// |mojo_handle|: The Mojo handle from which to unwrap the native platform
    ///     handle.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///     |MOJO_RESULT_OK| if the handle was successfully unwrapped. In this case
    ///         |*platform_handle| contains the unwrapped platform handle.
    ///     |MOJO_RESULT_INVALID_ARGUMENT| if |mojo_handle| was not a valid Mojo
    ///         handle wrapping a platform handle.
    pub fn MojoUnwrapPlatformHandle(
        mojo_handle: MojoHandle,
        options: *const MojoUnwrapPlatformHandleOptions,
        platform_handle: *mut MojoPlatformHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Wraps a native platform shared memory region with a Mojo shared buffer handle
    /// which can be used exactly like a shared buffer handle created by
    /// |MojoCreateSharedBuffer()| or |MojoDuplicateBufferHandle()|.
    ///
    /// Takes ownership of the native platform shared buffer handle(s).
    ///
    /// |platform_handles|: The platform handle(s) to wrap. Must be one or more
    ///     native handles representing a shared memory region. On POSIX systems
    ///     with |access_mode| set to
    ///     |MOJO_PLATFORM_SHARED_MEMORY_REGION_ACCESS_MODE_WRITABLE| this must have
    ///     two handles, with the second one being a handle opened for read-only
    ///     mapping. For all other platforms and all other access modes, there should
    ///     be only one handle.
    /// |num_platform_handles|: The number of platform handles given in
    ///     |platform_handles|. See note above.
    /// |num_bytes|: The size of the shared memory region in bytes.
    /// |access_mode|: The current access mode of the shared memory region.
    /// |options|: Options to control behavior. May be null.
    ///
    /// !!WARNING!!: |access_mode| DOES NOT CONTROL ACCESS TO THE REGION. It is an
    /// informational field used by Mojo to ensure end-to-end consistency when
    /// wrapping and unwrapping region handles. The caller is responsible for
    /// ensuring that wrapped handles are already subject to the access constraints
    /// conveyed by |access_mode|.
    ///
    /// Returns:
    ///     |MOJO_RESULT_OK| if the handle was successfully wrapped. In this case
    ///         |*mojo_handle| contains a Mojo shared buffer handle.
    ///     |MOJO_RESULT_INVALID_ARGUMENT| if |platform_handle| was not a valid
    ///         platform shared buffer handle.
    pub fn MojoWrapPlatformSharedMemoryRegion(
        platform_handles: *const MojoPlatformHandle,
        num_platform_handles: u32,
        num_bytes: u64,
        guid: *const MojoSharedBufferGuid,
        access_mode: MojoPlatformSharedMemoryRegionAccessMode,
        options: *const MojoWrapPlatformSharedMemoryRegionOptions,
        mojo_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Unwraps a native platform shared memory region from a Mojo shared buffer
    /// handle. If this call succeeds, ownership of the underlying shared buffer
    /// object is assumed by the caller.
    ///
    /// The Mojo handle is always closed regardless of success or failure.
    ///
    /// |mojo_handle|: The Mojo shared buffer handle to unwrap.
    ///
    /// On input, |*num_platform_handles| must be non-zero, and |platform_handles|
    /// should point to enough memory to hold at least that many |MojoPlatformHandle|
    /// values. Each element in |platform_handles| must have also initialized
    /// |struct_size| to the caller's known |sizeof(MojoPlatformHandle)|.
    ///
    /// |platform_handles|, |num_platform_handles|, |num_bytes| and |access_mode| are
    /// all used to receive output values and MUST always be non-null.
    ///
    /// |options| may be null.
    ///
    /// NOTE: On POSIX systems when unwrapping regions with the
    /// |MOJO_PLATFORM_SHARED_MEMORY_REGION_ACCESS_MODE_WRITABLE| access mode,
    /// this will always unwrap two platform handles, with the first one being a
    /// POSIX file descriptor which can be mapped to writable memory, and the second
    /// one being a POSIX file descriptor which can only be mapped read-only. For all
    /// other access modes and all other platforms, this always unwraps to a single
    /// platform handle.
    ///
    /// Returns:
    ///    |MOJO_RESULT_OK| if the handle was successfully unwrapped. In this case
    ///        |*platform_handles| contains one or more platform handles to represent
    ///        the unwrapped region, |*num_platform_handles| contains the number of
    ///        platform handles actually stored in |platform_handles| on output,
    ///        |*num_bytes| contains the size of the shared buffer object, and
    ///        |*access_mode| indicates the access mode of the region.
    ///    |MOJO_RESULT_INVALID_ARGUMENT| if |mojo_handle| is not a valid Mojo
    ///        shared buffer handle or |*num_platform_handles| is not large enough
    ///        to hold all the handles that would have been unwrapped on success.
    pub fn MojoUnwrapPlatformSharedMemoryRegion(
        mojo_handle: MojoHandle,
        options: *const MojoUnwrapPlatformSharedMemoryRegionOptions,
        platform_handles: *mut MojoPlatformHandle,
        num_platform_handles: *mut u32,
        num_bytes: *mut u64,
        guid: *mut MojoSharedBufferGuid,
        access_mode: *mut MojoPlatformSharedMemoryRegionAccessMode,
    ) -> MojoResult;
}
/// Flags included in |MojoProcessErrorDetails| indicating additional status
/// information.
pub type MojoProcessErrorFlags = u32;
/// Details regarding why an invited process has had its connection to this
/// process terminated by the system. See |MojoProcessErrorHandler| and
/// |MojoSendInvitation()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoProcessErrorDetails {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// The length of the string pointed to by |error_message| below.
    pub error_message_length: u32,
    /// An error message corresponding to the reason why the connection was
    /// terminated. This is an information message which may be useful to
    /// developers.
    pub error_message: *const ::std::os::raw::c_char,
    /// See |MojoProcessErrorFlags|.
    pub flags: MojoProcessErrorFlags,
}
/// An opaque process handle value which must be provided when sending an
/// invitation to another process via a platform transport. See
/// |MojoSendInvitation()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoPlatformProcessHandle {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// The process handle value. For Windows this is a valid process HANDLE value.
    /// For Fuchsia it must be |zx_handle_t| process handle, and for all other
    /// POSIX systems, it's a PID.
    pub value: u64,
}
/// Enumeration indicating the type of transport over which an invitation will be
/// sent or received.
pub type MojoInvitationTransportType = u32;
/// A transport endpoint over which an invitation may be sent or received via
/// |MojoSendInvitation()| or |MojoAcceptInvitation()| respectively.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoInvitationTransportEndpoint {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// The type of this transport endpoint. See |MojoInvitationTransportType|.
    pub type_: MojoInvitationTransportType,
    /// The number of platform handles in |platform_handles| below.
    pub num_platform_handles: u32,
    /// Platform handle(s) corresponding to the system object(s) backing this
    /// endpoint. The concrete type of the handle(s) depends on |type|.
    ///
    /// For |MOJO_INVITATION_TRANSPORT_TYPE_CHANNEL| endpoints:
    ///   - On Windows, this is a single named pipe HANDLE
    ///   - On Fuchsua, this is a single channel Fuchsia handle
    ///   - On other POSIX systems, this is a single Unix domain socket file
    ///     descriptor.
    pub platform_handles: *const MojoPlatformHandle,
}
/// Flags passed to |MojoCreateInvitation()| via |MojoCreateInvitationOptions|.
pub type MojoCreateInvitationFlags = u32;
/// Options passed to |MojoCreateInvitation()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateInvitationOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoCreateInvitationFlags|.
    pub flags: MojoCreateInvitationFlags,
}
/// Flags passed to |MojoAttachMessagePipeToInvitation()| via
/// |MojoAttachMessagePipeToInvitationOptions|.
pub type MojoAttachMessagePipeToInvitationFlags = u32;
/// Options passed to |MojoAttachMessagePipeToInvitation()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoAttachMessagePipeToInvitationOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoAttachMessagePipeToInvitationFlags|.
    pub flags: MojoAttachMessagePipeToInvitationFlags,
}
/// Flags passed to |MojoExtractMessagePipeFromInvitation()| via
/// |MojoExtractMessagePipeFromInvitationOptions|.
pub type MojoExtractMessagePipeFromInvitationFlags = u32;
/// Options passed to |MojoExtractMessagePipeFromInvitation()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoExtractMessagePipeFromInvitationOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoExtractMessagePipeFromInvitationFlags|.
    pub flags: MojoExtractMessagePipeFromInvitationFlags,
}
/// Flags passed to |MojoSendInvitation()| via |MojoSendInvitationOptions|.
pub type MojoSendInvitationFlags = u32;
/// Options passed to |MojoSendInvitation()|.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoSendInvitationOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoSendInvitationFlags|.
    pub flags: MojoSendInvitationFlags,
    /// If |flags| includes |MOJO_SEND_INVITATION_FLAG_ISOLATED| then these fields
    /// specify a name identifying the established isolated connection. There are
    /// no restrictions on the value given. If |isolated_connection_name_length| is
    /// non-zero, the system ensures that only one isolated process connection can
    /// exist for the given name at any time.
    pub isolated_connection_name: *const ::std::os::raw::c_char,
    pub isolated_connection_name_length: u32,
}
/// Flags passed to |MojoAcceptInvitation()| via |MojoAcceptInvitationOptions|.
pub type MojoAcceptInvitationFlags = u32;
/// Options passed to |MojoAcceptInvitation()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoAcceptInvitationOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoAcceptInvitationFlags|.
    pub flags: MojoAcceptInvitationFlags,
}
/// Flags passed to |MojoSetDefaultProcessErrorHandler()| via
/// |MojoSetDefaultProcessErrorHandlerOptions|.
pub type MojoSetDefaultProcessErrorHandlerFlags = u32;
/// Options passed to |MojoSetDefaultProcessErrorHandler()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoSetDefaultProcessErrorHandlerOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoSetDefaultProcessErrorHandlerFlags|.
    pub flags: MojoSetDefaultProcessErrorHandlerFlags,
}
/// A callback which may be invoked by the system when a connection to an invited
/// process is terminated due to a communication error (i.e. the invited process
/// has sent a message which fails some validation check in the system). See
/// |MojoSendInvitation()|.
///
/// |context| is the value of |context| given to |MojoSendInvitation()| when
/// inviting the process for whom this callback is being invoked.
pub type MojoProcessErrorHandler = ::std::option::Option<
    unsafe extern "C" fn(context: usize, details: *const MojoProcessErrorDetails),
>;
/// Similar to above, but registered globally via
/// |MojoSetDefaultProcessErrorHandler()| and invoked only for communication
/// errors regarding processes NOT invited by the calling process.
pub type MojoDefaultProcessErrorHandler =
    ::std::option::Option<unsafe extern "C" fn(details: *const MojoProcessErrorDetails)>;
unsafe extern "C" {
    /// Creates a new invitation to be sent to another process.
    ///
    /// An invitation is used to invite another process to join this process's
    /// IPC network. The caller must already be a member of a Mojo network, either
    /// either by itself having been previously invited, or by being the Mojo broker
    /// process initialized via the Mojo Core Embedder API.
    ///
    /// Invitations can have message pipes attached to them, and these message pipes
    /// are used to bootstrap Mojo IPC between the inviter and the invitee. See
    /// |MojoAttachMessagePipeToInvitation()| for attaching message pipes, and
    /// |MojoSendInvitation()| for sending an invitation.
    ///
    /// |options| controls behavior. May be null for default behavior.
    /// |invitation_handle| must be the address of storage for a MojoHandle value
    ///     to be output upon success.
    ///
    /// NOTE: If discarding an invitation instead of sending it with
    /// |MojoSendInvitation()|, you must close its handle (i.e. |MojoClose()|) to
    /// avoid leaking associated system resources.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the invitation was created successfully. The new
    ///       invitation's handle is stored in |*invitation_handle| before returning.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |options| was non-null but malformed.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a handle could not be allocated for the
    ///       new invitation.
    pub fn MojoCreateInvitation(
        options: *const MojoCreateInvitationOptions,
        invitation_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Attaches a message pipe endpoint to an invitation.
    ///
    /// This creates a new message pipe which will span the boundary between the
    /// calling process and the invitation's eventual target process. One end of the
    /// new pipe is attached to the invitation while the other end is returned to the
    /// caller. Every attached message pipe has an arbitrary |name| value which
    /// identifies it within the invitation.
    ///
    /// Message pipes can be extracted by the recipient by calling
    /// |MojoExtractMessagePipeFromInvitation()|. It is up to applications to
    /// communicate out-of-band or establish a convention for how attached pipes
    /// are named.
    ///
    /// |invitation_handle| is the invitation to which a pipe should be attached.
    /// |name| is an arbitrary name to give this pipe, required to extract the pipe
    ///     on the receiving end of the invitation. Note that the name is scoped to
    ///     this invitation only, so e.g. multiple invitations may attach pipes with
    ///     the name "foo", but any given invitation may only have a single pipe
    ///     attached with that name.
    /// |name_num_bytes| is the number of bytes from |name| to use as the name.
    /// |options| controls behavior. May be null for default behavior.
    /// |message_pipe_handle| is the address of storage for a MojoHandle value.
    ///     Upon success, the handle of the local endpoint of the new message pipe
    ///     will be stored here.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the pipe was created and attached successfully. The
    ///       local endpoint of the pipe has its handle stored in
    ///       |*message_pipe_handle| before returning. The other endpoint is attached
    ///       to the invitation.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |invitation_handle| was not an invitation
    ///       handle, |options| was non-null but malformed, or |message_pipe_handle|
    ///       was null.
    ///   |MOJO_RESULT_ALREADY_EXISTS| if |name| was already in use for this
    ///       invitation.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a handle could not be allocated for the
    ///       new local message pipe endpoint.
    pub fn MojoAttachMessagePipeToInvitation(
        invitation_handle: MojoHandle,
        name: *const ::std::os::raw::c_void,
        name_num_bytes: u32,
        options: *const MojoAttachMessagePipeToInvitationOptions,
        message_pipe_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Extracts a message pipe endpoint from an invitation.
    ///
    /// |invitation_handle| is the invitation from which to extract the endpoint.
    /// |name| is the name of the endpoint within the invitation. This corresponds
    ///     to the name that was given to |MojoAttachMessagePipeToInvitation()| when
    ///     the endpoint was attached.
    /// |name_num_bytes| is the number of bytes from |name| to use as the name.
    /// |options| controls behavior. May be null for default behavior.
    /// |message_pipe_handle| is the address of storage for a MojoHandle value.
    ///     Upon success, the handle of the extracted message pipe endpoint will be
    ///     stored here.
    ///
    /// Note that it is possible to extract an endpoint from an invitation even
    /// before the invitation has been sent to a remote process. If this is done and
    /// then the invitation is sent, the receiver will not see this endpoint as it
    /// will no longer be attached.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if a new local message pipe endpoint was successfully
    ///       created and returned in |*message_pipe_handle|. Note that the
    ///       association of this endpoint with an invitation attachment is
    ///       necessarily an asynchronous operation, and it is not known at return
    ///       whether an attachment named |name| actually exists on the invitation.
    ///       As such, the operation may still fail eventually, resuling in a broken
    ///       pipe, i.e. the extracted pipe will signal peer closure.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |invitation_handle| was not an invitation
    ///       handle, |options| was non-null but malformed, or |message_pipe_handle|
    ///       was null.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a handle could not be allocated for the
    ///       new local message pipe endpoint.
    ///   |MOJO_RESULT_NOT_FOUND| if it is known at call time that there is no pipe
    ///       named |name| attached to the invitation. This is possible if the
    ///       invtation was created within the calling process by
    ///       |MojoCreateInvitation()|.
    pub fn MojoExtractMessagePipeFromInvitation(
        invitation_handle: MojoHandle,
        name: *const ::std::os::raw::c_void,
        name_num_bytes: u32,
        options: *const MojoExtractMessagePipeFromInvitationOptions,
        message_pipe_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Sends an invitation on a transport endpoint to bootstrap IPC between the
    /// calling process and another process.
    ///
    /// |invitation_handle| is the handle of the invitation to send.
    /// |process_handle| is an opaque, platform-specific handle to the remote
    ///     process. See |MojoPlatformProcessHandle|. This is not necessarily
    ///     required to be a valid process handle, but on some platforms (namely
    ///     Windows and Mac) it's important if the invitation target will need to
    ///     send or receive any kind of platform handles (including shared memory)
    ///     over Mojo message pipes.
    /// |transport_endpoint| is one endpoint of a platform transport primitive, the
    ///     other endpoint of which should be established within the process
    ///     corresponding to |*process_handle|. See |MojoInvitationTransportEndpoint|
    ///     for details.
    /// |error_handler| is a function to invoke if the connection to the invitee
    ///     encounters any kind of error condition, e.g. a message validation failure
    ///     reported by |MojoNotifyBadMessage()|, or permanent disconnection. See
    ///     |MojoProcessErrorDetails| for more information.
    /// |error_handler_context| is an arbitrary value to be associated with this
    ///     process invitation. This value is passed as the |context| argument to
    ///     |error_handler| when invoked regarding this invitee.
    /// |options| controls behavior. May be null for default behavior.
    ///
    /// This assumes ownership of any platform handles in |transport_endpoint| if
    /// and only if returning |MOJO_RESULT_OK|. In that case, |invitation_handle| is
    /// also invalidated.
    ///
    /// NOTE: It's pointless to send an invitation without at least one message pipe
    /// attached, so it is considered an error to attempt to do so.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the invitation was successfully sent over the
    ///       transport. |invitation_handle| is implicitly closed. Note that this
    ///       does not guarantee that the invitation has been received by the target
    ///       yet, or that it ever will be (e.g. the target process may terminate
    ///       first or simply fail to accept the invitation).
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |invitation_handle| was not an invitation
    ///       handle, |transport_endpoint| was null or malformed, or |options| was
    ///       non-null but malformed.
    ///   |MOJO_RESULT_ABORTED| if the system failed to issue any necessary
    ///       communication via |transport_endpoint|, possibly due to a configuration
    ///       issue with the endpoint. The caller may attempt to correct this
    ///       situation and call again.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if there were no message pipes attached
    ///       to the invitation. The caller may correct this situation and call
    ///       again.
    ///   |MOJO_RESULT_UNIMPLEMENTED| if the transport endpoint type is not supported
    ///       by the system's version of Mojo.
    pub fn MojoSendInvitation(
        invitation_handle: MojoHandle,
        process_handle: *const MojoPlatformProcessHandle,
        transport_endpoint: *const MojoInvitationTransportEndpoint,
        error_handler: MojoProcessErrorHandler,
        error_handler_context: usize,
        options: *const MojoSendInvitationOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Accepts an invitation from a transport endpoint to complete IPC bootstrapping
    /// between the calling process and whoever sent the invitation from the other
    /// end of the transport.
    ///
    /// |transport_endpoint| is one endpoint of a platform transport primitive, the
    ///     other endpoint of which should be established within a process
    ///     who has sent or will send an invitation via that endpoint. See
    ///     |MojoInvitationTransportEndpoint| for details.
    /// |options| controls behavior. May be null for default behavior.
    /// |invitation_handle| is the address of storage for a MojoHandle value. Upon
    ///     success, the handle of the accepted invitation will be stored here.
    ///
    /// Once an invitation is accepted, message pipes endpoints may be extracted from
    /// it by calling |MojoExtractMessagePipeFromInvitation()|.
    ///
    /// Note that it is necessary to eventually close (i.e. |MojoClose()|) any
    /// accepted invitation handle in order to clean up any associated system
    /// resources. If an accepted invitation is closed while it still has message
    /// pipes attached (i.e. not exracted as above), those pipe endpoints are also
    /// closed.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the invitation was successfully accepted. The handle
    ///       to the invitation is stored in |*invitation_handle| before returning.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |transport_endpoint| was null or
    ///       malfored, |options| was non-null but malformed, or |invitation_handle|
    ///       was null.
    ///   |MOJO_RESULT_ABORTED| if the system failed to receive any communication via
    ///       |transport_endpoint|, possibly due to some configuration error. The
    ///       caller may attempt to correct this situation and call again.
    ///   |MOJO_RESULT_UNIMPLEMENTED| if the transport endpoint type is not supported
    ///       by the system's version of Mojo.
    pub fn MojoAcceptInvitation(
        transport_endpoint: *const MojoInvitationTransportEndpoint,
        options: *const MojoAcceptInvitationOptions,
        invitation_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Registers a process-wide handler to be invoked when an error is raised on a
    /// connection to a peer process. Such errors can be raised if the peer process
    /// sends malformed data to this process.
    ///
    /// Note that this handler is only invoked for connections to processes NOT
    /// explicitly invited by this process. To handle errors concerning processes
    /// invited by this process, see the MojoProcessErrorHandler argument to
    /// |MojoSendInvitation()|.
    ///
    /// The general use case for this API is to be able to log or report instances of
    /// bad IPCs received by a client process which no real ability or authority to
    /// identify the source.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if |handler| is successfully registered as the global
    ///       default process error handler within the calling process. If |handler|
    ///       is null, any registered default process error handler is removed.
    ///   |MOJO_RESULT_ALREADY_EXISTS| if |handler| is non-null and there is already
    ///       a registered error handler. Callers wishing to replace an existing
    ///       handler must first call |MojoSetDefaultProcessErrorHandler()| with null
    ///       in order to do so.
    pub fn MojoSetDefaultProcessErrorHandler(
        handler: MojoDefaultProcessErrorHandler,
        options: *const MojoSetDefaultProcessErrorHandlerOptions,
    ) -> MojoResult;
}
/// Used to refer to message objects created by |MojoCreateMessage()|.
pub type MojoMessageHandle = usize;
/// Flags passed to |MojoCreateMessagePipe()| via |MojoCreateMessagePipeOptions|.
/// See values defined below.
pub type MojoCreateMessagePipeFlags = u32;
/// Options passed to |MojoCreateMessagePipe()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateMessagePipeOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoCreateMessagePipeFlags|.
    pub flags: MojoCreateMessagePipeFlags,
}
/// Flags passed to |MojoWriteMessage()| via |MojoWriteMessageOptions|. See
/// values defined below.
pub type MojoWriteMessageFlags = u32;
/// Options passed to |MojoWriteMessage()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoWriteMessageOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoWriteMessageFlags|.
    pub flags: MojoWriteMessageFlags,
}
/// Flags passed to |MojoReadMessage()| via |MojoReadMessageOptions|. See values
/// defined below.
pub type MojoReadMessageFlags = u32;
/// Options passed to |MojoReadMessage()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoReadMessageOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoReadMessageFlags|.
    pub flags: MojoReadMessageFlags,
}
/// Flags passed to |MojoFuseMessagePipes()| via |MojoFuseMessagePipeOptions|.
/// See values defined below.
pub type MojoFuseMessagePipesFlags = u32;
/// Options passed to |MojoFuseMessagePipes()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoFuseMessagePipesOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoFuseMessagePipesFlags|.
    pub flags: MojoFuseMessagePipesFlags,
}
/// Flags passed to |MojoCreateMessage()| via |MojoCreateMessageOptions|.
pub type MojoCreateMessageFlags = u32;
/// Options passed to |MojoCreateMessage()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateMessageOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoCreateMessageFlags|.
    pub flags: MojoCreateMessageFlags,
}
/// Flags passed to |MojoSerializeMessage()| via |MojoSerializeMessageOptions|.
pub type MojoSerializeMessageFlags = u32;
/// Options passed to |MojoSerializeMessage()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoSerializeMessageOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoSerializeMessageFlags|.
    pub flags: MojoSerializeMessageFlags,
}
/// Flags passed to |MojoAppendMessageData()| via |MojoAppendMessageDataOptions|.
pub type MojoAppendMessageDataFlags = u32;
/// Options passed to |MojoAppendMessageData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoAppendMessageDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoAppendMessageDataFlags|.
    pub flags: MojoAppendMessageDataFlags,
}
/// Flags passed to |MojoGetMessageData()| via |MojoGetMessageDataOptions|.
pub type MojoGetMessageDataFlags = u32;
/// Options passed to |MojoGetMessageData()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoGetMessageDataOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoGetMessageDataFlags|.
    pub flags: MojoGetMessageDataFlags,
}
/// Flags passed to |MojoSetMessageContext()| via |MojoSetMessageContextOptions|.
pub type MojoSetMessageContextFlags = u32;
/// Options passed to |MojoSetMessageContext()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoSetMessageContextOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoSetMessageContextFlags|.
    pub flags: MojoSetMessageContextFlags,
}
/// Flags passed to |MojoGetMessageContext()| via |MojoGetMessageContextOptions|.
pub type MojoGetMessageContextFlags = u32;
/// Options passed to |MojoGetMessageContext()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoGetMessageContextOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoGetMessageContextFlags|.
    pub flags: MojoGetMessageContextFlags,
}
/// Flags passed to |MojoNotifyBadMessage()| via |MojoNotifyBadMessageOptions|.
pub type MojoNotifyBadMessageFlags = u32;
/// Options passed to |MojoNotifyBadMessage()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoNotifyBadMessageOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoNotifyBadMessageFlags|.
    pub flags: MojoNotifyBadMessageFlags,
}
/// A callback which can serialize a message given some context. Passed to
/// |MojoSetMessageContext()| along with a context it knows how to serialize.
/// See |MojoSetMessageContext()| for more details.
///
///   |message| is a message object which had |context| attached.
///   |context| the context which was attached to |message|.
///
/// Note that the context is always detached from the message immediately before
/// this callback is invoked, and that the associated destructor (if any) is also
/// invoked on |context| immediately after the serializer returns.
pub type MojoMessageContextSerializer =
    ::std::option::Option<unsafe extern "C" fn(message: MojoMessageHandle, context: usize)>;
/// A callback which can be used to destroy a message context after serialization
/// or in the event that the message to which it's attached is destroyed without
/// ever being serialized.
pub type MojoMessageContextDestructor = ::std::option::Option<unsafe extern "C" fn(context: usize)>;
unsafe extern "C" {
    /// Creates a message pipe, which is a bidirectional communication channel for
    /// framed data (i.e., messages). Messages can contain plain data and/or Mojo
    /// handles.
    ///
    /// |options| may be set to null for a message pipe with the default options.
    ///
    /// On success, |*message_pipe_handle0| and |*message_pipe_handle1| are set to
    /// handles for the two endpoints (ports) for the message pipe.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid (e.g.,
    ///       |*options| is invalid).
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a process/system/quota/etc. limit has
    ///       been reached.
    pub fn MojoCreateMessagePipe(
        options: *const MojoCreateMessagePipeOptions,
        message_pipe_handle0: *mut MojoHandle,
        message_pipe_handle1: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Writes a message to the message pipe endpoint given by |message_pipe_handle|.
    ///
    /// Note that regardless of success or failure, |message| is destroyed by this
    /// call and therefore invalidated.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success (i.e., the message was enqueued).
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message_pipe_handle| or |message| is
    ///       invalid.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed.
    ///       Note that closing an endpoint is not necessarily synchronous (e.g.,
    ///       across processes), so this function may succeed even if the other
    ///       endpoint has been closed (in which case the message would be dropped).
    ///   |MOJO_RESULT_NOT_FOUND| if |message| has neither a context nor serialized
    ///       buffer attached and therefore has nothing to be written.
    pub fn MojoWriteMessage(
        message_pipe_handle: MojoHandle,
        message: MojoMessageHandle,
        options: *const MojoWriteMessageOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Reads the next message from a message pipe and returns a message as an opaque
    /// message handle. The returned message must eventually be destroyed using
    /// |MojoDestroyMessage()|.
    ///
    /// Message payload and handles can be accessed using |MojoGetMessageData()|. For
    /// Unserialized messages, context may be accessed using
    /// |MojoGetMessageContext()|.
    ///
    /// |options| may be null. |message| must be non-null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success (i.e., a message was actually read).
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if some argument was invalid.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if the other endpoint has been closed
    ///       and there are no more messages to read.
    ///   |MOJO_RESULT_SHOULD_WAIT| if no message was available to be read.
    pub fn MojoReadMessage(
        message_pipe_handle: MojoHandle,
        options: *const MojoReadMessageOptions,
        message: *mut MojoMessageHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Fuses two message pipe endpoints together. Given two pipes:
    ///
    ///     A <-> B    and    C <-> D
    ///
    /// Fusing handle B and handle C results in a single pipe:
    ///
    ///     A <-> D
    ///
    /// Handles B and C are ALWAYS closed. Any unread messages at C will eventually
    /// be delivered to A, and any unread messages at B will eventually be delivered
    /// to D.
    ///
    /// NOTE: A handle may only be fused if it is an open message pipe handle which
    /// has not been written to.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| on success.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if both handles were valid message pipe
    ///       handles but could not be merged (e.g. one of them has been written to).
    ///   |MOJO_INVALID_ARGUMENT| if either handle is not a fusable message pipe
    ///       handle.
    pub fn MojoFuseMessagePipes(
        handle0: MojoHandle,
        handle1: MojoHandle,
        options: *const MojoFuseMessagePipesOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Creates a new message object which may be sent over a message pipe via
    /// |MojoWriteMessage()|. Returns a handle to the new message object in
    /// |*message|.
    ///
    /// In its initial state the message object cannot be successfully written to a
    /// message pipe, but must first have either an opaque context or some serialized
    /// data attached (see |MojoSetMessageContext()| and
    /// |MojoAppendMessageData()|).
    ///
    /// NOTE: Unlike other types of Mojo API objects, messages are NOT thread-safe
    /// and thus callers of message-related APIs must be careful to restrict usage of
    /// any given |MojoMessageHandle| to a single thread at a time.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if a new message was created. |*message| contains a handle
    ///       to the new message object upon return.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is null.
    pub fn MojoCreateMessage(
        options: *const MojoCreateMessageOptions,
        message: *mut MojoMessageHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Destroys a message object created by |MojoCreateMessage()| or
    /// |MojoReadMessage()|.
    ///
    /// |message|: The message to destroy. Note that if a message has been written
    ///     to a message pipe using |MojoWriteMessage()|, it is neither necessary nor
    ///     valid to attempt to destroy it.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if |message| was valid and has been freed.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| was not a valid message.
    pub fn MojoDestroyMessage(message: MojoMessageHandle) -> MojoResult;
}
unsafe extern "C" {
    /// Forces a message to be serialized in-place if not already serialized.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if |message| was not serialized and is now serialized.
    ///       In this case its thunks were invoked to perform serialization and
    ///       ultimately destroy its associated context. The message may still be
    ///       written to a pipe or decomposed by |MojoGetMessageData()|.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if |message| was already serialized.
    ///   |MOJO_RESULT_NOT_FOUND| if |message| cannot be serialized (i.e. it was
    ///       created with null |MojoMessageContextSerializer|.)
    ///   |MOJO_RESULT_BUSY| if one or more handles provided by the user context
    ///       reported itself as busy during the serialization attempt. In this case
    ///       all serialized handles are closed automatically.
    ///   |MOJO_RESULT_ABORTED| if some other unspecified error occurred during
    ///       handle serialization. In this case all serialized handles are closed
    ///       automatically.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is not a valid message handle.
    ///
    /// Note that unserialized messages may be successfully transferred from one
    /// message pipe endpoint to another without ever being serialized. This function
    /// allows callers to coerce eager serialization.
    pub fn MojoSerializeMessage(
        message: MojoMessageHandle,
        options: *const MojoSerializeMessageOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Reserves capacity within a message object.
    ///
    /// `message`: The message.
    /// `payload_buffer_size`: The number of bytes to preallocate for the payload
    ///     of the message.
    ///
    /// NOTE: Can only be called on a newly-created message, before serialization
    /// begins.
    ///
    /// If this call succeeds, if `buffer_size` was non-null then `*buffer_size`
    /// will contain the storage capacity.
    ///
    /// Returns:
    ///   `MOJO_RESULT_OK` upon success. The message's payload capacity is stored
    ///       into `*buffer_size`.
    ///   `MOJO_RESULT_INVALID_ARGUMENT` if `message` is not a valid message object.
    ///   `MOJO_RESULT_FAILED_PRECONDITION` if `message` has a context attached,
    ///       or if the `message` is already partly or fully serialized.
    pub fn MojoReserveMessageCapacity(
        message: MojoMessageHandle,
        payload_buffer_size: u32,
        buffer_size: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Appends data to a message object.
    ///
    /// |message|: The message.
    /// |additional_payload_size|: The number of bytes by which to extend the payload
    ///     of the message.
    /// |handles|: Handles to be appended to the message. May be null iff
    ///     |num_handles| is 0.
    /// |num_handles|: The number of handles to be appended to the message.
    ///
    /// |options| may be null.
    ///
    /// If this call succeeds, |*buffer| will contain the address of the data's
    /// storage if |buffer| was non-null, and if |buffer_size| was non-null then
    /// |*buffer_size| will contain the storage capacity. The caller may write
    /// message contents here.
    ///
    /// Note that while the size of the returned buffer may exceed the total
    /// requested size accumulated over one or more calls to
    /// |MojoAppendMessageData()|, only the extent of caller's requested capacity is
    /// considered to be part of the message.
    ///
    /// A message with attached data must have its capacity finalized before it can
    /// be transmitted by calling this function with
    /// |MOJO_APPEND_MESSAGE_DATA_FLAG_COMMIT_SIZE| set in |options->flags|. Note
    /// that even after this happens, the returned |*buffer| remains valid and
    /// writable until the message is passed to either |MojoWriteMessage()| or
    /// |MojoDestroyMessage()|.
    ///
    /// Ownership of all handles in |handles| is transferred to the message object if
    /// and ONLY if this operation succeeds and returns |MOJO_RESULT_OK|. Otherwise
    /// the caller retains ownership.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| upon success. The message's data buffer and size are
    ///       stored to |*buffer| and |*buffer_size| respectively. Any previously
    ///       appended data remains intact but may be moved in the event that
    ///       |*buffer| itself is moved. If
    ///       |MOJO_APPEND_MESSAGE_DATA_FLAG_COMMIT_SIZE| was set in
    ///       |options->flags|, the message is ready for transmission.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is not a valid message object;
    ///       if |num_handles| is non-zero but |handles| is null; or if any handle in
    ///       |handles| is invalid.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if |additional_payload_size| or
    ///       |num_handles| exceeds some implementation- or embedder-defined maximum.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if |message| has a context attached.
    ///   |MOJO_RESULT_BUSY| if one or more handles in |handles| is currently busy
    ///       and unable to be serialized.
    pub fn MojoAppendMessageData(
        message: MojoMessageHandle,
        payload_size: u32,
        handles: *const MojoHandle,
        num_handles: u32,
        options: *const MojoAppendMessageDataOptions,
        buffer: *mut *mut ::std::os::raw::c_void,
        buffer_size: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Retrieves data attached to a message object.
    ///
    /// |message|: The message.
    /// |num_bytes|: An output parameter which will receive the total size in bytes
    ///     of the message's payload.
    /// |buffer|: An output parameter which will receive the address of a buffer
    ///     containing exactly |*num_bytes| bytes of payload data. This buffer
    ///     address is not owned by the caller and is only valid as long as the
    ///     message handle in |message| is valid.
    /// |num_handles|: An input/output parameter. On input, if not null, this points
    ///     to value specifying the available capacity (in number of handles) of
    ///     |handles|. On output, if not null, this will point to a value specifying
    ///     the actual number of handles available in the serialized message.
    /// |handles|: A buffer to contain up to (input) |*num_handles| handles. May be
    ///     null if |num_handles| is null or |*num_handles| is 0.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if |message| is a message with data attached and the
    ///       provided handle storage is sufficient to contain all handles attached
    ///       to the message. If |MOJO_GET_MESSAGE_DATA_FLAG_IGNORE_HANDLES| was set
    ///       in |options->flags|, any attached handles in the message are left
    ///       intact and both |handles| and |num_handles| are ignored. Otherwise
    ///       ownership of any attached handles is transferred to the caller, and
    ///       |MojoGetMessageData()| may no longer be called on |message| unless
    ///       |MOJO_GET_MESSAGE_DATA_FLAG_IGNORE_HANDLES| is used.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |num_handles| is non-null and
    ///       |*num_handles| is non-zero, but |handles| is null; or if |message| is
    ///       not a valid message handle.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if |message| is not a fully serialized
    ///       message. The caller may use |MojoSerializeMessage()| and try again,
    ///       or |MojoAppendMessageData()| with the
    ///       |MOJO_APPEND_MESSAGE_DATA_FLAG_COMMIT_SIZE| flag set to complete a
    ///       partially serialized |message|.
    ///   |MOJO_RESULT_NOT_FOUND| if the message's handles (if any) contents have
    ///       already  been extracted (or have failed to be extracted) by a previous
    ///       call to |MojoGetMessageData()|.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if |num_handles| is null and there are
    ///       handles attached to the message, or if |*num_handles| on input is less
    ///       than the number of handles attached to the message. Also may be
    ///       returned if |num_bytes| or |buffer| is null and the message has a non-
    ///       empty payload. Note that if |MOJO_GET_MESSAGE_DATA_FLAG_IGNORE_HANDLES|
    ///       is set in |options->flags| any current or previously attached handles
    ///       are ignored.
    ///   |MOJO_RESULT_ARBORTED| if the message is in an invalid state and its data
    ///       and/or handles are unrecoverable. The message is left in this state but
    ///       future calls to this API will yield the same result.
    pub fn MojoGetMessageData(
        message: MojoMessageHandle,
        options: *const MojoGetMessageDataOptions,
        buffer: *mut *mut ::std::os::raw::c_void,
        num_bytes: *mut u32,
        handles: *mut MojoHandle,
        num_handles: *mut u32,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Sets an opaque context value on a message object. The presence of an opaque
    /// context is mutually exclusive to the presence of message data.
    ///
    /// |context| is the context value to associate with this message, and
    /// |serializer| is a function which may be called at some later time to convert
    /// |message| to a serialized message object using |context| as input. See
    /// |MojoMessageContextSerializer| for more details. |destructor| is a function
    /// which may be called to allow the user to cleanup state associated with
    /// |context| after serialization or in the event that the message is destroyed
    /// without ever being serialized.
    ///
    /// Typically a caller will use |context| as an opaque pointer to some heap
    /// object which is effectively owned by the message once this returns. In this
    /// way, messages can be sent over a message pipe to a peer endpoint in the same
    /// process as the sender without performing a serialization step.
    ///
    /// If the message does need to cross a process boundary or is otherwise
    /// forced to serialize (see |MojoSerializeMessage()| below), it will be
    /// serialized by invoking |serializer|.
    ///
    /// If |serializer| is null, the created message cannot be serialized. Subsequent
    /// calls to |MojoSerializeMessage()| on the created message, or any attempt to
    /// transmit the message across a process boundary, will fail.
    ///
    /// If |destructor| is null, it is assumed that no cleanup is required after
    /// serializing or destroying a message with |context| attached.
    ///
    /// A |context| value of zero is invalid, and setting this on a message
    /// effectively removes its context. This is necessary if the caller wishes to
    /// attach data to the message or if the caller wants to destroy the message
    /// object without triggering |destructor|.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the opaque context value was successfully set.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is not a valid message object;
    ///       |options| is non-null and |*options| contains one or more malformed
    ///       fields; or |context| is zero but either |serializer| or |destructor| is
    ///       non-null.
    ///   |MOJO_RESULT_ALREADY_EXISTS| if |message| already has a non-zero context.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if |message| has data attached.
    pub fn MojoSetMessageContext(
        message: MojoMessageHandle,
        context: usize,
        serializer: MojoMessageContextSerializer,
        destructor: MojoMessageContextDestructor,
        options: *const MojoSetMessageContextOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Retrieves a message object's opaque context value.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if |message| is a valid message object. |*context|
    ///       contains its opaque context value, which may be zero.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is not a valid message object
    ///       or |options| is non-null and |*options| contains one or more malformed
    ///       fields.
    pub fn MojoGetMessageContext(
        message: MojoMessageHandle,
        options: *const MojoGetMessageContextOptions,
        context: *mut usize,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Notifies the system that a bad message was received on a message pipe,
    /// according to whatever criteria the caller chooses. This ultimately tries to
    /// notify the embedder about the bad message, and the embedder may enforce some
    /// policy for dealing with the source of the message (e.g. close the pipe,
    /// terminate, a process, etc.) The embedder may not be notified if the calling
    /// process has lost its connection to the source process.
    ///
    /// |message|: The message to report as bad.
    /// |error|: An error string which may provide the embedder with context when
    ///     notified of this error.
    /// |error_num_bytes|: The length of |error| in bytes.
    ///
    /// |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if successful.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |message| is not a valid message.
    pub fn MojoNotifyBadMessage(
        message: MojoMessageHandle,
        error: *const ::std::os::raw::c_char,
        error_num_bytes: u32,
        options: *const MojoNotifyBadMessageOptions,
    ) -> MojoResult;
}
/// Flags passed to |MojoSetQuota| via |MojoSetQuotaOptions|.
pub type MojoSetQuotaFlags = u32;
/// Options passed to |MojoSetQuota()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoSetQuotaOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoSetQuotaFlags| above.
    pub flags: MojoSetQuotaFlags,
}
/// Flags passed to |MojoQueryQuota| via |MojoQueryQuotaOptions|.
pub type MojoQueryQuotaFlags = u32;
/// Options passed to |MojoQueryQuota()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoQueryQuotaOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// See |MojoQueryQuotaFlags| above.
    pub flags: MojoQueryQuotaFlags,
}
/// An enumeration of different types of quotas that can be set on a handle.
pub type MojoQuotaType = u32;
unsafe extern "C" {
    /// Sets a quota on a given handle which will cause that handle to raise the
    /// |MOJO_HANDLE_SIGNAL_QUOTA_EXCEEDED| signal if the quota is exceeded. Signals
    /// can be trapped using |MojoCreateTrap()| and related APIs (see trap.h).
    ///
    /// All quota limits on a handle default to |MOJO_QUOTA_LIMIT_NONE|, meaning that
    /// the resource is unlimited.
    ///
    /// NOTE: A handle's quota is only enforced as long as the handle remains within
    /// the process which set the quota.
    ///
    /// Parameters:
    ///   |handle|: The handle on which a quota should be set.
    ///   |type|: The type of quota to set. Certain types of quotas may only be set
    ///       on certain types of handles. See notes on individual quota type
    ///       definitions above for meaning and restrictions.
    ///   |limit|: The limiting value of the quota. The meaning of this is determined
    ///       by |type|. See notes on individual quota type definitions above.
    ///   |options|: Additional options; may be null.
    ///
    ///  Returns:
    ///    |MOJO_RESULT_OK| if the quota was successfully set.
    ///    |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle value,
    ///        |type| is not a known quota type, |options| is non-null but
    ///        |*options| is malformed, or the quota |type| cannot be set on |handle|
    ///        because the quota does not apply to that type of handle.
    pub fn MojoSetQuota(
        handle: MojoHandle,
        type_: MojoQuotaType,
        limit: u64,
        options: *const MojoSetQuotaOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Queries a handle for information about a specific quota.
    ///
    /// Parameters:
    ///   |handle|: The handle to query.
    ///   |type|: The type of quota to query.
    ///   |limit|: Receives the quota's currently set limit if non-null.
    ///   |usage|: Receives the quota's current usage if non-null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the quota was successfully queried on |handle|. Upon
    ///       return, |*limit| contains the quota's current limit if |limit| is
    ///       non-null, and |*usage| contains the quota's current usage if |usage| is
    ///       non-null.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |handle| is not a valid handle value or
    ///       quota |type| does not apply to the type of object referenced by
    ///       |handle|.
    pub fn MojoQueryQuota(
        handle: MojoHandle,
        type_: MojoQuotaType,
        options: *const MojoQueryQuotaOptions,
        limit: *mut u64,
        usage: *mut u64,
    ) -> MojoResult;
}
/// Flags passed to trap event handlers within |MojoTrapEvent|.
pub type MojoTrapEventFlags = u32;
/// Structure passed to trap event handlers when invoked by a tripped trap.
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoTrapEvent {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// May take on some combination of the following values:
    ///
    ///   |MOJO_TRAP_EVENT_FLAG_NONE|: No flags.
    ///
    ///   |MOJO_TRAP_EVENT_FLAG_WITHIN_API_CALL|: The trap was tripped within the
    ///       extent of a user call to some Mojo API. This means that the event
    ///       handler itself is re-entering user code. May happen, for example, if
    ///       user code writes to an intra-process pipe and the receiving end trips
    ///       a trap as a result. In that case the event handler executes within
    ///       the extent of the |MojoWriteMessage()| call.
    pub flags: MojoTrapEventFlags,
    /// The context for the trigger which tripped the trap.
    pub trigger_context: usize,
    /// A result code indicating the cause of the event. May take on any of the
    /// following values:
    ///
    ///   |MOJO_RESULT_OK|: The trigger's conditions were met.
    ///   |MOJO_RESULT_FAILED_PRECONDITION|: The trigger's observed handle has
    ///       changed state in such a way that the trigger's conditions can never
    ///       be met again.
    ///   |MOJO_RESULT_CANCELLED|: The trigger has been removed and will never
    ///       cause another event to fire. This is always the last event fired by
    ///       a trigger and it will fire when: the trigger is explicitly removed
    ///       with |MojoRemoteTrigger()|, the trigger's owning trap handle is
    ///       closed, or the handle observed by the trigger is closed.
    ///
    ///       Unlike the other result types above |MOJO_RESULT_CANCELLED| can
    ///       fire even when the trap is disarmed.
    pub result: MojoResult,
    /// The last known signalling state of the trigger's observed handle at the
    /// time the trap was tripped.
    pub signals_state: MojoHandleSignalsState,
}
/// Value given to |MojoAddTrigger| to configure what condition should cause it
/// to trip its trap. May be one of the following values:
///
///   |MOJO_TRIGGER_CONDITION_SIGNALS_UNSATISFIED| - A trigger added with this
///       condition will trip its trap when any of its observed signals
///       transition from being satisfied to being unsatisfied.
///   |MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED| - A triger added with this
///       condition will trip its trap  when any of its observed signals
///       transition from being unsatisfied to being satisfied, or when none of
///       the observed signals can ever be satisfied again.
pub type MojoTriggerCondition = u32;
/// Flags passed to |MojoCreateTrap()| via |MojoCreateTrapOptions|.
pub type MojoCreateTrapFlags = u32;
/// Options passed to |MojoCreateTrap()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoCreateTrapOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// Flags. Currently unused.
    pub flags: MojoCreateTrapFlags,
}
/// Flags passed to |MojoAddTrigger()| via |MojoAddTriggerOptions|.
pub type MojoAddTriggerFlags = u32;
/// Options passed to |MojoAddTrigger()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoAddTriggerOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// Flags. Currently unused.
    pub flags: MojoAddTriggerFlags,
}
/// Flags passed to |MojoRemoveTrigger()| via |MojoRemoveTriggerOptions|.
pub type MojoRemoveTriggerFlags = u32;
/// Options passed to |MojoRemoveTrigger()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoRemoveTriggerOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// Flags. Currently unused.
    pub flags: MojoRemoveTriggerFlags,
}
/// Flags passed to |MojoArmTrap()| via |MojoArmTrapOptions|.
pub type MojoArmTrapFlags = u32;
/// Options passed to |MojoArmTrap()|.
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct MojoArmTrapOptions {
    /// The size of this structure, used for versioning.
    pub struct_size: u32,
    /// Flags. Currently unused.
    pub flags: MojoArmTrapFlags,
}
/// A user-provided callback to handle trap events. Passed to |MojoCreateTrap()|.
pub type MojoTrapEventHandler =
    ::std::option::Option<unsafe extern "C" fn(event: *const MojoTrapEvent)>;
unsafe extern "C" {
    /// Creates a new trap which can be used to detect signal changes on a handle.
    /// Traps execute arbitrary user code when tripped.
    ///
    /// Traps can trip only while armed**, and new traps are created in a disarmed
    /// state. Traps may be armed using |MojoArmTrap()|.
    ///
    /// Arming a trap is only possible when the trap has one or more triggers
    /// attached to it. Triggers can be added or removed using |MojoAddTrigger()| and
    /// |MojoRemoveTrigger()|.
    ///
    /// If a trap is tripped by any of its triggers, it is disarmed immediately and
    /// the traps |MojoTrapEventHandler| is invoked once for every relevant trigger.
    ///
    /// |options| may be null.
    ///
    /// ** An unarmed trap will still fire an event when a trigger is removed. This
    /// event will always convey the result |MOJO_RESULT_CANCELLED|.
    ///
    /// Parameters:
    ///   |handler|: The |MojoTrapEventHandler| to invoke any time this trap is
    ///       tripped. Note that this may be called from any arbitrary thread.
    ///   |trap_handle|: The address at which to store the MojoHandle corresponding
    ///       to the new trap if successfully created.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the trap has been successfully created.
    ///   |MOJO_RESULT_RESOURCE_EXHAUSTED| if a handle could not be allocated for
    ///       this trap.
    pub fn MojoCreateTrap(
        handler: MojoTrapEventHandler,
        options: *const MojoCreateTrapOptions,
        trap_handle: *mut MojoHandle,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Adds a trigger to a trap. This configures the trap to invoke its event
    /// handler if the specified conditions are met (or can no longer be met) while
    /// the trap is armed.
    ///
    /// Note that event handler invocations for a given trigger are mutually
    /// exclusive in execution: the handler will never be entered for a trigger while
    /// another thread is executing it for the same trigger. Similarly, event
    /// handlers are never re-entered. If an event handler changes the state of the
    /// system such that another event would fire, that event is deferred until the
    /// first handler returns.
    ///
    /// Parameters:
    ///   |trap_handle|: The trap to which this trigger is to be added.
    ///   |handle|: The handle whose signals this trigger will observe. Must be a
    ///       message pipe or data pipe handle.
    ///   |signals|: The specific signal(s) this trigger will observe on |handle|.
    ///   |condition|: The signaling condition this trigger will observe. i.e.
    ///       whether to trip the trap when |signals| become satisfied or when they
    ///       become unsatisfied.
    ///   |context|: An arbitrary context value to be passed to the trap's event
    ///       handler when this trigger was responsible for tripping the trap. See
    ///       the |trigger_context| field in |MojoTrapEvent|. This value must be
    ///       unique among all triggers on the trap.
    ///
    ///   |options| may be null.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the handle is now being observed by the trigger.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |trap_handle| is not a trap handle,
    ///       |handle| is not a valid message pipe or data pipe handle, or |signals|
    ///       or |condition| are an invalid value.
    ///   |MOJO_RESULT_ALREADY_EXISTS| if the trap already has a trigger associated
    ///       with |context| or |handle|.
    pub fn MojoAddTrigger(
        trap_handle: MojoHandle,
        handle: MojoHandle,
        signals: MojoHandleSignals,
        condition: MojoTriggerCondition,
        context: usize,
        options: *const MojoAddTriggerOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Removes a trigger from a trap.
    ///
    /// This ensures that the trigger is removed as soon as possible. Removal may
    /// block an arbitrarily long time if the trap is already executing its handler.
    ///
    /// When removal is complete, the trap's handler is invoked one final time for
    /// time for |context|, with the result |MOJO_RESULT_CANCELLED|.
    ///
    /// The same  behavior can be elicted by either closing the watched handle
    /// associated with this trigger, or by closing |trap_handle| itself.
    ///
    /// Parameters:
    ///   |trap_handle|: The handle of the trap from which to remove a trigger.
    ///   |context|: The context of the trigger to be removed.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the trigger has been removed.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |trap_handle| is not a trap handle.
    ///   |MOJO_RESULT_NOT_FOUND| if there is no trigger registered on this trap for
    ///       the given value of |context|.
    pub fn MojoRemoveTrigger(
        trap_handle: MojoHandle,
        context: usize,
        options: *const MojoRemoveTriggerOptions,
    ) -> MojoResult;
}
unsafe extern "C" {
    /// Arms a trap, allowing it to invoke its event handler the next time any of its
    /// triggers' conditions are met.
    ///
    /// Parameters:
    ///   |trap_handle|: The handle of the trap to be armed.
    ///   |num_blocking_events|: An address pointing to the number of elements
    ///       available for storage at the address given by |blocking_events|.
    ///       Optional and only used when |MOJO_RESULT_FAILED_PRECONDITION| is
    ///       returned. See below.
    ///   |blocking_events|: An output buffer for |MojoTrapEvent| structures to be
    ///       filled in if one or more triggers would have tripped the trap
    ///       immediately if it were armed. Optional and used only when
    ///       |MOJO_RESULT_FAILED_PRECONDITION| is returned. See below.
    ///
    /// Returns:
    ///   |MOJO_RESULT_OK| if the trap has been successfully armed.
    ///       |num_blocking_events| and |blocking_events| are ignored.
    ///   |MOJO_RESULT_NOT_FOUND| if the trap does not have any triggers.
    ///       |num_blocking_events| and |blocking_events| are ignored.
    ///   |MOJO_RESULT_INVALID_ARGUMENT| if |trap_handle| is not a valid trap handle,
    ///       or if |num_blocking_events| is non-null but |blocking_events| is
    ///       not.
    ///   |MOJO_RESULT_FAILED_PRECONDITION| if one or more triggers would have
    ///       tripped the trap immediately upon arming. If |num_blocking_events| is
    ///       non-null, this assumes there is enough space for |*num_blocking_events|
    ///       entries at the non-null address in |blocking_events|.
    ///
    ///       At most |*num_blocking_events| entries are populated there, with each
    ///       entry corresponding to one of the triggers which would have tripped the
    ///       trap. The actual number of entries populated is written to
    ///       |*num_blocking_events| before returning.
    ///
    ///       If there are more ready triggers than available provided storage, the
    ///       subset presented to the caller is arbitrary. The runtime makes an
    ///       effort to circulate triggers returned by consecutive failed
    ///       |MojoArmTrap()| calls so that callers may avoid handle starvation when
    ///       observing a large number of active handles with a single trap.
    pub fn MojoArmTrap(
        trap_handle: MojoHandle,
        options: *const MojoArmTrapOptions,
        num_blocking_events: *mut u32,
        blocking_events: *mut MojoTrapEvent,
    ) -> MojoResult;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoSystemThunks2 {
    /// Should be set to sizeof(MojoSystemThunks).
    pub size: u32,
    pub Initialize: ::std::option::Option<
        unsafe extern "C" fn(options: *const MojoInitializeOptions) -> MojoResult,
    >,
    pub GetTimeTicksNow: ::std::option::Option<unsafe extern "C" fn() -> MojoTimeTicks>,
    /// Generic handle API.
    pub Close: ::std::option::Option<unsafe extern "C" fn(handle: MojoHandle) -> MojoResult>,
    pub QueryHandleSignalsState: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle,
            signals_state: *mut MojoHandleSignalsState,
        ) -> MojoResult,
    >,
    /// Message pipe API.
    pub CreateMessagePipe: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateMessagePipeOptions,
            message_pipe_handle0: *mut MojoHandle,
            message_pipe_handle1: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub WriteMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message_pipe_handle: MojoHandle,
            message_handle: MojoMessageHandle,
            options: *const MojoWriteMessageOptions,
        ) -> MojoResult,
    >,
    pub ReadMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message_pipe_handle: MojoHandle,
            options: *const MojoReadMessageOptions,
            message_handle: *mut MojoMessageHandle,
        ) -> MojoResult,
    >,
    pub FuseMessagePipes: ::std::option::Option<
        unsafe extern "C" fn(
            handle0: MojoHandle,
            handle1: MojoHandle,
            options: *const MojoFuseMessagePipesOptions,
        ) -> MojoResult,
    >,
    /// Message object API.
    pub CreateMessage: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateMessageOptions,
            message: *mut MojoMessageHandle,
        ) -> MojoResult,
    >,
    pub DestroyMessage:
        ::std::option::Option<unsafe extern "C" fn(message: MojoMessageHandle) -> MojoResult>,
    pub SerializeMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoSerializeMessageOptions,
        ) -> MojoResult,
    >,
    pub AppendMessageData: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            additional_payload_size: u32,
            handles: *const MojoHandle,
            num_handles: u32,
            options: *const MojoAppendMessageDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            buffer_size: *mut u32,
        ) -> MojoResult,
    >,
    pub GetMessageData: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoGetMessageDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            num_bytes: *mut u32,
            handles: *mut MojoHandle,
            num_handles: *mut u32,
        ) -> MojoResult,
    >,
    pub SetMessageContext: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            context: usize,
            serializer: MojoMessageContextSerializer,
            destructor: MojoMessageContextDestructor,
            options: *const MojoSetMessageContextOptions,
        ) -> MojoResult,
    >,
    pub GetMessageContext: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoGetMessageContextOptions,
            context: *mut usize,
        ) -> MojoResult,
    >,
    pub NotifyBadMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            error: *const ::std::os::raw::c_char,
            error_num_bytes: u32,
            options: *const MojoNotifyBadMessageOptions,
        ) -> MojoResult,
    >,
    /// Data pipe API.
    pub CreateDataPipe: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateDataPipeOptions,
            data_pipe_producer_handle: *mut MojoHandle,
            data_pipe_consumer_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub WriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle,
            elements: *const ::std::os::raw::c_void,
            num_elements: *mut u32,
            options: *const MojoWriteDataOptions,
        ) -> MojoResult,
    >,
    pub BeginWriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle,
            options: *const MojoBeginWriteDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            buffer_num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub EndWriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle,
            num_elements_written: u32,
            options: *const MojoEndWriteDataOptions,
        ) -> MojoResult,
    >,
    pub ReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle,
            options: *const MojoReadDataOptions,
            elements: *mut ::std::os::raw::c_void,
            num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub BeginReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle,
            options: *const MojoBeginReadDataOptions,
            buffer: *mut *const ::std::os::raw::c_void,
            buffer_num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub EndReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle,
            num_elements_read: u32,
            options: *const MojoEndReadDataOptions,
        ) -> MojoResult,
    >,
    /// Shared buffer API.
    pub CreateSharedBuffer: ::std::option::Option<
        unsafe extern "C" fn(
            num_bytes: u64,
            options: *const MojoCreateSharedBufferOptions,
            shared_buffer_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub DuplicateBufferHandle: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle,
            options: *const MojoDuplicateBufferHandleOptions,
            new_buffer_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub MapBuffer: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle,
            offset: u64,
            num_bytes: u64,
            options: *const MojoMapBufferOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
        ) -> MojoResult,
    >,
    pub UnmapBuffer: ::std::option::Option<
        unsafe extern "C" fn(buffer: *mut ::std::os::raw::c_void) -> MojoResult,
    >,
    pub GetBufferInfo: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle,
            options: *const MojoGetBufferInfoOptions,
            info: *mut MojoSharedBufferInfo,
        ) -> MojoResult,
    >,
    /// Traps API.
    pub CreateTrap: ::std::option::Option<
        unsafe extern "C" fn(
            handler: MojoTrapEventHandler,
            options: *const MojoCreateTrapOptions,
            trap_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub AddTrigger: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle,
            handle: MojoHandle,
            signals: MojoHandleSignals,
            condition: MojoTriggerCondition,
            context: usize,
            options: *const MojoAddTriggerOptions,
        ) -> MojoResult,
    >,
    pub RemoveTrigger: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle,
            context: usize,
            options: *const MojoRemoveTriggerOptions,
        ) -> MojoResult,
    >,
    pub ArmTrap: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle,
            options: *const MojoArmTrapOptions,
            num_blocking_events: *mut u32,
            blocking_events: *mut MojoTrapEvent,
        ) -> MojoResult,
    >,
    /// Platform handle API.
    pub WrapPlatformHandle: ::std::option::Option<
        unsafe extern "C" fn(
            platform_handle: *const MojoPlatformHandle,
            options: *const MojoWrapPlatformHandleOptions,
            mojo_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub UnwrapPlatformHandle: ::std::option::Option<
        unsafe extern "C" fn(
            mojo_handle: MojoHandle,
            options: *const MojoUnwrapPlatformHandleOptions,
            platform_handle: *mut MojoPlatformHandle,
        ) -> MojoResult,
    >,
    pub WrapPlatformSharedMemoryRegion: ::std::option::Option<
        unsafe extern "C" fn(
            platform_handles: *const MojoPlatformHandle,
            num_platform_handles: u32,
            num_bytes: u64,
            guid: *const MojoSharedBufferGuid,
            access_mode: MojoPlatformSharedMemoryRegionAccessMode,
            options: *const MojoWrapPlatformSharedMemoryRegionOptions,
            mojo_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub UnwrapPlatformSharedMemoryRegion: ::std::option::Option<
        unsafe extern "C" fn(
            mojo_handle: MojoHandle,
            options: *const MojoUnwrapPlatformSharedMemoryRegionOptions,
            platform_handles: *mut MojoPlatformHandle,
            num_platform_handles: *mut u32,
            num_bytes: *mut u64,
            guid: *mut MojoSharedBufferGuid,
            access_mode: *mut MojoPlatformSharedMemoryRegionAccessMode,
        ) -> MojoResult,
    >,
    /// Invitation API.
    pub CreateInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateInvitationOptions,
            invitation_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub AttachMessagePipeToInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle,
            name: *const ::std::os::raw::c_void,
            name_num_bytes: u32,
            options: *const MojoAttachMessagePipeToInvitationOptions,
            message_pipe_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub ExtractMessagePipeFromInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle,
            name: *const ::std::os::raw::c_void,
            name_num_bytes: u32,
            options: *const MojoExtractMessagePipeFromInvitationOptions,
            message_pipe_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    pub SendInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle,
            process_handle: *const MojoPlatformProcessHandle,
            transport_endpoint: *const MojoInvitationTransportEndpoint,
            error_handler: MojoProcessErrorHandler,
            error_handler_context: usize,
            options: *const MojoSendInvitationOptions,
        ) -> MojoResult,
    >,
    pub AcceptInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            transport_endpoint: *const MojoInvitationTransportEndpoint,
            options: *const MojoAcceptInvitationOptions,
            invitation_handle: *mut MojoHandle,
        ) -> MojoResult,
    >,
    /// Core ABI version 1 additions begin here.
    pub SetQuota: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle,
            type_: MojoQuotaType,
            limit: u64,
            options: *const MojoSetQuotaOptions,
        ) -> MojoResult,
    >,
    pub QueryQuota: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle,
            type_: MojoQuotaType,
            options: *const MojoQueryQuotaOptions,
            limit: *mut u64,
            usage: *mut u64,
        ) -> MojoResult,
    >,
    /// Core ABI version 2 additions begin here.
    pub Shutdown: ::std::option::Option<
        unsafe extern "C" fn(options: *const MojoShutdownOptions) -> MojoResult,
    >,
    /// Core ABI version 3 additions begin here.
    pub SetDefaultProcessErrorHandler: ::std::option::Option<
        unsafe extern "C" fn(
            handler: MojoDefaultProcessErrorHandler,
            options: *const MojoSetDefaultProcessErrorHandlerOptions,
        ) -> MojoResult,
    >,
    /// Core ABI version 4 additions begin here.
    pub ReserveMessageCapacity: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            payload_buffer_size: u32,
            buffer_size: *mut u32,
        ) -> MojoResult,
    >,
}
/// Hacks: This is a copy of the ABI from before it was switched to pointer-sized
/// MojoHandle values. It can be removed once the Chrome OS IME service is
/// longer consuming it.
pub type MojoHandle32 = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MojoSystemThunks {
    /// Should be set to sizeof(MojoSystemThunks32).
    pub size: u32,
    pub Initialize: ::std::option::Option<
        unsafe extern "C" fn(options: *const MojoInitializeOptions) -> MojoResult,
    >,
    pub GetTimeTicksNow: ::std::option::Option<unsafe extern "C" fn() -> MojoTimeTicks>,
    /// Generic handle API.
    pub Close: ::std::option::Option<unsafe extern "C" fn(handle: MojoHandle32) -> MojoResult>,
    pub QueryHandleSignalsState: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle32,
            signals_state: *mut MojoHandleSignalsState,
        ) -> MojoResult,
    >,
    /// Message pipe API.
    pub CreateMessagePipe: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateMessagePipeOptions,
            message_pipe_handle0: *mut MojoHandle32,
            message_pipe_handle1: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub WriteMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message_pipe_handle: MojoHandle32,
            message_handle: MojoMessageHandle,
            options: *const MojoWriteMessageOptions,
        ) -> MojoResult,
    >,
    pub ReadMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message_pipe_handle: MojoHandle32,
            options: *const MojoReadMessageOptions,
            message_handle: *mut MojoMessageHandle,
        ) -> MojoResult,
    >,
    pub FuseMessagePipes: ::std::option::Option<
        unsafe extern "C" fn(
            handle0: MojoHandle32,
            handle1: MojoHandle32,
            options: *const MojoFuseMessagePipesOptions,
        ) -> MojoResult,
    >,
    /// Message object API.
    pub CreateMessage: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateMessageOptions,
            message: *mut MojoMessageHandle,
        ) -> MojoResult,
    >,
    pub DestroyMessage:
        ::std::option::Option<unsafe extern "C" fn(message: MojoMessageHandle) -> MojoResult>,
    pub SerializeMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoSerializeMessageOptions,
        ) -> MojoResult,
    >,
    pub AppendMessageData: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            additional_payload_size: u32,
            handles: *const MojoHandle32,
            num_handles: u32,
            options: *const MojoAppendMessageDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            buffer_size: *mut u32,
        ) -> MojoResult,
    >,
    pub GetMessageData: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoGetMessageDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            num_bytes: *mut u32,
            handles: *mut MojoHandle32,
            num_handles: *mut u32,
        ) -> MojoResult,
    >,
    pub SetMessageContext: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            context: usize,
            serializer: MojoMessageContextSerializer,
            destructor: MojoMessageContextDestructor,
            options: *const MojoSetMessageContextOptions,
        ) -> MojoResult,
    >,
    pub GetMessageContext: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            options: *const MojoGetMessageContextOptions,
            context: *mut usize,
        ) -> MojoResult,
    >,
    pub NotifyBadMessage: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            error: *const ::std::os::raw::c_char,
            error_num_bytes: u32,
            options: *const MojoNotifyBadMessageOptions,
        ) -> MojoResult,
    >,
    /// Data pipe API.
    pub CreateDataPipe: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateDataPipeOptions,
            data_pipe_producer_handle: *mut MojoHandle32,
            data_pipe_consumer_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub WriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle32,
            elements: *const ::std::os::raw::c_void,
            num_elements: *mut u32,
            options: *const MojoWriteDataOptions,
        ) -> MojoResult,
    >,
    pub BeginWriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle32,
            options: *const MojoBeginWriteDataOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
            buffer_num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub EndWriteData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_producer_handle: MojoHandle32,
            num_elements_written: u32,
            options: *const MojoEndWriteDataOptions,
        ) -> MojoResult,
    >,
    pub ReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle32,
            options: *const MojoReadDataOptions,
            elements: *mut ::std::os::raw::c_void,
            num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub BeginReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle32,
            options: *const MojoBeginReadDataOptions,
            buffer: *mut *const ::std::os::raw::c_void,
            buffer_num_elements: *mut u32,
        ) -> MojoResult,
    >,
    pub EndReadData: ::std::option::Option<
        unsafe extern "C" fn(
            data_pipe_consumer_handle: MojoHandle32,
            num_elements_read: u32,
            options: *const MojoEndReadDataOptions,
        ) -> MojoResult,
    >,
    /// Shared buffer API.
    pub CreateSharedBuffer: ::std::option::Option<
        unsafe extern "C" fn(
            num_bytes: u64,
            options: *const MojoCreateSharedBufferOptions,
            shared_buffer_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub DuplicateBufferHandle: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle32,
            options: *const MojoDuplicateBufferHandleOptions,
            new_buffer_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub MapBuffer: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle32,
            offset: u64,
            num_bytes: u64,
            options: *const MojoMapBufferOptions,
            buffer: *mut *mut ::std::os::raw::c_void,
        ) -> MojoResult,
    >,
    pub UnmapBuffer: ::std::option::Option<
        unsafe extern "C" fn(buffer: *mut ::std::os::raw::c_void) -> MojoResult,
    >,
    pub GetBufferInfo: ::std::option::Option<
        unsafe extern "C" fn(
            buffer_handle: MojoHandle32,
            options: *const MojoGetBufferInfoOptions,
            info: *mut MojoSharedBufferInfo,
        ) -> MojoResult,
    >,
    /// Traps API.
    pub CreateTrap: ::std::option::Option<
        unsafe extern "C" fn(
            handler: MojoTrapEventHandler,
            options: *const MojoCreateTrapOptions,
            trap_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub AddTrigger: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle32,
            handle: MojoHandle32,
            signals: MojoHandleSignals,
            condition: MojoTriggerCondition,
            context: usize,
            options: *const MojoAddTriggerOptions,
        ) -> MojoResult,
    >,
    pub RemoveTrigger: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle32,
            context: usize,
            options: *const MojoRemoveTriggerOptions,
        ) -> MojoResult,
    >,
    pub ArmTrap: ::std::option::Option<
        unsafe extern "C" fn(
            trap_handle: MojoHandle32,
            options: *const MojoArmTrapOptions,
            num_blocking_events: *mut u32,
            blocking_events: *mut MojoTrapEvent,
        ) -> MojoResult,
    >,
    /// Platform handle API.
    pub WrapPlatformHandle: ::std::option::Option<
        unsafe extern "C" fn(
            platform_handle: *const MojoPlatformHandle,
            options: *const MojoWrapPlatformHandleOptions,
            mojo_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub UnwrapPlatformHandle: ::std::option::Option<
        unsafe extern "C" fn(
            mojo_handle: MojoHandle32,
            options: *const MojoUnwrapPlatformHandleOptions,
            platform_handle: *mut MojoPlatformHandle,
        ) -> MojoResult,
    >,
    pub WrapPlatformSharedMemoryRegion: ::std::option::Option<
        unsafe extern "C" fn(
            platform_handles: *const MojoPlatformHandle,
            num_platform_handles: u32,
            num_bytes: u64,
            guid: *const MojoSharedBufferGuid,
            access_mode: MojoPlatformSharedMemoryRegionAccessMode,
            options: *const MojoWrapPlatformSharedMemoryRegionOptions,
            mojo_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub UnwrapPlatformSharedMemoryRegion: ::std::option::Option<
        unsafe extern "C" fn(
            mojo_handle: MojoHandle32,
            options: *const MojoUnwrapPlatformSharedMemoryRegionOptions,
            platform_handles: *mut MojoPlatformHandle,
            num_platform_handles: *mut u32,
            num_bytes: *mut u64,
            guid: *mut MojoSharedBufferGuid,
            access_mode: *mut MojoPlatformSharedMemoryRegionAccessMode,
        ) -> MojoResult,
    >,
    /// Invitation API.
    pub CreateInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            options: *const MojoCreateInvitationOptions,
            invitation_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub AttachMessagePipeToInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle32,
            name: *const ::std::os::raw::c_void,
            name_num_bytes: u32,
            options: *const MojoAttachMessagePipeToInvitationOptions,
            message_pipe_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub ExtractMessagePipeFromInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle32,
            name: *const ::std::os::raw::c_void,
            name_num_bytes: u32,
            options: *const MojoExtractMessagePipeFromInvitationOptions,
            message_pipe_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub SendInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            invitation_handle: MojoHandle32,
            process_handle: *const MojoPlatformProcessHandle,
            transport_endpoint: *const MojoInvitationTransportEndpoint,
            error_handler: MojoProcessErrorHandler,
            error_handler_context: usize,
            options: *const MojoSendInvitationOptions,
        ) -> MojoResult,
    >,
    pub AcceptInvitation: ::std::option::Option<
        unsafe extern "C" fn(
            transport_endpoint: *const MojoInvitationTransportEndpoint,
            options: *const MojoAcceptInvitationOptions,
            invitation_handle: *mut MojoHandle32,
        ) -> MojoResult,
    >,
    pub SetQuota: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle32,
            type_: MojoQuotaType,
            limit: u64,
            options: *const MojoSetQuotaOptions,
        ) -> MojoResult,
    >,
    pub QueryQuota: ::std::option::Option<
        unsafe extern "C" fn(
            handle: MojoHandle32,
            type_: MojoQuotaType,
            options: *const MojoQueryQuotaOptions,
            limit: *mut u64,
            usage: *mut u64,
        ) -> MojoResult,
    >,
    pub Shutdown: ::std::option::Option<
        unsafe extern "C" fn(options: *const MojoShutdownOptions) -> MojoResult,
    >,
    pub SetDefaultProcessErrorHandler: ::std::option::Option<
        unsafe extern "C" fn(
            handler: MojoDefaultProcessErrorHandler,
            options: *const MojoSetDefaultProcessErrorHandlerOptions,
        ) -> MojoResult,
    >,
    pub ReserveMessageCapacity: ::std::option::Option<
        unsafe extern "C" fn(
            message: MojoMessageHandle,
            payload_buffer_size: u32,
            buffer_size: *mut u32,
        ) -> MojoResult,
    >,
}
pub type MojoSystemThunks32 = MojoSystemThunks;
unsafe extern "C" {
    pub fn MojoEmbedderGetSystemThunks2() -> *const MojoSystemThunks2;
}
unsafe extern "C" {
    pub fn MojoEmbedderGetSystemThunks32() -> *const MojoSystemThunks32;
}
unsafe extern "C" {
    pub fn MojoEmbedderSetSystemThunks(system_thunks: *const MojoSystemThunks2);
}
