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

BytesMut::unsplit: rename to join #445

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

Conversation

vorot93
Copy link
Member

@vorot93 vorot93 commented Nov 29, 2020

The naming of unsplit is unfortunate because it can both revert a split and degenerate to extend_from_slice.

Therefore I think that join is a better name that truly reflects what it is.

Also we could consider reporting an error if the slices are not contiguous - this could be an even better alternative to this PR.

@carllerche
Copy link
Member

Thoughts cc @tokio-rs/maintainers

@Darksonn
Copy link
Contributor

Do we have a method that only succeeds if they can be joined without copying? If so, having both could make sense, and I do think that unsplit is a good name for the fallible one.

@seanmonstar
Copy link
Member

Having a try_unsplit and unsplit (unsplit_at_all_costs) makes sense to me.

I think the name join might conflict (at least mentally) with joining a vec or array of strings with the argument as the glue between each item.

@Matthias247
Copy link
Contributor

Having a try_unsplit and unsplit (unsplit_at_all_costs) makes sense to me.

I agree. A pure unsplit fallible unsplit method would have made sense to me too. But since the non-failing version already exists I think it should just be kept and an the try_unsplit be added.

@Darksonn
Copy link
Contributor

I think unsplit and try_unsplit are actually pretty good.

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

5 participants