schema_with attribute

This commit is contained in:
Graham Esau 2020-05-15 17:11:28 +01:00
parent 9d951b34ce
commit 3fd316063a
15 changed files with 538 additions and 51 deletions

View file

@ -1,6 +1,6 @@
mod from_serde;
use crate::attr::{Attrs, WithAttr};
use crate::attr::Attrs;
use from_serde::FromSerde;
use serde_derive_internals::ast as serde_ast;
use serde_derive_internals::{Ctxt, Derive};
@ -68,12 +68,4 @@ impl<'a> Field<'a> {
pub fn name(&self) -> String {
self.serde_attrs.name().deserialize_name()
}
pub fn type_for_schema(&self) -> &syn::Type {
match &self.attrs.with {
None => self.ty,
Some(WithAttr::Type(ty)) => ty,
Some(WithAttr::_Function(_)) => unimplemented!(), // TODO
}
}
}