structs-from-excel

This crate adds a procedural macro that will generate structs based on a given Excel spreadsheet. It was made for a project where I knew that one of the people helping was not going to want to work with JSON or XML or anything reasonable. I'm sorry.

Invocation of the macro is as follows:

``` use structsfromexcel;

[sheet("resources/objects.xls")]

pub struct Object; // This struct will get ignored and replaced by whatever structs you define. Anything can go here, pretty much. ```

Each sheet is then read and parsed, keeping the following rules in mind:

The following two sheets:

image

image

become:

pub struct Slime { pub hp: i32, } impl Default for Slime { fn default() -> Self { Self { hp: 30 } } } impl Slime { pub fn new() -> Self { return Default::default(); } } pub struct OtherSlime { pub hp: i32, } impl Default for OtherSlime { fn default() -> Self { Self { hp: 60 } } } impl OtherSlime { pub fn new() -> Self { return Default::default(); } } pub struct PlayerOne { pub what: f32, pub wa: String, pub hp: i32, } impl Default for PlayerOne { fn default() -> Self { Self { what: 15.5, wa: String::from("lorem"), hp: 20, } } } impl PlayerOne { pub fn new() -> Self { return Default::default(); } } pub struct PlayerTwo { pub hp: i32, pub wa: String, pub what: f32, } impl Default for PlayerTwo { fn default() -> Self { Self { hp: 20, wa: String::from("ipsum"), what: 15.5, } } } impl PlayerTwo { pub fn new() -> Self { return Default::default(); } } pub struct PlayerThree { pub what: f32, pub wa: String, pub hp: i32, } impl Default for PlayerThree { fn default() -> Self { Self { what: 15.5, wa: String::from("dot"), hp: 20, } } } impl PlayerThree { pub fn new() -> Self { return Default::default(); } } pub struct PlayerFour { pub what: f32, pub wa: String, pub hp: i32, } impl Default for PlayerFour { fn default() -> Self { Self { what: 15.5, wa: String::from("ament"), hp: 20, } } } impl PlayerFour { pub fn new() -> Self { return Default::default(); } }