mirror of
https://github.com/Pumpkin-MC/Pumpkin
synced 2025-01-30 21:51:36 +00:00
22 lines
569 B
Rust
22 lines
569 B
Rust
use proc_macro2::TokenStream;
|
|
use quote::quote;
|
|
|
|
use crate::array_to_tokenstream;
|
|
|
|
pub(crate) fn build() -> TokenStream {
|
|
println!("cargo:rerun-if-changed=../assets/sound_category.json");
|
|
|
|
let sound_categories: Vec<String> =
|
|
serde_json::from_str(include_str!("../../assets/sound_category.json"))
|
|
.expect("Failed to parse sound_category.json");
|
|
let variants = array_to_tokenstream(sound_categories);
|
|
|
|
quote! {
|
|
#[derive(Clone, Copy)]
|
|
#[repr(u8)]
|
|
pub enum SoundCategory {
|
|
#variants
|
|
}
|
|
}
|
|
}
|