Skip to content

derive Holder for tuple struct#146

Merged
termoshtt merged 5 commits intomasterfrom
holder4tuple
Nov 17, 2021
Merged

derive Holder for tuple struct#146
termoshtt merged 5 commits intomasterfrom
holder4tuple

Conversation

@ytanimura
Copy link
Contributor

Close #145.

@ytanimura
Copy link
Contributor Author

Generate Holder struct for it, support #[derive(Holder)] for tuple struct

@ytanimura ytanimura marked this pull request as ready for review November 17, 2021 06:15
@ytanimura ytanimura requested a review from termoshtt November 17, 2021 06:15
.ident
.as_ref()
.expect_or_abort("Tuple struct case is not supported");
let ident = field.ident.as_ref().expect_or_abort("unreachable");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know when it fails? If you know, please write here it.

syn::Data::Struct(st) => match st.fields {
syn::Fields::Named(_) => entity::derive_holder(ident, st, &attr),
syn::Fields::Unnamed(_) => type_decl::derive_holder(ident, st, &attr),
syn::Fields::Unit => panic!("Unit struct is not supported."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use abort_call_site!

@ytanimura
Copy link
Contributor Author

fixed them

@termoshtt termoshtt merged commit 44d5329 into master Nov 17, 2021
termoshtt added a commit that referenced this pull request Nov 17, 2021
@termoshtt termoshtt deleted the holder4tuple branch December 2, 2021 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate Holder struct for it, support #[derive(Holder)] for tuple struct

2 participants