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§
- FsContent
Provider - Filesystem-backed
ContentProviderfor the build-time pipeline. - Memory
Content Provider - In-memory
ContentProviderbacked by a key→bytes map.
Enums§
- Provider
Error - Outcome of a
ContentProviderlookup.
Traits§
- Content
Provider - Abstract content store consumed by the renderer.
Type Aliases§
- Provider
Result - Specialised
ResultforContentProviderlookups.