axiolid_contracts/
profiles.rs

1//! Normative v0.4 downstream integration profiles.
2
3use crate::{
4    ApiVersion, BoundaryContract, IntegrationProfile, INTEGRATION_API_VERSION, MINIMUM_RUST_VERSION,
5};
6
7/// Compatibility promise for one supported way of consuming Axiolid.
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub struct ProfileContract {
10    pub profile: IntegrationProfile,
11    pub name: &'static str,
12    pub transport: &'static str,
13    pub capability_discovery: &'static str,
14    pub compatibility: &'static str,
15    pub api_version: ApiVersion,
16    pub abi_version: Option<ApiVersion>,
17    pub minimum_rust_version: Option<&'static str>,
18    pub boundary: BoundaryContract,
19}
20
21/// Profiles supported by the v0.4 integration protocol.
22///
23/// These rows promise boundary behavior, not geometry operations. A concrete
24/// build advertises operation availability through `IntegrationDescriptor`;
25/// operation traits and conformance evidence remain authoritative.
26pub const V04_PROFILE_CONTRACTS: [ProfileContract; 3] = [
27    ProfileContract {
28        profile: IntegrationProfile::RustLeaf,
29        name: "rust-leaf",
30        transport: "Rust packages selected directly",
31        capability_discovery: "selected operation traits plus Backend::descriptor",
32        compatibility: "Cargo SemVer per selected leaf package",
33        api_version: INTEGRATION_API_VERSION,
34        abi_version: None,
35        minimum_rust_version: Some(MINIMUM_RUST_VERSION),
36        boundary: BoundaryContract::rust(),
37    },
38    ProfileContract {
39        profile: IntegrationProfile::RustFacade,
40        name: "rust-facade",
41        transport: "feature-gated axiolid package",
42        capability_discovery: "compiled IntegrationDescriptor plus operation traits",
43        compatibility: "Cargo SemVer and additive feature names",
44        api_version: INTEGRATION_API_VERSION,
45        abi_version: None,
46        minimum_rust_version: Some(MINIMUM_RUST_VERSION),
47        boundary: BoundaryContract::rust(),
48    },
49    ProfileContract {
50        profile: IntegrationProfile::NativeC,
51        name: "native-c",
52        transport: "C ABI with opaque handles",
53        capability_discovery: "ABI version and runtime IntegrationDescriptor query",
54        compatibility: "ABI major match; additive minor and patch releases",
55        api_version: INTEGRATION_API_VERSION,
56        abi_version: Some(INTEGRATION_API_VERSION),
57        minimum_rust_version: None,
58        boundary: BoundaryContract::native(),
59    },
60];
61
62#[cfg(test)]
63mod tests {
64    use super::*;
65    use std::collections::BTreeSet;
66
67    #[test]
68    fn profile_names_are_unique_and_every_boundary_is_explicit() {
69        let names: BTreeSet<_> = V04_PROFILE_CONTRACTS
70            .iter()
71            .map(|profile| profile.name)
72            .collect();
73        assert_eq!(names.len(), V04_PROFILE_CONTRACTS.len());
74        for profile in V04_PROFILE_CONTRACTS {
75            assert!(profile.boundary.right_handed_cartesian_f64);
76            assert!(profile.boundary.caller_defined_consistent_units);
77            assert!(profile.boundary.explicit_tolerance);
78        }
79    }
80
81    #[test]
82    fn only_the_native_profile_promises_an_abi() {
83        for profile in V04_PROFILE_CONTRACTS {
84            assert_eq!(
85                profile.abi_version.is_some(),
86                profile.profile == IntegrationProfile::NativeC
87            );
88        }
89    }
90}