fulltime_plugin_api/lib.rs
1//! Canonical league-data schema, data-provider WIT interface, and plugin manifest format
2//! shared by the `FullTime` plugin host and every data-provider plugin.
3//!
4//! Neither the host nor any plugin owns this contract: it is versioned and published
5//! independently of both so the host and plugins can evolve without a lockstep release.
6//! See `openspec/changes/define-league-data-contract/proposal.md` for the full rationale.
7//!
8//! # Examples
9//!
10//! ```
11//! use fulltime_plugin_api::{Manifest, SCHEMA_VERSION};
12//!
13//! let source = include_str!("../tests/fixtures/manifest.toml");
14//! let manifest = Manifest::parse(source)?;
15//! assert!(SCHEMA_VERSION.accepts(manifest.schema_version));
16//! # Ok::<(), Box<dyn std::error::Error>>(())
17//! ```
18
19#![warn(clippy::pedantic, clippy::nursery, missing_docs, rust_2018_idioms)]
20#![deny(unsafe_op_in_unsafe_fn)]
21#![forbid(unsafe_code)]
22
23mod bindings;
24mod manifest;
25mod version;
26
27pub use manifest::{Manifest, ManifestError, ManifestField};
28pub use version::{ParseVersionError, Version};
29
30pub use bindings::fulltime::plugin_api::errors::*;
31pub use bindings::fulltime::plugin_api::types::*;
32
33/// Current version of the canonical `league-data-schema` (see [`types`
34/// interface](https://github.com/pilgrimagesoftware/fulltime-plugin-api/blob/develop/wit/data-provider.wit)).
35///
36/// A plugin declaring a `schema_version` in its manifest is compatible with a host running
37/// this version when `SCHEMA_VERSION.accepts(plugin_schema_version)` is `true` — see
38/// [`Version::accepts`].
39pub const SCHEMA_VERSION: Version = Version::new(1, 0);
40
41/// Current version of the `data-provider` WIT interface.
42///
43/// A plugin declaring an `interface_version` in its manifest is compatible with a host
44/// running this version when `INTERFACE_VERSION.accepts(plugin_interface_version)` is
45/// `true` — see [`Version::accepts`].
46pub const INTERFACE_VERSION: Version = Version::new(1, 0);