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

feat: relax trait bounds on map_codec #11

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

thomaseizinger
Copy link
Contributor

These trait-bounds are unnecessarily restrictive and don't need to be on this function. If the user maps to a type that doesn't implement Encoder + Decoder, they end up with an unusable type. However, this may sometimes be desired.

For example, in libp2p/rust-libp2p#4548, mapping the codec is a fallible function that returns a tuple where only one part is the codec. This is hard to express in a general way which is why #10 got closed.

However, if we relax these trait-bounds, the codec can be mapped to an Option<T> and extracted via mem::replace.

@thomaseizinger
Copy link
Contributor Author

Friendly ping @mxinden.

Copy link
Owner

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 can you bump the patch version? I can then cut a new release.

@thomaseizinger
Copy link
Contributor Author

thomaseizinger commented Oct 10, 2023

👍 can you bump the patch version? I can then cut a new release.

I'd like this to just merge it together with #9 so I figured only one of them needs to bump the version.

@mxinden mxinden merged commit a62d433 into mxinden:master Oct 11, 2023
4 checks passed
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.

None yet

2 participants