#helper #nested #complex #structures #generate #macro #yuuka

macro yuuka-macros

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

13 releases

new 0.3.7 Nov 1, 2024
0.3.6 Oct 31, 2024
0.2.2 Oct 5, 2024
0.1.1 Oct 2, 2024

#2106 in Procedural macros

Download history 244/week @ 2024-09-27 558/week @ 2024-10-04 342/week @ 2024-10-11 10/week @ 2024-10-18 233/week @ 2024-10-25

1,220 downloads per month
Used in yuuka

Apache-2.0

52KB
1K 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.

Quick Start

use yuuka::derive_struct;

derive_struct!(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

~0.6–1.2MB
~26K SLoC