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

Does not support generics. #35

Open
entropylost opened this issue May 27, 2021 · 6 comments
Open

Does not support generics. #35

entropylost opened this issue May 27, 2021 · 6 comments

Comments

@entropylost
Copy link

If I have something like:

struct Foo<T: S> {
  x: T
}

the derive command causes errors.

@Luthaf
Copy link
Member

Luthaf commented May 27, 2021

Yes, that's something that would be nice to implement, and should not be too hard. Unfortunately, I have very limited time to work on this crate, so this would be a good candidate for an external contribution!

It should only be a matter of storing the generic parameters and bounds in the Input struct; and then parametrize the generated structs (slice, mut slice, reference, mut reference, pointer, mut pointer, ...) by the same generic parameters and bounds. The impl blocks should also be parametrized by the same generics parameters & bounds.

@entropylost
Copy link
Author

My god this looks like so much work...

@mangelats
Copy link
Contributor

To be honest I'd love to work on it. Unfortunately right now I don't really have the time for it (and single length would come first anyways). I'd love to talk about project reorganization to code this features more easier (the more advanced the features the more I tend to hurt myself with it).

@entropylost
Copy link
Author

Hm for the single length thing perhaps just make the storage generic and use a HList?

@Luthaf
Copy link
Member

Luthaf commented May 28, 2021

Hm for the single length thing perhaps just make the storage generic and use a HList?

I really don't see how a HList would help here, could you clarify?

EDIT: moved the discussion to #19 (comment)

I'd love to talk about project reorganization to code this features more easier (the more advanced the features the more I tend to hurt myself with it).

I'm open to changes in this crate code organization: while none of the code is very complex, it can be a bit daunting to make changes, and the compiler error messages are not very helpful when you make a typo/miss a bound somewhere. Please open an issue with your proposition!

@entropylost

This comment has been minimized.

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

No branches or pull requests

3 participants