Skip to content

Add .shrink_to_fit() method for Array #427

Open
@jturner314

Description

@jturner314

Some methods (e.g. .remove_axis(), .into_subview(), and .slice_move()) can cause some of the elements in an owned array to be come inaccessable. It would be useful to have a method that removes the inaccessable elements (to reduce memory usage without performing a new heap allocation) by shifting the remaining elements to the front of the underlying Vec and shrinking the Vec. See the discussion in #425, in particular this comment for some thoughts about the implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions