News for hackers. Stuff that matters.
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:

    let foo = [0_u8, 1, 2];
    foo[0].unwrap(); // really?
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.
Re:A pair of Linux kernel modules using Rust by couchand on Tuesday September 13, 2022 @07:10PM (#32831312)
But in real code you never want unwrap, so why provide sugar for it?