Skip to main content

copperlace/
lib.rs

1//! Copperlace text renderer.
2//!
3//! Copperlace compiles configuration into named rules and renders one rule at a
4//! time. Templates can reference other rules, make random choices, bind values
5//! for the duration of one render, use lazy `context` defaults, and transform
6//! rendered text with processors.
7//! Rust callers can also provide initial render context values when rendering a
8//! rule.
9//!
10//! For repeated renders from the same config, use [`Copperlace`] or [`RuleSet`]
11//! so the config is parsed and compiled once. For one-off rendering, use
12//! [`render_file`] or [`render_str`].
13
14pub mod config;
15#[cfg(not(target_arch = "wasm32"))]
16pub mod ffi;
17mod processors;
18pub mod render;
19#[cfg(target_arch = "wasm32")]
20mod wasm;
21
22pub use config::{
23    ConfigError, Copperlace, render_file, render_file_inferred, render_file_inferred_with_context,
24    render_file_structured, render_file_structured_with_context, render_file_with_context,
25    render_str, render_str_inferred, render_str_inferred_with_context, render_str_structured,
26    render_str_structured_with_context, render_str_with_context, ruleset_from_file,
27    ruleset_from_str,
28};
29pub use render::{
30    CopperlaceNumber, CopperlaceValue, Processor, ProcessorRegistry, RenderContext, RenderError,
31    RuleSet, StructuredNode, TextGeneratorNode, processor, render_config_rule,
32    render_config_rule_structured, render_config_rule_structured_with_context,
33    render_config_rule_with_context,
34};