QuickForm
QuickForm is a flexible templating and operation execution framework for Rust that provides a type-safe, state-aware system for executing async operations and rendering their results using templates.
Features
- Type-safe State Management: Support for multiple state types with thread-safe access
- Async Operations: Execute async functions with state-aware parameters
- Template Rendering: Integrate with template files for output generation
- In-memory Filesystem: Virtual filesystem for managing templates and generated files
- Builder Pattern API: Fluent interface for configuration and setup
Installation
Add QuickForm to your Cargo.toml
:
[]
= "0.1.0"
Usage
Here's a basic example:
use App;
// Define some state
// Define an async operation
async
// Create and run the app
let app = new
.with_templates
.with_state
.render_operation;
// Execute operations and write results
app.run.await?;
State Management
QuickForm provides thread-safe state management through the Data<T>
wrapper:
let state = new;
// Update state
state.update.await;
// Get state value
let user = state.clone_inner.await;
Template Rendering
Templates are loaded from disk and rendered using the MiniJinja engine. Templates can access state data and operation results through a context object.
Example template:
Hello, {{ user.name }}!
Your account was created on {{ user.created_at | date }}.
Operations
QuickForm supports two types of operations:
- Render Operations: Execute async functions and render their results using templates
- State Operations: Execute async functions that modify application state
Operations can accept up to 4 state parameters and return any serializable type.
Documentation
For detailed documentation and examples, see the API documentation.
License
This project is licensed under the MIT License.