Re:A pair of Linux kernel modules using Rust
by vgel on Tuesday September 13, 2022 @11:29AM
(#32825587)
Some people have argued that indexed access is a wart, but it would be quite heavyweight to always have to unwrap an option when accessing a known-good index:
Instead, indexing on arrays / vecs is (essentially) sugar for .get(index).unwrap(), if you don't want the unwrap behavior use get. This is very similar to Python, though Python throws an exception which obviously isn't available to Rust.
[ Parent
| on HN ]