prosaic-common 1.0.1

Shared type metadata for prosaic-core and prosaic-derive: ValueType, PipeSpec registry, and const-eval schema helpers.
Documentation
  • Coverage
  • 53.33%
    8 out of 15 items documented0 out of 5 items with examples
  • Size
  • Source code size: 17.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 268.73 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • wildmason/prosaic
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mattnb

prosaic-common

Shared type metadata for the Prosaic template engine.

This crate is the dependency-free, no_std layer shared by prosaic-core and prosaic-derive. It owns the public pipe type registry used by runtime template rendering and compile-time template validation.

Install

[dependencies]
prosaic-common = "1.0.1"

Most applications should depend on prosaic-core instead. Use this crate directly when you are writing tooling, macros, validators, or integrations that need to reason about Prosaic template slot and pipe types without pulling in the full engine.

What It Provides

  • ValueType: the slot-level type model shared by the engine and derive macros.
  • PipeSpec and PIPE_SPECS: the canonical registry of built-in pipe input and output types.
  • pipe_spec: const-friendly pipe lookup by name.
  • types_compatible: const-friendly compatibility checks for schema validation.
  • schema_lookup: const-friendly lookup for hand-authored schema tables.

Example

use prosaic_common::{pipe_spec, types_compatible, ValueType};

let pipe = pipe_spec("pluralize").expect("pluralize is a built-in pipe");
assert_eq!(pipe.input, ValueType::Number);
assert_eq!(pipe.output, ValueType::String);

assert!(types_compatible(ValueType::Any, ValueType::String));
assert!(!types_compatible(ValueType::Number, ValueType::List));

License

MIT OR Apache-2.0