Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by burntsushi

5 hours ago

> or you yolo it with reserve+set_len, which is invalid Rust because you didn't properly use MaybeUninit for locations which are only ever written

`Vec::spare_capacity_mut`[1] gives you a view into the unused capacity. There's nothing "invalid" about it.

[1]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.spa...

0 comments

burntsushi

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities