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

refactor: split the Header trait into three traits #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

npmccallum
Copy link

The Header trait is now Named, Decodable and Encodable.

The goal of this change is to make it possible to implement Encodable
for borrowed types. Under the existing code, Header::decode() requires
that Self own its data. But it is a legitimate use to do
Header::encode() on borrowed data. By separating the traits, we can
implement Encodable on borrowed types and Encodable and Decodable
on owned types.

Signed-off-by: Nathaniel McCallum [email protected]

The `Header` trait is now `Named`, `Decodable` and `Encodable`.

The goal of this change is to make it possible to implement `Encodable`
for borrowed types. Under the existing code, `Header::decode()` requires
that `Self` own its data. But it is a legitimate use to do
`Header::encode()` on borrowed data. By separating the traits, we can
implement `Encodable` on borrowed types and `Encodable` and `Decodable`
on owned types.

Signed-off-by: Nathaniel McCallum <[email protected]>
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.

1 participant