citum_resolver_api/lib.rs
1/*
2SPDX-License-Identifier: MIT OR Apache-2.0
3SPDX-FileCopyrightText: © 2023-2026 Bruce D'Arcus and Citum contributors
4*/
5
6//! Canonical style resolution interfaces for the Citum citation engine.
7//!
8//! This crate provides a lightweight bridge between the schema layer
9//! (which defines style models) and the store layer (which implements
10//! persistence and network resolution). It minimizes dependencies
11//! to facilitate integration by third-party tool authors who don't
12//! need the full store logic.
13
14/// Error types and conversion helpers.
15pub mod error;
16pub use error::{ResolutionError, ResolverError};
17
18/// A resolver that can locate styles and locales.
19///
20/// This trait uses associated types to break cyclic dependencies between
21/// schema models and resolution logic.
22pub trait StyleResolver: Send + Sync {
23 /// The style type resolved by this implementation.
24 type Style;
25 /// The locale type resolved by this implementation.
26 type Locale;
27
28 /// Resolve a style by URI or ID.
29 ///
30 /// # Errors
31 /// Returns a [`ResolverError`] if the style cannot be found or loaded.
32 fn resolve_style(&self, uri: &str) -> Result<Self::Style, ResolverError>;
33
34 /// Resolve a locale by ID.
35 ///
36 /// # Errors
37 /// Returns a [`ResolverError`] if the locale cannot be found or loaded.
38 fn resolve_locale(&self, id: &str) -> Result<Self::Locale, ResolverError>;
39}