4 ms·
For slices the access is handled inside of the compiler: https://github.com/rust-lang/rust/blob/235a4c083eb2a2bfe8779d211c3232f39396de00/library/core/src/slice/
by OptionOfT 1y ago
For slices the access is handled inside of the compiler: https://github.com/rust-lang/rust/blob/235a4c083eb2a2bfe8779d211c3232f39396de00/library/core/src/slice/index.rs#L264-L274 https://github.com/rust-lang/rust/blob/235a4c083eb2a2bfe8779...
I'm checking to see how array access is implemented, whether through deref to slice, or otherwise.
- vlovich123 1y agoI had Vec in mind but regardless nothing forces you to use the bounds-checked variant vs one that returns option<t>. And if you really are sure the bounds hold you can always use the assume crate or just unwrap_unchecked explicitly.