commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
73a6ca4db9714be1c659fc99c72fece532da8665 | Ted Driggs | 2017-06-19T00:38:59 | Use early-return style in ExtractAttribute::extractor | diff --git a/core/src/codegen/mod.rs b/core/src/codegen/mod.rs
index c12e481..c7704c1 100644
--- a/core/src/codegen/mod.rs
+++ b/core/src/codegen/mod.rs
@@ -56,52 +56,53 @@ pub trait ExtractAttribute {
let will_parse_any = !self.attr_names().is_empty();
let will_fwd_any = self.forwarded_attrs().map(|f... | 1 | 41 | 40 |
97d83bc5a06e579c2bdc9f22def81bd4db4d1a98 | Ted Driggs | 2017-06-19T00:19:46 | Fix an issue where unit structs can't be addressed as `Self` | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 8b999a5..c2b0533 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -13,13 +13,17 @@ impl<'a> ToTokens for FmiImpl<'a> {
let base = &self.base;
let impl_block = match base.body {
+ ... | 1 | 5 | 1 |
6605779fd1e990b868d8963041546b65e191d233 | Ted Driggs | 2017-06-19T00:00:43 | Renamed darling_core::errors to darling_core::error, and made it public | diff --git a/core/src/errors.rs b/core/src/error.rs
similarity index 100%
rename from core/src/errors.rs
rename to core/src/error.rs
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 54d42ba..90e7623 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -15,7 +15,7 @@ mod macros;
pub mod ast;
pub mod codegen;
-p... | 3 | 3 | 6 |
ad9b5df665a08fe266cd374f394a8f6cbbd752a4 | Ted Driggs | 2017-06-18T23:48:38 | Add support for multiple errors in a single Error instance | diff --git a/core/src/errors.rs b/core/src/errors.rs
index 0d38737..550f3e9 100644
--- a/core/src/errors.rs
+++ b/core/src/errors.rs
@@ -1,12 +1,22 @@
+//! Types for working with darling errors and results.
+
use std::error::Error as StdError;
use std::fmt;
+use std::iter::{self, Iterator};
use std::string::ToString... | 2 | 232 | 22 |
21f40b4c74a186b3153235463aac1314b066a7d4 | Ted Driggs | 2017-06-19T00:21:55 | Use restricted visibility in darling_core::codegen | diff --git a/core/src/codegen/trait_impl.rs b/core/src/codegen/trait_impl.rs
index c6f6336..694b788 100644
--- a/core/src/codegen/trait_impl.rs
+++ b/core/src/codegen/trait_impl.rs
@@ -17,8 +17,7 @@ pub struct TraitImpl<'a> {
impl<'a> TraitImpl<'a> {
/// Generate local variable declarations for all fields.
- ... | 2 | 9 | 14 |
ea432d147d666399bae5d23aacf5db9a837429bb | Ted Driggs | 2017-06-15T00:02:24 | Convert Error to use ErrorKind internally | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index ab25c56..8b999a5 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -60,6 +60,8 @@ impl<'a> ToTokens for FmiImpl<'a> {
quote!(
fn from_list(__outer: &[::syn::NestedMetaItem... | 2 | 86 | 13 |
ebcc1b3a6004600479c1be36c236e349aaf7bacb | Ted Driggs | 2017-05-26T20:41:17 | New trait impls
Improved HashMap trait impl | diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs
index f7670ee..9463d4b 100644
--- a/core/src/from_meta_item.rs
+++ b/core/src/from_meta_item.rs
@@ -27,7 +27,8 @@ use {Error, Result};
/// * As a raw string literal, e.g. `foo = r#"hello "world""#`.
///
/// ## ()
-/// * Word with no value specified... | 3 | 45 | 4 |
a14ac7c9b68d2d6641542224e394299b2e826483 | Ted Driggs | 2017-05-24T17:34:45 | Fixed darling_macro | diff --git a/macro/Cargo.toml b/macro/Cargo.toml
index d558704..4c17bfa 100644
--- a/macro/Cargo.toml
+++ b/macro/Cargo.toml
@@ -9,13 +9,10 @@ implementing custom derives. Use https://crates.io/crates/darling in your code.
"""
license = "MIT"
-[lib]
-proc-macro = true
-
[dependencies]
quote = "0.3.15"
syn = "0.1... | 1 | 3 | 6 |
d06489e1ec49a4cfbec25b61bc140822375fa806 | Ted Driggs | 2017-05-24T17:30:11 | Trying to fix darling_macro | diff --git a/macro/Cargo.toml b/macro/Cargo.toml
index d2d2d39..d558704 100644
--- a/macro/Cargo.toml
+++ b/macro/Cargo.toml
@@ -15,4 +15,7 @@ proc-macro = true
[dependencies]
quote = "0.3.15"
syn = "0.11.11"
-darling_core = { version = "=0.1.6", path = "../core" }
\ No newline at end of file
+
+[dependencies.darlin... | 1 | 4 | 1 |
1ebfe474d7d915fbbf62e34cbef6dd8fc48f0ff0 | Ted Driggs | 2017-05-24T17:16:10 | Fix borrow check issue and bump version | diff --git a/Cargo.toml b/Cargo.toml
index 5174005..6c0954f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "darling"
-version = "0.1.5"
+version = "0.1.6"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
-documentation = "https://docs.r... | 4 | 15 | 12 |
68ac0e7ebf04655fbe0d7887cec7d971529d3d21 | Ted Driggs | 2017-05-24T17:01:08 | Version bump | diff --git a/Cargo.toml b/Cargo.toml
index 259f3ba..5174005 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "darling"
-version = "0.1.4"
+version = "0.1.5"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
-documentation = "https://docs.r... | 3 | 7 | 7 |
61ab617510014e6687a2e1b52341266e857d000c | Ted Driggs | 2017-05-24T17:00:13 | Document codegen::DefaultExpression | diff --git a/core/src/codegen/default_expr.rs b/core/src/codegen/default_expr.rs
index 3432cd5..ae27f21 100644
--- a/core/src/codegen/default_expr.rs
+++ b/core/src/codegen/default_expr.rs
@@ -7,6 +7,8 @@ const DEFAULT_STRUCT_NAME: &str = "__default";
/// The fallback value for a field or container.
#[derive(Debug, C... | 1 | 3 | 0 |
440f70a68e775109171052ff4040435c5045a450 | Ted Driggs | 2017-05-24T16:57:46 | Better AST docs | diff --git a/core/src/ast.rs b/core/src/ast.rs
index 0b53898..4c53ee7 100644
--- a/core/src/ast.rs
+++ b/core/src/ast.rs
@@ -1,7 +1,12 @@
+//! Utility types for working with the AST.
+
use syn;
use {FromField, FromVariant, Result};
+/// A struct or enum body.
+///
+/// `V` is the type which receives any encounte... | 1 | 28 | 2 |
5047e7eef12c35b2e8b742ad7bb449946515e949 | Ted Driggs | 2017-05-24T15:24:09 | Fix broken shape tests | diff --git a/core/src/options/shape.rs b/core/src/options/shape.rs
index 0344e7e..8caf5fb 100644
--- a/core/src/options/shape.rs
+++ b/core/src/options/shape.rs
@@ -205,7 +205,6 @@ mod tests {
use super::Shape;
use {FromMetaItem};
- use util::Flag;
/// parse a string as a syn::MetaItem instanc... | 1 | 7 | 8 |
6c4e00087e0eb9313b013e4af30b9b22fb09767a | Ted Driggs | 2017-05-23T22:31:28 | Version bump | diff --git a/Cargo.toml b/Cargo.toml
index 2b38343..259f3ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "darling"
-version = "0.1.3"
+version = "0.1.4"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
-documentation = "https://docs.r... | 3 | 7 | 7 |
b3262f97d134cbdb1eac74e3c1bca5d3d484d5d0 | Ted Driggs | 2017-05-23T21:29:28 | Improvements to shape validation | diff --git a/core/src/codegen/from_variant_impl.rs b/core/src/codegen/from_variant_impl.rs
index 178698e..7a667f2 100644
--- a/core/src/codegen/from_variant_impl.rs
+++ b/core/src/codegen/from_variant_impl.rs
@@ -2,7 +2,7 @@ use quote::{Tokens, ToTokens};
use syn::{self, Ident};
use codegen::{ExtractAttribute, Oute... | 5 | 84 | 46 |
4fc63bc704aad8a42799cddb914a672960aeabd8 | Ted Driggs | 2017-05-23T19:54:05 | Add pre-validation for body format | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 94d0c1e..8c67466 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -3,7 +3,7 @@ use syn::{self, Ident};
use ast::Body;
use codegen::{TraitImpl, ExtractAttribute, OuterFromImpl... | 5 | 204 | 10 |
bafcb7bb7e8a87c04b3d5aafc4d5143ad240e919 | Ted Driggs | 2017-05-23T17:12:49 | Renamed name_in_struct to ident | diff --git a/core/src/codegen/field.rs b/core/src/codegen/field.rs
index 1723bb8..b2d83ac 100644
--- a/core/src/codegen/field.rs
+++ b/core/src/codegen/field.rs
@@ -13,7 +13,7 @@ pub struct Field<'a> {
/// The name presented to the author of the library. This will appear
/// in the setters or temporary vari... | 2 | 13 | 13 |
37162027fd03634597365b1e40cff27c9a224433 | Ted Driggs | 2017-05-23T17:02:59 | WIP adding supports declaration to control input shape
* Options are present
* Codegen is not | diff --git a/core/src/options/from_derive.rs b/core/src/options/from_derive.rs
index ea9e249..ef55c9b 100644
--- a/core/src/options/from_derive.rs
+++ b/core/src/options/from_derive.rs
@@ -1,8 +1,8 @@
use syn::{self, Ident};
-use Result;
+use {FromMetaItem, Result};
use codegen;
-use options::{ParseAttribute, Parse... | 3 | 134 | 3 |
8501b081b6e9eb59b21887572ce201d7b5200deb | Ted Driggs | 2017-05-23T16:40:26 | Add darling::util::Flag | diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs
index 1af71c0..c7d5b0c 100644
--- a/core/src/util/mod.rs
+++ b/core/src/util/mod.rs
@@ -1,4 +1,8 @@
//! Utility types for attribute parsing.
+use std::ops::Deref;
+
+use syn;
+use {FromMetaItem, Result};
mod ident_list;
mod ignored;
@@ -6,4 +10,39 @@ mod ove... | 1 | 40 | 1 |
9688a29b7523d0719b0bab97b739b6970b68e2b5 | Ted Driggs | 2017-05-23T16:40:04 | Fix generated code to use new method name | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 0c84b5a..94d0c1e 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -41,7 +41,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> {
let passed_vis = self.vis.as_ref().map(|... | 1 | 1 | 1 |
6d44f4d20fc622fceaa43800d8611f62a87c12fe | Ted Driggs | 2017-05-23T00:58:55 | Don't assume every field has an ident | diff --git a/core/src/codegen/from_field.rs b/core/src/codegen/from_field.rs
index fb90265..78a88e1 100644
--- a/core/src/codegen/from_field.rs
+++ b/core/src/codegen/from_field.rs
@@ -29,7 +29,7 @@ impl<'a> ToTokens for FromFieldImpl<'a> {
self.base.fallback_decl()
};
- let passed_ident ... | 1 | 1 | 1 |
cb86267f58996299b88ef49ad228cacec9a8c596 | Ted Driggs | 2017-05-23T00:55:34 | Remove darling::util items exposed through darling::ast | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 5e333b4..ab25c56 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -1,9 +1,8 @@
use quote::{Tokens, ToTokens};
use syn;
-use ast::Style;
+use ast::{Body, Style, VariantData};
use codegen::{Field, TraitImpl,... | 9 | 10 | 128 |
9fccfd1f4fb7979f2285fbd96e8406d58d8ec48b | Ted Driggs | 2017-05-23T00:49:08 | Move types from darling::util to darling::ast | diff --git a/core/src/ast.rs b/core/src/ast.rs
new file mode 100644
index 0000000..0b53898
--- /dev/null
+++ b/core/src/ast.rs
@@ -0,0 +1,203 @@
+use syn;
+
+use {FromField, FromVariant, Result};
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum Body<V = (), F = ()> {
+ Enum(Vec<V>),
+ Struct(VariantData<F>),
+... | 13 | 237 | 164 |
e6dfd7da2142a4dd7b80ac997c39a62f8575e6ff | Ted Driggs | 2017-05-22T22:16:51 | Derive FromDeriveInput on newtype struct | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index cf21368..7578f13 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -3,6 +3,7 @@ use syn::{self, Ident};
use codegen::{TraitImpl, ExtractAttribute, OuterFromImpl};
use options:... | 1 | 18 | 2 |
fb22ea2a014f23edfbbbf476c659b8089974cc1d | Ted Driggs | 2017-05-22T19:44:16 | Added () impls to all traits | diff --git a/core/src/from_derive_input.rs b/core/src/from_derive_input.rs
index 38f81a5..a5e525a 100644
--- a/core/src/from_derive_input.rs
+++ b/core/src/from_derive_input.rs
@@ -13,6 +13,12 @@ pub trait FromDeriveInput: Sized {
fn from_derive_input(input: &DeriveInput) -> Result<Self>;
}
+impl FromDeriveInpu... | 3 | 27 | 3 |
156550b5590ed1919459b9056b80106c07d6382a | Ted Driggs | 2017-05-19T01:26:03 | Add skip support to variants | diff --git a/core/src/codegen/variant.rs b/core/src/codegen/variant.rs
index 8e73b37..8b9f601 100644
--- a/core/src/codegen/variant.rs
+++ b/core/src/codegen/variant.rs
@@ -17,6 +17,9 @@ pub struct Variant<'a> {
pub ty_ident: &'a Ident,
pub data: VariantData<Field<'a>>,
+
+ /// Whether or not the variant... | 4 | 53 | 10 |
ea160eeb6c55bd40005e4784c390e65ca86af796 | Ted Driggs | 2017-05-19T01:21:20 | Fix build break due to extra quotation marks | diff --git a/core/src/codegen/from_variant_impl.rs b/core/src/codegen/from_variant_impl.rs
index cfb94a9..b868543 100644
--- a/core/src/codegen/from_variant_impl.rs
+++ b/core/src/codegen/from_variant_impl.rs
@@ -77,11 +77,11 @@ impl<'a> ExtractAttribute for FromVariantImpl<'a> {
impl<'a> OuterFromImpl<'a> for FromV... | 1 | 2 | 2 |
c1e6095f5a9055b0cbbeb9c60f78d484442b5b40 | Ted Driggs | 2017-05-19T00:56:02 | Partway through enabling bounds customization | diff --git a/core/src/codegen/trait_impl.rs b/core/src/codegen/trait_impl.rs
index b250d4e..bf0570d 100644
--- a/core/src/codegen/trait_impl.rs
+++ b/core/src/codegen/trait_impl.rs
@@ -1,5 +1,5 @@
use quote::{Tokens};
-use syn::{Generics, Ident, Path};
+use syn::{Generics, Ident, Path, WherePredicate};
use codegen:... | 4 | 68 | 19 |
87d2006d3e1a6c2af74dfc412c48f4d2592284f9 | Ted Driggs | 2017-05-19T00:53:29 | More FromMetaItem impls | diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs
index e0daef4..f7670ee 100644
--- a/core/src/from_meta_item.rs
+++ b/core/src/from_meta_item.rs
@@ -1,4 +1,8 @@
+use std::cell::RefCell;
use std::collections::hash_map::{Entry, HashMap};
+use std::rc::Rc;
+use std::sync::Arc;
+use std::sync::atomic::... | 1 | 34 | 0 |
14f728e99fb6da492495aff101180e1cca6e10b8 | Ted Driggs | 2017-05-18T19:38:11 | Variable renaming | diff --git a/core/src/codegen/from_field.rs b/core/src/codegen/from_field.rs
index f5119de..fb90265 100644
--- a/core/src/codegen/from_field.rs
+++ b/core/src/codegen/from_field.rs
@@ -11,7 +11,7 @@ pub struct FromFieldImpl<'a> {
pub vis: Option<&'a Ident>,
pub ty: Option<&'a Ident>,
pub attrs: Option<&'... | 2 | 9 | 9 |
0eb5f01d6f4965a5bf6c2a6ea089a8d5d799cccb | Ted Driggs | 2017-05-18T19:35:17 | Internal docs | diff --git a/core/src/options/mod.rs b/core/src/options/mod.rs
index b50edda..60e4824 100644
--- a/core/src/options/mod.rs
+++ b/core/src/options/mod.rs
@@ -107,11 +107,15 @@ pub trait ParseBody: Sized {
}
}
+ /// Apply the next found variant to the object, returning an error
+ /// if parsing goes... | 1 | 4 | 0 |
c57b0ec102518861bd3730d55347d7bf78679777 | Ted Driggs | 2017-05-18T19:32:48 | Use path! macro for static path declarations | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 40a0865..14fadb2 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -92,7 +92,7 @@ impl<'a> ToTokens for FmiImpl<'a> {
impl<'a> OuterFromImpl<'a> for FmiImpl<'a> {
fn trait_path(&self) -> syn::Path {
- ... | 7 | 16 | 8 |
598ad1b207da8dc02d1af4bf4ad3a20e791bd534 | Ted Driggs | 2017-05-18T19:31:00 | Add parsing support for WhereClause | diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs
index fd51a5d..e0daef4 100644
--- a/core/src/from_meta_item.rs
+++ b/core/src/from_meta_item.rs
@@ -143,6 +143,12 @@ impl FromMetaItem for syn::MetaItem {
}
}
+impl FromMetaItem for syn::WhereClause {
+ fn from_string(value: &str) -> Result... | 1 | 6 | 0 |
804011c40b2bf86a0bbff379085d1f054582ffbc | Ted Driggs | 2017-05-18T18:41:21 | v1 generics support (issue #4) | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 1ccf4bb..40a0865 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -1,4 +1,5 @@
use quote::{Tokens, ToTokens};
+use syn;
use codegen::{Field, TraitImpl, OuterFromImpl, Variant};
use util::{Body, VariantData... | 13 | 123 | 76 |
6f1f7f97e0e67337de2ed8b539d5caf93edf9845 | Ted Driggs | 2017-05-18T16:57:32 | Add darling::util::Ignored | diff --git a/core/src/util/ignored.rs b/core/src/util/ignored.rs
new file mode 100644
index 0000000..ed92fc3
--- /dev/null
+++ b/core/src/util/ignored.rs
@@ -0,0 +1,38 @@
+use syn;
+
+use {FromMetaItem, FromField, FromVariant, Result};
+
+/// An efficient way of discarding data from an attribute.
+///
+/// All meta-ite... | 2 | 40 | 0 |
9165c02acba906fe8983b82dbeb3e6ae29bd6468 | Ted Driggs | 2017-05-18T02:21:42 | Move all generators onto OuterFromImpl | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index b62e0c2..1ccf4bb 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -1,6 +1,6 @@
use quote::{Tokens, ToTokens};
-use codegen::{Field, TraitImpl, Variant};
+use codegen::{Field, TraitImpl, OuterFromImpl, Varian... | 5 | 70 | 96 |
99f843da3e4ff0b2e6226b2b4518aaad04e63705 | Ted Driggs | 2017-05-18T02:03:29 | Added location tracking to errors | diff --git a/core/src/codegen/field.rs b/core/src/codegen/field.rs
index 392b3d3..1723bb8 100644
--- a/core/src/codegen/field.rs
+++ b/core/src/codegen/field.rs
@@ -74,7 +74,7 @@ impl<'a> ToTokens for MatchArm<'a> {
let name_in_struct = self.0.name_in_struct;
let with_path = self.0.with_path;
... | 3 | 75 | 5 |
c1abdf55f152dc8267336be95abb2bebe0490587 | Ted Driggs | 2017-05-18T02:03:10 | Added new FromField impl | diff --git a/core/src/from_field.rs b/core/src/from_field.rs
index 4bbae7d..3b37b6d 100644
--- a/core/src/from_field.rs
+++ b/core/src/from_field.rs
@@ -1,4 +1,4 @@
-use syn::{Field, Ty};
+use syn::{Field, Ty, Visibility};
use Result;
@@ -17,4 +17,10 @@ impl FromField for Ty {
fn from_field(field: &Field) -> ... | 1 | 7 | 1 |
10010aa75ac79b1dcab75034ca900b9d505314b3 | Ted Driggs | 2017-05-17T21:37:12 | Version bump | diff --git a/Cargo.toml b/Cargo.toml
index 01b4ac9..2b38343 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "darling"
-version = "0.1.2"
+version = "0.1.3"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
-documentation = "https://docs.r... | 3 | 9 | 9 |
1907f2656185320acf8256f01c8b01e74dc7b7de | Ted Driggs | 2017-05-17T21:37:08 | Variant-related fixes | diff --git a/core/src/util/variant_data.rs b/core/src/util/variant_data.rs
index 0dcbbad..7f56413 100644
--- a/core/src/util/variant_data.rs
+++ b/core/src/util/variant_data.rs
@@ -119,7 +119,7 @@ impl<T> Into<Vec<T>> for VariantData<T> {
}
}
-impl Default for VariantData {
+impl<T> Default for VariantData<T> {... | 2 | 13 | 1 |
dd5666f3e12d753291e842598b8c9f6266b8aaa6 | Ted Driggs | 2017-05-17T21:35:47 | Add a default for VariantData
This makes working with uninitialized data simpler | diff --git a/core/src/util/variant_data.rs b/core/src/util/variant_data.rs
index 48e3593..0dcbbad 100644
--- a/core/src/util/variant_data.rs
+++ b/core/src/util/variant_data.rs
@@ -117,4 +117,10 @@ impl<T> Into<Vec<T>> for VariantData<T> {
VariantData::Unit => Vec::new(),
}
}
+}
+
+impl Defau... | 1 | 6 | 0 |
6fc6cc86c91ab3452776746b6f1b08901719089f | Ted Driggs | 2017-05-17T21:31:15 | Add FromVariant support throughout | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 42841ff..d70f6d8 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -9,6 +9,7 @@ pub struct FromDeriveInputImpl<'a> {
pub generics: Option<&'a Ident>,
pub vis: Option<&'a... | 11 | 248 | 5 |
072b8f1f118f849ef6671ab2a22d3f21ac3a2704 | Ted Driggs | 2017-05-17T21:29:21 | impl std::error::Error for darling::Error | diff --git a/core/src/errors.rs b/core/src/errors.rs
index e47f6e1..c68e661 100644
--- a/core/src/errors.rs
+++ b/core/src/errors.rs
@@ -1,3 +1,4 @@
+use std::error::Error as StdError;
use std::fmt;
use std::string::ToString;
@@ -46,6 +47,16 @@ impl Error {
}
}
+impl StdError for Error {
+ fn description... | 1 | 11 | 0 |
2a0366a2ce0d5796ea1ea8d9b20015da1be77754 | Ted Driggs | 2017-05-16T18:17:08 | Add newtype variant support | diff --git a/core/src/codegen/variant.rs b/core/src/codegen/variant.rs
index 6e476ad..8e73b37 100644
--- a/core/src/codegen/variant.rs
+++ b/core/src/codegen/variant.rs
@@ -88,6 +88,12 @@ impl<'a> ToTokens for DataMatchArm<'a> {
}
}
));
+ } else if val.data.is_n... | 3 | 105 | 0 |
3b2378cbf93a3622978023f4c9b8f8b71043bac1 | Ted Driggs | 2017-05-16T18:16:16 | Remove excessive whitespace | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 60ab0c9..b62e0c2 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -67,7 +67,7 @@ impl<'a> ToTokens for FmiImpl<'a> {
match __nested.name() {
... | 1 | 1 | 1 |
e402ef29a14d5ff31bdd863bed13e61a2ed3611e | Ted Driggs | 2017-05-16T16:59:39 | Document and expose FromVariant | diff --git a/core/src/from_derive_input.rs b/core/src/from_derive_input.rs
index f2486c1..92502ac 100644
--- a/core/src/from_derive_input.rs
+++ b/core/src/from_derive_input.rs
@@ -4,6 +4,11 @@ use Result;
/// Creates an instance by parsing an entire proc-macro `derive` input,
/// including the, identity, generics,... | 3 | 8 | 1 |
133416b32673c41b3349c8ecbbde1f1b72dfd43c | Ted Driggs | 2017-05-16T16:59:26 | Finish renaming | diff --git a/core/src/util/body.rs b/core/src/util/body.rs
index ca89f1a..22a3b40 100644
--- a/core/src/util/body.rs
+++ b/core/src/util/body.rs
@@ -106,7 +106,7 @@ impl<V: FromVariant, F: FromField> Body<V, F> {
pub fn from_body(body: &syn::Body) -> Result<Self> {
match *body {
syn::Body::En... | 1 | 1 | 1 |
1a2b712b48eeb8330f0299e22e14a1fd73aad2dc | Ted Driggs | 2017-05-16T16:59:15 | Rename VariantData::from to VariantData::try_from as it's fallible | diff --git a/core/src/util/body.rs b/core/src/util/body.rs
index d7ec9e9..ca89f1a 100644
--- a/core/src/util/body.rs
+++ b/core/src/util/body.rs
@@ -21,6 +21,7 @@ impl<V, F> Body<V, F> {
}
}
+ /// Creates a new `Body<&'a V, &'a F>` instance from `Body<V, F>`.
pub fn as_ref<'a>(&'a self) -> Body<... | 2 | 27 | 4 |
a2116293aa9c46e2551e78fb344bc99aa3dc943d | Ted Driggs | 2017-05-16T00:27:23 | Add docs and bump version | diff --git a/Cargo.toml b/Cargo.toml
index 7af460b..957afb3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "darling"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
-documentation = "https://docs.r... | 4 | 57 | 7 |
3f06966076f0e3b68d3f7e87712aed855791b58f | Ted Driggs | 2017-05-15T22:03:21 | Cleanup generated code to avoid unreachable match arm | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 3571837..60ab0c9 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -61,8 +61,7 @@ impl<'a> ToTokens for FmiImpl<'a> {
quote!(
fn from_list(__outer: &[::syn::NestedMetaItem])... | 1 | 2 | 3 |
6e58b23b7e9452fe65c67e196456b43e7606b994 | Ted Driggs | 2017-05-15T19:23:48 | Prep for publication | diff --git a/Cargo.toml b/Cargo.toml
index dda1381..7af460b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,11 +3,13 @@ name = "darling"
version = "0.1.0"
authors = ["Ted Driggs <ted.driggs@outlook.com>"]
repository = "https://github.com/TedDriggs/darling"
+documentation = "https://docs.rs/darling/0.1.0"
description... | 3 | 15 | 1 |
a2d7b6fb459d50f7feacd0798f9daa1905087936 | Ted Driggs | 2017-05-15T19:19:16 | Tinkering with error | diff --git a/core/src/errors.rs b/core/src/errors.rs
index 9033dc2..e47f6e1 100644
--- a/core/src/errors.rs
+++ b/core/src/errors.rs
@@ -1,4 +1,5 @@
use std::fmt;
+use std::string::ToString;
/// An alias of `Result` specific to attribute parsing.
pub type Result<T> = ::std::result::Result<T, Error>;
@@ -8,36 +9,40... | 1 | 13 | 8 |
17c0acdb281c0bc1e4a2dc7c7110343d077b2e3e | Ted Driggs | 2017-05-15T18:50:42 | Rename method in macro to be more specific | diff --git a/macro/src/lib.rs b/macro/src/lib.rs
index 230ec5b..c3fd9ed 100644
--- a/macro/src/lib.rs
+++ b/macro/src/lib.rs
@@ -11,7 +11,7 @@ use syn::parse_derive_input;
use darling_core::{options, codegen};
#[proc_macro_derive(FromMetaItem, attributes(darling))]
-pub fn derive(input: TokenStream) -> TokenStream ... | 1 | 1 | 1 |
a2bdf35ebf7c5872de4f01272a86958d2257f77e | Ted Driggs | 2017-05-15T18:40:02 | Fix build for enum variants by adding unreachable arm | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 5e9e389..3571837 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -73,6 +73,7 @@ impl<'a> ToTokens for FmiImpl<'a> {
::darling::export::Err(::darling::Error::unsupported_for... | 2 | 64 | 9 |
436acffc5649f2d39895344c73a3622acdb57173 | Ted Driggs | 2017-05-15T18:39:27 | Added comments to integration tests | diff --git a/tests/enums_struct.rs b/tests/enums_struct.rs
index 1922142..81db457 100644
--- a/tests/enums_struct.rs
+++ b/tests/enums_struct.rs
@@ -1,3 +1,5 @@
+//! Test expansion of enums which have struct variants.
+
#[macro_use]
extern crate darling;
extern crate syn;
diff --git a/tests/enums_unit.rs b/tests/enu... | 4 | 22 | 4 |
7c8efaec3146bb58a0a4f91354ca756a6c897704 | Ted Driggs | 2017-05-15T17:56:55 | Rename StructMatchArm to DataMatchArm | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 5858a95..5e9e389 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -56,7 +56,7 @@ impl<'a> ToTokens for FmiImpl<'a> {
}
Body::Enum(ref variants) => {
let unit_arms = va... | 2 | 20 | 13 |
b452e703bddf074568163ce7e070123f6fd0e7f5 | Ted Driggs | 2017-05-15T17:51:53 | Move list format check into match arms for enums | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 52a9c61..5858a95 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -65,13 +65,9 @@ impl<'a> ToTokens for FmiImpl<'a> {
__x if __x > 1 => ::darling::export::Err(::darling::Error::too_... | 2 | 12 | 12 |
6332bf2abb713883f38338206cfc863b9b1373ac | Ted Driggs | 2017-05-13T00:16:11 | Fix generated code errors | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 7731666..52a9c61 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -59,13 +59,13 @@ impl<'a> ToTokens for FmiImpl<'a> {
let struct_arms = variants.iter().map(Variant::as_struct_match_arm);
... | 2 | 4 | 4 |
c7b05e545dbf0a521af592fb4e151371f7ba51a4 | Ted Driggs | 2017-05-13T00:11:14 | Added support for struct enum variants and mixed enums | diff --git a/core/src/codegen/fmi_impl.rs b/core/src/codegen/fmi_impl.rs
index 1316a20..7731666 100644
--- a/core/src/codegen/fmi_impl.rs
+++ b/core/src/codegen/fmi_impl.rs
@@ -55,12 +55,34 @@ impl<'a> ToTokens for FmiImpl<'a> {
)
}
Body::Enum(ref variants) => {
- ... | 5 | 103 | 46 |
dc0419d6720f75140ebf80b1b00fb4fc7be6fb8d | Ted Driggs | 2017-05-13T00:08:17 | Document util::VariantData | diff --git a/core/src/util/variant_data.rs b/core/src/util/variant_data.rs
index 1c1efac..f7183f2 100644
--- a/core/src/util/variant_data.rs
+++ b/core/src/util/variant_data.rs
@@ -2,6 +2,9 @@ use syn;
use {FromField, Result};
+/// A generic container which holds the body of a struct or enum variant.
+/// This is ... | 1 | 3 | 0 |
c5bb888cb46afd83a20cd223d71e010b9bf98b5f | Ted Driggs | 2017-05-13T00:06:47 | Add utility methods to prepare for struct-style enums | diff --git a/core/src/codegen/variant_data.rs b/core/src/codegen/variant_data.rs
index f70fe19..5f63810 100644
--- a/core/src/codegen/variant_data.rs
+++ b/core/src/codegen/variant_data.rs
@@ -9,7 +9,7 @@ pub struct VariantDataGen<'a>(pub &'a VariantData<Field<'a>>);
#[allow(dead_code)]
impl<'a> VariantDataGen<'a> ... | 4 | 47 | 3 |
06517126405feeb12015c33821cf3e86edb4028c | Ted Driggs | 2017-05-12T23:17:53 | Refactoring to support other body types | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 2df7be3..42841ff 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -1,7 +1,7 @@
use quote::{Tokens, ToTokens};
use syn::Ident;
-use codegen::{Field, TraitImpl, ExtractAttribut... | 7 | 90 | 28 |
2589a3151b30243db478c792e0d32f6755add0b4 | Ted Driggs | 2017-05-12T22:56:03 | Add Into<Vec<T>> for util::VariantData<T> | diff --git a/core/src/util/variant_data.rs b/core/src/util/variant_data.rs
index 1d5ab2b..ce7c686 100644
--- a/core/src/util/variant_data.rs
+++ b/core/src/util/variant_data.rs
@@ -81,4 +81,13 @@ impl<F: FromField> VariantData<F> {
}
}
}
+}
+
+impl<T> Into<Vec<T>> for VariantData<T> {
+ fn... | 1 | 9 | 0 |
74600ccf9b26fca5b7a98361c241c67e202961a5 | Ted Driggs | 2017-05-12T22:49:03 | Add docs to util::VariantData | diff --git a/core/src/util/variant_data.rs b/core/src/util/variant_data.rs
index ddc3061..1d5ab2b 100644
--- a/core/src/util/variant_data.rs
+++ b/core/src/util/variant_data.rs
@@ -10,6 +10,8 @@ pub enum VariantData<T> {
}
impl<T> VariantData<T> {
+ /// Creates a new `VariantData` instance of the same shape as t... | 1 | 4 | 0 |
b68f4f56a6a432f5742a248f3e4beb4d116f1eeb | Ted Driggs | 2017-05-12T22:39:04 | Remove codegen::EnumImpl | diff --git a/core/src/codegen/enum_impl.rs b/core/src/codegen/enum_impl.rs
deleted file mode 100644
index 57e6cdd..0000000
--- a/core/src/codegen/enum_impl.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use quote::{Tokens, ToTokens};
-use syn::{Ident, Generics};
-
-use codegen::Variant;
-
-/// Data needed to generate an impl of `F... | 3 | 1 | 53 |
19203ff0bb56c9e11e1284e6333e19441e758e4b | Ted Driggs | 2017-05-12T22:30:50 | Continued refactoring | diff --git a/core/src/codegen/default_expr.rs b/core/src/codegen/default_expr.rs
index 6bd0db8..3432cd5 100644
--- a/core/src/codegen/default_expr.rs
+++ b/core/src/codegen/default_expr.rs
@@ -5,7 +5,7 @@ use syn::{Ident, Path};
const DEFAULT_STRUCT_NAME: &str = "__default";
/// The fallback value for a field or co... | 18 | 312 | 96 |
d5380d063fa13cd21c8a0cbe16e6b3288bb61f4e | Ted Driggs | 2017-05-12T02:19:50 | Major refactoring | diff --git a/core/src/codegen/variant.rs b/core/src/codegen/variant.rs
index f8d686f..d464d91 100644
--- a/core/src/codegen/variant.rs
+++ b/core/src/codegen/variant.rs
@@ -1,6 +1,9 @@
use quote::{Tokens, ToTokens};
use syn::Ident;
+use codegen::Field;
+use util::VariantData;
+
/// An enum variant.
pub struct Var... | 14 | 289 | 227 |
0afce0ccf21e4c6622fd2edd84db063f20a04e4e | Ted Driggs | 2017-05-12T01:17:12 | Refine modeling of input bodies | diff --git a/core/src/util/body.rs b/core/src/util/body.rs
index 300d4df..e5a60c3 100644
--- a/core/src/util/body.rs
+++ b/core/src/util/body.rs
@@ -1,20 +1,20 @@
-use syn::{Field, Variant};
+use syn::{self, Variant};
use {FromField, FromVariant, Result};
+use util::VariantData;
/// Contents of a type.
+#[derive(De... | 3 | 67 | 12 |
5e1d74c9c70a10eb74826c380f9707c8452115a2 | Ted Driggs | 2017-05-11T20:11:54 | Rename options::Container to options::Core | diff --git a/core/src/options/container.rs b/core/src/options/core.rs
similarity index 91%
rename from core/src/options/container.rs
rename to core/src/options/core.rs
index cc73304..7cfcdf0 100644
--- a/core/src/options/container.rs
+++ b/core/src/options/core.rs
@@ -3,11 +3,11 @@ use syn;
use {Result, Error, FromM... | 3 | 14 | 4 |
515b4b20dd046f1a23e4c75e86835ef70611f5dc | Ted Driggs | 2017-05-11T20:11:43 | Trait impls | diff --git a/core/src/options/meta_item_field.rs b/core/src/options/meta_item_field.rs
index 6f60090..f22d69f 100644
--- a/core/src/options/meta_item_field.rs
+++ b/core/src/options/meta_item_field.rs
@@ -12,7 +12,7 @@ lazy_static! {
};
}
-#[derive(Debug)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Met... | 3 | 5 | 5 |
8d47aff3771a31e417e48069d9b84d28be4c928e | Ted Driggs | 2017-05-11T19:40:07 | Add util::Body | diff --git a/core/src/util/body.rs b/core/src/util/body.rs
new file mode 100644
index 0000000..300d4df
--- /dev/null
+++ b/core/src/util/body.rs
@@ -0,0 +1,30 @@
+use syn::{Field, Variant};
+use {FromField, FromVariant, Result};
+
+/// Contents of a type.
+pub enum Body<V, F> {
+ Variants(Vec<V>),
+ Fields(Vec<F>... | 2 | 33 | 1 |
61f2caa577db85f229ea73cdc04128a735b1e3bb | Ted Driggs | 2017-05-11T17:01:19 | Rename options::Container | diff --git a/core/src/lib.rs b/core/src/lib.rs
index dd89f0f..8c42a3a 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -51,7 +51,7 @@ mod tests {
map: None,
};
- let container = options::Container {
+ let container = options::Core {
ident: syn::parse_ident("Foo").... | 10 | 38 | 38 |
940f984ef8026e4cec92899b58d5d16df33bb6ae | Ted Driggs | 2017-05-10T23:54:05 | Formatting nit | diff --git a/core/src/options/from_variant.rs b/core/src/options/from_variant.rs
index dc9c96b..d72fc31 100644
--- a/core/src/options/from_variant.rs
+++ b/core/src/options/from_variant.rs
@@ -1,6 +1,6 @@
use syn::MetaItem;
-use {Result};
+use Result;
use options::{OuterFrom, ParseAttribute};
#[derive(Debug)] | 1 | 1 | 1 |
980ccd704a214870c64e0c7d2dff96323961064a | Ted Driggs | 2017-05-10T22:14:22 | Fix macro build | diff --git a/macro/src/lib.rs b/macro/src/lib.rs
index d2006bf..efe5406 100644
--- a/macro/src/lib.rs
+++ b/macro/src/lib.rs
@@ -63,17 +63,17 @@ pub fn derive_from_input(input: TokenStream) -> TokenStream {
let mut fields = Vec::with_capacity(fields_in.len());
for field_in in fields_in {
... | 1 | 4 | 4 |
e3bfe15ebc4220b59ad5b87b0e9b34fe4bd77f8a | Ted Driggs | 2017-05-10T22:13:32 | Remove ApplyMetaItem | diff --git a/core/src/codegen/trait_impl.rs b/core/src/codegen/trait_impl.rs
index 67e5155..d345825 100644
--- a/core/src/codegen/trait_impl.rs
+++ b/core/src/codegen/trait_impl.rs
@@ -10,7 +10,6 @@ pub struct TraitImpl<'a> {
pub generics: &'a Generics,
pub fields: Vec<Field<'a>>,
pub default: Option<Def... | 4 | 1 | 29 |
0ff2ebdfb0b58aa7faf714f32186116a417a00b0 | Ted Driggs | 2017-05-10T22:12:12 | Consolidate FromDeriveInputContainer into FromOuter | diff --git a/core/src/options/from_derive.rs b/core/src/options/from_derive.rs
index 18ba233..a8b237f 100644
--- a/core/src/options/from_derive.rs
+++ b/core/src/options/from_derive.rs
@@ -1,87 +1,62 @@
use ident_case::RenameRule;
use syn::{MetaItem, Ident, Generics, Attribute};
-use {Result, FromMetaItem};
+use Re... | 1 | 28 | 53 |
aad665b7430e3c20944c7b6af26a4c86dcbac75b | Ted Driggs | 2017-05-10T21:23:18 | Add FromVariant; prep for OuterFrom | diff --git a/core/src/from_variant.rs b/core/src/from_variant.rs
index 34613c1..12cf1f0 100644
--- a/core/src/from_variant.rs
+++ b/core/src/from_variant.rs
@@ -2,6 +2,6 @@ use syn::Variant;
use Result;
-pub trait FromVariant {
+pub trait FromVariant: Sized {
fn from_variant(variant: &Variant) -> Result<Self>... | 4 | 65 | 1 |
44431cc3df7f7c97cc5a1a9606d9af27da09bf66 | Ted Driggs | 2017-05-10T20:12:06 | Declare FromVariant trait | diff --git a/core/src/from_variant.rs b/core/src/from_variant.rs
new file mode 100644
index 0000000..34613c1
--- /dev/null
+++ b/core/src/from_variant.rs
@@ -0,0 +1,7 @@
+use syn::Variant;
+
+use Result;
+
+pub trait FromVariant {
+ fn from_variant(variant: &Variant) -> Result<Self>;
+}
\ No newline at end of file
d... | 2 | 9 | 0 |
2d17705743a922e4905a5f3b414c4be1b9e7169e | Ted Driggs | 2017-05-10T20:06:33 | Use published ident_case crate | diff --git a/core/Cargo.toml b/core/Cargo.toml
index e4650c6..6fb96fe 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -9,10 +9,7 @@ authors = ["Ted Driggs <ted.driggs@outlook.com>"]
default = ["syn/full"]
[dependencies]
+ident_case = "1.0.0"
lazy_static = "0.2.8"
syn = "0.11.11"
-quote = "0.3.12"
-
-[depend... | 5 | 10 | 13 |
6e466ab9dcf6c36b427d11215e232b8351c85c8d | Ted Driggs | 2017-05-10T19:32:30 | Add FromMetaItem impl for darling::Result | diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs
index 4ac7ddf..9efd3e0 100644
--- a/core/src/from_meta_item.rs
+++ b/core/src/from_meta_item.rs
@@ -145,6 +145,12 @@ impl<T: FromMetaItem> FromMetaItem for Box<T> {
}
}
+impl<T: FromMetaItem> FromMetaItem for Result<T> {
+ fn from_meta_item... | 1 | 6 | 0 |
b967bf16c57ff66bda45ee0fb80dbe7b6ef22bc0 | Ted Driggs | 2017-05-10T17:01:11 | Test updates | diff --git a/core/src/codegen/from_field.rs b/core/src/codegen/from_field.rs
index c968031..da32082 100644
--- a/core/src/codegen/from_field.rs
+++ b/core/src/codegen/from_field.rs
@@ -14,6 +14,7 @@ pub struct FromFieldImpl<'a> {
pub body: TraitImpl<'a>,
pub attr_names: Vec<&'a str>,
pub forward_attrs: O... | 5 | 70 | 9 |
47938035978d0e1685bc8e6a8678f09c848d9946 | Ted Driggs | 2017-05-09T20:57:54 | Move options::Field to options::MetaItemField | diff --git a/core/src/options/from_field.rs b/core/src/options/from_field.rs
index 9544fef..bcaeefa 100644
--- a/core/src/options/from_field.rs
+++ b/core/src/options/from_field.rs
@@ -2,7 +2,7 @@ use syn::{Attribute, Generics, Ident, MetaItem};
use {FromMetaItem, Result};
use codegen::FromFieldImpl;
-use options::... | 3 | 16 | 7 |
ad8994025eb5950b9577cb1b5f9310f4efda22e7 | Ted Driggs | 2017-05-09T20:57:37 | Add docs for `map` path property | diff --git a/core/src/options/container.rs b/core/src/options/container.rs
index aede52c..9af34c9 100644
--- a/core/src/options/container.rs
+++ b/core/src/options/container.rs
@@ -23,6 +23,8 @@ pub struct Container {
/// The rule that should be used to rename all fields/variants in the container.
pub rename_... | 1 | 2 | 0 |
b422350a4b97806ee83a93e7a8ea394a1777759c | Ted Driggs | 2017-05-09T18:25:22 | Added `map` function support for all darling attributes | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 6eda6be..2df7be3 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -34,6 +34,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> {
};
let grab_attrs = self.extr... | 5 | 21 | 6 |
1b2b19a92737d772b4451844a92323f17b055a2e | Ted Driggs | 2017-05-09T18:24:16 | Broadened support for strings in meta items | diff --git a/core/src/from_meta_item.rs b/core/src/from_meta_item.rs
index 6750e83..4a58395 100644
--- a/core/src/from_meta_item.rs
+++ b/core/src/from_meta_item.rs
@@ -57,7 +57,7 @@ pub trait FromMetaItem: Sized {
fn from_value(value: &Lit) -> Result<Self> {
match *value {
Lit::Bool(ref b) =... | 1 | 16 | 4 |
520449ef57ea991df9e7cd64fbaefdbb57c3a652 | Ted Driggs | 2017-05-09T15:05:02 | Added attribute forwarding and filtering
Refactoring to reduce code duplication | diff --git a/core/src/codegen/default_expr.rs b/core/src/codegen/default_expr.rs
new file mode 100644
index 0000000..6bd0db8
--- /dev/null
+++ b/core/src/codegen/default_expr.rs
@@ -0,0 +1,42 @@
+use quote::{Tokens, ToTokens};
+use syn::{Ident, Path};
+
+/// This will be in scope during struct initialization after opti... | 11 | 275 | 147 |
df2fde0a1ee9eb0d820f8239b4d9067d8dfc9cb7 | Ted Driggs | 2017-05-08T18:15:30 | Fix defaulting decision in cases where `skip` is used. | diff --git a/core/src/options/field.rs b/core/src/options/field.rs
index ae5927e..310eece 100644
--- a/core/src/options/field.rs
+++ b/core/src/options/field.rs
@@ -82,11 +82,25 @@ impl Field {
self.attr_name = Some(parent.rename_rule.apply_to_field(&self.target_name));
}
- // Regardless ... | 2 | 36 | 5 |
eaeea714fa719aa1529352097fc8053ea2c76181 | Ted Driggs | 2017-05-08T17:27:04 | Added skip and map support | diff --git a/core/src/codegen/field.rs b/core/src/codegen/field.rs
index 262966b..706417e 100644
--- a/core/src/codegen/field.rs
+++ b/core/src/codegen/field.rs
@@ -19,6 +19,7 @@ pub struct Field<'a> {
pub ty: &'a Ty,
pub default_expression: Option<DefaultExpression<'a>>,
pub with_path: &'a Path,
+ pu... | 2 | 12 | 1 |
d60d649603db61ad170bbf16438cf5c3c0307f01 | Ted Driggs | 2017-05-05T18:23:23 | Added support for skipped fields | diff --git a/core/src/codegen/field.rs b/core/src/codegen/field.rs
index 13f26a8..262966b 100644
--- a/core/src/codegen/field.rs
+++ b/core/src/codegen/field.rs
@@ -19,11 +19,12 @@ pub struct Field<'a> {
pub ty: &'a Ty,
pub default_expression: Option<DefaultExpression<'a>>,
pub with_path: &'a Path,
+ ... | 5 | 49 | 20 |
083a67a7cb841d6e7f6ed3da529f2159ab039276 | Ted Driggs | 2017-05-05T16:26:59 | Add traits and utility methods to util::IdentList | diff --git a/core/src/util/ident_list.rs b/core/src/util/ident_list.rs
index 3c83823..837b1b3 100644
--- a/core/src/util/ident_list.rs
+++ b/core/src/util/ident_list.rs
@@ -4,10 +4,27 @@ use syn::{Ident, NestedMetaItem, MetaItem};
use {FromMetaItem, Result, Error};
-#[derive(Debug, Default)]
+/// A list of `syn::I... | 1 | 24 | 1 |
9782ce1f2b39701b1062effd8002d8130cbc6ffe | Ted Driggs | 2017-05-05T16:15:54 | Refactor option parsing and code generation | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 40618db..49c74ac 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -1,7 +1,7 @@
use quote::{Tokens, ToTokens};
use syn::Ident;
-use codegen::{DefaultExpression, Field, TraitIm... | 9 | 227 | 15 |
481675066969ddaa2ce22aa76e154761d88b88be | Ted Driggs | 2017-05-05T16:15:42 | Add darling::util to house helper types | diff --git a/core/src/lib.rs b/core/src/lib.rs
index 3edc5e8..59fcfd6 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -12,15 +12,16 @@ extern crate serde_case;
pub mod codegen;
mod errors;
+mod from_field;
mod from_derive_input;
mod from_meta_item;
-mod ident_list;
pub mod options;
+pub mod util;
pub us... | 5 | 171 | 12 |
0a1666bb7729cc7a23abc65fb2f3d0e88f7c7a70 | Ted Driggs | 2017-05-05T16:14:34 | Documentation | diff --git a/core/src/codegen/enum_impl.rs b/core/src/codegen/enum_impl.rs
index d1ad6ce..57e6cdd 100644
--- a/core/src/codegen/enum_impl.rs
+++ b/core/src/codegen/enum_impl.rs
@@ -3,9 +3,15 @@ use syn::{Ident, Generics};
use codegen::Variant;
+/// Data needed to generate an impl of `FromMetaItem` for a unit enum.... | 5 | 24 | 4 |
82320703613b895e59b181d550c839cb461c6257 | Ted Driggs | 2017-05-04T20:44:10 | Make from_ident generate correct code for unspecified fields | diff --git a/core/src/options/from_derive.rs b/core/src/options/from_derive.rs
index 5b24ebd..6b7f4f3 100644
--- a/core/src/options/from_derive.rs
+++ b/core/src/options/from_derive.rs
@@ -3,7 +3,7 @@ use syn::{MetaItem, Ident, Generics, Attribute};
use {Result, IdentList, FromMetaItem};
use codegen;
-use options::... | 1 | 8 | 2 |
16b5a22ebfb64bea86eab4f8f76e0c5380706832 | Ted Driggs | 2017-05-04T20:31:31 | Another fix for from_ident | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 96fc285..40618db 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -27,7 +27,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> {
let decls = self.struct_impl.local_decla... | 2 | 2 | 1 |
6e339ec241e70342450cfe01fa757a8ceca5cd09 | Ted Driggs | 2017-05-04T20:30:26 | Fix generated code for from_ident | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index 51254db..96fc285 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -27,7 +27,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> {
let decls = self.struct_impl.local_decla... | 1 | 1 | 1 |
a3c68d1f93c9ee853f71d2a81cf57ec65465a642 | Ted Driggs | 2017-05-04T20:29:26 | Add from_ident attribute for FromDeriveInput attribute | diff --git a/core/src/codegen/from_derive_impl.rs b/core/src/codegen/from_derive_impl.rs
index e9bf35a..51254db 100644
--- a/core/src/codegen/from_derive_impl.rs
+++ b/core/src/codegen/from_derive_impl.rs
@@ -4,11 +4,12 @@ use syn::Ident;
use codegen::{DefaultExpression, Field, TraitImpl};
pub struct FromDeriveInpu... | 2 | 15 | 3 |
58c1a36ad46ba7ab160d5e7aacc845469e851d08 | Ted Driggs | 2017-05-04T18:38:50 | Added a test to verify omission of fields for FromDeriveInput | diff --git a/tests/happy_path.rs b/tests/happy_path.rs
index 0174efb..12fb84d 100644
--- a/tests/happy_path.rs
+++ b/tests/happy_path.rs
@@ -21,6 +21,14 @@ struct Container {
lorem: Lorem
}
+#[derive(FromDeriveInput, PartialEq, Debug)]
+#[darling(attributes(darling_demo))]
+struct TraitContainer {
+ ident: s... | 1 | 26 | 0 |
a70f2eac351eab8e329af006fab3ee7bb7474269 | Ted Driggs | 2017-05-04T00:47:58 | Added documentation | diff --git a/core/src/options/field.rs b/core/src/options/field.rs
index 8d92f3d..cf6ecd1 100644
--- a/core/src/options/field.rs
+++ b/core/src/options/field.rs
@@ -21,6 +21,7 @@ pub struct Field {
}
impl Field {
+ /// Generate a view into this field that can be used for code generation.
pub fn as_codegen_f... | 1 | 10 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.