Skip to main content

Crate systemprompt_templates

Crate systemprompt_templates 

Source
Expand description

§systemprompt-templates

Template registry, loading, and rendering for systemprompt.io. The crate exposes:

  • TemplateRegistry — Handlebars-backed engine with multi-source template discovery, partial registration, and stat reporting. Registers a json helper for emitting values inside JSON contexts (e.g. JSON-LD <script> blocks): {{{json field}}} serialises via serde_json::to_string, which correctly escapes backslashes, newlines, and control characters that Handlebars’ default HTML escaping leaves intact.
  • TemplateRegistryBuilder — fluent builder that wires together loaders, providers, and partial sources.
  • CoreTemplateProvider — filesystem provider scanning a directory for .html templates plus an optional templates.yaml manifest.
  • EmbeddedDefaultsProvider — bundles the in-tree defaults/ templates so consumers get a usable engine without touching disk.
  • Re-exports of the systemprompt-template-provider traits the engine composes against.

§Feature flags

FeatureDefaultEffect
nonen/aThe crate exposes a single feature surface; all modules are compiled unconditionally. The [package.metadata.docs.rs] all-features = true setting is retained so future feature additions automatically appear in published docs.

§Layering

systemprompt-templates is a domain crate whose only systemprompt dependency is the systemprompt-template-provider shared crate.

Re-exports§

pub use error::TemplateError;
pub use error::TemplateResult;

Modules§

error
Typed error surface for the templates crate.

Structs§

ComponentContext
CoreTemplateProvider
EmbeddedDefaultsProvider
EmbeddedLoader
ExtendedData
ExtenderContext
FileSystemLoader
PageContext
RegistryStats
RenderedComponent
TemplateDefinition
TemplateRegistry
TemplateRegistryBuilder

Enums§

TemplateSource

Traits§

ComponentRenderer
PageDataProvider
TemplateDataExtender
TemplateLoader
#[async_trait] is required: this trait is consumed as Arc<dyn TemplateLoader> (see DynTemplateLoader), so it must be dyn-compatible — native async fn in traits is not.
TemplateProvider

Type Aliases§

DynComponentRenderer
DynPageDataProvider
DynTemplateDataExtender
DynTemplateLoader
DynTemplateProvider