Rust requires a mindset shift
That's easier said than done. I find that there's no clear vision of what "idiomatic" Rust is. With functional programming, it feels like there's a strong theoretical basis of how to structure and write code: pure functions everywhere, anything unpure (file access, network access, input conversion, parsing, etc.) goes into a monad. TBF, the only functional code I write is in JS or nix
and nix-lang is... not really made for programming, nor is there any clear idea of what "good" nix code looks like.
Rust however... are Arc
, Box
, Rc
, async
, etc. fine? match
or if/else
? How should errors be handled? Are macros OK? Yes, the clippy
linter exists, but it can't/won't answer those questions for you. Also the fact that there is no inheritance leads to some awkward solutions when there is stuff that is hierarchical or shares attributes (Person -> Employee -> Boss -> ... | Animal -> Mammal-Reptile-Insect --> Dog-Snake-Grasshopper). I haven't found good examples of solutions or guidance on these things.
My rust code still feel kludgy, yet safe after a year of using it.