5

Github alloc: Added `as_slice` method to `BinaryHeap` collection by frol · Pull...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/82331
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

frol commented on Feb 20

edited

I initially asked about whether it is useful addition on https://internals.rust-lang.org/t/should-i-add-as-slice-method-to-binaryheap/13816, and it seems there were no objections, so went ahead with this PR.

There is BinaryHeap::into_vec, but it consumes the value. I wonder if there is API design limitation that should be taken into account. Implementation-wise, the inner buffer is just a Vec, so it is trivial to expose as_slice from it.

Please, guide me through if I need to add tests or something else.

UPD: Tracking issue #83659


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK