openstranded_plugin_api/lib.rs
1//! # openstranded-plugin-api
2//!
3//! Plugin SDK for `OpenStranded` — re-exports all contract types from
4//! [`openstranded-common-wasmcontract`] and adds plugin-specific utilities.
5//!
6//! ## Re-exports
7//!
8//! All core types come from [`openstranded-common-wasmcontract`]:
9//!
10//! - [`Value`] — dynamic type for cross-plugin arguments and return values
11//! - [`ServiceError`] — typed errors for Service API calls
12//! - [`Service`] — cross-plugin method call interface (trait)
13//! - [`Registry`] — in-memory content pack data store
14//! - [`RegistryEntry`] — a single file from content pack (DTO)
15//! - [`GameAPI`] — host-side API surface provided to plugins
16//! - [`Contribution`] — declarative output from WASM plugin `build()` phase
17//! - [`ApiVersion`] — compile-time baked version for compatibility checks
18//! - [`LogLevel`] — log severity level
19//!
20//! ## Plugin-specific additions
21//!
22//! - [`MockGameAPI`](test_utils::MockGameAPI) (behind `test-utils` feature):
23//! mock implementation of [`GameAPI`] for unit-testing plugins natively
24//!
25//! ## Feature flags
26//!
27//! - `test-utils`: enables `MockGameAPI` and test utilities
28//!
29//! ## WASM entry points (planned)
30//!
31//! Every WASM plugin must export the following `#[no_mangle] extern "C"` functions:
32//!
33//! | Export | Required | Called during |
34//! |--------|----------|---------------|
35//! | `plugin_api_version() -> ApiVersion` | Yes | Load, before anything |
36//! | `plugin_build(ctx) -> Vec<Contribution>` | Yes | Registry phase |
37//! | `plugin_ready(api) -> bool` | No | Discovery phase |
38//! | `plugin_finish(api)` | No | Integration phase |
39
40// Re-export everything from the shared wasmcontract crate.
41pub use openstranded_common_wasmcontract::*;
42
43#[cfg(feature = "test-utils")]
44pub mod test_utils;