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

Support derives on more types by allowing user to specify concrete types #1877

Open
joshlf opened this issue Oct 11, 2024 · 0 comments
Open

Comments

@joshlf
Copy link
Member

joshlf commented Oct 11, 2024

Credit to @kupiakos for this idea

Our derives are not able to support all generic types. However, sometimes a user may not need a given trait to be implemented for every instantiation of type variables. In this case, we could permit them to specify concrete types for which they want zerocopy trait impls:

#[derive(IntoBytes)]
#[zerocopy(derive_for = Foo<u64, u64>)]
#[repr(C)]
struct Foo<A, B>(A, B);

// Emitted by derive:
unsafe impl IntoBytes for Foo<u64, u64> { ... }
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

1 participant