darling_core 0.6.1

Helper crate for proc-macro library for reading attributes into structs when implementing custom derives. Use https://crates.io/crates/darling in your code.
Documentation
use syn;

use codegen;
use options::{Core, ParseAttribute, ParseData};
use Result;

pub struct FromMetaOptions {
    base: Core,
}

impl FromMetaOptions {
    pub fn new(di: &syn::DeriveInput) -> Result<Self> {
        (FromMetaOptions {
            base: Core::start(di),
        }).parse_attributes(&di.attrs)?
            .parse_body(&di.data)
    }
}

impl ParseAttribute for FromMetaOptions {
    fn parse_nested(&mut self, mi: &syn::Meta) -> Result<()> {
        self.base.parse_nested(mi)
    }
}

impl ParseData for FromMetaOptions {
    fn parse_variant(&mut self, variant: &syn::Variant) -> Result<()> {
        self.base.parse_variant(variant)
    }

    fn parse_field(&mut self, field: &syn::Field) -> Result<()> {
        self.base.parse_field(field)
    }
}

impl<'a> From<&'a FromMetaOptions> for codegen::FromMetaImpl<'a> {
    fn from(v: &'a FromMetaOptions) -> Self {
        codegen::FromMetaImpl {
            base: (&v.base).into(),
        }
    }
}