-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
I wanted to move out a number of front element from a vector, like my_vec.drain(..x)
but I wonder if this is the right way to do this cause doc is unclear, note 1 and note 2 say the opposite each other:
Creates a draining iterator that removes the specified range in the vector and yields the removed items.
Note 1: The element range is removed even if the iterator is only partially consumed or not consumed at all.
Note 2: It is unspecified how many elements are removed from the vector if the Drain value is leaked.
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain
This issue has been assigned to @poliorcetics via this comment.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.