google / google/zerocopy

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

Open
#1,877 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2.6k
Forks
179
Avg merge
1d 19h
Merged PRs (30d)
29

Description

*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:

```rust
#[derive(IntoBytes)]
#[zerocopy(derive_for = Foo)]
#[repr(C)]
struct Foo(A, B);

// Emitted by derive:
unsafe impl IntoBytes for Foo { ... }
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.