-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix derived ItemKey field rename and impl derive(Attributes) #115
Conversation
dynomite-derive/src/lib.rs
Outdated
@@ -115,6 +115,7 @@ fn parse_attrs(all_attrs: &[Attribute]) -> Vec<Attr> { | |||
/// # Panics | |||
/// | |||
/// This proc macro will panic when applied to other types | |||
//#[proc_macro_error::proc_macro_error] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: revisit this before merging. it seems the proc_macro_error crate requires this and I didn't catch that last time.
// impl Attribute for Name (these are essentially just a map) | ||
let attribute = quote!(::dynomite::Attribute); | ||
let impl_attribute = quote! { | ||
impl #attribute for #name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to derive Attribute since embedded structs within Items need to be viewed as an Attribute. It turns out that makes this impl quite simple since its basically just a map of attributes anyway!
…hich as it turns out helps to cover up the case where Items omit partition_keys and and pass silently in the night. Let's impl Attributes instead of Item ItemKeys
958e2b2
to
cc49dd5
Compare
generating some compile tests. noting for future reference. |
Wow, this is awesome, looking forward for 0.9 release! |
What did you implement:
addresses issue with renaming partition key fields which has an affect on derived ItemKey struct when it breaks with rust's conventions.
Closes: #108, #107, #79
How did you verify your change:
unit test and compiler warning checks
What (if anything) would need to be called out in the CHANGELOG for the next release:
a number of related things that are open issues were at play. ItemKey's derive impls clone partition and sort keys from Item structs and rewrote them to their deserialized names but in struct field form yielding less than ideal results when renamed to using non-rust naming conventions.
The impl of this derived(Item) who's impl for deriving Item keys will silently omit generating another ItemKey struct if a partition_key is absent. This was to work around an infinite compilation phase loop. An artifact of this is that there's no check in derive Item to ensure Items actually have partition key defined.
The following things where resolved in this change
whew.