mdcast_api/lib.rs
1//! Shared data types for mdcast: the document/brand model plus the HTTP wire
2//! protocol spoken between `mdcast-server` and `mdcast-client`.
3//!
4//! This crate exists so a client does not have to build mdcast itself. The
5//! `mdcast` crate unconditionally pulls `clap`, `rust-embed` (which compiles
6//! the whole vendored `embedded/` tree through a proc macro), `tempfile`,
7//! `toml`, `regex`, `pulldown-cmark`, `futures`, `tracing-subscriber` and a
8//! fat `tokio` — a price nobody should pay for a handful of structs. So the
9//! types both sides need live here, and depend on **serde and nothing else**.
10//!
11//! Nothing in here does IO or returns `anyhow::Result` by default. The
12//! loaders that do (`frontmatter::extract`, the `anyhow`-wrapped
13//! `brand::from_toml`, …) stay in `mdcast` and operate on these types, which
14//! `mdcast` re-exports from their original paths (`mdcast::Target`,
15//! `mdcast::BrandSpec`, `mdcast::DocMeta`, …). The one exception is
16//! [`BrandSpec::from_toml`](brand::BrandSpec::from_toml), gated behind this
17//! crate's optional `toml` feature (issue #80), for a caller that has a
18//! `brand.toml` but must not compile `mdcast` to parse it.
19//!
20//! ## Module map
21//!
22//! | Module | Contents |
23//! |---|---|
24//! | [`doc`] | [`Target`], [`DocMeta`] — the document model |
25//! | [`brand`] | [`BrandSpec`] and the auto-layout config it carries |
26//! | [`digest`] | [`Digest`] — a validated lowercase-hex sha256 |
27//! | [`manifest`] | [`AssetManifest`] — asset key → digest |
28//! | [`wire`] | request/response bodies for the HTTP service |
29
30pub mod brand;
31pub mod digest;
32pub mod doc;
33pub mod manifest;
34pub mod wire;
35
36pub use brand::{AutoLayout, AutoRule, BrandSpec, LogoPosition, LogoSpec, ShapePredicate};
37pub use digest::{Digest, DigestError};
38pub use doc::{DocMeta, Target};
39pub use manifest::AssetManifest;
40pub use wire::{
41 BlobCheckRequest, BlobCheckResponse, BoardOptions, BoardTheme, CapabilitiesResponse, ErrorCode,
42 ErrorResponse, GeneratedAsset, GeneratedSpec, Generator, MissingBlob, MissingBlobsError,
43 QrEcLevel, RenderMarkdownRequest, RenderOptions, RenderTemplateRequest, TemplateFormat,
44};