mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() add Vec::push_within_capacity - fallible, does not allocate This method can serve several purposes. It * is fallible * guarantees that items in Vec aren't moved * allows loops that do `reserve` and `push` separately to avoid pulling in the allocation machinery a second time in the `push` part which should make things easier on the optimizer * eases the path towards `ArrayVec` a bit since - compared to `push()` - there are fewer questions around how it should be implemented I haven't named it `try_push` because that should probably occupy a middle ground that will still try to reserve and only return an error in the unlikely OOM case. resolves #84649 |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
Cargo.toml |