1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-04 02:54:08 +02:00

derive macros for entity parsing

This commit is contained in:
Robin Appelman 2022-02-27 17:40:01 +01:00
commit 6ced393424
7 changed files with 384 additions and 158 deletions

27
derive/tests/expand.rs Normal file
View file

@ -0,0 +1,27 @@
use vbsp::RawEntity;
use vbsp_derive::Entity;
#[derive(Entity)]
pub struct SpotLight {
pub angles: [f32; 3],
#[entity(name = "render_color")]
pub color: [u8; 3],
pub cone: u8,
#[entity(default)]
pub optional: bool,
}
#[derive(Entity)]
pub struct Lifetime<'a> {
pub model: &'a str,
}
#[derive(Entity)]
pub enum Entity<'a> {
// #[entity(name = "spot")]
// SpotLight(SpotLight),
#[entity(name = "bar")]
Foo(Lifetime<'a>),
#[entity(default)]
Unknown(RawEntity<'a>),
}