chartml_core/resolver/backends/mod.rs
1//! Pluggable persistent `CacheBackend` implementations (chartml 5.0 phase 3b).
2//!
3//! Each backend lives behind its own cargo feature so non-browser builds stay
4//! lean. Today this hosts:
5//!
6//! - [`codec`] — pure-Rust binary codec for the on-disk blob format. Shared
7//! across every persistent backend so the framing has one source of truth.
8//! Compiled whenever a backend that uses it is on (today: `wasm-indexeddb`)
9//! OR whenever tests are running, so the framing is exercised on native via
10//! `cargo test --workspace` even with no feature flags enabled.
11//! - [`indexeddb::IndexedDbBackend`] — browser-side persistent cache wired
12//! through the [`idb`] crate. Behind the `wasm-indexeddb` feature, only
13//! compiles on the `wasm32-unknown-unknown` target.
14//!
15//! Future tier-2 backends (file-system, SQLite, Redis, …) will land alongside
16//! `indexeddb` here, each behind their own feature flag, and reuse the same
17//! `codec` framing.
18
19// `codec` is pure Rust (no `idb`/`js-sys`/`wasm-bindgen` deps). Compiled when
20// any consuming backend is on, OR when tests are building — that way native
21// `cargo test --workspace` exercises the byte framing without needing the
22// browser feature on. Cfg-gating it to consumers + `test` keeps `cargo check`
23// on native (no features, no tests) free of dead-code warnings, so the
24// workspace-wide `dead_code = "deny"` policy stays honored without per-fn
25// lint suppression attributes.
26#[cfg(any(test, all(target_arch = "wasm32", feature = "wasm-indexeddb")))]
27pub(crate) mod codec;
28
29#[cfg(all(target_arch = "wasm32", feature = "wasm-indexeddb"))]
30pub mod indexeddb;