Crate quickform

Source
Expand description

QuickForm: A flexible templating and operation execution framework

This library provides a type-safe, state-aware templating system that can execute async operations and render their results using templates. It’s designed to be flexible and extensible while maintaining strong type safety.

§Examples

use quickform::{App};

// Define some state
#[derive(Clone)]
struct User {
    name: String,
    age: u32,
}

// Define an async operation
async fn process_user(user: Data<User>) -> String {
    format!("Hello, {}!", user.name)
}

// Create and run the app
let app = App::new()
    .with_templates("templates/")
    .with_state(User {
        name: "Alice".to_string(),
        age: 30,
    })
    .operation("greet.txt", process_user);

§Features

  • State Management: Support for multiple state types using a type-safe API
  • Async Operations: Execute async functions with state-aware parameters
  • Template Rendering: Integrate with template files for output generation
  • Builder Pattern: Fluent API for configuration and setup

§Type Parameters

  • T: The type of state stored in the App. Can be:
    • NoData: For apps with no state
    • Data<S>: For apps with a single state type
    • (Data<S1>, Data<S2>, ...): For apps with multiple state types

Structs§

App
The main application struct that manages state, operations, and template rendering