nongoose-derive 0.1.0-beta.1

Macros implementation of #[derive(Schema)]
Documentation
1
2
3
4
5
6
7
8
9
10
11
use syn::{Data, DeriveInput, Fields, FieldsNamed};

pub(crate) fn get(input: &DeriveInput) -> &FieldsNamed {
  match &input.data {
    Data::Struct(s) => match &s.fields {
      Fields::Named(fields) => fields,
      _ => panic!("Schema only supports named fields"),
    },
    _ => panic!("Schema only supports named fields"),
  }
}