Skip to content

Docs: Vec<T>'s contents being contiguous could be a little more clear #31554

Closed

Description

At the moment, Vec<T>'s module and type doc pages don't quite make it clear that its contents are in fact contiguous. They imply it in several places...

Vectors have O(1) indexing, amortized O(1) push (to the end) and O(1) pop (from the end).

Most fundamentally, Vec is and always will be a (pointer, capacity, length) triplet. No more, no less.

...but it would be better to make it more clear. In addition, Vec<T>'s documentation refers to it as a "growable list type", which could be misleading in light of this; "list" is more often used to mean a linked list.

Perhaps something like one of these would be better as the description line:

A contiguous growable list type with heap-allocated contents, written Vec<T> but pronounced 'vector.'

A growable array type with heap-allocated contents, written Vec<T> but pronounced 'vector.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions