yog-abi 0.35.0

Yog stable C ABI — the shared contract between mods and the runtime.
Documentation
//! Yog stable C ABI — the ONLY types that cross the mod/runtime boundary.
//!
//! Rules this file must never break:
//!  - Every type is `#[repr(C)]`.
//!  - No Rust trait objects, no generics, no std types in public structs.
//!  - Adding is a minor change: new fields go at the END of structs, new
//!    callback types and functions are new names; increment `ABI_MINOR`.
//!  - Anything else is a major change: removing (clean out what's obsolete
//!    then, here, in the runtime, the hosts' JNI, yog-api), reordering,
//!    changing a type or a meaning; increment `ABI_MAJOR`, `ABI_MINOR` = 0.
//!
//! Mods and the runtime are compiled independently; the runtime loads a mod
//! of its major version and a minor no newer than its own ([`compatible`]):
//! such a mod sees a prefix of every table, all of it there.

mod tables;

use std::os::raw::c_void;

mod primitives;
pub use primitives::*;
pub use tables::api::*;
pub use tables::bus::*;
pub use tables::gfx::*;
pub use tables::handlers::*;
pub use tables::mirror::*;
#[cfg(test)]
mod tests;

// ── Version ──────────────────────────────────────────────────────────────────

pub const ABI_MAJOR: u32 = 6;
pub const ABI_MINOR: u32 = 0;
/// `ABI_MAJOR * 10_000 + ABI_MINOR`.  Checked at mod load time.
pub const ABI_VERSION: u32 = ABI_MAJOR * 10_000 + ABI_MINOR;

/// Whether a mod built for ABI `version` runs on this one: the same major,
/// a minor no newer (what it knows is all here; later additions it doesn't use).
pub const fn compatible(version: u32) -> bool {
    version / 10_000 == ABI_MAJOR && version <= ABI_VERSION
}