Skip to main content

Module content_provider

Module content_provider 

Source
Expand description

ContentProvider — abstract I/O for the renderer.

The build-time pipeline reads markdown + templates from the local filesystem (std::fs). The Edge / WASM renderer needs the same sources but from Cloudflare KV, Vercel Edge Config, an in-memory cache, or anywhere else.

This trait is the seam: every renderer code path that needs to resolve a source dependency goes through ContentProvider. Build-time uses FsContentProvider; runtime adapters (Cloudflare Workers, Vercel Edge) supply their own implementations.

§Why in ssg-core?

ssg-core is the WASM-compatible crate. The trait must compile to wasm32-unknown-unknown so the same Rust renderer code can be consumed by both the native build binary and the Edge WASM renderer.

§Determinism

Implementations MUST be deterministic for the lifetime of a single render request. If the same key is fetched twice in one render, both calls must return the same bytes. Adapters that wrap a mutable backing store (KV, Edge Config) should snapshot at the start of a render request.

Structs§

FsContentProvider
Filesystem-backed ContentProvider for the build-time pipeline.
MemoryContentProvider
In-memory ContentProvider backed by a key→bytes map.

Enums§

ProviderError
Outcome of a ContentProvider lookup.

Traits§

ContentProvider
Abstract content store consumed by the renderer.

Type Aliases§

ProviderResult
Specialised Result for ContentProvider lookups.