Skip to main content

Crate mdcast_api

Crate mdcast_api 

Source
Expand description

Shared data types for mdcast: the document/brand model plus the HTTP wire protocol spoken between mdcast-server and mdcast-client.

This crate exists so a client does not have to build mdcast itself. The mdcast crate unconditionally pulls clap, rust-embed (which compiles the whole vendored embedded/ tree through a proc macro), tempfile, toml, regex, pulldown-cmark, futures, tracing-subscriber and a fat tokio — a price nobody should pay for a handful of structs. So the types both sides need live here, and depend on serde and nothing else.

Nothing in here does IO or returns anyhow::Result by default. The loaders that do (frontmatter::extract, the anyhow-wrapped brand::from_toml, …) stay in mdcast and operate on these types, which mdcast re-exports from their original paths (mdcast::Target, mdcast::BrandSpec, mdcast::DocMeta, …). The one exception is BrandSpec::from_toml, gated behind this crate’s optional toml feature (issue #80), for a caller that has a brand.toml but must not compile mdcast to parse it.

§Module map

ModuleContents
docTarget, DocMeta — the document model
brandBrandSpec and the auto-layout config it carries
digestDigest — a validated lowercase-hex sha256
manifestAssetManifest — asset key → digest
wirerequest/response bodies for the HTTP service

Re-exports§

pub use brand::AutoLayout;
pub use brand::AutoRule;
pub use brand::BrandSpec;
pub use brand::LogoPosition;
pub use brand::LogoSpec;
pub use brand::ShapePredicate;
pub use digest::Digest;
pub use digest::DigestError;
pub use doc::DocMeta;
pub use doc::Target;
pub use manifest::AssetManifest;
pub use wire::BlobCheckRequest;
pub use wire::BlobCheckResponse;
pub use wire::CapabilitiesResponse;
pub use wire::ErrorCode;
pub use wire::ErrorResponse;
pub use wire::MissingBlob;
pub use wire::MissingBlobsError;
pub use wire::RenderMarkdownRequest;
pub use wire::RenderOptions;
pub use wire::RenderTemplateRequest;
pub use wire::TemplateFormat;

Modules§

brand
Brand specification: single source of truth for palette, fonts, margins, and the auto-layout rules. v1 only models what the page-layout system needs; richer projection (palette → typst/CSS/reference docs) lands in Phase 4.
digest
Content digest: the identity of one blob in the asset-negotiation protocol. A caller announces the assets a render needs by digest, the server answers with the ones it does not hold yet.
doc
The document model: what to render (DocMeta) and what to render it into (Target).
manifest
Asset manifest: the flat asset-key namespace mapped to content digests.
wire
HTTP wire protocol: the request and response bodies mdcast-server and mdcast-client exchange. Types only — no transport, no handler logic.