Skip to main content

ethos_core/
lib.rs

1/*
2 * Copyright 2026 The Ethos maintainers
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! # ethos-core
18//!
19//! The Ethos product contract in Rust: canonical document model, deterministic
20//! serialization (c14n v1), fingerprints, stable error/warning codes, page-range
21//! configuration, and the trait boundaries between crates.
22//!
23//! Normative references: `schemas/*.json` and `docs/determinism-contract.md`.
24//! Contract changes happen only via `contract-change` PRs with version bumps.
25//!
26//! ## Feature layers (invariant 4: verify portability)
27//!
28//! - `grounding` — the [`grounding::GroundingSource`] trait module alone. `ethos-verify`
29//!   depends on `ethos-core` with `default-features = false, features = ["grounding", "verify-types"]`
30//!   and therefore can never see parser internals. CI builds it that way to prove it.
31//! - `verify-types` — verification report/config schema types + stable warning codes.
32//! - `full` (default) — canonical model, c14n, fingerprints, geometry, config, traits.
33
34#![forbid(unsafe_code)]
35#![warn(missing_docs)]
36
37#[cfg(feature = "grounding")]
38pub mod grounding;
39
40#[cfg(feature = "verify-types")]
41pub mod codes;
42#[cfg(feature = "verify-types")]
43pub mod verify_types;
44
45#[cfg(feature = "full")]
46pub mod c14n;
47#[cfg(feature = "full")]
48pub mod config;
49#[cfg(feature = "full")]
50pub mod crop_element;
51#[cfg(feature = "full")]
52pub mod error;
53#[cfg(feature = "full")]
54pub mod fingerprint;
55#[cfg(feature = "full")]
56pub mod geom;
57#[cfg(feature = "full")]
58pub mod ids;
59#[cfg(feature = "full")]
60pub mod model;
61#[cfg(feature = "full")]
62pub mod traits;
63
64/// Canonical schema version emitted by this crate (all five schemas move in lockstep).
65pub const SCHEMA_VERSION: &str = "1.0.0";
66
67/// The deterministic profile this crate is built to honor.
68pub const PROFILE_ID: &str = "ethos-deterministic-v1";
69
70/// c14n algorithm version implemented by [`c14n`] (when the `full` feature is on).
71pub const C14N_VERSION: &str = "c14n-v1";
72
73/// ID scheme version implemented by [`ids`] (when the `full` feature is on).
74pub const ID_SCHEME_VERSION: &str = "ids-v1";