ERRATA Tauri hasn't yet release mobile app bundling, though its in their roadmap. Desktop only for now! 2:31 Though the "80%" header is right, the table below is only for 128MB lambdas 4:53 The heading reads "Hander" instead of "Handler"
These videos convinced me to write my latest project in rust. At first I thought the project was too big, too many states to model and too many breaking changes. But having written something once, it never broke. Whenever I added a new thing, I first extended the valid states by changing the type of a variable from String to a parsed struct - and the compiler told me where I had to fix stuff. When there were no more compiler errors, I was done. It's fun to write code like this.
Oh! The same for me! I rewrote an old project that never leaves my mind, and now it works at a decent speed and memory usage, while doing what I want it to do. It was strange at first, seeing errors and warns I didn't even know the meaning, but with time (just 2 days), once there were no more errors, it was beautiful (actually, as it's image processing, and I have a bad taste, it was ugly, but conceptually working)!
I read that energy efficiency paper. The reason Java is so high up is because they used Java to execute the power analysis function, and instead of launching the program externally like they did for literally every other language, they just ran the Java program inside the same VM, cutting corners significantly.
The production quality of this is so high. The message is a complex thing made simple, using rudimentary graphics done well, overlaid with a voice that is so pleasant this guy should voice audiobooks. Very much appreciate the level of quality in this!
You're too kind! I honed my production skills on a hopepunk, scifi podcast, and I'd love to know what you think! ua-cam.com/video/p3bDE9kszMc/v-deo.html
@@NoBoilerplate It is - but the meaning of _podcast_ has been lost over time - I certainly found it surprising that a podcast meant _any_ digitally distributed programme, and did not specifically refer to the format of several hosts having a recorded conversation... P.s. Lost Terminal is amazing! It's the first podcast I've listened to in a long time (read: ever) and I love it.
@@NoBoilerplate As others have said, the quality of your videos is high, and I feel like that's also part of why you love Rust so much, because you too care about correctness. And with such, you keep your videos correct, which in the context of YT vids would be considered videos that achieve their goals well and nothing else, and since you're teaching us about Rust, you're fast, concise, and to the point with no meaningless detours. This video quality is amazing, and I'm very thankful to have stumbled onto this channel. Thanks for your amazing work!
Another thing about rust that makes it very good for writing code: I often find that if I understand what a struct is, I can very often tell what a method does just by its name and type signature. I can also very often find the method I want quickly by looking through the autogenerated documentation
You've mentioned execution time and memory usage but there is an area you didn't mention: disk usage. Rust's compiler is a powerful tool that does a lot of checking for you. This takes a lot of time. The first build in Rust takes a long time, easily in the order of minutes. The authors knew this and so, just like C's object files, the compiler produces a lot of artifacts to remember its progress. And this is where the cost of Rust manifests because nothing in the world is ever completely free. Rust consumes a lot of persistent memory on the developer side to power its magic. Even a simple hello world project will take a couple hundred megabytes, real projects easily number in gigabytes of compile-time artifact data. There is a argument to be made that persistent memory is pretty cheap today and that this single-time, developer-side cost of space is a small price to pay for all the good stuff - and I would agree with that. But I felt it necessary to mention it for the sake of completeness.
Very good take, it's certainly an are that could be optimised more isn't it? Running a Rust CI pipeline is very different to other languages for this particular reason!
As Mark (CTO of Azure) correctly tweeted, C/C++ should be declared as retired languages and instead use Rust. Am pretty sure, going forward most of the cloud services and data centre infrastructure code will be written in Rust. Fast, energy efficient and of course cheap!
In exchange for making code fast, you generally have to sacrifice some space to hold the compiled binary. While your code may not get to the size of a shell-script one-liner, Rust has plenty of tools available that let you get down to an absurdly small binary, even forgoing the entire C runtime, while still being confident that things won't break.
I'm not sure what you mean by "In exchange for making code fast, you generally have to sacrifice some space to hold the compiled binary." Whilst it is true that sometimes one can optimise a compilation for speed and get a bigger binary as a result or vice-versa, I would say that in general the differences are not very big. More common is things like Java, Javascript, Python where one gets extra memory usage, thanks to the way they maintain variables and use garbage collection and at the same time slow performance, for much the same reasons. That's before we have added on the memory consumed by their run-rime systems/interpreters. Anyway, yes, Rust can produce binaries that are as small and performant as C or C++ can, there are many embedded projects running on micro-controllers to test to that. By the way, what do yo mean "forgoing the entire C runtime, "? C pretty much does not have a run time beyond what is needed to initialise the stack and such before jumping to main(), but even that is not running once your program is started.
@@Heater-v1.0.0 That comment was largely in reference to replacing a shell invocation that took a few dozen bytes with a 2kiB binary (which was optimized for size). And yes, C _does_ have a runtime and Rust by default links to it, and the dynamic linking alone actually increased the size of the binary more than reimplementing the necessary parts myself.
@@angeldude101 Well certainly it nice to be able to write one line of shell to get some quite complex task done. The comparison with a 2K compiled binary is of little relevance usually. I mean, that line of shell script can be dependent on millions of lines of code, in the shell interpreter, in the commands it is invoking, in the libraries they depend on, in the operating system the whole thing runs on. Perhaps if you wanted to do that same task on a memory constrained system, like a micro-controller, the 2K compiled binary would be the way to go. No, C does not have a run-time. Sure your C code may depend on library functions defined in the standard library. Or it may depend on other libraries. Or it mat depend on syscalls to the operating system. It mat even achieve all that via dynamic linked libraries. Non of that is a language run-time. That is just library dependencies. After all consider the kernel of your operating system, often written in C, there is no language run-time underneath that, it is running on the bare metal. In fact that kernel provides run time facilities that all your applications need. Yeah, I know there is often something called "crt" something or other, as in "C run time" that is typically very small and only initialises the stack, processor registers, static variable, etc before jumping to your main(). It can be as small as a handful of instructions. It's also not running when your C code is. Whilst it is true that Rust links to the standard functions provided by lib C on Linux, Windows, Mac etc, that is not actually necessary to run Rust programs. Many people are using Rust on bare metal systems that have none of that.
When I first tried Rust in 2016, I was repelled by its weird syntax and borrow checker - C++ seemed much more familiar. Later (in 2019) I decided to try it once more, maybe write something small and simple. And it clicked. Since then I'm using Rust for all my personal projects. I don't remember last time when my program crashed NOT on my own unwrap(), which is just quick dirty hack to make program compile. But unlike said C++, I know that I can just grep for unwrap()s and replace them with proper error handling, not re-reading whole code 50 times.
Can we get a complete Rust tutorial for begginers? You have an amazing writing style and your voice is very pleasant to listen. I'd love to see a good Rust tutorial series
Thank you! I did that once, have you seen this ua-cam.com/video/br3GIIQeefY/v-deo.html My focus for the moment is shining a light on all the incredible features of Rust. Once you're excited, The Book is all you need to learn, it's written brilliantly! doc.rust-lang.org/stable/book/
@@zakstephens9297 It's ridiculous to call the rust lang book "low value", meanwhile learning any language is going to be high effort if you want to be fluent in it. The rust lang book is probably the single highest quality resource I've come across learning ANY language, with an imbedded compiler and multiple examples and explanations for every single rust concept.
Jean Young's talk on Strange Loop was amazing for bringing attention to system rationality and not just saying "your local program is the only system you ought to be concerned about" knowing there's plenty of tooling for proving local state to not only be correct, but for invalid state to not be representable. Proving that our code can be glued together to talk to other systems correctly would be a huge win in my book for engineers everywhere! :)
Some projects use pact for this when the language is JavaScript. It is used to shard type definition, test cases and mock code between systems. Ones systems mock code are the expected values for the test cases of the other system. This shows that a rich type system together with sharing the type definition goes a long way to securing compatibility. Perhaps there's something like pact for rust, which would also share the tests.
Thank you so much! If you want something relaxing to listen to in my voice, I recently started season 10 of my hopepunk scifi podcast, Lost Terminal ua-cam.com/video/p3bDE9kszMc/v-deo.html
Everytime I see your videos, it inspires me to push forward with Rust. It beats me up everytime I try to journey forth, but I'm sure it'll all click eventually. Some of the development experience with Rust isn't perfect. An example is the examples.provided with Yew, where I spent 2-3 hours debugging a framework I had never used before to just get their example (written for an older version) working with the latest. Ultimately, I'm hopeful for the future of Rust, but I'm also held back by my colleagues that are scared away by the unfamiliar nature of Rust. I'm hoping I can forge a new chapter in my company's history, and move to a bright future in which much of our infrastructure is written in Rust.
You and me both my friend! Yeah, I hit that problem with Yew too, their documentation could be better :-( But once I got it working, I LOVED hot-reloading in-browser. That was an unexpected treat!
I too had this experience, with all the tutorials being so simple it gives you the idea that all will be simple from now on. But then when you try making your own thing that is not a tutorial, the compiler beats you up! It is frustrating - "I just wanna use the thing I just created! Why can't I even REFER to it, you silly compiler?!" But I find, now after a while, that stops happening. I kind-of just started placing things in memory more consciously, more deliberately, and when I mutate things i tend to do it in a more structured way than before. And slowly the compiler stopped being an annoying brat. Now I even prefer doing "quick and small" tools in Rust, over Python.
I've been learning Rust for a few weeks now and one of the things I've spotted is how well the type checker helps you prevent errors you didn't even realise were possible. For example, I recently got a compiler error because converting a character to uppercase returns an integrator of characters rather than a single character - it turns out that in some languages, converting some letters to uppercase gives two letters as a result. Without Rust's type checker and its spectacular support for Unicode I never would have considered that edge case, which for some kinds of code is going to lead to massive bugs - you've probably heard of all the crashes on iOS and Android due to text rendering issues (if not, Tom Scott has great videos on it). I wonder how many crashes would have been prevented if the text-rendering engines for our operating systems were written in a safe language like Rust.
Currently in the process of learning speed (coming from a Javascript background). I do find it quite challenging, but I hope it'll all pay off in the end. When I do get something write, I feel like I just wrote a magic spell.
It's a tough start, you're doing well so far! I recommend: - fasterthanli.me/articles/a-half-hour-to-learn-rust - My rust series (10 other videos) - The Book doc.rust-lang.org/stable/book/ Good luck! Ask for help on my discord if you need it, loads of nice people there! links on noboilerplate.org!
"Oxidizing your entire stack" I like that! :) Great channel, just found this today. I have been looking to see if any languages out there have been picking up traction in the coding space and Rust keeps popping up for me. I will definitely be learning Rust as soon as I can.
Roc language is probably going to be in 3-4 years my main "productive language" while still being "safe enough". Every time Feldman makes a new video about it's progress I am quite amazed. He takes ELM unrivaled developer experience and "faster than GO" as his main objectives for his pure functional language. My hope is that he can go in terms of speed more to rivaling C# and Java. Then it's truly going to be an incredible language. His full type inference approach is very interesting. - Richard Feldman, Pushing Boundaries with Roc - latest talk is the reason I'm so excited about it. Most of the comparisons in his video are with Rust and Typescript.
Very impressive! But, so is Haskell, and as you say, Elm. I'm excited by Haskell not just because of it's technical qualities, but because it's *popular* and I can hire a team and get working with it TODAY. When Roc passes Common Lisp (dead center) I will start to pay attention. redmonk.com/sogrady/2022/03/28/language-rankings-1-22/
Just to clarify, it is very possible to write logic errors in rust that will compile. Just because the types match in a statement doesn't mean that it is logically sound. You can for example accidentally write "or" instead of "and", the compiler wouldn't be able to see that that one is incorrect just from the types, it would have to know the programmers intention, which it do not.
Very true, of course. It's much easier to find these errors, when you don't have to wade through the marsh of uncertainty that other languages have, however!
Very interesting and actually the main reason I'm learning Rust currently. If I need a highly efficient language, especially as cloud providers will charge you for all inefficiencies too, for critical code it's imperative to be efficient. Otherwise the whole system can become unnecessarily slow or Ressource hungry
Thank you for the video. The style of your videos feel like a breath of fresh air. Interesting topics presented in a simple to understand and short enough format. No boilerplate indeed. I wish other content creators would learn from you
5:42 This makes me wonder, how many things we could automate and improve to make dev lives better, but we never thought about doing it? Automated upgrade of code to new library versions? Maybe graph based documentation that is compile time checked, so it's never out of date? Maybe automated scaling where code works without changes no matter if it runs on one cpu, multiple cpus, multiple local network machines or cloud? There are many ideas coming to mind, though most are taken from "Features of a dream programming language 2nd draft"
Can you talk about the implications of adding Rust to the Linux Kernel and how it affects code safety e.g. when a kernel panic occurs from whatever cause could Rust handle that better than existing C implementations?
rust doesn't inherently handle panics better, but it does require programmers to clearly mark everywhere where a panic can occur using the `panic!()` macro, the `.unwrap()` method, or something similar. In theory, if a programmer can replace all `panic!()`s and such with code that compensates for the issue, you code can become panic-proof. You can even use a macro called `no-panic` to make sure a method is incapable of panicking or it will fail to compile. In practice, I suspect panics will still happen sometimes, but they may be so rare as to only effect driver developers with non-rust languages and the like.
I haven't looked at the latest iteration in detail, but as far as I'm aware the kernel doesn't panic. That's not a thing it wants to ever do. In light of this one of the things that were required to put rust into the kernel was to provide better support for non-panicking data structures/functions. For example Box::try_new tries to allocate a new Box, but if it runs out of memory and the allocator can't do that, then it gives an Err instead. So Rust's normal enum and rich type system actually makes the same patterns even better. In C you would perform the allocation and simply receive a null pointer in the cases where it runs out of memory, and it's up to the developer to check each pointer returned by malloc. In Rust that's as easy as ?
While Rust forces you to prevent errors, the compiler usually tells you exactly how to fix the problem, and gives pointers explaining the problem very clearly. The problem with learning Rust is on the level one up from getting the syntax right. It is getting rid of unsafe constructs that other languages advocate. Like callbacks or back-pointers etc. But it are exactly those structures that make our software so brittle.
Rust in the kernel is really exciting, to finally see another language in the kernel that is memory safe! But there are still a lot of problems, mainly the use of unstable features in kernel rust. That is to say that rust is not yet mature enough to be stable for kernel needs. But what is most exciting is the comparison of the NVME driver which is just as fast the C implementation, thwarting any concerns about speed!
"mainly the use of unstable features in kernel rust." I'm not sure that's quite right there. Unsafe isn't any worse than C, it just means you can defeference a raw pointer, plus 4 other pointer-related superpowers. (see the book for them). ...C can do all these unsafe operations with no oversight already, and we already write the linux kernel in that XD
@@NoBoilerplate Im not talking about unsafe, i mean feature like 'global_asm' or 'allocator_api' which are currently unstable that means the build could break in any verison which is a huge nogo. There are talks of having a dedicated kernel rust version, but that would lead to stagnation, like with C, where they had C89 for the longest time as the kernel C version, they only updated it because of a speculation bug, which couldnt be fixed in the version they had, so they went straight to C11 Wich is also a decade old but its atleast more modern than what they had.
@@wChris_ oh! sorry I read 'unstable' as 'unsafe'. My bad! Unstable features get stabilised pretty quickly, even in the short time I've been following things. The Editions system perhaps could help here?
Your Videos always make me want to try Rust out even more! I started a lot of smaller tests with rust here and there, but I still need to work myself up to work through the Rust Book to get fully started with the language. What is your stance on "the right tool for the job" with Rust? Would there still be Projects you wouldn't recommend Rust for?
I think the biggest category where Rust wouldn't be the right choice is applications where having a big runtime is an asset, not a feature. The one that comes to mind first is Data Science. Playing around with datasets in a repl is a huge part of doing data science, and it's not the types that matter but the values, so a rich compiler won't be as much help as building a larger app. Julia is a language i'm excited about for this sort of work!
@@NoBoilerplate Oh absolutely, especially doing Uni work, it’s nice to just script things and play around with data. I’m using Python for that :) But Julia or R are also present in some fields. There’s really a lot of languages to choose from haha
8:45 "Look how simple a hello world" is in Rust. At least compared to more popular languages like Java/C#. No need to use classes, static methods, string arrays, return types. In the beginning you wouldn't need to know static, arrays, string types, and any class specific stuff. You only want to know functions, maybe. And that's basically what a "hello world" in Rust looks like. Just a function, and a macro. No types at all. I still think, a simple hello world has some value.
"You can trust compilers" Meh, debatable, I've read a very interesting paper that was saying that compilers could inject malware or bad code into your code, take care of what compilers you download. But I get the point! great vid as usual
Hey, awesome content as always. Was just wondering: I have a hard time differentiating your videos from afar when I see them appear in my recommended, mainly because they're so similar visually (thumbnail). I'm sure you're aware, so have you thought about how you could have more diversity in your thumbnails apart from keeping the same icon and changing the text? I mean, your thumbnails *are* recognizable, I immediately know it's your video, so I guess that's good, and given they're not really about any visual topic, I also struggle to come up with a good alternate design without making them annoyingly clickbaity or cluttered. I don't know! What are your thoughts?
My rust series won't go on forever. I will eventually run out of features to hype up! :-) And then, I might try a different colour logo. It's entirely possible I'll need to figure out the art of a YT thumbnail later on, and you might find big changes! I'd welcome any and all suggestions.
Another great video - one of my favorites yet! I mainly write of Typescript for work, but have to admit that you got me to read up on Rust and I love it. Starting Rust for Rustaceans now. Just wish GCP had integrations with rust (apart from running containerized in Cloud Run or GKE).
After using Rust for a project and spending the time to understand new concepts like borrowing, lifetimes, I started to enjoy coding in Rust. The start was frustrating as the compiler just doesn't compile! It was very different with how development was with NodeJS. Which even if the code or syntax was wrong, NodeJS compiles and only when you execute that function it fails. I can totally relate with the narrative in the video whereby in Rust, if the compiler compiles, it just works. Unfortunately I'm working on a NodeJS project (not typescript) and always thinking about the type system, enums and lifetime. Writing in Rust really changed the way I handle my codes now.
Fantastic! Do watch my other videos on Rust, there's astonishingly good features there that you'll NEED to know about! Start here fasterthanli.me/articles/a-half-hour-to-learn-rust Then hit The Rust Book, and Rustlings. Good luck!
What are your thoughts of Clojure, a dynamically typed functional programming language that runs on JVM. Rich Hickey, the creator of Clojure, have very strong opinions about why to not use static typed language. I am curious. What are your thoughts?
Love it. Before I discovered Rust, I was a professional clojure developer for 2 years, I even made a video about it! ua-cam.com/video/k_4rLyqQeAA/v-deo.html Rust has taken so many of the features i love from Clojure: - Expression-based language - Real lisp macros - fluent interfaces everywhere - Instant feedback (albeit from the compiler instead of repl) I searched for years for a way to make typing work with clojure. Typed clojure just never clicked for me, it was so much overhead, no-one really uses it, and it wasn't very powerful, clearly an after-thought. Finding Rust (which is Lisp in C's clothing with Haskell's type system) has been revolutionary!
This is intentional. I've noticed a lack of clear, well-explained introductory videos to Rust topics. There's loads of people making really great technical tutorials, but not stuff to get EXCITED about. I crashed out of writing Rust TWICE in 2020, and I only came back because I had a mentor to help me. Most people don't have this luxury. Rust has a BRUTAL learning curve, compared to other popular languages (though not as bad as Haskell et al), and so you need to know ALL of the great features that you simply can't get elsewhere, in order to push yourself through the initial learning period. Have you tried Rust? Thanks for your comment!
Hello Mr.Tris , here's a thing for you : when Joe Armstrong said Erlang is 'write once, run forever' and as Erlang's main strength is support for concurrency (also its functional ❤️) . And as far the journey had we knew Rust⚙️ is known for the FEARLESS CONCURRENCY ⚡. Could you please make a next video on concurrency and the parallel stuffs ... taking Rust and other buddies in comparison.
The downside I can see with the "correct now" principle is that it can harm velocity when prototyping and iterating. You often don't know what product you need to build, so it's important to get some kind of prototype in the hands of a user as quick as possible, so you don't waste time building a product that no-one needs. In those cases it usually doesn't matter if there are bugs in edge cases, since you just want to know if the entire idea is crap or not. There are of course still shortcuts you can use in Rust like using unwrap and clone liberally and there's also the risk of prototypes ending up in production, but I still think this is a real downside to using languages like Rust and Haskell, which forces your programs to be correct from the start.
I don't think your concerns actually manifest in practice. Once you know Ruby on Rails, you can rapidly prototype, once you know React you can rapidly prototype, and once you know Rust, you can rapidly prototype. A newbie in any of these would be slower at first. And even on top of that: Compiler-driven development has the potential to be FASTER than iterating in traditional tools because so much more is checked for you by the compiler. I've got a draft video on this topic coming soon!
I'm currently learning Go as I think it has more appeal on the market right now, but I can't wait to start writing some Rust, your amazing videos really convinced me to buy the Rust book. I will ASAP
Go's a great language too, you'll have a good time! Absolutely no harm in learning both, as developers, that's what we do! The book (also in epub) is free, don't forget doc.rust-lang.org/stable/book/ (dead tree formats don't have working links ;-) )
Was able to write a rust rocket app today. It was 100% a challenge but I learned a lot. What advice do you have for writing good idiomatic rust? I find myself cloning strings and objects often to get it to compile. It works, but it feels like I'm taking the easy way our or not thinking rusty enough.
Adam, you're doing it right, cloning strings and objects is absolutely fine when you are getting started. Rust is 80x faster than Python, you'll get fine performance XD Come ask questions on the noboilerplate.org discord - there's a channel #newbie-advice just for this!
"most apps should be written in a higher level language until you can no longer do so" Telling a newbie this is very mean and closed-minded. Please learn more.
@Christopher Grant Chris, look at the context of your statements: You're commenting in a thread where a newbie is excited about Rust and has written a simple web app and is starting to ask intermediate questions about cloneing. You're too late with all this advice! Adam is excited about Rust and has already breezed past the problems that that paper's authors seem to think are too difficult. They're not, ownership is easy. Python's a fine langauge to learn to code in, so is javascript or ruby. For me, Python was my boat. It's got me to the other side of the river, but I'm not taking it with me as I climb the mountain.
Building a large project with any Rust framework is extremely energy intensive though. Just the initial Yew/Rocket/what have you build downloads ~400-500 dependencies, spinning all cores at 100% for 5-15 minutes depending on how new your computer is. That number shoots insanely high once you get everything else you need (db drivers, auth, caching etc). I would use Rust a lot more if it wasn't for tiny one off projects taking ~6 gigabytes of storage after draining my battery by 20% before I even get to open my editor.
Compile times are a huge focus for the core team. And maybe you're a little out of date? I remember such compile times when I first started using Rust in 2020, but every version they get faster and faster! I just tried the Rocket hello world demo, and it uses ~100 crates. On an M1 mac this takes 10s to compile cold, and 0.1s to recompile. Do try the same and let me know how you get on!
@@NoBoilerplate I don't know about Rocket now, I used it around the same year you mentioned. Yew however comes at this size, presumably for all the wasm deps. Following the Yew tutorial, it took me ~30 minutes before I could open my editor, downloading and install trunk, wasm, bindgen, yew and what not. Those 30 minutes were 80-100% CPU usage on all cores, and drained a fifth of my battery. This has been my experience with all Rust frameworks 2019-2021 (ish). But happy to hear! I know there's been some fuzz around linkers and debug builds coming down. That is awesome news.
@@Honken Yeah, do try out Rocket again, you'll be pleasantly surprised! Yew did take a lot to set up didn't it? Trunk was especially weird too when I set it up, downloading some binary blobs that I wasn't keen on . HOWEVER I don't actually mind those setup costs - they're one-time. They should be faster, you're right, and they're getting better, but at least they're one time. Once I got yew installed for the last video, and started playing around with it, the experience was SO FAST, even hot-loading code into the browser when sourcecode changed and compiled. WOW! Please don't let the long compile times put you off, and if they still do, just try again in 2 months, they're getting better every release 🙂
@@Honken My pleasure! I'm trying to help people out with the videos, it'd be weird if I didn't also do that in the comments 🙂 There's 10 other videos in the series right now, have you seen them? Here's the playlist ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
This channel is the reason I finally decided to learn Rust. Since then, every new project I have language choice over has been in Rust and I could not be happier! Coming from primarily Python, I tend to echo your statement that the language's simplicity causes more problems than solutions at scale
How does rust and native compiled dart code compare on arm for performance? My company's Flutter app is already fast enough to not appear on our heavy users' battery monitors.
Most languages are fast enough. Even Python's 80x slower than C doesn't hold it back from being the #2 language in the world! I don't know of ARM benchmarks, but according to the paper referenced in this video, Dart is 6.67x slower than C, just behind Javascript. For comparison, Rust is 1.04x slower than C, and C++ was 1.56 slower. So your dart app uses probably a similar amount of power to a javascript app, but the CPU-bound parts use 6x more than Rust. This is only pure cpu tasks, most app time is waiting for IO, which is why most languages seem fast enough - they're not executing most of the time!
@@NoBoilerplate Flutter projects are compiled to native arm machine code for mobile devices. It also leverages GPU acceleration a lot for the GUI layer The near JS performance is likely when it's transpiled from dart to JS for use as a JS alternative like typescript. We're actually doing a lot of heavy lifting in the Flutter client.
I agree that rust is “Good Fast Cheap” but as an C\C++ I have 2 problems that make it hard for me to use rust: 1. No support for C++ libraries (as far as I know) 2. Rusts syntax is just too different, and I don't know, for me, it feels weird to write a type of variable right of it instead of left. Thing that I probably would like if I switch: 1. Compiler errors 2. More memory protection BUT in my case, “no support for C++ libraries” out weights every other thing.
1. You're right, though Rust's C support is excellent (doc.rust-lang.org/nomicon/ffi.html) calling C++ functions requires a C wrapper. This is how C++ libraries are wrapped (such as GTK crates.io/crates/gtk) So it's not impossible, certainly easier than with Python, it's not as direct as with C. Check crates.io, you may find that someone has done the work for you for the library you want to use! 2. Syntax is syntax. Some people prefer type on the left, some on the right. Many people have it even harder, and are coming from dynamic languages and ask me why it needs to be there at all! This is a matter of style, and one you may have to get used to if you want to try new languages, as it appears to be the prevailing style. My take is that the NAME of the variable is something I look at much more often than the type. Because the Rust compiler does type inference based on both sides of the = sign, in most cases, only the function signature needs to be typed. I am sure that you will have no problem learning Rust, coming from a C++ background you're already familiar with many of the low-level features I had to learn (My background was Python). This article was revolutionary for me fasterthanli.me/articles/a-half-hour-to-learn-rust.md So much so that I got permission from the author to make a video version ua-cam.com/video/br3GIIQeefY/v-deo.html (though the article is better) I have written about 10 other Rust videos showing the remarkable features of this language. The playlist is here ua-cam.com/video/Q3AhzHq8ogs/v-deo.html I'd give them a watch, and I hope you will see that small differences in syntax will seem like a small price to pay :-)
Oh! I just found cxx.rs - which seems to do what you want! There's also bindgen, but I don't know much about that. Come and chat to me and the community on my discord if you like, the people over in #programming would be delighted to talk C++ / Rust integration discord.gg/mCY2bBmDKZ
I still can't see the advantages of lifetimes. I can def see the need for them considering how the compiler overall works, but I still can't see a single scenario where the lifetime allows me to do something I wouldn't be able to do without. Something that should be told, till you aren't proeficient in rust, rust is a headache cause you spend 20 hours on compiler errors for every 1 hour without. But once you are fluent in it, everything you said is pretty correct.
No denying the learning curve, but that's why I'm here to get you (and me!) excited enough to push through to that point you mentioned, where you're fluent in it. It's a hard road initially, though. I crashed out twice in 2020. Glad I pushed through! The benefit of lifetimes (to us, not to the compiler) I can't yet explain clearly enough, though I'm nearly there. I'm writing the video, stay tuned! The tldr is that if your type system has lifetimes, you can model not just what your data is, but WHEN. (what sequences of your data are valid). Come ask on my discord, links on noboilerplate.org, and those smarter than me may give a better answer!
Looking forward for "When not to use Rust". Currently I'm curating some references about when Rust become problematic for my study and amusements because making technical decision is hard and sometime biased. (keyword: Rust is not Panacea)
I won't be making that video. However I can get you started: The biggest domain where you shouldn't use rust is where a large runtime is an asset, not a liability. Data science is a huge field where this is true. Julia is a really exciting language for these applications!
Great stuff. Keeps this cranky old Python programmer motivated to continue learning Rust and to use it. There's something especially optimistic and soothing about the delivery, too.🙂
Just don't buy into the "70x more efficient" part from right at the beginning. It's perhaps 70x faster to run, but what are Python scripts generally for? The language not meant for heavy lifting, so those comparisons are unfair, so to speak, unless you do come across a Python script that ends up crunching numbers at max speed for minutes (or higher) on end. But yes, do learn Rust! It's a great language. Just don't forget about scope and scale.
"python scripts" is not what we call the second most popular language in the world. Despite what you or I think about Python's applicability, people are using it for EVERYTHING! Also 70x slower than C speed, is Python's pure cpu single-threaded benchmark. It utterly crumbles in multithreaded benchmarks due to the GIL. Yes speed doesn't really matter. But when it's HUNDREDS of times slower, it starts to matter. As I said in the video, unit tests are 100% cpu with no waiting for IO, so it's especially noticeable there.
@@NoBoilerplate No, python scripts are what you create with Python. And if you want more performance with similar ease, Nim is a fine alternative. If you want actual performance you go for a more suitable language. I don't think we'd disagree on this. I write Python for things where bash doesn't cut it, but still in the same domain as bash scripts. Beyond that, other languages are far more suitable.
@@herrpez I am aware of nim, I am a maintainer of inim, the most popular repl ua-cam.com/video/Qa_9vut4TzQ/v-deo.html Please understand most people don't use python in the way you do. It's not the second most popular language in the world because people write scripts "where bash doesn't cut it".
I just looove your channel so much. I wish I could work with Rust in my day-to-day job. The reality I've gotten used to is that for fullstack web dev (+ serverless), using e2e typescript in a monorepo saves incredible amounts of time: shared types, strong generics (close to rust), linters, shared libs, and one language design. But ngl I just love rust and wish I could use it professionally
As a complete newcomer to low-ish level languages from python who doesn't even know what the use cases for Rust are, is the Rust book still a good place to start, or do I build my beginner level experience elsewhere first? I want to be future-proof, since I hear a lot of buzz about Rust replacing C++ in the years to come.
You've got a very similar background to me! I'd recommend: - fasterthanli.me/articles/a-half-hour-to-learn-rust (or my video made on this article) - github.com/rust-lang/rustlings and the book. Come ask in #newbie-advice on my discord server, there's a thousand lovely people who can help! (me too!)
"what does a developer do?" -- made me waste 5 minutes wondring... found out 90% of my mental stamina goes to waste into dealing with the anxiety of not knowing what I don't know yet but will get me stuck mid project. For I quite enjoy thinking about the problem and the route I will approach it, but I cringe to the thought of everything crashing in front of me
#1 reason why I want to learn Rust: Not because of any of the great things you’ve talked about on this channel. But because since macros are denoted by a !, the macro to terminate the program because of a detected bug is *panic!*
Rust's learning curve is about the same learning curve it takes to write safe C++ code on/near the level of Rust, only it's steeper due to the language enforcing safety onto you. You need to know ownership, borrowing, lifetimes, etc. before you can write a sizeable Rust project, while in C++, you need to learn pass by value, reference or pointer, null checking properly, and lifetimes. However, because it's not required, you don't need to do it, making the learning curve for general C++ code much shallower, at the large cost of possibly segfaulting/crashing code.
The way I like to put it is Rust has V-shaped difficulty curve. It's hard to learn, easy to get proficient and hard to fully master. With C++ it's an ever-steepening hill all the way up.
Ooh, that's very interesting. I think of it like this: In most languages Easy things are Easy, and hard things are possible. In Rust, Easy things are possible, hard things are Easy.
I’m already convinced that rust is amazing, and use it for pretty much all of my new projects. Still I really like these videos, as they help me articulate why I actually like rust as much. Great content!
As a person whose never coded in their life, how does one go from "hello world" to translating their favorite open source program written in C+ into Rust? I have a hunch OpenToonz's "buggy" reputation is mostly memory errors. Because it works fine for me (with ancient quad channel memory) but crashes fairly frequently for everyone else.
@@NoBoilerplate it would be nice if you made playlist called something like "For boss" where in right order all reletad videos would be to convince him :D
I built critical national infrastructure in it while working at the Government Digital Service, here in the UK, in 2020, that was my first taste. The experience was really profound for me: the whole first day nothing was compiling, and I thought the language was insane, but at 4pm we got it compiling and then no further changes were required and it's currently sitting in production, receiving dependabot security updates, code passing tests in CI and building with no changes. I genuinely think it could run for ever, this language is so focussed on uncompromising rock-solid backwards and forward compatibility. This commenter said it better than I ever could: ua-cam.com/video/ZFDqh3slQfU/v-deo.html
That's the debug build, a release-optimised hello world build (I just tested this) is 256k. That 256k overhead doesn't balloon as your program increases in complexity, either, that's it. The rest of the program filesize will be your app. A real-world example is that a release-optimised build of the axum web framework's 'hello world', that includes ssl, a web server that is so fast you don't need a reverse proxy to host your static files, is 605k. Here's a short playlist of videos I've made that get to the heart of why Rust is something special that is changing the world from amazon, to microsoft, to linux. ua-cam.com/video/oY0XwMOSzq4/v-deo.html
I don't know rust. I don't write rust. I don't plan to learn rust in the near future.(maybe i would learn when i get some free time) All i have is small experience with python. But your videos are therapeutic to watch.
Thank you so much! I hope to inspire people to try it out! If you like my style of video, perhaps you'd like Lost Terminal: ua-cam.com/video/p3bDE9kszMc/v-deo.html
Hi it was such a great video man loved it 🤙 I have a question🙋 I am a web developer more specialized in frontend development and nodejs( I love js/ts 😄) I am thinking about learning rust but confused between rust and go. What do you think I should go with that will help in my career. Thanks in advance. 🙏
Both! Go is a fine language that if rust didn't exist, I'd be writing. These are not the last two languages you'll be learning in your career either, so start today 😊 Try rocket.rs and yew.rs, and go through Rustlings and the Book. Hit up my discord and ask for help in there. Good luck!
I didn't set out to do so. Perhaps I make assumptions that the audience has watched the previous videos in my rust series? There's far more to Rust than static typing: ua-cam.com/play/PLZaoyhMXgBzoM9bfb5pyUOT3zjnaDdSEP.html
@@NoBoilerplate Well, the thing about prevoius videos is that it's entirely reliant on the UA-cam algorithm. It recommended this video to me without telling me there were others. From what I can tell after spending 10 minutes with an installed compiler, it's a convoluted language combinging the arcane syntax of C++ with an extensive pythonesque library. I mean, that's not necessarily a bad thing, but I have to wonder if it's a gatekeeping language intended to scare away new developers with its unnecessarily complicated syntax.
@@YDV669 I should make it clear that these are part of a Rust series! Good point, thank you. Oh it's TOUGH isn't it! I also hated the syntax when I started learning in 2020, I gave up twice, but luckily had a mentor that put me back on the right track! Here's the way to think about it: C or Python or other popular languages don't have all this syntax because they don't support the FEATURES that rust has that they don't. Three clear examples of this are the Result type, often seen in return values, lifetime annotations (which state that reference x must live at least as long as reference y), and references themselves. A recent video where I showed an example of why this extra syntax is needed was Rust on Rails ua-cam.com/video/sbVxq7nNtgo/v-deo.html I'd love to know your thoughts after watching this.
@@NoBoilerplate Book follows. :) So I watched your video, and I still don't really agree that such syntax complexity is necessary, despite all the things Rust seems to do for you at the compiler level. let mut x = 1 let y = 1 Why force the use of two keywords for almost every single variable? Mutable function variables would normally be the default, with immutables the exception, wouldn't they?. mut x = 1 let y = 1 Or to more clearly identify the immutables, let x = 1 imm y = 1 The constant abuse of the exclamation mark(!). The apparently forced use of the question mark(?) to unwrap the actual result from a return payload. "Your code will never crash." That's like the worst thing to tell companies. Maybe it won't crash, but is it correct? It's bad enough remembering having a manager with the unshakable belief that code is production-ready the moment it cleanly compiles and after a few sanity-check runs(yes, even batch update cycles). This kind of thought corrodes development budgets. I have no problem with the language enforcing safety at compilation time, but does it need to be so needlessly and thoughtlessly convoluted? It sounds great at the "I designed a language to impresse my girlfriend" stage, but when you're debugging a program at 3am(or even compilation errors) after already being awake for 20 hours, the ivory tower intellectualism embedded in the core of this language isn't going to win you any friends due to issues with arcane syntax potentially obscuring critical logic errors with badly placed question marks or somesuch. I say all this as someone who grew up on a language that literally did not believe in division by zero being any sort of error, where string comparisons were all essentially right-trimmed(empty string is equivallent to ' '*x where x is any integer from 0 to MAXINT). None of this is intended in any way as a criticism of you personally. Your videos are well-written and narrated, and I appreciate learning about Rust.
@@YDV669 Thank you for a very coherent comment! I'm DELIGHTED to help you here, you're on the right track, but have misunderstood a few things, I think. If that's due to my video, my apologies. You wrote me a book, I'll write one for you: 1. Mutability. Mutable variables are indeed the default for most languages. Rust chose to make immutability default because it's *better*. Immutability is the default in functional languages, you'll see this in Haskell and similar. Rust is a functional language. Look at any modern javascript tutorial, you'll find more `const` declarations than `let`. For instance, here's the first React tutorial reactjs.org/tutorial/tutorial.html the first code blocks that have variable declarations in use const. There are more `const`s on that page than `let`s My understanding is that in JS, the advice is is "use const by default, if you need mutability, use let". And why is this? One reason is Immutable variables are much easier to reason about and debug, we can't accidentally shadow them and mutate them, causing surprises. 2. "Constant abuse of exclamation mark." The compiler enforces that macros must end with a question mark, and nothing else may. If you see a !, you are looking at a macro, simple as that. Macros are STAGGERINGLY powerful, they can: 1. Rewrite syntax at compile time, and 2. Execute arbitrary code at compile time (even disk and network access) You'll never have come across this power before, except if you've use lisp. Other languages have things they call macros (or templates or comptime etc) but they are very rarely able to do both the above superpowers. Macros have a bang ! at the end because it's important we know where they are so we aren't surprised. 3. "Forced use of question mark to unwrap" Functional error passing is very different to exception handling and I understand why you are confused. It's not forced, nor does it unwrap the errors. My video on Rust's error handling is here, and I'm very proud of it, do take a look ua-cam.com/video/sbVxq7nNtgo/v-deo.html 4. (related) "Your code will never crash" I think after you watch the above video about error handling, you'll understand why I say this more. Rust CARES about not crashing at runtime (it is this feature that made it perfect for Linux kernel development, something that is THIS WEEK official), and has the complex syntax and compiler to find nearly every case where it could. (edge cases that require more care to handle are OOM errors and unchecked maths, but they both have simple solutions for if you need them, say in an embedded environment) 5. "arcane syntax potentially obscuring critical logic errors" I understand the syntax is unfamiliar, I really do. I hated it for the longest time, I kept crashing out of learning Rust. But I came back for the world-leading features that you simply can't get anywhere else. If you want a hard, realtime language that doesn't use a GC, and you ALSO don't want manual memory management, you're going to NEED the borrow checker. There's simply no other language available! The good news here is that the syntax is there for a reason. Other languages don't have borrows, so we need two symbols for a read-only borrow, and a mutable borrow [& and &mut]. OK, and now the compiler needs to know how long the programmer wants these borrows to live for, when can they be cleaned up? let's use ['a 'b 'c], name the lifetimes with simple names, you can use 'longer 'names, but most of the time there's only one or two lifetimes in a function, if any, so 'a and 'b are fine. Types are annotated with HashMap angle brackets as normal. The way I learned Rust's syntax was by reading the BRILLIANT Amos's blog post: fasterthanli.me/articles/a-half-hour-to-learn-rust I was so impressed by this post I made my own video version (after asking permission) ua-cam.com/video/br3GIIQeefY/v-deo.html Depending on if you are a reading person, or a watching person, you could try either of these to grok the syntax fast? (I'm, ironically, a reading person!) I wish Rust had simpler syntax too. Just as I wish for proper self-driving cars. For now, I'll have to drive a normal car, and program using a bit more syntax! Both get me where I want to go. It's worth noting that the rust core team add more and more places where lifetimes don't need to be explicitly stated - the goal isn't to have zero lifetimes, but to have as few as possible, while being unambiguous. Thanks for reading all this and chatting with me, I think this video of mine, doing a deep-dive into unsafe and macros explains these two features pretty well - and you simply can't get them anywhere else, AND THEY'RE SO GOOD I didn't know I wanted these features when I was writing Python! ua-cam.com/video/PuMXWc0xrK0/v-deo.html Thanks friend!
Rust is cheaper, The company just need to pay for the entire training of the developer and attach rust programs to their pipeline with duct tape. Until some company spends hard on making full solutions with rust that interact well with older tech stacks (specially java and javascript stuff: java is still used in a lot of servers and javascript is impossible to get rid of), it'll just be too expensive to maintain a department just to solve rust problems while the rest of the firm runs with older software
Rust's FFI in C and Javascript is terrific, but you're right about Java. If there's a huge legacy of Java code, would I be right in saying it might be better to use something like Kotlin or Clojure to modernise the code?
ERRATA
Tauri hasn't yet release mobile app bundling, though its in their roadmap. Desktop only for now!
2:31 Though the "80%" header is right, the table below is only for 128MB lambdas
4:53 The heading reads "Hander" instead of "Handler"
Then for now we will just write it in wasm and use a webapp infrastructure. Rust has always a way ; )
We do have Rust in our kernels now too.
Can't wait. Really wanted to check out Rust's mobile feasibility, but couldn't find anything particularly easy to get the feet wet.
Plus we can write Python dynamic libraries in Rust using PyO3
yeah, I'm really waiting for it because it will cover all my project needs with it (windows, android, linux, ios, macintosh, oculus quest (I hope)).
"oxidizing your entire stack" what a great line, cheers
Here's another, if you've not heard of it: Rust is named so because it's close to the metal!
This is becoming a must watch channel. I don't even read the title anymore. I know it is my reliable rust content.
Thank you! Keep checking the ERRATA comment to make sure it's actually accurate!
Completely agree. Started watching just a couple of weeks ago and now I click as fast as I can when I see a new video
Same, this channel is always amazing
@@NoBoilerplate The fact that you mention this also makes you worth the praise. Thank you for the content.
oui
These videos convinced me to write my latest project in rust. At first I thought the project was too big, too many states to model and too many breaking changes. But having written something once, it never broke. Whenever I added a new thing, I first extended the valid states by changing the type of a variable from String to a parsed struct - and the compiler told me where I had to fix stuff. When there were no more compiler errors, I was done. It's fun to write code like this.
"When there were no more compiler errors, I was done." this is my experience every time I write Rust too! Isn't it relaxing!
Can you please explain what do you mean by “added a new thing”. It’s so hard to understand what you are working on.
Oh! The same for me!
I rewrote an old project that never leaves my mind, and now it works at a decent speed and memory usage, while doing what I want it to do.
It was strange at first, seeing errors and warns I didn't even know the meaning, but with time (just 2 days), once there were no more errors, it was beautiful (actually, as it's image processing, and I have a bad taste, it was ugly, but conceptually working)!
I read that energy efficiency paper. The reason Java is so high up is because they used Java to execute the power analysis function, and instead of launching the program externally like they did for literally every other language, they just ran the Java program inside the same VM, cutting corners significantly.
Rude!
@@NoBoilerplate indeed, but so is academically misleading many people
@@tuskiomisham oh I'm so sorry, I meant that them misleading people is rude, not you!
Public static void main string args amirite
@@pixelsam123 say it again, public static void main string args
also you forgot the class
The production quality of this is so high. The message is a complex thing made simple, using rudimentary graphics done well, overlaid with a voice that is so pleasant this guy should voice audiobooks. Very much appreciate the level of quality in this!
You're too kind! I honed my production skills on a hopepunk, scifi podcast, and I'd love to know what you think! ua-cam.com/video/p3bDE9kszMc/v-deo.html
i mean, he does a fiction podcast, so audiobooks kinda. it's also really good
@@NoBoilerplate I always wondered why you opted for calling it a podcast.
@@raymanovich3254 what, Lost Terminal? Isn't it a podcast?
@@NoBoilerplate It is - but the meaning of _podcast_ has been lost over time - I certainly found it surprising that a podcast meant _any_ digitally distributed programme, and did not specifically refer to the format of several hosts having a recorded conversation...
P.s. Lost Terminal is amazing! It's the first podcast I've listened to in a long time (read: ever) and I love it.
will he ever make a video that isn’t amazing probably not
You're too kind! I'm always improving.
@@NoBoilerplate This one is right. You seem to just not be able to not be amazing.
Your videos are a real source of inspiration for a lot of us.
@@nicolashumbert8344 Thank you so much, I'm so grateful!
@@NoBoilerplate As others have said, the quality of your videos is high, and I feel like that's also part of why you love Rust so much, because you too care about correctness. And with such, you keep your videos correct, which in the context of YT vids would be considered videos that achieve their goals well and nothing else, and since you're teaching us about Rust, you're fast, concise, and to the point with no meaningless detours.
This video quality is amazing, and I'm very thankful to have stumbled onto this channel. Thanks for your amazing work!
@@znefas That's so kind of you to say, thank you 🙂
Another thing about rust that makes it very good for writing code: I often find that if I understand what a struct is, I can very often tell what a method does just by its name and type signature. I can also very often find the method I want quickly by looking through the autogenerated documentation
This is something you find in Haskell too, rich types are amazing!
That feeling when he says "Hi friends" and for a moment you feel like you actually have a friend ... and then the video ends.
Plenty of friends on the noboilerplate.org discord :-)
Just program a friend in Rust.
Rust is my best friend
@@somedooby honestly it feels like that when working with the compiler - amazing!
You've mentioned execution time and memory usage but there is an area you didn't mention: disk usage.
Rust's compiler is a powerful tool that does a lot of checking for you. This takes a lot of time. The first build in Rust takes a long time, easily in the order of minutes. The authors knew this and so, just like C's object files, the compiler produces a lot of artifacts to remember its progress. And this is where the cost of Rust manifests because nothing in the world is ever completely free. Rust consumes a lot of persistent memory on the developer side to power its magic. Even a simple hello world project will take a couple hundred megabytes, real projects easily number in gigabytes of compile-time artifact data.
There is a argument to be made that persistent memory is pretty cheap today and that this single-time, developer-side cost of space is a small price to pay for all the good stuff - and I would agree with that. But I felt it necessary to mention it for the sake of completeness.
Very good take, it's certainly an are that could be optimised more isn't it? Running a Rust CI pipeline is very different to other languages for this particular reason!
wait kovic? the_kovic, the one that made the doom eternal ost remaster? You a rustacean too? life is crazy! cheers m8
As Mark (CTO of Azure) correctly tweeted, C/C++ should be declared as retired languages and instead use Rust.
Am pretty sure, going forward most of the cloud services and data centre infrastructure code will be written in Rust. Fast, energy efficient and of course cheap!
All that is required is for people to understand the power that we have today with rust. I'm making progress on that goal 😊
Rust is very new to me, and I wonder: Do you use unwrap()s if you are certein that a variable is Some or Ok?
In exchange for making code fast, you generally have to sacrifice some space to hold the compiled binary. While your code may not get to the size of a shell-script one-liner, Rust has plenty of tools available that let you get down to an absurdly small binary, even forgoing the entire C runtime, while still being confident that things won't break.
17k on windows, is the record I've seen!
I'm not sure what you mean by "In exchange for making code fast, you generally have to sacrifice some space to hold the compiled binary." Whilst it is true that sometimes one can optimise a compilation for speed and get a bigger binary as a result or vice-versa, I would say that in general the differences are not very big. More common is things like Java, Javascript, Python where one gets extra memory usage, thanks to the way they maintain variables and use garbage collection and at the same time slow performance, for much the same reasons. That's before we have added on the memory consumed by their run-rime systems/interpreters. Anyway, yes, Rust can produce binaries that are as small and performant as C or C++ can, there are many embedded projects running on micro-controllers to test to that. By the way, what do yo mean "forgoing the entire C runtime, "? C pretty much does not have a run time beyond what is needed to initialise the stack and such before jumping to main(), but even that is not running once your program is started.
@@Heater-v1.0.0 That comment was largely in reference to replacing a shell invocation that took a few dozen bytes with a 2kiB binary (which was optimized for size). And yes, C _does_ have a runtime and Rust by default links to it, and the dynamic linking alone actually increased the size of the binary more than reimplementing the necessary parts myself.
@@angeldude101 Well certainly it nice to be able to write one line of shell to get some quite complex task done. The comparison with a 2K compiled binary is of little relevance usually. I mean, that line of shell script can be dependent on millions of lines of code, in the shell interpreter, in the commands it is invoking, in the libraries they depend on, in the operating system the whole thing runs on. Perhaps if you wanted to do that same task on a memory constrained system, like a micro-controller, the 2K compiled binary would be the way to go.
No, C does not have a run-time. Sure your C code may depend on library functions defined in the standard library. Or it may depend on other libraries. Or it mat depend on syscalls to the operating system. It mat even achieve all that via dynamic linked libraries. Non of that is a language run-time. That is just library dependencies. After all consider the kernel of your operating system, often written in C, there is no language run-time underneath that, it is running on the bare metal. In fact that kernel provides run time facilities that all your applications need. Yeah, I know there is often something called "crt" something or other, as in "C run time" that is typically very small and only initialises the stack, processor registers, static variable, etc before jumping to your main(). It can be as small as a handful of instructions. It's also not running when your C code is.
Whilst it is true that Rust links to the standard functions provided by lib C on Linux, Windows, Mac etc, that is not actually necessary to run Rust programs. Many people are using Rust on bare metal systems that have none of that.
When I first tried Rust in 2016, I was repelled by its weird syntax and borrow checker - C++ seemed much more familiar. Later (in 2019) I decided to try it once more, maybe write something small and simple. And it clicked. Since then I'm using Rust for all my personal projects. I don't remember last time when my program crashed NOT on my own unwrap(), which is just quick dirty hack to make program compile. But unlike said C++, I know that I can just grep for unwrap()s and replace them with proper error handling, not re-reading whole code 50 times.
THIS IS EXACTLY IT
Rust can panic like other languages, but you can SEE when it's going to. Fantastic!
Can we get a complete Rust tutorial for begginers?
You have an amazing writing style and your voice is very pleasant to listen. I'd love to see a good Rust tutorial series
Thank you! I did that once, have you seen this ua-cam.com/video/br3GIIQeefY/v-deo.html
My focus for the moment is shining a light on all the incredible features of Rust. Once you're excited, The Book is all you need to learn, it's written brilliantly!
doc.rust-lang.org/stable/book/
@@NoBoilerplate This is low value and high effort, but the Rust Book with your radio voice would probably come out like a fun bedtime story.
@@zakstephens9297 It's ridiculous to call the rust lang book "low value", meanwhile learning any language is going to be high effort if you want to be fluent in it. The rust lang book is probably the single highest quality resource I've come across learning ANY language, with an imbedded compiler and multiple examples and explanations for every single rust concept.
@@RMy4v5aPte Nah, I mean getting old mate to read it out is low value. The Rust Book is fantastic, I have a copy on my desk right now.
@@NoBoilerplate The Book is my bible for the past month.. What an amazing doc is that!
Jean Young's talk on Strange Loop was amazing for bringing attention to system rationality and not just saying "your local program is the only system you ought to be concerned about" knowing there's plenty of tooling for proving local state to not only be correct, but for invalid state to not be representable. Proving that our code can be glued together to talk to other systems correctly would be a huge win in my book for engineers everywhere! :)
Nice! I'll watch, thank you
Some projects use pact for this when the language is JavaScript. It is used to shard type definition, test cases and mock code between systems. Ones systems mock code are the expected values for the test cases of the other system. This shows that a rich type system together with sharing the type definition goes a long way to securing compatibility. Perhaps there's something like pact for rust, which would also share the tests.
You can see the full talk here: "Building Observability for 99% Developers" by Jean Yang (Strange Loop 2022)
ua-cam.com/video/UJA4PGKny2k/v-deo.html
@@LowestofheDead Nice, thanks for the link!
“5x faster… If you single thread them.”
Vito Corleone “ Look at what they did to my boy.”
the rust compiler is a real friend, instead of hiding things from you, it shows your mistakes in a comprehensible way.
A true friend!
You can definitely see the improvements in information quality by the number of items in ERRATA decreasing each video. Keep it up!
That's the plan!
The voices, the script is so fascinating to watch & listen. 😊😊 you are the one who inspire me to try rust.
Thank you so much! If you want something relaxing to listen to in my voice, I recently started season 10 of my hopepunk scifi podcast, Lost Terminal ua-cam.com/video/p3bDE9kszMc/v-deo.html
I'd love to see how one might take formal specification (such as TLA+/PlusCal) and bring it over to the invariants and typing of Rust
Write the macro!
Everytime I see your videos, it inspires me to push forward with Rust. It beats me up everytime I try to journey forth, but I'm sure it'll all click eventually.
Some of the development experience with Rust isn't perfect. An example is the examples.provided with Yew, where I spent 2-3 hours debugging a framework I had never used before to just get their example (written for an older version) working with the latest.
Ultimately, I'm hopeful for the future of Rust, but I'm also held back by my colleagues that are scared away by the unfamiliar nature of Rust. I'm hoping I can forge a new chapter in my company's history, and move to a bright future in which much of our infrastructure is written in Rust.
Sound like Stockholm syndrome to me. Getting beat up and coming back for more.
You and me both my friend!
Yeah, I hit that problem with Yew too, their documentation could be better :-( But once I got it working, I LOVED hot-reloading in-browser. That was an unexpected treat!
I too had this experience, with all the tutorials being so simple it gives you the idea that all will be simple from now on. But then when you try making your own thing that is not a tutorial, the compiler beats you up! It is frustrating - "I just wanna use the thing I just created! Why can't I even REFER to it, you silly compiler?!"
But I find, now after a while, that stops happening. I kind-of just started placing things in memory more consciously, more deliberately, and when I mutate things i tend to do it in a more structured way than before. And slowly the compiler stopped being an annoying brat. Now I even prefer doing "quick and small" tools in Rust, over Python.
no boilerplate is the not just bikes of the programming world
Another great video! I love that "oxidization of the stack" is a term. Very clever :D
Rust is close to the metal XD
I've been learning Rust for a few weeks now and one of the things I've spotted is how well the type checker helps you prevent errors you didn't even realise were possible.
For example, I recently got a compiler error because converting a character to uppercase returns an integrator of characters rather than a single character - it turns out that in some languages, converting some letters to uppercase gives two letters as a result.
Without Rust's type checker and its spectacular support for Unicode I never would have considered that edge case, which for some kinds of code is going to lead to massive bugs - you've probably heard of all the crashes on iOS and Android due to text rendering issues (if not, Tom Scott has great videos on it). I wonder how many crashes would have been prevented if the text-rendering engines for our operating systems were written in a safe language like Rust.
Right! The whole community cares about correctness, this is SUCH a huge force!
Currently in the process of learning speed (coming from a Javascript background). I do find it quite challenging, but I hope it'll all pay off in the end. When I do get something write, I feel like I just wrote a magic spell.
It's a tough start, you're doing well so far! I recommend:
- fasterthanli.me/articles/a-half-hour-to-learn-rust
- My rust series (10 other videos)
- The Book doc.rust-lang.org/stable/book/
Good luck! Ask for help on my discord if you need it, loads of nice people there! links on noboilerplate.org!
@@NoBoilerplate Thank you very much for the recommendations. I'll stick with it. I know I'll be turning to nice people like you when in need of help!!
"Oxidizing your entire stack" I like that! :) Great channel, just found this today. I have been looking to see if any languages out there have been picking up traction in the coding space and Rust keeps popping up for me. I will definitely be learning Rust as soon as I can.
Fantastic! Do check out my other videos for incredible features to get excited about. You'll need that to get over the initial learning curve! 😁
Roc language is probably going to be in 3-4 years my main "productive language" while still being "safe enough".
Every time Feldman makes a new video about it's progress I am quite amazed. He takes ELM unrivaled developer experience and "faster than GO" as his main objectives for his pure functional language. My hope is that he can go in terms of speed more to rivaling C# and Java. Then it's truly going to be an incredible language.
His full type inference approach is very interesting.
- Richard Feldman, Pushing Boundaries with Roc - latest talk is the reason I'm so excited about it.
Most of the comparisons in his video are with Rust and Typescript.
Very impressive! But, so is Haskell, and as you say, Elm.
I'm excited by Haskell not just because of it's technical qualities, but because it's *popular* and I can hire a team and get working with it TODAY.
When Roc passes Common Lisp (dead center) I will start to pay attention. redmonk.com/sogrady/2022/03/28/language-rankings-1-22/
Just to clarify, it is very possible to write logic errors in rust that will compile. Just because the types match in a statement doesn't mean that it is logically sound. You can for example accidentally write "or" instead of "and", the compiler wouldn't be able to see that that one is incorrect just from the types, it would have to know the programmers intention, which it do not.
Very true, of course. It's much easier to find these errors, when you don't have to wade through the marsh of uncertainty that other languages have, however!
This man's delivery could convince you night is day.
I promise to only use my powers for awesome
Very interesting and actually the main reason I'm learning Rust currently. If I need a highly efficient language, especially as cloud providers will charge you for all inefficiencies too, for critical code it's imperative to be efficient. Otherwise the whole system can become unnecessarily slow or Ressource hungry
That's it! And, unlike C++, we get this with a pleasant to use high-level language too!
Thank you for the video. The style of your videos feel like a breath of fresh air. Interesting topics presented in a simple to understand and short enough format. No boilerplate indeed.
I wish other content creators would learn from you
You're very kind! I try to make it as good as I can.
"The human cost of writing Rust" 😆
hehe
The compiler demands a sacrifice
Short precise and to the point - hard to be anything than Impressed.
Thank you!
5:42 This makes me wonder, how many things we could automate and improve to make dev lives better, but we never thought about doing it? Automated upgrade of code to new library versions? Maybe graph based documentation that is compile time checked, so it's never out of date? Maybe automated scaling where code works without changes no matter if it runs on one cpu, multiple cpus, multiple local network machines or cloud?
There are many ideas coming to mind, though most are taken from "Features of a dream programming language 2nd draft"
If you made just one of these, I'd buy it :-D
It's a good day whenever he uploads 😀
Yep, always feels such a long wait for the next one..
I feel the same! So nice to chat to everyone :-)
Currently it's fortnightly, but if the Patreon takes off...!
Can you talk about the implications of adding Rust to the Linux Kernel and how it affects code safety e.g. when a kernel panic occurs from whatever cause
could Rust handle that better than existing C implementations?
I too am looking forward to the discussion on this topic. I'm not a kernel developer, so I'm not the right person to talk about it I'm afraid!
rust doesn't inherently handle panics better, but it does require programmers to clearly mark everywhere where a panic can occur using the `panic!()` macro, the `.unwrap()` method, or something similar.
In theory, if a programmer can replace all `panic!()`s and such with code that compensates for the issue, you code can become panic-proof. You can even use a macro called `no-panic` to make sure a method is incapable of panicking or it will fail to compile.
In practice, I suspect panics will still happen sometimes, but they may be so rare as to only effect driver developers with non-rust languages and the like.
@@lucky-segfault Indeed, I did a video on this very topic! ua-cam.com/video/sbVxq7nNtgo/v-deo.html
I haven't looked at the latest iteration in detail, but as far as I'm aware the kernel doesn't panic. That's not a thing it wants to ever do. In light of this one of the things that were required to put rust into the kernel was to provide better support for non-panicking data structures/functions. For example Box::try_new tries to allocate a new Box, but if it runs out of memory and the allocator can't do that, then it gives an Err instead. So Rust's normal enum and rich type system actually makes the same patterns even better. In C you would perform the allocation and simply receive a null pointer in the cases where it runs out of memory, and it's up to the developer to check each pointer returned by malloc.
In Rust that's as easy as ?
In fact Asahi Lina (whose live streams are on youtube) has just written a GPU driver for the M1 mac in Rust, which is where I saw these patterns
Great and exciting vid! Really like the channel format!
While Rust forces you to prevent errors, the compiler usually tells you exactly how to fix the problem, and gives pointers explaining the problem very clearly.
The problem with learning Rust is on the level one up from getting the syntax right. It is getting rid of unsafe constructs that other languages advocate. Like callbacks or back-pointers etc. But it are exactly those structures that make our software so brittle.
Agreed, and rust's unsafe system makes this process as easy as it can be!
Can we get a video describing your workflow when creating a video like this if you have time? what software do you use. Why and how do you do things?
Have a look at the middle of my 'lightsaber' video - I use obsidian.md!
@@NoBoilerplate Rust and obsidian! Tis a beautiful way to live
Rust in the kernel is really exciting, to finally see another language in the kernel that is memory safe! But there are still a lot of problems, mainly the use of unstable features in kernel rust. That is to say that rust is not yet mature enough to be stable for kernel needs. But what is most exciting is the comparison of the NVME driver which is just as fast the C implementation, thwarting any concerns about speed!
"mainly the use of unstable features in kernel rust."
I'm not sure that's quite right there.
Unsafe isn't any worse than C, it just means you can defeference a raw pointer, plus 4 other pointer-related superpowers. (see the book for them).
...C can do all these unsafe operations with no oversight already, and we already write the linux kernel in that XD
@@NoBoilerplate Im not talking about unsafe, i mean feature like 'global_asm' or 'allocator_api' which are currently unstable that means the build could break in any verison which is a huge nogo. There are talks of having a dedicated kernel rust version, but that would lead to stagnation, like with C, where they had C89 for the longest time as the kernel C version, they only updated it because of a speculation bug, which couldnt be fixed in the version they had, so they went straight to C11 Wich is also a decade old but its atleast more modern than what they had.
@@wChris_ oh! sorry I read 'unstable' as 'unsafe'. My bad!
Unstable features get stabilised pretty quickly, even in the short time I've been following things. The Editions system perhaps could help here?
Your Videos always make me want to try Rust out even more! I started a lot of smaller tests with rust here and there, but I still need to work myself up to work through the Rust Book to get fully started with the language.
What is your stance on "the right tool for the job" with Rust? Would there still be Projects you wouldn't recommend Rust for?
I think the biggest category where Rust wouldn't be the right choice is applications where having a big runtime is an asset, not a feature.
The one that comes to mind first is Data Science. Playing around with datasets in a repl is a huge part of doing data science, and it's not the types that matter but the values, so a rich compiler won't be as much help as building a larger app.
Julia is a language i'm excited about for this sort of work!
@@NoBoilerplate Oh absolutely, especially doing Uni work, it’s nice to just script things and play around with data. I’m using Python for that :) But Julia or R are also present in some fields. There’s really a lot of languages to choose from haha
8:45 "Look how simple a hello world" is in Rust. At least compared to more popular languages like Java/C#.
No need to use classes, static methods, string arrays, return types.
In the beginning you wouldn't need to know static, arrays, string types, and any class specific stuff. You only want to know functions, maybe.
And that's basically what a "hello world" in Rust looks like. Just a function, and a macro. No types at all.
I still think, a simple hello world has some value.
Now compare that with Python...
@@CristiNeagu Same for scopes. Probably shorter. It's just this line:
print "Hello World"
Ok damn that answers my question about aws. Thanks for linking this in your comment!
My pleasure!
"You can trust compilers" Meh, debatable, I've read a very interesting paper that was saying that compilers could inject malware or bad code into your code, take care of what compilers you download. But I get the point! great vid as usual
Oh sure, everything is possible, but I'll take my chances with an extremely well-reviewed piece of open source software ;-)
Hey, awesome content as always. Was just wondering: I have a hard time differentiating your videos from afar when I see them appear in my recommended, mainly because they're so similar visually (thumbnail). I'm sure you're aware, so have you thought about how you could have more diversity in your thumbnails apart from keeping the same icon and changing the text? I mean, your thumbnails *are* recognizable, I immediately know it's your video, so I guess that's good, and given they're not really about any visual topic, I also struggle to come up with a good alternate design without making them annoyingly clickbaity or cluttered. I don't know! What are your thoughts?
My rust series won't go on forever. I will eventually run out of features to hype up! :-) And then, I might try a different colour logo.
It's entirely possible I'll need to figure out the art of a YT thumbnail later on, and you might find big changes!
I'd welcome any and all suggestions.
hi friends. my name is tris and this is no boilerplate, focusing on fast, technical videos.
you should have your own show! :-D
You got me into rust and now I'm building two project with it. Thank you so much!
I'm so pleased! This is why I started this series!
Listening while at Costco this is fun. I love these videos.
Thank you so much!
Was that blue line at the bottom always there? I can't unsee it anymore
It's a progress bar for people who watch in full screen.
Reveal.js has it as a feature, and I quite like it!
11:08 Flesh is unpredictable, silicon is certain.
You've been listening to Lost Terminal haven't you XD
ua-cam.com/video/p3bDE9kszMc/v-deo.html
The best Rust videos live here. Great accented voice over. ❤
Thank you!
Another great video - one of my favorites yet! I mainly write of Typescript for work, but have to admit that you got me to read up on Rust and I love it. Starting Rust for Rustaceans now. Just wish GCP had integrations with rust (apart from running containerized in Cloud Run or GKE).
Google back Go, of course, and have made a carbon copy of Rust, called Carbon. I'm deeply suspicious of their motives there! -.-
@@NoBoilerplate 😆😆
After using Rust for a project and spending the time to understand new concepts like borrowing, lifetimes, I started to enjoy coding in Rust.
The start was frustrating as the compiler just doesn't compile! It was very different with how development was with NodeJS. Which even if the code or syntax was wrong, NodeJS compiles and only when you execute that function it fails. I can totally relate with the narrative in the video whereby in Rust, if the compiler compiles, it just works.
Unfortunately I'm working on a NodeJS project (not typescript) and always thinking about the type system, enums and lifetime.
Writing in Rust really changed the way I handle my codes now.
Rest is good for our mental health isn't it!
I urge the Rustaceans to give Lost Terminal a try - it's gonna be up the alley of most of you!
You're too kind! I also think so!
The podcast? Not sure if I am looking at the right thing
@@serioustr This is Lost Terminal, written by a geek for geeks 🙂
ua-cam.com/video/p3bDE9kszMc/v-deo.html
Alright you got me. I'm learning Rust today
Fantastic! Do watch my other videos on Rust, there's astonishingly good features there that you'll NEED to know about!
Start here fasterthanli.me/articles/a-half-hour-to-learn-rust
Then hit The Rust Book, and Rustlings. Good luck!
What are your thoughts of Clojure, a dynamically typed functional programming language that runs on JVM. Rich Hickey, the creator of Clojure, have very strong opinions about why to not use static typed language. I am curious. What are your thoughts?
Love it. Before I discovered Rust, I was a professional clojure developer for 2 years, I even made a video about it! ua-cam.com/video/k_4rLyqQeAA/v-deo.html
Rust has taken so many of the features i love from Clojure:
- Expression-based language
- Real lisp macros
- fluent interfaces everywhere
- Instant feedback (albeit from the compiler instead of repl)
I searched for years for a way to make typing work with clojure. Typed clojure just never clicked for me, it was so much overhead, no-one really uses it, and it wasn't very powerful, clearly an after-thought.
Finding Rust (which is Lisp in C's clothing with Haskell's type system) has been revolutionary!
Your channel is just a giant Rust advertising. And it's working freaking well!
This is intentional.
I've noticed a lack of clear, well-explained introductory videos to Rust topics. There's loads of people making really great technical tutorials, but not stuff to get EXCITED about.
I crashed out of writing Rust TWICE in 2020, and I only came back because I had a mentor to help me. Most people don't have this luxury.
Rust has a BRUTAL learning curve, compared to other popular languages (though not as bad as Haskell et al), and so you need to know ALL of the great features that you simply can't get elsewhere, in order to push yourself through the initial learning period.
Have you tried Rust? Thanks for your comment!
@@NoBoilerplate I actually started learning because of you. Moreover, I watch your videos sometimes when I lose my motivation. It really helps! :3
@@SeresHotes25 I'm so pleased, thank you 🙂
@@SeresHotes25 And imma start because of this guy
Hello Mr.Tris , here's a thing for you : when Joe Armstrong said Erlang is 'write once, run forever' and as Erlang's main strength is support for concurrency
(also its functional ❤️) .
And as far the journey had we knew Rust⚙️ is known for the FEARLESS CONCURRENCY ⚡.
Could you please make a next video on concurrency and the parallel stuffs ... taking Rust and other buddies in comparison.
Love it, good comparison topic erlang-rust. Thank you!
"You can always trust the compiler" he says totally not paid by big compiler. Remember to live in fear everybody!!
I *wish* I was getting that big compiler money (mozilla call me! 🤙)
How does rust targeting arm on lambda compare to rust targeting wasm-wasi. I think I remember a blog post saying wasm was way faster
I don't understand your question, this sounds like Apples and oranges. Do explain more?
When you said there is nothing to stop you oxidizing your entire stack I realized why its called Rust; It's inevitable...
Oooh! that's a good one.
I heard recently that 'rust is close to the metal'
The downside I can see with the "correct now" principle is that it can harm velocity when prototyping and iterating. You often don't know what product you need to build, so it's important to get some kind of prototype in the hands of a user as quick as possible, so you don't waste time building a product that no-one needs. In those cases it usually doesn't matter if there are bugs in edge cases, since you just want to know if the entire idea is crap or not.
There are of course still shortcuts you can use in Rust like using unwrap and clone liberally and there's also the risk of prototypes ending up in production, but I still think this is a real downside to using languages like Rust and Haskell, which forces your programs to be correct from the start.
I don't think your concerns actually manifest in practice. Once you know Ruby on Rails, you can rapidly prototype, once you know React you can rapidly prototype, and once you know Rust, you can rapidly prototype.
A newbie in any of these would be slower at first.
And even on top of that: Compiler-driven development has the potential to be FASTER than iterating in traditional tools because so much more is checked for you by the compiler. I've got a draft video on this topic coming soon!
I'm currently learning Go as I think it has more appeal on the market right now, but I can't wait to start writing some Rust, your amazing videos really convinced me to buy the Rust book. I will ASAP
Go's a great language too, you'll have a good time! Absolutely no harm in learning both, as developers, that's what we do!
The book (also in epub) is free, don't forget doc.rust-lang.org/stable/book/
(dead tree formats don't have working links ;-) )
@@NoBoilerplate I agree 100% :) thanks for the link!
@@fabiobregasi5290 HAVING SAID THAT here's two features that you can't get in Go ;-) ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Was able to write a rust rocket app today. It was 100% a challenge but I learned a lot. What advice do you have for writing good idiomatic rust? I find myself cloning strings and objects often to get it to compile. It works, but it feels like I'm taking the easy way our or not thinking rusty enough.
Adam, you're doing it right, cloning strings and objects is absolutely fine when you are getting started. Rust is 80x faster than Python, you'll get fine performance XD
Come ask questions on the noboilerplate.org discord - there's a channel #newbie-advice just for this!
"most apps should be written in a higher level language until you can no longer do so" Telling a newbie this is very mean and closed-minded. Please learn more.
@Christopher Grant Chris, look at the context of your statements:
You're commenting in a thread where a newbie is excited about Rust and has written a simple web app and is starting to ask intermediate questions about cloneing.
You're too late with all this advice! Adam is excited about Rust and has already breezed past the problems that that paper's authors seem to think are too difficult. They're not, ownership is easy.
Python's a fine langauge to learn to code in, so is javascript or ruby.
For me, Python was my boat. It's got me to the other side of the river, but I'm not taking it with me as I climb the mountain.
I just want to say, I love your content man. Cheers from Switzerland
Hey, thanks!
Didn't realise "oxidising" would be a valid word for "rewrite it in Rust".
I've also heard "Carcinisation" DX
@@NoBoilerplate Yep, always go for the fancier one. My choice: Ferrous oxide proliferation.
Building a large project with any Rust framework is extremely energy intensive though.
Just the initial Yew/Rocket/what have you build downloads ~400-500 dependencies, spinning all cores at 100% for 5-15 minutes depending on how new your computer is. That number shoots insanely high once you get everything else you need (db drivers, auth, caching etc).
I would use Rust a lot more if it wasn't for tiny one off projects taking ~6 gigabytes of storage after draining my battery by 20% before I even get to open my editor.
Compile times are a huge focus for the core team. And maybe you're a little out of date? I remember such compile times when I first started using Rust in 2020, but every version they get faster and faster!
I just tried the Rocket hello world demo, and it uses ~100 crates. On an M1 mac this takes 10s to compile cold, and 0.1s to recompile.
Do try the same and let me know how you get on!
@@NoBoilerplate
I don't know about Rocket now, I used it around the same year you mentioned.
Yew however comes at this size, presumably for all the wasm deps.
Following the Yew tutorial, it took me ~30 minutes before I could open my editor, downloading and install trunk, wasm, bindgen, yew and what not.
Those 30 minutes were 80-100% CPU usage on all cores, and drained a fifth of my battery. This has been my experience with all Rust frameworks 2019-2021 (ish).
But happy to hear! I know there's been some fuzz around linkers and debug builds coming down. That is awesome news.
@@Honken Yeah, do try out Rocket again, you'll be pleasantly surprised!
Yew did take a lot to set up didn't it? Trunk was especially weird too when I set it up, downloading some binary blobs that I wasn't keen on . HOWEVER I don't actually mind those setup costs - they're one-time. They should be faster, you're right, and they're getting better, but at least they're one time.
Once I got yew installed for the last video, and started playing around with it, the experience was SO FAST, even hot-loading code into the browser when sourcecode changed and compiled. WOW!
Please don't let the long compile times put you off, and if they still do, just try again in 2 months, they're getting better every release 🙂
@@NoBoilerplate Thank you for always being so positive and encouraging in your comments. I'll take you up on that, and subscribe :)
@@Honken My pleasure! I'm trying to help people out with the videos, it'd be weird if I didn't also do that in the comments 🙂
There's 10 other videos in the series right now, have you seen them? Here's the playlist ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
This channel is the reason I finally decided to learn Rust. Since then, every new project I have language choice over has been in Rust and I could not be happier!
Coming from primarily Python, I tend to echo your statement that the language's simplicity causes more problems than solutions at scale
And the less we talk about the GIL the better!
How does rust and native compiled dart code compare on arm for performance?
My company's Flutter app is already fast enough to not appear on our heavy users' battery monitors.
Most languages are fast enough. Even Python's 80x slower than C doesn't hold it back from being the #2 language in the world!
I don't know of ARM benchmarks, but according to the paper referenced in this video, Dart is 6.67x slower than C, just behind Javascript. For comparison, Rust is 1.04x slower than C, and C++ was 1.56 slower.
So your dart app uses probably a similar amount of power to a javascript app, but the CPU-bound parts use 6x more than Rust.
This is only pure cpu tasks, most app time is waiting for IO, which is why most languages seem fast enough - they're not executing most of the time!
@@NoBoilerplate Flutter projects are compiled to native arm machine code for mobile devices. It also leverages GPU acceleration a lot for the GUI layer
The near JS performance is likely when it's transpiled from dart to JS for use as a JS alternative like typescript.
We're actually doing a lot of heavy lifting in the Flutter client.
By the way your videos are great!
@@magfal Oh cool! I didn't know that. I hear only good things about Flutter.
@@magfal Oh thank you so much! I'm learning every day 🙂
I agree that rust is “Good Fast Cheap” but as an C\C++ I have 2 problems that make it hard for me to use rust:
1. No support for C++ libraries (as far as I know)
2. Rusts syntax is just too different, and I don't know, for me, it feels weird to write a type of variable right of it instead of left.
Thing that I probably would like if I switch:
1. Compiler errors
2. More memory protection
BUT in my case, “no support for C++ libraries” out weights every other thing.
1. You're right, though Rust's C support is excellent (doc.rust-lang.org/nomicon/ffi.html) calling C++ functions requires a C wrapper. This is how C++ libraries are wrapped (such as GTK crates.io/crates/gtk)
So it's not impossible, certainly easier than with Python, it's not as direct as with C.
Check crates.io, you may find that someone has done the work for you for the library you want to use!
2. Syntax is syntax. Some people prefer type on the left, some on the right. Many people have it even harder, and are coming from dynamic languages and ask me why it needs to be there at all! This is a matter of style, and one you may have to get used to if you want to try new languages, as it appears to be the prevailing style.
My take is that the NAME of the variable is something I look at much more often than the type.
Because the Rust compiler does type inference based on both sides of the = sign, in most cases, only the function signature needs to be typed.
I am sure that you will have no problem learning Rust, coming from a C++ background you're already familiar with many of the low-level features I had to learn (My background was Python).
This article was revolutionary for me
fasterthanli.me/articles/a-half-hour-to-learn-rust.md
So much so that I got permission from the author to make a video version ua-cam.com/video/br3GIIQeefY/v-deo.html (though the article is better)
I have written about 10 other Rust videos showing the remarkable features of this language. The playlist is here ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
I'd give them a watch, and I hope you will see that small differences in syntax will seem like a small price to pay :-)
Oh! I just found cxx.rs - which seems to do what you want! There's also bindgen, but I don't know much about that.
Come and chat to me and the community on my discord if you like, the people over in #programming would be delighted to talk C++ / Rust integration discord.gg/mCY2bBmDKZ
Looks like a good written promotion) but honestly, everything you are saying is totally true imo
I should hope so! I'm certainly making hype videos
I still can't see the advantages of lifetimes. I can def see the need for them considering how the compiler overall works, but I still can't see a single scenario where the lifetime allows me to do something I wouldn't be able to do without.
Something that should be told, till you aren't proeficient in rust, rust is a headache cause you spend 20 hours on compiler errors for every 1 hour without. But once you are fluent in it, everything you said is pretty correct.
No denying the learning curve, but that's why I'm here to get you (and me!) excited enough to push through to that point you mentioned, where you're fluent in it. It's a hard road initially, though. I crashed out twice in 2020. Glad I pushed through!
The benefit of lifetimes (to us, not to the compiler) I can't yet explain clearly enough, though I'm nearly there. I'm writing the video, stay tuned!
The tldr is that if your type system has lifetimes, you can model not just what your data is, but WHEN. (what sequences of your data are valid). Come ask on my discord, links on noboilerplate.org, and those smarter than me may give a better answer!
@@NoBoilerplate Thx
Like how you mentioned Neovide I've been using it recently it's so awesome :)
Nice! Did you see my setup video for it? (my 'lightsaber' video)
Another great video, I always look forward to the next video!
you have convinced me to learn rust
Wonderful! Honestly this language sells itself! Have you seen my video on how to learn Rust? ua-cam.com/video/2hXNd6x9sZs/v-deo.html
Looking forward for "When not to use Rust". Currently I'm curating some references about when Rust become problematic for my study and amusements because making technical decision is hard and sometime biased.
(keyword: Rust is not Panacea)
I won't be making that video. However I can get you started: The biggest domain where you shouldn't use rust is where a large runtime is an asset, not a liability. Data science is a huge field where this is true. Julia is a really exciting language for these applications!
Great stuff. Keeps this cranky old Python programmer motivated to continue learning Rust and to use it. There's something especially optimistic and soothing about the delivery, too.🙂
Just don't buy into the "70x more efficient" part from right at the beginning. It's perhaps 70x faster to run, but what are Python scripts generally for? The language not meant for heavy lifting, so those comparisons are unfair, so to speak, unless you do come across a Python script that ends up crunching numbers at max speed for minutes (or higher) on end.
But yes, do learn Rust! It's a great language. Just don't forget about scope and scale.
"python scripts" is not what we call the second most popular language in the world. Despite what you or I think about Python's applicability, people are using it for EVERYTHING!
Also 70x slower than C speed, is Python's pure cpu single-threaded benchmark. It utterly crumbles in multithreaded benchmarks due to the GIL.
Yes speed doesn't really matter. But when it's HUNDREDS of times slower, it starts to matter.
As I said in the video, unit tests are 100% cpu with no waiting for IO, so it's especially noticeable there.
Thank you so much! Perhaps you'd like my delivery of Lost Terminal too? ua-cam.com/video/p3bDE9kszMc/v-deo.html
@@NoBoilerplate No, python scripts are what you create with Python. And if you want more performance with similar ease, Nim is a fine alternative. If you want actual performance you go for a more suitable language.
I don't think we'd disagree on this.
I write Python for things where bash doesn't cut it, but still in the same domain as bash scripts. Beyond that, other languages are far more suitable.
@@herrpez I am aware of nim, I am a maintainer of inim, the most popular repl ua-cam.com/video/Qa_9vut4TzQ/v-deo.html
Please understand most people don't use python in the way you do. It's not the second most popular language in the world because people write scripts "where bash doesn't cut it".
Could you guide me for building microservices with rust?
Come chat to the community on the discord, links in the description!
I just looove your channel so much. I wish I could work with Rust in my day-to-day job.
The reality I've gotten used to is that for fullstack web dev (+ serverless), using e2e typescript in a monorepo saves incredible amounts of time: shared types, strong generics (close to rust), linters, shared libs, and one language design.
But ngl I just love rust and wish I could use it professionally
I too take what I've learned from Rust into my day job to improve the Ruby we write!
As a complete newcomer to low-ish level languages from python who doesn't even know what the use cases for Rust are, is the Rust book still a good place to start, or do I build my beginner level experience elsewhere first? I want to be future-proof, since I hear a lot of buzz about Rust replacing C++ in the years to come.
You've got a very similar background to me!
I'd recommend:
- fasterthanli.me/articles/a-half-hour-to-learn-rust
(or my video made on this article)
- github.com/rust-lang/rustlings
and the book.
Come ask in #newbie-advice on my discord server, there's a thousand lovely people who can help! (me too!)
Another eloquent video. Thanks for the excellent work!
My pleasure!
"what does a developer do?" -- made me waste 5 minutes wondring... found out 90% of my mental stamina goes to waste into dealing with the anxiety of not knowing what I don't know yet but will get me stuck mid project. For I quite enjoy thinking about the problem and the route I will approach it, but I cringe to the thought of everything crashing in front of me
Developers are paid to think, managers are paid to worry.
#1 reason why I want to learn Rust:
Not because of any of the great things you’ve talked about on this channel.
But because since macros are denoted by a !, the macro to terminate the program because of a detected bug is *panic!*
I wonder if there is a calm! crate...
Rust's learning curve is about the same learning curve it takes to write safe C++ code on/near the level of Rust, only it's steeper due to the language enforcing safety onto you. You need to know ownership, borrowing, lifetimes, etc. before you can write a sizeable Rust project, while in C++, you need to learn pass by value, reference or pointer, null checking properly, and lifetimes. However, because it's not required, you don't need to do it, making the learning curve for general C++ code much shallower, at the large cost of possibly segfaulting/crashing code.
The way I like to put it is Rust has V-shaped difficulty curve. It's hard to learn, easy to get proficient and hard to fully master. With C++ it's an ever-steepening hill all the way up.
Ooh, that's very interesting. I think of it like this:
In most languages Easy things are Easy, and hard things are possible. In Rust, Easy things are possible, hard things are Easy.
I’m already convinced that rust is amazing, and use it for pretty much all of my new projects. Still I really like these videos, as they help me articulate why I actually like rust as much. Great content!
My goal is to get as many people excited about rust as possible, and while they're learning, to stay excited 😊
Anyone knows what's the font used in the examples?
It's defined in the first line of the source code.
(it's FiraCode Nerd Font)
Make invalid states unrepresentable in your system is exactly how F# works too.
I hear great things about F#! If I were in the dotnet ecosystem, I'd be using it for sure.
As a person whose never coded in their life, how does one go from "hello world" to translating their favorite open source program written in C+ into Rust?
I have a hunch OpenToonz's "buggy" reputation is mostly memory errors. Because it works fine for me (with ancient quad channel memory) but crashes fairly frequently for everyone else.
Thanks for motivating me to keep learning rust :)
You can do it!
Nice video, i hope now I can finally convince my boss to use Rust in the next project after i will force him watch this video :D
This is EXACTLY why I made this video! I have a few others that are also very boss-compatible too, check them out!
@@NoBoilerplate Nice :D, good job!!!
@@NoBoilerplate it would be nice if you made playlist called something like "For boss" where in right order all reletad videos would be to convince him :D
@@edems131 DONE ua-cam.com/video/4dvf6kM70qM/v-deo.html
@@NoBoilerplate :D awesome
What do you actually use rust for yourself, do you use it for work? Hobbies? What kinds of projects do you work on?
I built critical national infrastructure in it while working at the Government Digital Service, here in the UK, in 2020, that was my first taste. The experience was really profound for me: the whole first day nothing was compiling, and I thought the language was insane, but at 4pm we got it compiling and then no further changes were required and it's currently sitting in production, receiving dependabot security updates, code passing tests in CI and building with no changes.
I genuinely think it could run for ever, this language is so focussed on uncompromising rock-solid backwards and forward compatibility.
This commenter said it better than I ever could: ua-cam.com/video/ZFDqh3slQfU/v-deo.html
with your videos i feel myself as some rust aristocrat... thank you for video
Excellent!
yet somehow a rustc hello-world takes almost 4MB...
That's the debug build, a release-optimised hello world build (I just tested this) is 256k.
That 256k overhead doesn't balloon as your program increases in complexity, either, that's it. The rest of the program filesize will be your app.
A real-world example is that a release-optimised build of the axum web framework's 'hello world', that includes ssl, a web server that is so fast you don't need a reverse proxy to host your static files, is 605k.
Here's a short playlist of videos I've made that get to the heart of why Rust is something special that is changing the world from amazon, to microsoft, to linux. ua-cam.com/video/oY0XwMOSzq4/v-deo.html
I don't know rust.
I don't write rust.
I don't plan to learn rust in the near future.(maybe i would learn when i get some free time)
All i have is small experience with python.
But your videos are therapeutic to watch.
Thank you so much! I hope to inspire people to try it out!
If you like my style of video, perhaps you'd like Lost Terminal: ua-cam.com/video/p3bDE9kszMc/v-deo.html
"Our web frontend could be written in you" - 12:20
Homophones are fun!
Hi it was such a great video man loved it 🤙
I have a question🙋
I am a web developer more specialized in frontend development and nodejs( I love js/ts 😄)
I am thinking about learning rust but confused between rust and go.
What do you think I should go with that will help in my career.
Thanks in advance. 🙏
Both! Go is a fine language that if rust didn't exist, I'd be writing. These are not the last two languages you'll be learning in your career either, so start today 😊
Try rocket.rs and yew.rs, and go through Rustlings and the Book. Hit up my discord and ask for help in there. Good luck!
I like that JS is not even on the Mb list.
Heh
I honestly don't get it, but is this video extolling the virtues of static typing vs dynamic typing and compiled languages vs interpreted languages?
I didn't set out to do so. Perhaps I make assumptions that the audience has watched the previous videos in my rust series?
There's far more to Rust than static typing: ua-cam.com/play/PLZaoyhMXgBzoM9bfb5pyUOT3zjnaDdSEP.html
@@NoBoilerplate Well, the thing about prevoius videos is that it's entirely reliant on the UA-cam algorithm. It recommended this video to me without telling me there were others.
From what I can tell after spending 10 minutes with an installed compiler, it's a convoluted language combinging the arcane syntax of C++ with an extensive pythonesque library.
I mean, that's not necessarily a bad thing, but I have to wonder if it's a gatekeeping language intended to scare away new developers with its unnecessarily complicated syntax.
@@YDV669 I should make it clear that these are part of a Rust series! Good point, thank you.
Oh it's TOUGH isn't it! I also hated the syntax when I started learning in 2020, I gave up twice, but luckily had a mentor that put me back on the right track!
Here's the way to think about it: C or Python or other popular languages don't have all this syntax because they don't support the FEATURES that rust has that they don't.
Three clear examples of this are the Result type, often seen in return values, lifetime annotations (which state that reference x must live at least as long as reference y), and references themselves.
A recent video where I showed an example of why this extra syntax is needed was Rust on Rails ua-cam.com/video/sbVxq7nNtgo/v-deo.html
I'd love to know your thoughts after watching this.
@@NoBoilerplate Book follows. :)
So I watched your video, and I still don't really agree that such syntax complexity is necessary, despite all the things Rust seems to do for you at the compiler level.
let mut x = 1
let y = 1
Why force the use of two keywords for almost every single variable? Mutable function variables would normally be the default, with immutables the exception, wouldn't they?.
mut x = 1
let y = 1
Or to more clearly identify the immutables,
let x = 1
imm y = 1
The constant abuse of the exclamation mark(!).
The apparently forced use of the question mark(?) to unwrap the actual result from a return payload.
"Your code will never crash." That's like the worst thing to tell companies. Maybe it won't crash, but is it correct? It's bad enough remembering having a manager with the unshakable belief that code is production-ready the moment it cleanly compiles and after a few sanity-check runs(yes, even batch update cycles). This kind of thought corrodes development budgets.
I have no problem with the language enforcing safety at compilation time, but does it need to be so needlessly and thoughtlessly convoluted? It sounds great at the "I designed a language to impresse my girlfriend" stage, but when you're debugging a program at 3am(or even compilation errors) after already being awake for 20 hours, the ivory tower intellectualism embedded in the core of this language isn't going to win you any friends due to issues with arcane syntax potentially obscuring critical logic errors with badly placed question marks or somesuch.
I say all this as someone who grew up on a language that literally did not believe in division by zero being any sort of error, where string comparisons were all essentially right-trimmed(empty string is equivallent to ' '*x where x is any integer from 0 to MAXINT).
None of this is intended in any way as a criticism of you personally. Your videos are well-written and narrated, and I appreciate learning about Rust.
@@YDV669 Thank you for a very coherent comment! I'm DELIGHTED to help you here, you're on the right track, but have misunderstood a few things, I think. If that's due to my video, my apologies. You wrote me a book, I'll write one for you:
1. Mutability.
Mutable variables are indeed the default for most languages. Rust chose to make immutability default because it's *better*. Immutability is the default in functional languages, you'll see this in Haskell and similar. Rust is a functional language.
Look at any modern javascript tutorial, you'll find more `const` declarations than `let`. For instance, here's the first React tutorial reactjs.org/tutorial/tutorial.html the first code blocks that have variable declarations in use const. There are more `const`s on that page than `let`s
My understanding is that in JS, the advice is is "use const by default, if you need mutability, use let".
And why is this?
One reason is Immutable variables are much easier to reason about and debug, we can't accidentally shadow them and mutate them, causing surprises.
2. "Constant abuse of exclamation mark."
The compiler enforces that macros must end with a question mark, and nothing else may. If you see a !, you are looking at a macro, simple as that.
Macros are STAGGERINGLY powerful, they can:
1. Rewrite syntax at compile time, and
2. Execute arbitrary code at compile time (even disk and network access)
You'll never have come across this power before, except if you've use lisp. Other languages have things they call macros (or templates or comptime etc) but they are very rarely able to do both the above superpowers.
Macros have a bang ! at the end because it's important we know where they are so we aren't surprised.
3. "Forced use of question mark to unwrap"
Functional error passing is very different to exception handling and I understand why you are confused. It's not forced, nor does it unwrap the errors. My video on Rust's error handling is here, and I'm very proud of it, do take a look ua-cam.com/video/sbVxq7nNtgo/v-deo.html
4. (related) "Your code will never crash"
I think after you watch the above video about error handling, you'll understand why I say this more. Rust CARES about not crashing at runtime (it is this feature that made it perfect for Linux kernel development, something that is THIS WEEK official), and has the complex syntax and compiler to find nearly every case where it could. (edge cases that require more care to handle are OOM errors and unchecked maths, but they both have simple solutions for if you need them, say in an embedded environment)
5. "arcane syntax potentially obscuring critical logic errors"
I understand the syntax is unfamiliar, I really do. I hated it for the longest time, I kept crashing out of learning Rust. But I came back for the world-leading features that you simply can't get anywhere else. If you want a hard, realtime language that doesn't use a GC, and you ALSO don't want manual memory management, you're going to NEED the borrow checker. There's simply no other language available!
The good news here is that the syntax is there for a reason. Other languages don't have borrows, so we need two symbols for a read-only borrow, and a mutable borrow [& and &mut]. OK, and now the compiler needs to know how long the programmer wants these borrows to live for, when can they be cleaned up? let's use ['a 'b 'c], name the lifetimes with simple names, you can use 'longer 'names, but most of the time there's only one or two lifetimes in a function, if any, so 'a and 'b are fine.
Types are annotated with HashMap angle brackets as normal.
The way I learned Rust's syntax was by reading the BRILLIANT Amos's blog post: fasterthanli.me/articles/a-half-hour-to-learn-rust
I was so impressed by this post I made my own video version (after asking permission) ua-cam.com/video/br3GIIQeefY/v-deo.html
Depending on if you are a reading person, or a watching person, you could try either of these to grok the syntax fast? (I'm, ironically, a reading person!)
I wish Rust had simpler syntax too. Just as I wish for proper self-driving cars. For now, I'll have to drive a normal car, and program using a bit more syntax! Both get me where I want to go.
It's worth noting that the rust core team add more and more places where lifetimes don't need to be explicitly stated - the goal isn't to have zero lifetimes, but to have as few as possible, while being unambiguous.
Thanks for reading all this and chatting with me, I think this video of mine, doing a deep-dive into unsafe and macros explains these two features pretty well - and you simply can't get them anywhere else, AND THEY'RE SO GOOD I didn't know I wanted these features when I was writing Python! ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Thanks friend!
Ok ok, ill learn rust..
gottem!
Start here, but make sure you've watched the whole short playlist ua-cam.com/video/2hXNd6x9sZs/v-deo.html
Rust is cheaper, The company just need to pay for the entire training of the developer and attach rust programs to their pipeline with duct tape. Until some company spends hard on making full solutions with rust that interact well with older tech stacks (specially java and javascript stuff: java is still used in a lot of servers and javascript is impossible to get rid of), it'll just be too expensive to maintain a department just to solve rust problems while the rest of the firm runs with older software
Rust's FFI in C and Javascript is terrific, but you're right about Java.
If there's a huge legacy of Java code, would I be right in saying it might be better to use something like Kotlin or Clojure to modernise the code?