Failed to contribute due to difficulty in understanding Rust

Hi everyone,

I am trying to migrate my api which is on typescript to Rust, And I've been trying for so many months to do it. It should'nt be that difficult for me as I have more than 10 years of experience in programming and building APIs. I tried so man ORMs and web frameworks. But I want to confess, IT's pain. Absolute pain to work with Rust. I tried to get engaged with various projects, (arysn, rbatis, wundergraph, etc.) but I'm unable to. I want a decent orm that supports geometry types. but not diesel. I am not able to find any. I want to add geometry types in a library, but Rust is so DIFFICULT that I cannot make even a simple change. It embarrasses me that this thing should be so easy( and is in every other language that I've worked with) but in Rust it becomes poison. I spent days to figure out if I could update existing libraries to add just one type.

Microservices is a space in which rust should shine as the binary is small and code is fast. When I look around there is no other language that comes close to in performance and memory safety. I have been an evangelist of rust to everyone I met. I even gave a presentation on Fastest and most reliable graphql service in the world. I am trying my best to contribute, but this language is insanely painful.

Someone tell me what am I missing. I just want to make microservices, not OS, not compilers, plain microservices with web frameworks and orms.


Rust is not a simple language like JS. Learning it takes time. And until you are fairly fluent with it, making changes to others libraries will look impossible – because it is!


One reason I think it's hard to get fully productive in Rust is that a lot of little tips and tricks and best practices are not really documented yet. The official documentation is good but there are still a lot of things it doesn't cover. We don't have an extensive library of printed books like older languages do. When you start a real-world project, it's easy to find yourself in “uncharted territory” and not know where to go next.

Because of this, asking a lot of questions (in this forum or elsewhere) can be hugely valuable. There's a lot of knowledge out there in the community that goes beyond the formal documentation.


I feel your pain.

I fist programmed rather more decades ago than you. First in BASIC, then: Algol, assembler, PL/M, Coral, Ada, C, C++, Javascript, Python, Rust. With a few others along the way.

Sometimes it feels like tackling Rust sends me all the way back to school. As if I had never programmed anything before.

Rust really does force you to think hard about what your program is doing and how you should structure it. You can't just throw code at the wall and hope it sticks.

As it happens during my fist year in Rust creating "micro-services" is exactly what I have been doing. These services are not just in the cloud, they are also in remote embedded systems. What the kids call "IoT" today.

Despite the difficulty I am very happy. They have been up and running, trouble free for months now. When it happens that I go in and refactor things, add/change features, it's great to know the compiler is watching my back and won't let me make a mess of it.

Perhaps greatest of all, when I get really stuck a little discussion here has always pointed me in the right direction.

I would not dream of trying to contribute to any project until I had mastery of the language. In any language.

If you want to see "insanely hard" try contributing to some multi-threaded C++ projects :slight_smile:

Lucky we are not trying to use Haskell !


You may think you've got enough programming experience in another language to basically know about everything there is to know about programming languages. The thought "switching to a new language is just learning about translating syntax and function names" might apply for most languages out there, but Rust is fundamentally different. You have to accept, that you do not know about everything there is and basically have to go back to being a student, learning something completely new every day. Once you have actually learned how to work with Rust, you can start contributing to libraries. I'd argue writing your own library is significantly easier than contributing to someone else's, because they may apply more advanced knowledge you haven't even heard about.

TL;DR: There is no shortcut to mastering Rust. You'll to start as a beginner, no matter your prior experience.

There are actually people tall enough to write multi-threaded code in C++ out there? :grin:


I would like to expand a little on this (which I endorse) because I happen to have talked about this effect recently:

I have the unsubstantiated theory that experienced developers have a harder time than less experienced developers when learning Rust. You need to forget a lot of constructs that work well enough in the languages you already know because they introduce things that go against the single owner enforcement that Rust has, whereas somebody with less experience will simultaneously accept restrictions as "just the way it is" and not seek out more performant constructs that can be much harder to understand or implement.

Rust has a curse (it has many, but this one is critical): inefficient code is generally visible. Experienced developers hate to notice that their code is inefficient. They will recoil at seeing Arc<RefCell<T>>, but won't bat an eye at using Python. I know because I have the same instinct! This makes it much harder to learn Rust for experienced developers because they start with the "simple Rust code that will work but is slightly inefficient" and in an effort to improve it they land squarely in parts of the language they haven't yet developed a mental model for.

Someone tell me what am I missing.

Don't worry about being fast. .clone() to your heart's content. Use Arc and Box if you need to. Get comfortable with the language first and then try to expand into understanding the more advanced uses and patterns that you might have already used in the past.


I wonder if it would help if you stated what programming languages you have been using in that time?

I get the impression that those who have experience of languages like C, C++, even assembler, get the idea of Rust more easily. They have already spent years chasing bugs caused by memory usage errors, null pointers, data races in threaded code etc. They appreciate how Rust is helping with all those issues.

On the other hand there seem to people people around who are quite at home with "functional programming" who seem to handle that aspect of Rust with ease.

I'm not sure how someone whose only experience is a scripting language like Javascript, Python, Java, etc would would feel about it.

I get the impression that those who have experience of languages like C, C++, even assembler, get the idea of Rust more easily. They have already spent years chasing bugs caused by memory usage errors, null pointers, data races in threaded code etc. They appreciate how Rust is helping with all those issues.

I find that people on that group are also very vocal in the "why do I have to keep fighting the compiler, just let me do what I want" camp. I think that the biggest predictor of how much of a good time will have learning Rust is how much they approach the exercise with the mindset of "this is new, it might be hard". I think that people learning, lets say, Haskell, have this mindset thanks to the unfamiliar syntax. Rust looks close enough to the paradigms that you might already know to fool you into thinking it'll be easy. That is a problem.


I have noticed that in various discussions about Rust with C/C++ programmers. They will often argue that one just has know how to code, code carefully, like they do, all the time, and all will be well.

They seem to be resistant to the idea that Rust can save them a lot of time doing all that tedious reviewing and checking, reading, understanding huge coding standards docs and so on.

Anyway, they should pay attention to the uber C coder, Linus Torvalds, who has given his nod of approval to the use of Rust in his kernel. Which kind of surprised me given his downer on C++ for the task.


I see many people out here are giving me same old repeated replies that, all the constructs in Rust are to help programmer write efficient and high performance code, but in my experience as a programmer, in real life project, you spend more time READING the code instead of writing. Not all projects are started from scratch. Most of the coding in my career was fixing the mess of others. My problem is not writing "hello world" code, as I've already written it in Rust. As a programmer I want to focus on writing code that helps my company, I want to put my time there.

I know there are multiple ways to define function signature, but what's the business logic inside is more important, I don't see mention of use cases in documentation. How would I use those various signature types in real life is still mystery to me. No docs or video tutorial.


  1. Programmers spend more time READING code and not writing.
  2. Real life programming is not always just "Hello world"

I guess that is because it is true and the correct response. To which I would add the important "correct, bug free code". What response would you find more acceptable?

I think I start to see the problem.

Yes, that code inside functions that actually does stuff is the "business logic" one wants to achieve.

But, the total business logic of the complete program is achieved by composing many such functions together, all do their little bit of business logic. All that mess in the type signatures, is there to specify what is required to bolt those functions together so as not to create a result that is likely to randomly produce wrong results or crash mysteriously.

One sees all that "noise" in other high performance languages, like Ada, Pascal, C, C++ to a greater of lesser degree. Rust does it in such away as to ensure memory and thread safety, which none of those languages has achieved before. This is a good thing.

As far as I can tell no other language has even tried to tackle the problem of memory use correctness whilst maintaining performance and applicability to systems programming.

I think it's a bit rash to assume those replying here are only talking about "Hello world" programs.

And I'm sure we would all agree code is for humans to read.


I think most professional programmers know this all too well and many people here have a professional background. It's not only about fixing bugs, but also about adding and changing features and teaching new people, having them develop new features by looking at how existing code does it.

I'm not sure where you want to go with your statement, tho. Do you just find open source projects hard to read which makes it hard to contribute? Your first post sounded more like a lack of experience in Rust, mostly in the API design department, to me. That is understandable, because when dealing with APIs that could potentially work with lifetimes in structs, you could also use other constructs that exchange the compile-time guarantess with runtime guarantess and sometimes just clone; everything to not have to deal with lifetime issues. Then there is also the question about thread-safety, that may never come up in certain other languages (where thread-safety is the default for simpler language design or multi-threading is non-existent). And don't get me started on async code. Library design is even more difficult with that.

Rust doesn't offer the one and only true solution and instead delegates all those hard questions to the language users.

The library author has to state the goals and non-goals, which should help potential contributors know what kind of contributions are welcome and what isn't. If it's not clear, just open and issue and ask about it. They should be adding the information to a CONTRIBUTING file, if they haven't.

My apologies for rashness. It was unfair. Coming back to my point, I picked-up rust and want to build all my apis on it is because of all the good reason, but I see that most of the tutorials, documentation, videos, and any other possible resources are limited to same "hello world" levels, no advanced tutorial , real life project is available out there. Latest search for any resources doesn't come up with any latest results. I wanted to build series for java programmers to onboard , but I am also not that comfortable.

I don't see a path to follow that can help me do same things in Rust that I was able to do in other programming languages, to be able to read and fix programs, to be able to solve problems. As a part of this community that's what I see I want to help onboard. But I am struggling after almost one year of learning rust. I want to fix rbatis lib for postgis support, I'll post mentor request, as I see no other way to achieve this.

I'd like to challenge this argument. I was a long time C++ programmer before having switched to Rust. I felt very relieved about the borrow checker, and I was happy it promised to catch all the low-level memory management errors which I had to spend days (!) on previously, trying to figure them out at runtime, using a debugger or valgrind.

My experience is that if you already followed C++ good practices and memory safety recommendations, you'll find that Rust "merely" formalizes and enforces these. And those C++ programmers who complain about how the borrow checker "doesn't let them just do the thing" are usually the ones who would write their low-quality code full of Undefined Behavior even in C++.


Agreed. I came to Rust after a bunch of time on a team that was already really careful about a move semantics, auto-vs-unique_ptr-vs-shared_ptr, reference lifetimes, etc. Rust made all that stuff so much easier, both with better defaults (no manual std::moveing shared_ptr, huzzah!) and because it's freeing to not have to worry about checking it myself.

I can totally see how coming from C, or a C++ dialect without doing all that, would be a completely different -- and far more painful -- experience, though.

Also, a previous conversation on this topic:

1 Like

Thank heaven for Valgrind and the sanitizers!

They help to give some confidence ones C++ code is robust. At the cost of a lot of effort. Without adequate tests in place or some serious fuzzing they tell you nothing.

I must have watched every cppcon presentation on Youtube going back three or four years. Of course they are full of explanations of all the wizzy new features in recent C++ standards. But I swear half of them are about all the pit falls one can get into in C++ and how to avoid them. Getting ever more obscure as C++ gets more complex year by year.

What did it for me was seeing that Bjarne Stroustrup himself could not spot the problem in a few lines of code put up as an example of such pit fall discussion.

If Bjarne does not understand this anymore then I have no chance. I thought. I'm out of here.

But I digress.


I want to fix rbatis lib for postgis support

I can sympathise with trying to do something like this. Recently someone asked for help in figuring out how to implement a certain SVG property in librsvg, and it made me realize that "adding a property" really requires touching like ten places in the code. For an ORM I can imagine these being individually tricky:

  • Finding the code to define a new type supported by a certain database.
  • Does that affect what types must be supported by other databases? E.g. if you implement lat/lon/proj types for postgis, do you have to bother with the sqlite backend?
  • The ORM is Too General(tm) and requires tons of generic types, trait bounds, strange lifetimes...
  • Probably a new type can be implemented by cut&paste of the code for existing types, but that code is spread among 20 different source files.

Etc. It's hard to dive into new code and learn a language at the same time!

(It's also, probably, a good way of learning obscure parts of the language.)

May I suggest a few things:

  • Definitely ask for mentorship among the rbatis maintainers. They may be able to point you to the right places in the code.
  • Do some code archaeology to see if you can find the history behind how a feature was added. Can you "git blame" on the file that implements a database type? Can you find the commits that have to do with the implementation of that type? Do the commit messages tell you anything?
  • Recursively grep for TypeId and see the code that uses it. Without trying to read through all of it, can you see some common patterns that would allow you to plug in your new types?

True. There are people working on this, but there are not that many of them yet.

If you haven't seen his videos yet, I'd highly recommend to take a look at Jon's Channel on YT. Top notch explanations, extremely in-depth tutorials, great delivery.

I haven't gone through it yet, but Tim McNamara's Rust in Action also seems to cover quite a lot of intermediate-to-advanced subjects in Rust, mentioning a whole bunch of external crates to use.

Finally, exploring the examples which can be directly in repositories of the projects you like the most also helps quite a bit. If you're into web frameworks, check the examples of Actix and Rocket. Destructuring existing projects to understand what's going on, many times, is much more fun than trying to implement it all of scratch without even being aware of the whole range of tools you could use.


@insanebaba I can understand your frustration :frowning:

Two things:

  1. Can you please specify the exact nature of your problems e.g. the specific areas of Rust you're having difficulty with? That'll help people provide better suggestions.
  2. Have you read end-to-end any of the Rust books yet? I've seen many people take this approach to a new language: read a bit, start writing code and then get by with the help of Google searches. That doesn't work with Rust. It'll really help if you finish a Rust book first (unless you already have).

Problems :

  1. There is no use cases based learning material. I don't want to watch 3 hours long video streams on just how to do simple stuff. I have finished rustlings, rust book, rust by example, and I do watch Jon's channel and Tensor's channel on Rust. All my latest search on youtube is about rust. many of those videos are either too long, or outdated.
  2. Being productive with Rust is pain. As a developer, I want to focus my time on my own business logic, instead of figuring out function signatures. Please, my time is valuable and I want to make best of it. Many of the comments on this post and in general, are that you need time, but I've been learning rust for almost an year and sorry but not everyone in this community is solely working on learning rust, my time is extremely valuable to me and my company.
  3. Between beginner to professional in Rust , there is a HUUUGE GAP and no one is filling it. Current attempts in onboarding is limited to syntax support, but not use case based support. Lack of intermediate tutorials. (to be honest I didn't know about typeid before someone commented on this post)
  4. Most of the community focus is on how good Rust is than other languages (I'm a sinner in this too, let's not talk about ) and how you can write better programs in Rust than other languages, BUT there's no checklist or documentation on WHAT YOU CANNOT DO IN RUST THAT YOU CAN DO IN OTHER LANGUAGES.(inheritance and polymorphism for example). I think that's a big problem as most of journey of a Rust developer is hit and trial , most of the questions new developers have only one reply (No you cannot do that in Rust)
  5. Much of the focus of community is onboarding C++ developers which is great, but In my opinion microservices is the area where rust shines, a docker image of 14 MB can run entire microservices and in times of cloud storage, that is insanely powerful and beautiful. This is so enticing for me as an API developer, But again, no ORM is a big problem for me. Lack of application architecture best practices is problem for me. DAO patterns, and lots of industry standard patterns are missing in documentation and tutorials. lists some, but they are also not related to application level designs(much of this repo is TODO). I tried to learn how to do it in Rust(Application design patterns) and that was my plan to create such videos for onboarding, but As I find myself struggling with menial task of adding a type in ORM has broke my heart.

Rust community is the best in programming communities, but I feel a bit handicapped when doing real life projects in Rust. The gap in beginners and professional levels in Rust is huge.

If you want to take away any one thing from this discussion - We should guide new programmers, on what they CANNOT do in Rust that is possible in other languages.

PS 1: I still want to fix rbatis for postgis, and I would like to ask anyone help me with it, we can do a video call or live stream.
PS 2: Official advice on using rust on windows via WSL is extremely flawed and should be removed. usage of c++ tools on windows saves more time.

For now I'm closing this topic

1 Like