My current ongoing game development project is ‘Gentle People’, a sixties-era band management sim about nudging some bands towards putting out some hit singles, albums etc. Updates are currently paused while I pick through a large UI overhaul but the bones of the game are in place and quite fun to muck about with. It’s written in Rust using Bevy and compiles to WASM for the browser.
Rust has a fantastic and well developed universe of 3rd-party crates which will help you develop almost any application, right up until they suddenly won’t. Here are four ways in which you will be suddenly and deeply frustrated while learning this exciting new language.
Weak typing is a documentation-specific feature.
One of the unique aspects of Rust is the subtle but specific control over the movement of data under the ‘borrow’ system, which provides tough but fair oversight of access to information. To work effectively in this system, you need to know all about your data types, their capabilities, their restrictions, their lifetimes and much else — especially if you want to pass them into and out of functions.
Enter the idiomatic documentation style, in which you’d be forgiven, encountering the language, for believing that the whole thing was weakly typed all along:
Taken (with apologies) from the rand crate book, the most popular rust crate.
Members of the community will be happy to inform you that compiler error messages are the fastest source of correct type name information.
2. The new version is completely different and we’re all using it now.
Enjoying all the conveniences afforded to you by this popular crate? Well, watch out, because that’s the deprecated 0.15 package.
That’s right, despite being at the end of a 32-crate long chain locking you in to 0.15, main development — and somehow a bulk of users — are focused on 0.16 now.
The API is fundamentally incompatible, usually due to the start or end of support for a platform you’re not interested in, and all of the dependencies are partially updated — if at all.
3. “I have made excellent progress on this in a private branch seven months ago”
Oh no — you’re using your fancy new Rust crate, but it won’t interop with another similarly fancy API or library that you’re also using! In fact, they’re mutually exclusive.
Fortunately, there’s a GitHub issue for tracking this already, and some smart young grouse is making very perceptive comments and hinting that the solution is just around the corner — seven months ago, with radio silence and the fork set to private ever since.
4. You shouldn’t, and therefore you can’t.
Code, colleagues and convenience will often contrive to back you into a corner on some proposed feature or extension. It’s ugly, but there’s no other way to do it without necessitating some fundamental restructuring of your application. You sigh as you open your box of ugly hacks and set about patching it up.
Unfortunately, you hit a blocker — some Rust package you depend on is complaining loudly about the exact thing you’re intending to do, and is blocking the build. Time to take to the airwaves, and search social media to see if there’s any quick way around this one. The replies comes quickly and in force: “you shouldn’t, and therefore you can’t”. Whether or not there’s a technical barrier to solving your problem, there’s an organic barrier that will be just as effective. Computers are machines of infinite flexibility, but that may not hold for your fellow coders.
(Double points if there is a workaround available in the interface, but it’s been unmaintained to the point where it no longer works correctly.)
A disclaimer, of course, that this list is at the very least wildly unfair on the good work usually done for free by package maintainers and the community around Rust, whose contribution to problems I’ve needed fixing absolutely outweighs their contribution to problems that have made me swear loudly.