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

macro yuuka

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

17 releases (4 breaking)

0.5.2 Nov 15, 2024
0.5.1 Nov 14, 2024
0.4.0 Nov 5, 2024
0.3.7 Nov 1, 2024
0.1.1 Oct 2, 2024

#223 in Procedural macros

Download history 383/week @ 2024-09-30 655/week @ 2024-10-07 84/week @ 2024-10-14 76/week @ 2024-10-21 392/week @ 2024-10-28 143/week @ 2024-11-04 344/week @ 2024-11-11 58/week @ 2024-11-18

1,013 downloads per month

Apache-2.0

90KB
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 = GameDevelopment {
    description: "A game development team".to_string(),
    members: 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(),
        },
    ]
};

TODO

  • Array type support
  • Enum type support
  • Anonymous struct support that can use auto! macro to confirm the auto-generated field name
  • Default value support that can use = to assign the default value
  • pub and pub(crate) identifier support
  • Support custom derive macro.
  • Write a homepage for this library
  • Upload to crates.io

Dependencies

~1–1.9MB
~39K SLoC