#serialization #nested #structures #macro #generate #complex #helper

macro yuuka

A helper library to generate complex and nested structures by a simple macro

19 releases (5 breaking)

0.6.1 Jan 7, 2025
0.6.0 Dec 28, 2024
0.5.2 Nov 15, 2024
0.4.0 Nov 5, 2024
0.1.1 Oct 2, 2024

#259 in Procedural macros

Download history 96/week @ 2024-09-25 309/week @ 2024-10-02 679/week @ 2024-10-09 38/week @ 2024-10-16 120/week @ 2024-10-23 413/week @ 2024-10-30 80/week @ 2024-11-06 364/week @ 2024-11-13 47/week @ 2024-11-20 8/week @ 2024-11-27 13/week @ 2024-12-04 2/week @ 2024-12-11 152/week @ 2024-12-25 79/week @ 2025-01-01 65/week @ 2025-01-08

296 downloads per month

Apache-2.0

86KB
2K SLoC

yuuka

Crates.io License Crates.io Version GitHub Actions Workflow Status

Introduction

This is a helper library to generate complex and nested structures by a simple macro. It is based on the serde library that is used to serialize and deserialize data in Rust.

The name yuuka comes from the character Yuuka in the game Blue Archive.

Still in development, the API may change in the future.

Quick Start

use serde::{Serialize, Deserialize};
use yuuka::derive_struct;

derive_struct!(
    #[derive(Serialize, Deserialize)]
    GameDevelopment {
        description: String,
        members: Members {
            script_writer: String,
            illustrator: String,
            programmer: String,
            tester: Vec<String>,
        },
        projects: [Project {
            project_name: String,
            engine: String,
        }],
    }
);

let config = auto!(GameDevelopment {
    description: "A game development team".to_string(),
    members: {
        script_writer: "Momoi".to_string(),
        illustrator: "Midori".to_string(),
        programmer: "Yuzu".to_string(),
        tester: vec!["Arisu".to_string(), "Key".to_string()],
    },
    projects: vec![
        Project {
            project_name: "777 Game Launcher".to_string(),
            engine: "Tauri".to_string(),
        },
        Project {
            project_name: "Blue Archive".to_string(),
            engine: "Unity".to_string(),
        },
    ]
});

More information can be found in the documentation (English | 简体中文 | 繁體中文).

Dependencies

~0.9–1.9MB
~39K SLoC