Skip to content
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

Add support for generics in pagination macro #83

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

kevin-pease
Copy link
Contributor

@kevin-pease kevin-pease commented Jun 3, 2024

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Fixes #70. Modifies the pagination derive macro to account for generics in structs.

⤵️ What is the current behavior?

The compiler throws a cryptic and unhelpful error when trying to apply the pagination macro to a struct with generics. This is because the macro previously didn't handle generics.

🆕 What is the new behavior (if this is a feature change)?

Structs with generics can now also be used. Behaviour for structs without generics remain unchanged.

💥 Does this PR introduce a breaking change?

No.

📝 Links to relevant issues/docs

https://docs.rs/syn/latest/syn/struct.Generics.html

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines
  • Relevant documentation was updated
  • Rebased onto current main

@kevin-pease kevin-pease requested a review from tluijken June 5, 2024 07:40
let expanded = quote! {
impl Paginatable for #struct_name {
impl #impl_generics Paginatable for #struct_name #type_generics #where_clause {
Copy link
Contributor

Choose a reason for hiding this comment

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

Kunnen we het hier een keer over hebben? Ik zeg niet dat het fout is maar ik wil het wat beter begrijpen voordat ik het approve.

@kevin-pease kevin-pease force-pushed the 70-generics-for-pagination branch from c99f7e0 to e78c80e Compare July 11, 2024 09:03
@kevin-pease kevin-pease force-pushed the 70-generics-for-pagination branch from e78c80e to 01e254f Compare July 11, 2024 09:17
@LeonardTibben LeonardTibben self-requested a review July 11, 2024 09:31
@LeonardTibben LeonardTibben merged commit 9e705cc into develop Jul 11, 2024
2 checks passed
@kevin-pease kevin-pease deleted the 70-generics-for-pagination branch July 11, 2024 12:21
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.

Extend Pagination derive macro to support generic structs
3 participants