openstranded_common_wasmcontract/lib.rs
1//! # openstranded-common-wasmcontract
2//!
3//! Shared WASM contract types for OpenStranded — the core types and traits
4//! that both the engine and the plugin SDK use to communicate across the
5//! WASM boundary.
6//!
7//! This crate is the single source of truth for all contract types:
8//!
9//! - [`Value`]: dynamic type for cross-plugin arguments and return values
10//! - [`ServiceError`]: typed errors for Service API calls
11//! - [`Service`]: cross-plugin method call interface (trait)
12//! - [`Registry`]: in-memory content pack data store
13//! - [`RegistryEntry`]: a single file from content pack (data + filename)
14//! - [`GameAPI`]: host-side API surface provided to plugins
15//! - [`Contribution`]: declarative output from WASM plugin `build()` phase
16//! - [`ApiVersion`]: compile-time baked version for compatibility checks
17//! - [`LogLevel`]: log severity level
18//!
19//! ## Feature flags
20//!
21//! - `parse` (default): enables [`parse_registry_data`] and [`parse_registry_list`]
22//! - `std` (default): enables types that require the standard library
23//!
24//! ## Crate relationships
25//!
26//! ```text
27//! openstranded (engine) ──┐
28//! ├── openstranded-common-wasmcontract
29//! openstranded-plugin-api ──┘
30//! ```
31//!
32//! The engine and `plugin-api` both depend on this crate for shared types.
33//! The `plugin-api` crate re-exports everything and adds test utilities
34//! (`MockGameAPI`) and WASM entry point stubs.
35
36mod value;
37mod error;
38mod service;
39mod registry;
40mod game_api;
41mod contributions;
42mod version;
43
44// ── Re-exports ─────────────────────────────────────────────────────
45
46pub use value::Value;
47pub use error::ServiceError;
48pub use service::Service;
49pub use registry::{Registry, RegistryEntry};
50#[cfg(feature = "parse")]
51pub use registry::{parse_registry_data, parse_registry_list};
52pub use game_api::{GameAPI, LogLevel};
53pub use contributions::{Contribution, SystemDecl, ResourceDecl};
54pub use version::{ApiVersion, VersionMismatch};