Skip to main content

Crate atom_engine

Crate atom_engine 

Source
Expand description

Atom Engine - A component-oriented template engine for Rust

§Overview

Atom Engine is a high-performance template engine built on Tera with additional features like components, props, slots, and provide/inject context.

§Features

  • Built on Tera for robust template parsing and rendering
  • Component system with props, slots, and validation
  • Provide/Inject context (React-style)
  • Stack system for content accumulation
  • 50+ built-in filters
  • Helper directives (@map, @filter, @each, @reduce)
  • Async and parallel rendering support
  • Component caching

§Quick Start

use atom_engine::Atom;
use serde_json::json;
 
let mut engine = Atom::new();
engine.add_template("hello.html", "Hello, {{ name }}!").unwrap();
let result = engine.render("hello.html", &json!({"name": "World"})).unwrap();
assert_eq!(result, "Hello, World!");

Modules§

filters
Filter modules for Atom Engine.

Structs§

Atom
The main template engine struct.
Component
A registered component with its template and prop definitions.
ComponentCache
Cache for rendered components.
ComponentRegistry
Registry for managing component templates.
ComponentRenderer
Runtime component renderer that manages slot content and stack buffers.
ContextChain
A chain of context layers supporting provide/inject pattern.
MemoryPool
A memory pool for managing chunk allocations.
PooledString
A string backed by a pooled buffer.
PropDef
Definition of a component prop.
ScopedSlotDef
Definition of a scoped slot.
SlotData
Data for slot rendering.
StringPool
A pool for managing multiple PooledStrings.

Enums§

Error
All error types that can occur in Atom Engine.
PropType
The type of a component prop.

Functions§

compute_cache_key
Computes a cache key from component path and props hash.
compute_props_hash
Computes a hash for component props.