mokuya 0.0.7

Generic procedural macro helpers for parsing, type analysis, and derive macro generation.
Documentation
1
2
3
4
5
6
7
8
use syn::{Data, DataStruct, DeriveInput};

pub fn get_data_struct(input: &DeriveInput) -> Result<&DataStruct, &str> {
    match &input.data {
        Data::Struct(data_struct) => Ok(data_struct),
        _ => Err("Data is not a struct"),
    }
}