Skip to content

New sort function 'sorted()' for vec that returns a new vec for chaining. #2731

Open
@johalun

Description

@johalun

I found an old (somewhat related) issue suggesting to change sort() to return &mut self which of course can't be done since it a breaking change. I suggest instead the following:

How about a new function "sorted()", that returns a new sorted vec? When I was doing iOS programming back in the day there were usually two functions for sorting, one sorted in place and one returned a new sorted vec. It was convenient to have both options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsProposals about collection APIsT-libs-apiRelevant to the library API team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions