mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 03:38:00 +00:00
Derive for remote types
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use syn;
|
||||
use attr;
|
||||
use check;
|
||||
use Ctxt;
|
||||
|
||||
pub struct Item<'a> {
|
||||
@@ -62,12 +63,14 @@ impl<'a> Item<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
let item = Item {
|
||||
ident: item.ident.clone(),
|
||||
attrs: attrs,
|
||||
body: body,
|
||||
generics: &item.generics,
|
||||
}
|
||||
};
|
||||
check::check(cx, &item);
|
||||
item
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +84,10 @@ impl<'a> Body<'a> {
|
||||
Body::Struct(_, ref fields) => Box::new(fields.iter()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_getter(&self) -> bool {
|
||||
self.all_fields().any(|f| f.attrs.getter().is_some())
|
||||
}
|
||||
}
|
||||
|
||||
fn enum_from_ast<'a>(cx: &Ctxt, variants: &'a [syn::Variant]) -> Vec<Variant<'a>> {
|
||||
|
||||
Reference in New Issue
Block a user