Skip to content

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