spatialos-macro 0.2.4

Procmacro crate used to expand SpatialOS component and types created with spatialos-codegen
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use proc_macro::TokenStream;
use syn::{parse_macro_input, ItemStruct};

use crate::ast::StructAST;

pub fn generate_type(item: TokenStream) -> TokenStream {
    let input = parse_macro_input!(item as ItemStruct);
    let ast = StructAST::from(&input);

    if ast.is_component() {
        panic!("Custom types should not have an ID");
    }

    ast.into()
}