Rust over the top


#1

The Rust language is good. I would like to use it more. Everything attached to Rust is too much work.

I worked with C and other languages to build simple quick utility applications. C development is too slow when you move past the most basic code. The Rust compiler includes a lot of useful stuff for those slightly larger projects but the rest of the Rust infrastructure is too much work.

I end up using easier languages that just work without jumping through all the rusty hoops.

The cargo system probably helps with very large projects but is a speed bump when you want just a little bit of extra code. For my small beginner projects, the infrastructure becomes a roadblock and I switch to another language, removing opportunities to explore Rust.

Of three attempts to use Rust, one failed due to the lack of a working GUI and two failed because the infrastructure overheads were too difficult.

How did you learn Rust? Are there tutorials for people who just want to run up a little utility the way you would with gcc?


#2

Write a small program with gcc:

$ vim test.c
$ gcc test.c
$ ./a.out

Write a small program with rustc:

$ vim test.rs
$ rustc test.rs
$ ./test

Write a slightly bigger program with Cargo + rustc:

$ cargo new --bin testproj
$ cd testproj
$ vim src/main.rs
$ cargo run

Using cargo is only one extra line, so I don’t see why you wouldn’t just do that all the time.


#3

How do you find it to be a speed bump? My experience was quite different:

  • Adding a dependency is adding a line in Cargo.toml. Comparison with a few other language tools:
    • C++: CMake scripts + dealing with linker issues can be hours
    • Java: Maven uses XML, which is highly verbose / lots of noise when trying to see what features are on or off.
    • Ruby: Bundler’s good, and Cargo reminds me of that.
  • Running tests is built-in to the language, so I don’t have to download a testing library and link it; I can just run cargo test. That said, I do use test libraries to make tests easier to write

I admit I’ve had a number of painful GUI related problems, usually due to error messages dropping detail, though the related libraries have improved since.

By reading most of the first edition of the Rust book (the second edition didn’t exist yet), and jumped to random pages in Rust by example. I was just happy (like, really happy) that the compiler gave me colourful error messages and told me where I went wrong.


#4

One of the things I found difficult in Rust is finding code in the cargo system. I want to find one little bit of code to do x or to show an example of x. Searching the code without installing the code was difficult. Finding the minimum download of code to do something was difficult.

The simple example in the tutorials seemed to be in limited areas. I might want to do something like read Exif data from an image to get the image orientation. That is really easy, by comparison, in the language I ended up using. In the other language, there are lots of examples and the code is in small chunks so you can use only what you want.

For the file read portion of that project, I searched for Rust equivalents and went round in circles. I might try again after I finish the application in the other language. I can use the other language to easily display files and data to work out their formats. That will reduce the work required to understand what is happening in Rust.

I am also waiting on a really easy stable GUI. In some other languages, the GUI is easy, stable, and lets me quickly display the data before conversion, during conversion, then after conversion. My attempts with Rust to display activity in progress ended up crashing into GUI library problems. I will look at that gain when there are new versions of the GUI libraries I tested last time.

I might give up on the GUI approach for development and settle for things like sitkevij/hex
to display stuff in the command line.


#5

Looking at your post, I have the impression that you mostly hit library maturity issues, rather than core language or tooling issues. Would you say that this accurately represents your point?

It is certainly true that the Rust library ecosystem is still young in many areas, GUI being a common pain point. Documentation is also a common issue with young programming languages. It is pretty clear that at this current stage of Rust’s growth, older and more established programming languages have a clear advantage on these fronts.

The hard part here is that the missing libraries/docs will not get written until someone decides to take the decision of fighting this ecosystem immaturity, while as you point out the easy path is often to just use an older ecosystem. These kind of chicken-and-egg problems can take a very long time to resolve, I am not sure what we in the Rust community could do to help them get resolved faster.