rich_derive 0.1.0

Implementation #[derive(MetaType)]
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// A source data structure annotated with `derive`, parsed into an internal representation.
pub struct Container<'a> {
  /// The struct or enum name (without generics).
  pub ident: syn::Ident,
  /// Original input.
  pub original: &'a syn::DeriveInput,
}

impl<'a> Container<'a> {
  /// Convert the raw Syn ast into a parsed container object, collecting errors in `cx`.
  pub fn from_ast(item: &'a syn::DeriveInput) -> Option<Container<'a>> {
    let item = Container {
      ident: item.ident.clone(),
      original: item,
    };
    Some(item)
  }
}