tyzen-macro 0.1.5

Procedural macros for the tyzen crate.
Documentation

Tyzen ⚡

A lightweight, high-performance tool to generate TypeScript type definitions from Rust structs and enums. Perfect for Tauri apps and full-stack Rust/TypeScript projects.

Features

  • 🚀 Lightning Fast: Generates types in milliseconds.
  • 📦 Zero Config: Works out of the box with minimal setup.
  • 🔌 Tauri Integration: First-class support for Tauri commands.
  • 🛠️ Macro-based: Simple #[derive(Type)] and #[command] attributes.
  • 🧩 Extensible: Easily supports custom types like Uuid and Chrono.

Packages

  • tyzen: The core crate containing the logic for type generation.
  • tyzen-macro: Procedural macros for deriving types and marking commands.
  • tyzen-tauri: Specialized integration for Tauri applications.

Quick Start

1. Add Dependencies

Add tyzen to your Cargo.toml:

[dependencies]
tyzen = { version = "0.1.5", path = "../tyzen/tyzen" }

2. Define Your Types

use tyzen::Type;

#[derive(Type)]
pub struct User {
    id: u32,
    username: String,
    email: String,
}

3. Generate TypeScript

fn main() {
    tyzen::generate("bindings.ts");
}

Tauri Support

If you are using Tauri, you can use tyzen-tauri to automatically generate type-safe command declarations.

#[tyzen::command]
pub fn create_user(user: User) -> Result<User, String> {
    // ...
}

License

MIT / Apache-2.0