Re:Rust 1.63
by tialaramex on Thursday August 11, 2022 @05:22PM
(#32431878)
Doh! I even had the "get_unchecked()" function in front of me on the screen and wrote get() anyway. Thanks Steve.
Re:Rust 1.63
by steveklabnik on Thursday August 11, 2022 @05:34PM
(#32431997)
No problem. Thanks for explaining what unsafe does and doesn't do; you're 100% right that this is a common misconception that comes up often.
> because Rust's get function v.get(i) is marked unsafe
You mean get_unchecked. get is safe, and returns an Option, so that None can be returned if something is out of bounds.