Prospects of Rust

Hello community,

I have recently begun to learn rust. I have been reading and hearing a lot of news and talks regarding rust as a potential replacement of C, C++.

As a novice programmer, I only heard about rust a few months ago from the white house press release: White House PRESS RELEASE: Future Software Should Be Memory Safe. With my superficial knowledge in C and buffer overflow exploitations, I understand the growing preference for memory safe languages.

However, with my limited insights and experience, I cannot judge whether the current excitement over Rust is just a spark or a persistent, growing fire. Will Rust eventually replace C,C++ as some people say? Or will C,C++ always prevail as the low-level system language as some other people say?

I'm mainly asking this question to jump into Rust community as well as gauge the "usefulness" of Rust as I begin to commit a significant portion of my time in learning Rust. I've yet to realize the "usefulness" of Rust (I'm willing to learn more about it).

I'm also aware that this question might be asked by every new visitor in this community...

Also going on a tangent, how do you know which crate to use? Does it come with years of experience, or is there a more systemic approach to search for the right crate (or make one if one can't find it)? So far, I have been just following project guidelines that recommend specific crates to use, but I feel like that can't be how it works in real life.

Thank you.

1 Like

You're asking the wrong crowd -- we're biased because we chose Rust. You should do independent research to try to answer that question. A biased group is least likely to predict the future.

Rust is a safer, more reliable, replacement for C++. It is currently the only systems language (without GC) that is memory safe and data race free. If that's what you want, it is a good choice.

It is best to choose crates with lots of downloads and usage in other crates, especially at first. This info is avalable on crates.io and lib.rs. The best thing is to wait until you need a crate, then take a look at what most people are using and ask questions here about it.

7 Likes

I look at downloads, but I also look at the documentation. Especially for things like does it have interfaces that make testing easy or dedicated testing facilities. I look at the library tests themselves, is the library tested, how much. What kind of issues does it have on its bug/issue tracker.

The ability to test my code is paramount to me. If the library doesn't let me test the code I'll be writing, I won't be using it in the first place.

2 Likes

will C,C++ always prevail as the low-level system language

Just here to leave a note that it is not a language. C and C++ are very different languages that serve different purposes, the first being an extremely minimalistic expansion of an untyped language and the second being a graveyard of ideas, some of which are implemented in Rust the way they might and should have been.

Speaking of ideas, memory safety is far from the only (or even main) reason to use Rust. Those ideas include, for example, affine typing, which C++ doesn’t support, instead offering you the amazing experience of utilizing a crutch known as std::move.

It doesn’t mean you must learn Rust, though. Do whatever language you like (and the more you like, the better), unless you just really want some position that requires, say, Java or JS.

5 Likes

The cause and effect are the other way. The "current excitement" is not a new spark, but a culmination of many years of Rust's development, adoption, and growth, reaching wider and wider audiences. NSA and the White House can recommend Rust, because over the last decade Rust has been adopted by bigger and bigger projects and companies, and has proven to work.

Rust isn't going anywhere. It already has a large and mature ecosystem of libraries. Its usage keeps growing exponentially. It's in Android. It's in Windows. It's in Firefox, and it's getting added to Chromium. Cloudflare has a Rust-based network stack that, so most likely you're browsing pages processed in Rust every day.

3 Likes

I look at the dependencies for crates / programs that ?work? For example egui has a nice demo. If you grab the source and compile, you will see lots of crates get downloaded and compiled. There is a good chance those crates ?work? or they would not be used by another crate that ?works?. You can look in the Cargo.toml file of ?known good? crates and see what they use. This will give you an idea of crates you can trust.

Then when I need a crate to do something, I search crates.io and hopefully see some of the names I alread know are ?trusted?

That said, I think the best method I have witnessed for finding crates is a well crafted post to this forum saying something like...

I am looking for a crate that can wobble widgets. i searched crates.io and found the wob-widg and widget-wobbler crates. I don't have much experience with widget wobbling and wonder if anybody here can give me some insight on the difference between these two or suggest another crate that can wobble widgets.

1 Like

C/C++ is not going anywhere soon for the next decade(s). It is one of the most used and most popular languages. New code will also still be written in C/C++. Companies today often lack the in-house knowledge of Rust to create new projects in it and will stick with C/C++.

I am, however, sure that Rust is here to stay. New start-ups or smaller companies who have more flexibility in the technology-stack they can use often choose Rust and provide a learning-trajectory for new employees not yet familiar with it.

And also big organizations like e.g the US government are starting to endorse Rust: US Government ENDORSE Rust?. The Government just released a report… | by Rahul Gupta | Medium

Also note that in Stackoverflow's Developer Survey Rust finishes as one of the most beloved/desired languages each year.

These are both the wrong question.

Realistically, there is so much code written in C and C++ that they will never go away.

But is that all you care about? The endless legacy code that some clueless dude in the 80s wrote at a bank and is now full of undiscovered security holes? The mess of a codebase full of mutable globals in an embedded system that's proprietary and you aren't going to be able to fix (or even see) it?

I can hardly imagine that "is C what we are stuck with?" is a useful question in deciding whether to learn Rust. You should choose the language based on its own merits, not because it's more popular than some other language.

I don't see any good reason to start new, greenfield projects in C or C++ today. There may be a desire to interoperate with existing C++ code in which C++ can be a reasonable choice. But Rust can FFI to C just fine, so if you don't need C++ compatibility, and there's no other constraint (eg. lack of platform support) forcing you, you probably shouldn't get a new project going using C.

Even very seasoned C and C++ programmers make trivial memory management mistakes all the time. Those who claim not to are either lying or bagatellizing the (otherwise billion-dollar) problem.

You should read Wikipedia then. The language is 17 years old. People were writing operating systems and other critical infrastructure in C when it was this old.

I'm honestly and repeatedly flabbergasted by the persistent belief that Rust is young, immature, and unproven. It's everything but. Interestingly, no one blinks an eyelid when someone asks whether they should use NodeJS. NodeJS is 2 years younger than Rust! (No, how old JS itself is doesn't matter, because for the server-side, it simply didn't have a runtime and an ecosystem, except for the browser.)

Experience and writing a ton of code.

Until then, your best bet is searching on crates.io or lib.rs then judging the top results based on some criteria that you prefer (eg. feature set, use of unsafe, maintenance status, MSRV), and/or asking others for specific recommendations.

2 Likes

I think "replace" is the wrong way to look at it. C and C++ are not going away on any time scale we care about. Nobody is going to rewrite all those millions of programs in billions of lines of code written in C and C++. Those projects will mostly continue development in C and C++. However given the ever increasing amount of software the world wants and that is a huge space opening up in the future for Rust (and other languages of course). It is not a "zero-sum game" as the kids like to say today.

I wonder who those "some people" are. Pretty much all Rust enthusiasts are wise enough not to campaign for replacement, rewriting the world in Rust. They know it is not practically, economically viable.

I don't much like to see C and C++ lumped together as "C/C++". They are so very different languages.

Personally I love C. It's about the smallest, simplest way to achieve a portable, performant, compiled to executable programming language worthy of being called "high level". Something one man can write a compiler for in a reasonable amount of time.

C++ on the other hand is a gigantic and ever expanding tower of Babel that nobody fully understands. Complexity piled on complexity and yet not fixing any other of the problems of the C language from which it is derived.

Up to a point. If a language only has one developer and three users it's probably wise to not start building one's business on it. One has to have some confidence in support and sustainability into the future. Unless that language actually enables one to do something that nothing else can. Luckily Rust is well past that stage and growing every day.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.