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

Add fallible alternative to slice sort methods #7

Open
baumanj opened this issue Sep 11, 2020 · 0 comments
Open

Add fallible alternative to slice sort methods #7

baumanj opened this issue Sep 11, 2020 · 0 comments

Comments

@baumanj
Copy link
Contributor

baumanj commented Sep 11, 2020

Since slice::sort and related functions like slice::sort_by_key may allocate "temporary storage half the size of self", it's possible to end up with a panic on allocation failure even when using TryVec.

Though sort_unstable and the unstable variants of the other sorting methods don't allocate, sometimes a stable sort is required. Perhaps adding a TrySort trait that provides fallible alternatives to these methods would be worthwhile.

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

No branches or pull requests

1 participant