I love both Rust and Zig. I’d probably use Zig for things where I need more fine control over something like memory: how and when allocation / deallocation happens for example. Sometimes you just don’t feel like fighting the borrow checker. Zig’s approach to compile time execution of code is refreshing and makes macros look like insanity I recommend spending some time with Zig.
Zig ❤ it can be easel added in existing c/c++ projects. Write C bridges for C++ is easy. Set up compiler also. Cool 😄 About Rust why Webassembly developers that developed rust - didn’t create it support safety threads in webassembly ?
Zig is an absolute must in certain applications. I don't remember where but a while back I read an article about someone who implemented a language VM in both Rust and Zig, VMs are an incredibly memory intensive application, and they ended up 99% of the time writing unsafe Rust. Rust, least as far as I can tell, has zero benefit over Zig when you're writing purely unsafe code. If you're going to be writing unsafe, might as well write it in Zig where the language lends itself best.
I've worked on some embedded systems over the course of my career. I've never use dynamic memory allocation in an embedded system (or needed to) for the following two reasons. One, what would you do if a memory allocation failed? That just can't happen. Two, embedded systems are typically intended to do a specific task and so you know the worst cast memory requirements for that task and can allocate the necessary memory statically up front. This makes a primary feature of Rust, memory safety, not as important for embedded systems. Sure, go ahead and use Rust. But C and C++ are still good and not as much of a detriment in embedded systems compared to Rust.
Zig is intended to be a replacement for C. Also it is beginner friendly(in my opinion compared to rust) and go to language for someone wanting to dive into low level programming.
@@letsgetrusty Easier learning curve i guess . Like i made my own http server in just 2nd day of learning zig whereas in rust i didnt even completed one(simple http server in rust) as it got more complex and ended up switching to zig :/.
I have heard from plenty of companies that are using Rust and hire experienced software engineers that have never heard of Rust. The important point being that you know how to design software and build software likely with plenty of experience in whatever other languages and/or have good domain knowledge. It is expected such hires can pick up Rust easily enough, perhaps with some training.
@@sharkpyro93 Are you suggesting that what I say about my own experience is not true? How could you possibly know that? I'll assume you did not mean to be so rude and meant to say that it is not your experience or not as common as one would like. As it happens I am currently using Rust full time at a company that has just adopted it having no previous experience of Rust myself before.
I like Rust and been using it for years (not at work tho), but I do feel like its mainly a C++ replacement. On one hand, a good C++ dev doesnt really need Rust. On the other, I wouldnt encourage a young beginner to choose C++ over Rust these days because C++ is complex but not for good reasons.
i mostly agree. however, if we look at it transitively then C++ is a replacement for C and Rust a replacement for C++ which implies that Rust is a replacement for C (all of this obviously isn't true in practice)
I keep hearing that "Good C++ devs don't really need Rust". Usually from people who think they are good C++ devs. But the statistics on bugs and security vulnerabilities cause by mistakes in writing C++ coming out of MS and others show that their devs need something better than C++. I'm assuming the likes of MS are hiring some of the best C++ devs.
I would assume they have varying levels of C++ devs, def with some of the best in the business. They have a lot of devs and they have a very old and very large codebase. At my company we have a small team of experienced capable C++ devs working together for many years now, and memory related issues are not really a thing, also not in the significant C parts of the code. We do use all the static and dynamic analysis tools on all the platforms with all the compilers (all = a few), and they are needed to catch issues early, but I can't remember a client crash due to a memory issue. So I do think there are circumstances where you can make C++ and C work, there is lots of safety critical C and C++ code out there without issues, but it is far from trivial for sure, and that doesn't mean they can't benefit from Rust imho. I am learning Rust atm and so far I like it. Haven't tried Zig yet, but it def an interesting languague/idea. But both wouldn't be an option for my company atm, even if everyone wanted to: lots of our codebase is intended for embedded DSP platforms, and some of these don't even have a C++ compiler, or a very old one, or just so badly optimized that you have to use the C compiler anyway. There is probably space for some stuff to be created with Rust, though I don't know enough about interop with C and especially C++ to know how viable it is, though I'd assume it would be manageable after some effort (I imagine you cant instantiate templates through the interop, so you need to create interop API's in some form most likely). The initial cost to get started with it is probably enough to get a no from management, as the benefit wouldn't make it worth it (in the shorter term). And that would even assume we're actually competent with rust, which we are def not, so that learning curve needs to be taken too, especially if it needs to be at the same level as the current C++ competence level.
I'm relearning Rust now, and I'm an experienced Scala dev. I'm looking for a culture that is less academic, more pragmatic, but still allows me to write high level code. Rust is surprisingly similar to Scala , it has ADTs, type classes, generics etc, extensive use of Option and Result (Its version of Either)
This year I’ve attempted to use Rust for adventofcode, and honestly it’s a good time. I was originally using Go, but it’s just not for me. Very mature tooling, but a ton of QoL is missing
There’s a huge elephant in the room which I was hoping you were going to mention and that is the failing leadership in the rust foundation that has given rise to the crablang fork that happened earlier this year. I have been trying to decide whether it is time for me to have a second attempt at learning rust as my previous attempt about 3 years ago failed mainly due to the difficulty in my battles to appease the dreaded borrow checker. Now that rust has matured somewhat and there are are more tools for learning such a language such as ChatGPT, I would like to give it another shot, but having recently learned of missteps by the rust leadership makes me wonder if I should just stick with golang (even given it’s short comings). I’m seriously worried about the potential fragmentation of the rust community as a result
There is no "elephant in the room". Perhaps a mouse. The Rust Foundation is a new thing finding its way. It has the impossible job of trying to please all kind of people pulling in all kind of directions. Sure mistakes happen, fathers get ruffled. With large entities like MS and AWS getting into the scene I'm pretty sure things will be force to become more professional. By the way, I cannot imagine asking ChatGPT is a good way to lean Rust. Read the book, write some code, do experiments. Besides where is the fun in having a machine "understand" things for you?
I ask a lot of clarifications for concepts that I can't get to wrap my head around ; ChatGPT is the guy that will answer without judging you @@Heater-v1.0.0
The Rust community is so dramatic. The Rust foundation has been pretty dumb, but they've also course-corrected whenever they messed up. And no matter what happens, crablang will likely always just be a Rust fork, so you'll be using Rust either way.
@@Heater-v1.0.0 what do you think I was doing in my first attempt at learning rust? I was writing code doing tutorials etc, but I just wasn’t productive enough in rust, taking too long to solve borrow check errors. This is where chat gpt can help a lot. If and when I give this another shot, I can not use the same technique as I did the first time round expecting a different result, some say that is the definition of insanity. I just hope that the tutorials that are available now are much MUCH better than they were a few years ago and I say this having been a c++ developer for many years. Perhaps the prior experience just makes it harder, I don’t know, but I am will to accept any criticism as long as I can learn from it and finally beat the borrow checker
@@dawnrazor I don't know. My experience of beginning to learn Rust was that there were far more other details of the language that stalled my progress than the borrow. checker. What with it's kind of lean toward Functional Programming and it's type system. Now, some years later I find that the borrow checker has rarely caused me issues. Things is that after years of experience with C, C++ and similar compiled languages one knows about the lifetimes of variables and objects. One knows not to use a pointer after the thing it points to has been freed for, one knows not to use a reference to an element of a vector after the vector has been pushed into, and so on. An experienced C/C++ programmer nows all about lifetimes through bitter experience of things going haywire or crashing when getting it wrong. It's just that the C/C++ syntax says nothing about lifetimes and does not help you. You just have to just know what is UB in all cases. Rust on the other hand does, and it tells you, and it is nothing strange. I guess that is the only advice I have. That there is nothing conceptually new about lifetimes in Rust. Those same lifetimes exist in C and C++. Rust only checks that you are not abusing lifetimes at compile time rather than you finding out with segfault at run time. Even now I start to think that if I find myself having to write lifetime "tick marks" in my code I am going down the wrong road. Most of my code does not have them. I have toyed with prompting ChatGPT about Rust code. Typically it did not come up with anything that is not readily found in "The Book" or many other places. Often its suggestions were, shall we say, wonky. The most important thing for my learning Rust was the Rust compiler, after reading what I can and trying some some examples I could spend quite some time experimenting with this and that and having a useful conversation with the compiler. The error messages and the suggestions offered are often very good and should be read and paid attention to.
I love c#. I worked a year now in the c# space and i love it. but i think it is time to switch to rust. What do you think? which ide should i use? rustrover, or neovim or helix? or vscode=?
I clicked on this video because I wanted to see if it was a good investment of my time to continue to learn Rust. But the comments have convinced me to try out Zig.
@@fusion9619I ended up installing Zig and then quit after 30 minutes, just didn't feel like learning another language. I stayed with Rust, because I actually really like the language, how it is designed, and cannot relate to the commenters struggling with the borrow checker. Finally managed to finish a real programming project with it.
I don't understand why Rust is often recommended for CLI apps. Doesn't it depend on the nature of apps? My team works with a zillion line codebase of a system of CLI apps that work on a large database, generates emails and PDFs, mails them, creates directories of files, generates reports/xml, transports data over https and tcp, ..., .etc. It is currently implemented in TCL and C. It is very old. We are planning to modernize it and are considering Java/Groovy/Scala or Python. Why would we consider Rust? It appears much more complicated than even Scala. I don't see why managing allocation and freeing memory yourself is a desirable thing.
Rust is memory safe. Anything that needs to be 100% reliable such as backend systems and high performance such as game engines benefit from Rust's memory system. If your building something you don't wanna touch again for months after you consider it complete, rust is a good option due to its dependency systems. On the flip side if you just need a quick and dirty method to achieve something there's no reason to use rust.
Rust is much more a C++ replacement than C. Zig is a C replacement for low level once it gets more mature. Zig is C with some helpful guard rails that don't get in the way and better tooling. It comes down to Rust being way too strict/awkward once you go below a certain level (entering C-world rather than C++ world) and unsafe Rust language needs a lot of work, my kingdom for "->" deref syntax. Microsoft are also moving their "C++" to Rust, not their C, though you see it written as "C/C++" a lot, they don't mean both.
What about Linux kernel? It completely C, but Rust penetrating there too! It's a myth that Rust is replacement for just C++, not C. Rust is alternative for both C and C++.
@@scitechplusexplorer2484 There is no Rust in the Linux kernel yet, just the toolchain. See Torvalds interview a few weeks ago on Rust impact in Linux kernel: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-YyRVOGxRKLg.html Rust is not a replacement for C. However, that does not mean Rust cannot do the things C can, it is an alternative. Rust is a replacement for C in the same way C++ is. They are just a pain or are impractical for anything truly "requiring" C. In Rust's case this is due to the lack of nicer syntax and features within the unsafe Rust language, which is needed due to things not being expressible in safe Rust without defeating the purpose, usually by sacrificing resources in some way. Ever since Microsoft began buying into Rust hard about 3-4ish years ago, the language has progressed further than in the previous 10+ years so give it a few more years for work on safe Rust to peak a bit and for focus to shift onto the unsafe Rust language. There is also a lot that can be done in the Kernel in Rust that is currently in C that doesn't "need" to be in C, but is due to having been the only available language. Zig is a long way off being suitable and I see it more likely that Rust will be improved to fit better rather than allowing Zig as a third language in 5-6 years time.
@@scitechplusexplorer2484 even if its true no company is going to switch thats for sure, C is not going anywhere, i like rust but its extremely overhyped, in the wilds of the real world barely anyone know what it is let alone use it
@@scitechplusexplorer2484 Rust is very complex and "too" memory safe. What I mean is that for programs that require fine memory control by their nature, such as say an OS, Rust is a burden. If you read Linux kernel code you'd quickly realize 90% of it would need to be written in unsafe rust. If you were to write in in safe rust it either would not be possible or would be painfully slow. Zig bridges this gap, Rust does not.
What about learning some assembly and then C/C++ very well, before trying to learn any of these other useless languages? Well, unless you do web or something else specific, then some of these languages have their pros as well.
I'm looking forward to the rise of a new generation of languages like Rust, Zig, Go and so forth. The changing software engineering landscape is what makes it worth doing IMO
Me too, I was hoping that kotlin would sort of do that for java, instead it's java that is evolving faster now. While I do like java, I am just tired being force to use his java 8 version and the pill of mess that has been built upon when we have java 21 available today. Add on top of that the conservatism of java devs in generale (which is both good and bad) + oracle extending up to 2030 java 8 support, I am not seeing the change any time soon 😂
I don't think calling C/C++ a gas vehicle and Rust an electric vehicle is as great an argument as you think it is. I'd personally compare C/C++ to sailboats and Rust to a modern freighter. Both doing the same things, with Rust far safer and more reliable.
For Zig lovers: I will wait until be done sothing meaningful in Zig and be at least 1.0. Don't get me wrong if zig is better tool for something I will use zig(after 1.0 version or stable)
The reality is that if you want to use Rust in a salaried role, you are better off learning C++. Most Rust developer jobs are with companies using an existing C++ codebase and wanting developers who can work with their legacy code. That's assuming you aren't willing to take jobs in blockchain development.
I think you should give Zig a chance. Even if it's only to use zig cc. At the very least, the tooling build around zig is pretty impressive, and has solved problems Rust and Go still struggle with, or aren't a part of their missions to solve.
zig is the perfect in between, he's safe, faster than c or rust in a few cases, and in zig, even if it's a safe language, you can do whatever you want without worrying. in the c vs rust, zig fit perfectly in between and seem, for me, to be the solution.
@@RustIsWinning It does not guarantee memory safety, not as Rust does. However, it still has a lot of safety improvements over C (optionals + pointers, defer, leak tracking allocator and more) while still maintaining simplicity. Those improvements are enough for some people. Rust might just be a complex overkill for them.
How come everyone ignores the lack of ABI stability in Rust? Do they not expect their software to be in production for 10 years or more? I'm so scared of those Rust fanboys who thoughtlessly drags Rust into such critical areas like OS, Cloud Infrastructure, and so on. If Rust wins, the humanity is doomed. On the other hand software engineers are safe, because rust applications will require migration to different programming languages
You know that everything from edition 2018 will be supported forever. There is no reason you could not use a crate from an older edition. If by ABI stability you mean stable compiler output: why does this matter? Does it matter that in 10 years your compiler will compile more correctly and performant code? I don't think so ...
Zig is just better if you need fine control over memory, not only its inherently more complex in Rust, Rust also supports things like operation overloading which are problematic for determining clear program flow. As much as this point of view is hated, I think Rust is a better replacement for C++ then C, Zig does much better job at replacing C.
@@egorsozonov7425 Zig does exist. It can already be used, and was used in 2 real projects (Tigerbeetle and Bun) . It is indeed not "completed" (only 0.13.0), but this doesn't mean you can't use it.
5:45 Can you make a video on using rust libraries from C code or other languages if that works well? Using bindings to established C libraries is fine, but what about making new dependable libraries in rust that works in other languages like how C gets everywhere? That'd be interesting (in terms of making lower level open source libraries)
@jazzycoder What? No, nothing to do with frontend devs, I just wonder if we could have nice bindings from a low level rust project into C codebases or do we have to write anything remotely reusable in C? Hint: linux DEs, wayland, shells...
for greenfield projects, js or golang is more than enough. for extreme performance (high frequency trading, hard real time stuff etc...) ZIG is crazy fast. 🚀 on the other hand, Rust is "like" a more performant and safer version of Apple's swift language. it has an interesting niche category of itself. it is a systems programming language but has too many useful but sometimes hard to grasp high level abstractions. it doesn't have direct memory manipulation by default, so it is systems language but not low level.
any way to reduce compilation time ? for a minor change in code it takes approx. 5sec which overall becomes very time consuming example for yew framework we have to wait more as compared to reactjs.. or actix web as compared to nestjs
The one thing that makes me leery of going all in on Rust is the insane toxicity of the leadership (and, to a lesser degree, the community). I've heard so many horror stories...
What about stream processing? I am developing a lot of event stream processing services. Some in java and migrating some to golanfg ( because of mem footprint ). My stomache says me that rust can here perform better ( there is no gc ) but I am not sure. Has someone test rust in that are ?
I am using rust in fintech for payments transactions stream events when each event need to be analyzed as fast as possible and assigned fraud/AML score with combination of deterministic rules, anomaly detection and some ai/ml stuff. My main responsibility is sw architect but even after several years break from serious programming my beginner code in rust is with much better performance, safety and additional features than our current java solution. AB testing showed us rust supermacy in this area but problem is to get developers for keeping solution alive 😢
Zig is more faster but it's more c like, because of that i don't sure it's fit for developing big apps. And also it isn't be stable until 2025. I'll give a shot when it'll be stable. Go is an easy language and it's not offering garbage collector and fully functioning guarantee when program compiles. So rust is the best programming language for me.
@@catto-from-heaven linux is a massive project that includes hundreds, maybe thousands of sub projects. There is probably no sub project in linux kernel which has 10 thousand lines and many modules. That's more testable in web applications, c++ and rust apps written with their frameworks are way more faster than c apps that written with their liblaries. If you want to write big projects with maximum optimisation you need to have too many data structures like c++ and rust. If there is not, you simply have do that with way more unefficient way. And finally, because of the whole reasons i mentioned, no one makes that 8 gb gpu required games with c, they do it with c++.
Good luck with that :) Rust specifically makes a lot annoying trade offs to address a set of problems that don’t even exist in wasm deployments. That would be like using Angularjs to build a simple static webpage. Don’t get me wrong- still worth learning up to a point, but try not to box yourself into a corner with it too hard.
A couple of Points for Zig are, a more comfortable work with memory which makes it better if you need raw access for example with micro controllers. Also it's Interoperability with C/C++ is way better as you can just import a header and are ready to go. Also Zig is very usefull as a build system using only the build.zig to help with the mess that is the C ecosystem or when working with FFIs like cgo and linking c into rust.
Zig: - is much easier to learn/use than rust - has simpler FFI with C - compiles faster - is probably a better choice in projects where unsafe rust would be heavily used - is a fantastic build tool
@@jly_dev Omg, I am surprised that you are really replying to this. This man writes comments like that all over the place :D He is either trolling or...
I've ben writing Rust for a few months now and, though it's very ugly and there are lots of annoyances, it's easily my favourite language rn. I wish I could write everything in Rust haha. Async traits are handy but you can't do dynamic dispatch on them - which is a big reason why I use traits. Trying to create a plugin system where the trait is the interface plugins adhere to is pretty tricky for this reason.
Please show the difference between actix web and axum which one it better and where exactly we have to use tokio library.. we can tokio separate only or can use it with actix or axum
Guy that runs a youtube channel about Rust: "I'm going to give you my completely unbiased answer." Little late for that. I enjoyed the video, but let's be real.
I would suggest to hold off using rust for web development, until rust has django replacement. For business it's important to have short TTM (time to market) and rust isn't a good choice for that. I would consider python, django, django-oscar applications because for business it's better to have more features fast than only 1 fast endpoint
With that logic java, c# would be an instant red flag. I think it comes more to the background/workplace you are working in more then a language issue. I see rust more used for example in companies that are like 50+ (non devs included) rather then small startup teams that requires indeed to prototype fast their ideas.
@@lufenmartofilia5804 the ecosystem and DX for web dev in Rust is horrible to say at least, ive been there it was miserable, its the immaturity of the ecosystem the problem rather than the language itself, and ive inddeed worked in rust in a startup where most big companies here (EU)its basically 99% java with spring
An important difference between Rust and Go is that Rust is much more suitable for embedded development, i.e. with a non-standard OS. Personally, I like Rust MUCH more than Go, because of its much stronger typing system and how that can be leveraged to writer better systems. And while it is low-level enough to replace C, it is also high-level enough to replace C# and Java. That makes it an AMAZING language! I foresee a huge growth for Rust, that will increase in speed as more platforms support it. Like Android and the Browser.
I saw you wrote that Go is "Not memory safe"? That doesn't make sense. Go uses a garbage collector. You can't access memory directly. How is that not memory safe?
Hii Imma, I am working on web application from last 1 year. I am learning rust from your playlist from last 2 months . I want a job in rust or blockchain technology. What is your advice for me to get job in this field and how can I get it?
I'm currently a compE student at Purdue who's been learning C for the past 2 years. This summer I got an opportunity to work with a professor on a Rust project. Thank you for the amazing vids and tutorials that have helped me to learn the basics!
Indeed, Rust is a solid language, but it doesn't absolutely replace C/C++. The reality is that there is no clear successor to C/C++ yet. While C/C++ may eventually be replaced, it would likely require a new language with a simple yet immensely powerful paradigm to emerge and lead the way.
I had a biology background and I want to get more serious about scientific computing and computational biology. Does learning rust could be a good start? I know it’s a low-level language harder than Python and R but does anyone know routine use of Rust in industry and university?
I've been out of the field for a while but unless you're already familiar with them I feel like numpy/scipy would generally be the best place to focus. Scientific computing often boils down to solving massive systems of linear equations and it's unlikely you'll outperform established tools at that.
I like rust. But I checked a popular website with jobs for developers in my country. And there are only 8 vacancies. 2 of them are not really rust, and 6 are blockchain.
It's NOT GOOD NEWS AT ALL which MS will dive deeper into Rust. For example, linux ubuntu has being slowed from 5.x kernel which Canonical seems to have connection with MS. Like Golang which sends some data to GoogleStatic whenever compile, tremendous datas may be collected by MS and this must influence on performance, time and personal info IMAO.
Bro I am excited by cant use it without vs community most tutorial with vs community can you make video how to install rust in vs code or vim without vs community
I am new in the IT field and like every other newbie I am all over the place can you suggest me what to do ? I just completed my basics of frontend (html,CSS and js) and my goal in full-stack using js, so should I learn rust and where can I use it? Pls pls reply❤️
No, don’t learn rust. If you are a complete beginner to programming and are looking for a job stick to what you’ve mentioned and learn a framework like react. If you have no programming or computer science background, a lot of the concepts in rust will be extremely confusing and you’ll get discouraged and quit completely. I would only move to a backend language once I’ve become extremely comfortable with the front-end stack. And even then you can begin using a python framework (again python is very beginner friendly). I’ve been coding and making websites for almost a decade and only recently did I feel comfortable to begin tackling low level languages like Rust and C++. Part of that is thanks to ChatGPT, but a big part of that is being extremely comfortable with the surface level coding concepts you learn in languages like JavaScript and Python. I’m also not saying wait 10 years to learn rust, you don’t need to wait that long. But by the sounds of it you are a complete beginner so I would wait at least a few years.