ERRATA - Rocket doesn't have a sql framework - I was thinking of using rocket with sqlx - my favourite rust sql tool which DOES compile-check against injection (and sql syntax errors, it's magic) - Discord uses Elixir, not Erlang, I guess my confusion was they use the same runtime.
I HATE using Rust! I'm trying to do this super niche thing using zero-copy deserialization (rkyv) to store directed graph data inside de-duplicated bump arenas (bumpalo) and on top of all that I need to deal with trait objects and a bajillion different derive and attribute procedural macros... and do you know what the worst thing about it is? There's no other language I can use that could even begin to try and do half these things as fast or as safely as rust does them 😭😭😭
4:21 I could be wrong, but there are no for loops in compiled code. Only branching, jumps and infinite loops. This is one of the reasons why Rust don't have for loops I believe. While/loop and iterators just compile nicer and in fast code.
You and me both. If my backlog at work wasn't so deep, I'd be rewriting our applications in Rust in my free time. Until then, I continue learning in the hopes that one day I can make the switch
@@elliotwilliams7523 If you want some more convincing: At work we have a backend written in PHP with the Laravel framework with a basic nginx and postgres stack. With that, most of our more basic endpoints take somewhere about 50ms per request and despite running multiple processes of PHP for concurrency and PHP 8's new JIT, the whole thing refuses to run past a few hundred requests per second, even with enabling keepalive in the benchmark tool, and just nginx+PHP already consume about 500MB of memory while *idle*. Since I wanted to test out some Rust web frameworks anyways, I decided to rewrite a little part of our API in one of them as a PoC. After a few short experiments I eventually settled on Axum, with SeaORM for the database access. The whole rewrite was a breeze, probably most of it was just translating the database migrations, after that SeaORM just generates the models for you and all that's left is copying a starter from the axum examples and writing the logic for the middlewares and handlers. Since I was only using some of the simple endpoints that was barely any work at all. Once rust-analyzer stopped complaining, the whole thing compiled and worked flawlessly. And the performance is a different order of magnitude entirely. With keepalive, most requests complete in just 0.01ms with about 13000 req/sec, and even without keepalive its about 0.015ms at 8100 req/sec, and the variance of those numbers is also a lot smaller than for PHP. To top it off, the Rust version peaked at just ~43MB of memory under *full load*.
@@NoBoilerplate Still, different and memorable enough that you are on your way to being THE tech quote laureate. I think this will be quoted often; hopefully, with attribution. Now, do one for Rust!
I started using Rust earlier this year, I think because I saw one of your videos. It has seriously brought my love of programming to a whole new level.
It's not you - I actually missed a deadline last week because I was not satisfied with the script for this video, it wasn't punchy enough. I like it now :-)
@@NoBoilerplate I love your commitment to this channel! It's amazing that you chose to delay your video to ensure the quality meets your standards 👏🏻 I love seeing commitment like that and is the reason I can always appreciate every video you make, thank you! ♥️
I've been (casually) studying rust for almost a year. I recently started a school project with it (frontend with rust, webserver, database bind, rabbitmq bind). It's such a pain, but I love it. When it compiles I'm sure what I'm doing will work. It's not gonna crash at the start
I think that’s the point. It’s boring once you learn the borrow checker because it’s difficult to write buggy code. There are many fewer adventures trying to track down segfaults, buffer overflows, etc
@@sploders1019 Oh I know. I once had a gig to shift a bit of C code from an ancient VAX to an HPUX machine. The code was apparently written by a learner using the successive approximation method. It worked on the VAX. I just rewrote it, no big deal, and then spent some happy time working out just why it worked on the VAX in the first place. To do with the way the stack was built. Pure chance. With rust, those things don't happen so I can concentrate on the metal.
The Discord thing never ceases to amuse me. The Go team deciding "No matter what we are going to do a FULL HEAP SCAN every 2 minutes, even if your memory usage has not changed at all." Like... what. I know they didn't want to add parameters to their GC but that is such an insane arbitrary decision it boggles my mind.
Is it me or is it not possible to write a GC without these pauses? I feel like I've been debugging them in various languages at scale my whole career. I won't miss them!
@@NoBoilerplate this case they could have because they preallocated the memory one time then never altered it. The issue was go assumed something was wrong if it was never scanning the heap so automatically did it every two minutes. If it allocate everything at once and never change the data there is zero reason to collect.
@@NoBoilerplate wasn't about format. The GC just always ran because when they ran into the problem it was hard coded to run every two minutes at a minimum. I've heard newer versions of Go fixed this but I don't use the language so that's hearsay from me.
@@NoBoilerplate there are a couple more recent GCs for the JVM that claim to be pauseless and run completely concurrently with program code. on the other hand, it's on the JVM.
Love your enthusiasm and clear explanations of Rust. I’ve been learning it myself for projects and work. It’d be great to see how it’s used in scientific computing and time series analysis - I haven’t seen any other videos or channels who focus on this field
It's actually because that's not an area of strength for Rust. In data science, having a fat long-running runtime is an asset, not a liability. Julia's my fav language in this field.
Just started learning rust to replace c++, to avoid writing c++ for multiple platforms, and your channel has been the biggest inspiration to get me through the growing pains of learning to work with the borrow checker
Honestly, if you have to fight the borrow checker, your C++ is very likely to have undefined behavior. Rust's rules are not arbitrary and its compiler is that "brutally honest" but friendly dude that says that you're wrong but helps you solve the problems. I wish you luck in your endeavor!
I dont interpret Rin's problem as fighting the borrow checker - just the same initial difficulties we all have when staring rust - unfamiliarity. Sounds like they are getting on top of it though!
@@NoBoilerplate yep, this exactly Just learning to work with the borrow checker, learning about how long what lives, etc There's always some growing pains, but I'm well on my way of replacing c++ with rust in our project!
I love rust because now people will leave Haskell alone. Haskell is a research language and should remain as such, a place where all new ideas can be explore without fear of losing backwards compatibility, because this is a problem we still haven't fixed how to combine innovation with legacy. And Rust is the language that gets to be a curated selection of the ideas explored in Haskell so people in the industry can get that innovation without being the party poppers for innovation.
My biggest issue is that it's difficult. People say C is difficult but once you understand the concepts of pointers it's not much more difficult than any other language, rust has a lot of syntax that can be really unorthodox which makes it more difficult to write
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel. Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetime syntax. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series. Yes Rust is very different from what you're used to. But that's the point. Two features you can't get in C that I think you'll like are (proper!) Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code. I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html Cheers!
@@NoBoilerplate yes, like I said very unorthodox. It could age better if it's features become more standardized bur as it is, it's like learning programming from the beginning again. I also really like the enums, with arguements.
Not that I'm complaining (exactly), but your videos feel like they're trying to "sell" Rust to the viewer. Okay, I'm sold. But now I need to know how to _do_ things, and all my experience is with C, a bit of Go, assembly code, and talking to hardware. I think in machine terms. How do you take a mind that thinks in terms of for-loops and pointers to structs describing HW registers and retrain it to think in terms of iterators, closures, and very strict typing? How do you take a blob of bytes received from a serial link whose layout you know and interpret it without resorting to 'unsafe', or to picking it apart byte by byte? I'd like to see more of the comparisons you did in some previous videos -- "Here's how you've probably done this in JS, and here's how you do it in Rust. And the Rust version won't crash or throw exceptions..."
let me be very clear: **My videos are mostly hype by design.** Most comments on my videos are not by people like you. **They are by total Rust newbies.** Some are even new to programming and are so excited by what they see! If you don't understand Rust, and someone explains it clearly, as I try to, it seems like magic. Rust is the #19th most popular language (redmonk.com/sogrady/2022/03/28/language-rankings-1-22/), but the scale is not linear. There is a lot of work to do if we are to not suffer the same fate as Haskell. **I want Rust to achieve escape velocity.** I see my job not as a details person, I am way under-qualified for that, I point people to fasterthanli.me for details. My focus is funnelling new people to Rust, getting them so excited they can't help but push through the learning curve, and then from there language sells itself. Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor (Shout-out to Alex!) who picked me up and helped me back on the path. Most people don't have this. They need the excitement of my hype videos to break through. I will eventually run out of hype topics and move on to slightly more detail. But first, there's a few million developers I want to send to rustup.rs :-)
Yo! Wow! I just had to comment. You breathe life into me when you said, “I am tired of writing bullshit that I cannot guarantee.” I felt your pain. It's so refreshing to see a community like this exists! I am now a follower. 🤣😂😂
This is the video I just needed to clear my hesitation on Go and Rust. This is confusion was not about garbage collection, but support and adoption for developers. As I can clearly see from your video, the evidence you present is beyond unreasonable doubt. Thanks!!!
Upon hearing Rust Crates, you reminded me of V-lang. Would you consider making a video analysing V-lang? I would like to see your perspective. I like how you think and order things. It's a humble request. 😊
Ha! I'd be delighted if you were to say hi on Discord :-) I'll check out V-lang, I love learning new languages, but it's rare that I'd make a video on them, popularity is a feature you see. Thank you so much for your kind words, I hope you'll like my other Rust videos, do check out my channel for them. If you would like to hear me ACTUALLY try to be soothing - I'd love to know what you think of my hopepunk scifi podcast, Lost Terminal, here's the first episode: ua-cam.com/video/p3bDE9kszMc/v-deo.html Thank you!
You feel like a professional salesman that I constantly revisit to hear more from. On top of this the product you sell is free. Never have I ever been so excited for something I know so little about. I just must find time! ⏰😳
You could try reading The Book cover to cover, without doing any programming at all, just let the words into your brain through osmosis - skip over sections you don't understand, and in doing so read most of the book. Then when you're done, it's time to go back and give it a go. This is what I did! doc.rust-lang.org/stable/book/
Friendliest experience - best for a general audience. I agree with your later response - I personally use poem-openapi for my projects. almost as fast as axium, great restfull framework.
I've started to learn Rust and noticed that it has a direct access to the array element, which may produce panic errors. Seems like rust is not so safe as was promised
I too was disappointed about this at first. It's the same with airthmatic - rust does not default to checked math - so divide by zero errors panic at runtime. However, I've started to understand Rust's comprimises - the language MUST have both fast AND safe methods, such as the checked_math module in the standard library, which has safe methods that return `Result`s. Vecs for example have .get doc.rust-lang.org/std/vec/struct.Vec.html#method.get
The mention of "perfect code" always puts me off. In university we had a secure programming module, we read case studies on programming errors that cost lives, and a key theme among them all wasn't choice of language or style, it was the assumptions the engineers made about the quality of their code. I recommend reading the report. It's called "Case Studies of Most Common and Severe Types of Software System Failure", from the International Journal of Advanced Research in Computer Science and Software Engineering. The perfect code thing was also seen a lot years back in the Haskell sphere, which lead to Haskell code being of significantly less quality than was expected, largely because of the assumptions programmers held about the language.
I sympathise with this thinking, I also studied formal system at university, and have tried for over a decade to find a programming language and ecosystem to let me write GOOD ENOUGH code that had loads of safeguards built-in to the language. I also thought it was Haskell, but what turned me off wasn't the community attitude, but I do know what you're talking about there, but Haskell's popularity, or lack, thereof. I need a language that has safety built-in, in a comprehensible way that doesn't scare off normal developers. My first video in this series is called Your Code Can Be Perfect (ua-cam.com/video/Q3AhzHq8ogs/v-deo.html) and I want to be clear: I don't think Rust is perfect, but I think it's the best language to write perfect code USING, because of the tools it gives you.
As a python programmer language speed hasn't really been something I needed to worry about. I decided to try out Rust in my free time anyway and I couldn't believe how smoothly everything went. It all felt so natural (except the borrowing system, I really don't get that part yet), especially when I tried to do some functional programming. I haven't used it since and I probably don't have much reason to use it anytime soon but I absolutely agree with those people saying it's their favourite language and I still keep it in high regard to this day.
Great that you tried it out, that's how I dipped my toe in, while still doing python day-to-day back in 2020. Why not combine forces! github.com/PyO3/pyo3
To be clear; Rust is the most loved programming language as voted on by 6625 people with 879 of those saying they dread working with it. It had the highest percentage, but one of the lowest number of voters. This is called selection bias... especially considering the total population of people who voted on it in 2022 was only 9.27% of the voters. Any reasonable person would have excluded it from the results as biased for selection and non-response. The most loved language from that survey with substantial enough voters to consider in the final results is TypeScript with 24,752 voters (34.63% of the sampled population).
I do a lot of Java programming, I have an OCA even. I have been able to use Rust recently for some projects. I am upset with Java. Rust is just as difficult as Java I feel, but Java is a contrived difficulty. Abstractions for the sake of abstractions. I could tell you all about making an abstract class that implements a marker interface. I can override a protected method in a child class allowing runtime polymorphism. And it would still lack null safety, there would be no easy way for me to see if a parameter had it's value changed in the method, if the object returned was new object or something already created. I could have built safer, cleaner, faster just as scalable code in Rust.
Rust even let’s you have low-cost dynamic typing using traits and boxes, and automates significant amounts of work with the macro system. I have it set up in a personal project to automatically generate a TypeScript API for the frontend by analyzing all of my exported types using macros, which is huge. Whenever I change an API, I just re-run the generator, which enables typescript codegen on all my data types and collects them using linkme before writing a ts file, triggering errors in my frontend anywhere I made a breaking change. I even have an event broker like JS written in rust that avoids copying using Arc and deref proxies that cast the data back into its original type without any safety issues. The fact that I can do that with only a few months of work, completely ironed out and working perfectly, while still maintaining runtime speed of 11x what I need for a real-time application is incredible, and only possible because of Rust
Primary language varies by the service. Their REST api is primarily python. The gateway uses elixir but the gateway is just a very small part of the puzzle :)
@@billasweather7833 the voice/chat app is they primary service/app, and this is written in Elixir, so I think we can say that Elixir is they primary language
For me, primary language is not about the total lines written in such language, instead I like to think how much those line of code are responsible for the business they are running. And I'm pretty sure that the python part of they stack could be much more easily replaced by rust or any other language than the elixir part, just because os all the good stuff around the elixir and erlang for websocket scalability
Never have I ever been filled with pure joy while watching a programming language video. With such motivation to learn something new, your videos are truly amazing. You've been my inspiration, these last few weeks, to, whenever I have the time, learn as much Rust as I can. Thank you!
@@NoBoilerplate I only saw it now, as I came across your channel recently. I already had started a course (google's comprehensive rust), but as soon as I finish it I will follow the steps there. Thanks for the amazing videos! :)
Awesome videos. Great inspiration to learn Rust. I've been trying to figure out how to deal with dependencies of dependencies. Let's say my project depends on crate A which depends on B. A uses some of B's types in its interface without re-exporting them or B. Now what? From what I can gather there is no way to tell cargo that my project also need that specific version of B. Am I missing something?
Unlike in other many other languages crates dependencies are independent. A -> B -> Cv1 and A -> Cv2 (where '->' means 'depends on') Is perfectly legal - just specify the version you want in your cargo.toml Any more questions, come ask in #newbie-advice on my discord!
I have been using Clojure for 3 years and love it but I am very curious about Rust. There are not much job opening about Clojure and Rust seems to have, as you mentioned, good popularity. Clojure just made me happy to code like never before but popularity might be the problem indeed, so learning Rust might be a good fallback in case. Cheers
Try them all! Obviously I prefer Rust, but Go is a fine language. I wrote Clojure at a startup bank for 2 years in the mid 2010s. In Rust, the conversation I have with the compiler feels just like the conversation I used to have with the repl in Clojure. I made a little edit, send it along to the kernel/compiler, and get instant feedback, and move forward. I think Rust is Lisp in C's clothing with Haskell's types, it's really incredible! Watch the intro carefully here: ua-cam.com/video/MWRPYBoCEaY/v-deo.html
Although I'm still in the phase of fighting the compiler, I love rust. I think my favorite things are Options and Results. Idk, but I find the wording of "Option" sooo cute :D. It feels like marrying Some(data type). Every time you use unwrap_or(), you think: "Yeah, another error handled". Whetever the use case is, Rust seems to be a great... "Option"! Sorry xD
This love letter to rust gave me chills... I'm a react dev and love typescript. This is the first time since switching from linux to mac to that I have ever considered a career change.
Wow, that is telling it straight. Performance is not even the game changer for me. The correctness, robustness, predictably, reliability and security of my product is. That is to say "quality". Programmers should take pride in their work, rather than quickly shipping out dross for a quick buck. Our civilisation depends on software, software that works, we should not let civilisation down.
@@NoBoilerplate Yes, but what is "critical infrastructure"? I want everything to work and work reliably. From the calculator in my phone, to my banking web page and everything behind them. Anything that does not deliver or causes errors can be critical. It's not just aircraft auto-pilots and nuke plant controls. Failures in security can cause grief on a huge scale, above and beyond whatever stupid program they are in. In Rust we trust :)
0:18 Unless I'm missing something, I'm pretty sure Rust does not have 1st class support on GCP. I have been working with it for a hobby/demo app and there is no official SDK or client libraries. It isn't supported in Cloud Functions like it is in AWS Lambda. The best thing I can find is auto generating gRPC stuff with Tonic
Ah interesting. I can imagine google might be uninterested in making a SDK for a competitor to Go! However, the Rust community seems to have filled in the gaps here crates.io/search?q=gcp I imagine you can just deploy a binary to GCP quite easily, just as with Go.
From the outside, I can see Rust has so many advantages, I will pick it up eventually. One thing I would clearly miss (and I miss in C/C++ as well) is the absence of a REPL. I found a REPL so nice to have (at least in Haskell and Python) that's it's become a favorite tool for me. Do you miss it too? Any idea if a REPL will ever be part of Rust?
I have excellent news for you, I really dig irust crates.io/crates/irust and for an even better experience, you can use rust inside a jupyter session with crates.io/crates/evcxr_jupyter It will never be the same experience as a language with a real long-running REPL, but you might find that, like me, you start learning rust with a repl, and then find that the compiler is so powerful, you don't need it!
When I was about 16, I had a mentor at Mozilla who told me I should start using Rust. I thought exactly what you said. This is a fad language that'll pass. Well, I didn't listen to my mentor. Now I work on a lamp stack.
Thank you! I focus on a good script and good audio so the video is accessible as possible! I had a 2-year head start on script writing: ua-cam.com/video/p3bDE9kszMc/v-deo.html
The issue I have with benchmarks is that they are so surface level. As a web developer I’d want to see someone comprehensively test something like realworld backend applications in a variety of different languages and frameworks. The realworld application as deals with handling http requests, serialization, database operations, async operations, authentication and more. I’ll add the web frameworks benchmarks are fun but they basically the equivalent of hello world just with http routing.
You speak of superior development ergonomics, and for the most part I agree with what is said, though the speed of Rust's compiler itself is concerningly slow. The Linux kernel already takes a very long time to compile. What if it was all Rust? Do you think the compile time issue will be resolved in the future?
There's two sides to this, one side is that people a misremembering that Rust compile times USED to be extremely slow, and articles from before 2020 might confuse you with this conclusion. The Rust compiler has had enormous optimisations since then, and is now much much faster. The Second side is that Rust compile times are indeed slower than go or C++ because the compiler does so much more for us. But it is possible to get around this problem with careful module design. The compiler is very smart about caching, and while an initial compile might take the same time, it is possible to speed up recompilation with good techniques. I highly recommend reading everything that Amos has ever written, starting with fasterthanli.me/articles/when-rustc-explodes
We're at the point where, if I had to write a native launcher, I would do it in Rust. If I had to write native glue code to something native, I would use FFI from whatever language the main code is in, because that is more maintainable than dragging along a hand-written native shim, even if that shim were written in Rust. But actually replacing the Java application with Rust? Not likely. But if we wanted to, here are the main gates in the way: - Rust's UI libraries are still very rudimentary. Even compared to Elixir, and Elixir is already something we want to use in production, but can't, because _its_ UI library isn't ready. - Java has a ton of libraries and sometimes it feels like we're using almost all of them - The quantity of the code that someone would have to migrate somehow
I see what you're saying, but take a step back: Coders in the top 10 languages all say "You can't replace [my language] with Rust, there's too many essential libraries that I use all the time from [my language's community]". I've had people say something like what you said in a dozen languages, including languages (like elixir) that are less popular than Rust and have fewer packages. (Rust: 110,655 packages Elixir: 14,255 packages) Perhaps you're not as familiar with the Rust ecosystem as you are with Java, or perhaps even Elixir? Regarding your specific use case, HTML is the standard interface, and with a project like tauri.app making it first-class on desktop and mobile, I don't see the problem. If your users want NATIVE native, then www.egui.rs is incredible.
@@NoBoilerplate I don't want to use web technologies to make a desktop application, so Tauri is already not an option. (Their web site is also terrible. I had to visit several pages even to figure out that it was just embedding a web browser. Initially I was reading "you can use whatever frontend framework you want", and thinking, "no, I'm looking for a frontend framework, you absolute buffoons.") Egui I have discovered before. I'm not so fond of immediate mode UI because when someone comes by to automate testing for it, they usually complain that there is no way to walk the component hierarchy to find a button to click on. I've also played with their example for long enough to realise that foreign languages don't work in their text renderer and that their emoji rendering is terrible. I'm also aware of Iced, but I haven't looked too closely at that one yet, so I'm not sure. I have read its examples - it is *WAY* more clunky than Jetpack Compose. I'm sure this is because these frameworks are "first attempt" frameworks - they don't have any other Rust frameworks to compete against, so they think they can get away with a somewhat ugly API. But then I come in, comparing with Jetpack Compose, and they look bad. So to answer your question, no, I'm not as familiar with Rust. → The reason I'm not as familiar with Rust is, I haven't used it for 1,000 hours at work. → The reason I haven't used it for 1,000 hours at work is, we haven't found a way to adopt it yet. → And the reason why we haven't found a way to adopt it yet is that we are still yet to find a good UI framework. We're also not confident enough to create that UI framework ourselves - so "just make it yourself" isn't really an option either. Just in case you try to argue that angle. I do acknowledge that 100% of today's code could be rewritten in Rust. It assumes that you're also happy to reimplement all the missing frameworks before you start on the actual code - but the claim is true, with this caveat.
I have decided to study Clojure instead of Rust. Rust is cool and all but for my personal growth (as a developer) I want the mind-expanding experience of writing in a lisp. I'll get to Rust eventually.
I started to learn Rust 2 months ago. Very steep learning curve but it is designed for speed and complex code. The syntax may be very wordy, however when you start to realize what it is designed to do then you marvel at its ingeniousness. The tools are still in its infancy similar like C# 1.0 without Resharper and the ability of break points. But with the energy crisis, every watt counts. More bare metal power with less energy means cheaper. However not every developer will survive the transition to learning Rust. The ability to adapt and "unlearn" is vital to the transition.
@@NoBoilerplate yeah agile, but the name of the game is to find who to blame when requirements need to change. It's not agile, it's often waterfall in fact.
There's loads of really great youtubers doing these deep-dives at the moment (try Code To The Moon and The Primeagen) I may yet do such a deep dive, but I see the gap in the market at the moment is getting people EXCITED about Rust enough to try it. From there the language sells itself. Have you seen my whole Rust series? ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
My pleasure! Thank you for commenting. The job market's small, of course, but the big players are all advertising rust positions: careers.microsoft.com/us/en/search-results?keywords=rust www.amazon.jobs/en/search?base_query=rust&loc_query=&latitude=&longitude=&loc_group_id=&invalid_location=false&country=&city=®ion=&county= And the trick is you can very easily make the pitch to write small amount of YOUR COMPANY's app in Rust - just a single lambda, or an event processor, something small. That's how you get'em ;-)
While i enjoy your videos as always, you keep saying that rust has a first class support in aws and is production ready, however when i looked it up it seems the aws sdk for rust is only in beta phases and is not recommended for production use. What am i missing?
You're right, the aws crate is both 'in beta' and production ready. You know, like half the plugins we use in production software! Rust packages 0.X releases are SO stable compared to other languages, in my experience. That the compiler guarantees SO MUCH makes me very caviller about getting going with pre-1.0 software.
Rust crate developers are super cautious about releasing 1.0, because that comes with stabilizing the API and disallowing any breaking changes (without major version change, ie. 2.0). What you will find is that many crates are not "stable" (as in 1.0), but they are "mature" (0.x, production ready, with breaking changes being minimized).
For those looking to use rust for web dev, do not use rocket. It’s really good and I like it but the problem is it’s not really in active development. It is but if you look at the commits and community activity compared to Axum ( a good replacement for rocket btw) it’s not. Don’t use Rocket I had to end up migrating my backend to Axum because of a lack of database pooling and other features. Though rocket finally added this, it was ready to go for months but never got updated in a new version.
This is unfortunately very true. I've stopped recommending it since this video as development stalled. I do have a recommended stack, based on Poem, did you see my video? ua-cam.com/video/pocWrUj68tU/v-deo.html
I did! The videos are great! I’m sad rocket doesn’t really update anymore as I really liked the framework! Keep up the great content! I just wanted to make sure nobody else ran into the same problem I did haha
My main issue with Rust is their seemingly immense support from community and so many individuals it’s mind boggling Yet they will not support certain older architectures. It boggles my mind Small price to pay to make the entire linux community happy with the new kernel changes, so why not?
Could you go into detail? There's only so many architectures llvm supports, and then the rust team need to choose a subset of THAT, depending on their available time?
@@NoBoilerplate My issues stem from the reliance on llvm only. Which I get, llvm is much simpler to work with than the alternatives, but it’s worrying to put all your eggs in one basket. My other worry is that now, going forward, LLVM being required now by much more code puts the responsibility of keeping older and even newer architectures that will come out solely on LLVM to support. Meaning that future revisions of gentoo and the like won’t support even something simple like ia64, hpaa, s390, among others. So when I see the massive support for Rust, why haven’t I seen a lot of support for bringing in and expanding llvm support before trying to bring it into the linux kernel? Since rust leans so heavily on llvm, this would be an awesome opportunity to see more arch support for llvm which would benefit many and reduce friction. You said it yourself, Rust is a mature language that has been around for well over a decade, so then I ask, why isn’t it seeing the arch support that it should.. if the aim is to bring in and replace C components then it should be better in every way or at least meet the standard. Less than optimal arch support will limit reusability and as a result, keep older but critical systems from receiving the proper support, opening up vulnerabilities for businesses and infrastructure.
It's possible that the LLVM's team are RIGHT to not support every architecture, reading this blog.yossarian.net/2021/02/28/Weird-architectures-werent-supported-to-begin-with
That's because it kindof is lacking. In scientific computing, a long-running fat runtime isn't a liability, it's an asset. Loading large datasets into memory and then transforming them is a natural thing for a runtime to do. With Rust it's less natural. Try this video by friend of the channel, CTTM: ua-cam.com/video/mlcSpxicx-4/v-deo.html If someone were to ask me what language to learn for data science (if not python) I'd say try Julia, it's really exciting!
Those seem to be good arguments. I am not convinced, yet. I leaned to like scala after having to work it in university. I feel like there are some intersections. What do you think?
Rust is the only language that makes me feel like I can accomplish something *solid.* When writing things in C#, there are exceptions that can just _happen_ and cause the program to come crashing down. Handling exceptions is not very easy either. (While Rust does have the panic!() macro which can be put anywhere, every single competent crate or method I've come across always uses Results, which are inherently explicit and much easier to handle.) I would MUCH prefer: `function().unwrap_or()` than: `try { v = function(); } catch (Exception e) { v = ; }` Not to mention the ? operator. All of Rust's types and mechanisms are not built into the language. Results, Options, Iterators, Deref, Index, Mul, Add, I could go on and on, are simply traits and enums that _you could make yourself._ While special traits like Deref/Index are syntactically special, it's all syntactic sugar which you can take hold of. This means that they can have a ton of helpful functions like map, filter, fold, chunks, enumerate, and unwrap_or. Rust is boring in the sense everything is made the same way and nothing is special, but that makes creating fun stuff much easier.
rust is such a cool language, i just get annoyed trying to actually write anything with it. i feel like i have to write a ton more code to do things, and i always feel like im doing it wrong (even if the code actually works)
I know what you mean, it's tough to get going, but I hope in my Rust series that I can show folks that it's worth it! It doesn't seem that way at the start, I agree. The way I think about it is: In other language simple things are easy and hard things are possible, in Rust simple things are possible and hard things are easy. I know which way round I'd prefer to build large programs!
@@NoBoilerplate I really do want to get into learning rust, but im struggling with getting my feet off the ground, but im going to keep trying on and off until i get more comfortable. also, your rust series has helped! it's one of the sole reasons im actually interested in it to begin with
@@whamer100 I presume you already know about the Rust Book? Really great, that's how I learned. If you want to force yourself to learn, I know of no better method than Rustlings code katas. I learn something new each time I take students through this course! github.com/rust-lang/rustlings Try it out!
I think Rust is a fantastic language marred by a politically biased community and developers, maybe that is most tech communities, but such political biases have been explicitly embedded by the Rust developers themselves who have repeatedly made progressive political statements in arguably innapropriate contexts (blogposts announcing new Rust releases, for instance). So for someone who isn´t a progressive (like myself), those biases becomes a Sword of Damocles over our heads, always threatening to fall down on our heads. Having said that, I still believe Rust is a great technical tool and is worth the attention its getting, its jsut too bad its inherentily attached to politics in such an explicit manner. I would´ve complained all the same if the devs had made a non-progressive political statement (say, if they were conservative), I might´ve agreed with them on the substance of the arguments (just liek progressives agree with them), but wouldn´t have thought those statements were highly innapropriate and out of context. I wish tech woudn´t become a platform for political posturing like that.
Thank you for your comment, could you say what sort of biases you have seen? 'progressive' means very different things in different countries, so I can't really guess. BUT! You're not the only one to say such things.
Rust is a language i _want_ to like but simply cannot. Oh sure, i read through the list of stuff it has/can do and go "wow, this sounds great!", but the moment i try to write it or god forbid _read someone else's rust code_ i suddenly feel as if the language centre of my brain was shut off barring alien concepts like the borrow checker and ownership malarky, its as if the language designers went "wow, c++ is becoming unreadable! look at how much crap is on one line and how long things get! LETS GO THE DIRECT OPPOSITE DIRECTION". Like, who thought that a statement without a semicolon being the return value for a scope was a *good* idea? thats the most miserable troll design decision i have ever come across. I'm like 90% sure that breaks _some_ kind of accessibility guideline somewhere (or at least it does for me. whee, mild dyslexia!). there are other readability problems i have with it (jesus christ why is ', and a _singular one_ at that, used outside of the context of strings???) but i think that one's the best example. Also, it has the same miserable after-school detention "write the same thing on the blackboard 100 times" schtick that c/c++ has. maybe not _as_ bad since there isnt a header/source file split but its still rather agonizing. if y'all can make effective use of rust then more power to you but unless some saint makes an alternate syntax style for it ill be sticking to my HolyC and GML ; v ;
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel. Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series. Yes Rust is very different from what you're used to. But that's the point. Two features you can't get in C++ that I think you'll like are Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code. I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html Cheers!
> Like, who thought that a statement without a semicolon being the return value for a scope was a good idea? Pretty much the entire CS branch of functional programming languages, where that is the norm. Also leaking into non-functional PLs like Ruby. Also, code-blocks in Rust are not just scopes. They are a combo of scope and comma expression from C. Almost everything in Rust is an expression that returns a value. Which is actually a simplification over C/C++ where there's a semi-arbitrary distinction between expressions and statements.
So i need someone who has worked with Rust and is not biased towards Rust to tell me. Is Rust any good or useful for Artificial Intelligence/ Machine Learning and Computer Graphics and AAA Games Development? Or No??
Python is more geared towards AI development and training, however the libraries required to properly train and actually use the AI will likely need to be written in an extremely fast language to be efficient, as Python does not have speed on its side. They can be built with C, C++, and Rust, or any language at around the same speed, but those three are much more bare metal and give you much better access to the device. For a proper AI, you will definitely need to use the GPU, which is difficult to do without using CUDA/OpenCL, or Rust's gpu crates. Computer graphics need to be fast and safe. C, C++ and Rust can be used, but Rust is the safest. AAA game development, unless you're making the engine, Rust is not a very good option. While it is great, C# gives the much needed leniency for game dev (for instance, nulls can be used as an advantage at times when Options are somewhat cumbersome, and the reflection in C# is amazing). tldr AI and CG _need_ to be fast and safe, enter Rust. AAA games do need to be optimized, but Rust is not required. C# is definitely recommended for game dev.
@@cerulity32k C# is *not* the best for game development, like yeah, unity uses it but it's just... Not the best choice, (unity has to do a lot of stuff to make it happen and even unity is quite a lot of C++ internally). Rust is definitely a good choice, the trouble is that basically every engine is C++, and rust just doesn't have the support from gamedevs that C++ does.
@@cerulity32k also, nulls cause *so many issues* in practice which is *why* rust doesn't have them. There is no good reason to have them. Reflection is a disaster that is really slow and frankly... Unnecessary? If you do the right thing you don't need reflection, it's really only useful for patching problems in existing code.
As someone with a bias towards rust, i can say rust is not currently well suited to AI or games. Not because it cannot handle these kinds of tasks, but because the relevant libraries are immature. For AI you likely want python, and for games you want whatever language works with your game engine (C# for unity)
@@lucky-segfault yeah I mean that's true. It's well suited, as a language, to handle those things but the frameworks are immature. That's the only real problem there (and c# is still a bad choice for game development imo, not that C++ is much better.)
Go is a very good language! But it has its limits - check out my previous rust video for a case study where Discord had to switch a service from go to rust, to avoid garbage collection pauses
"As fast as C" is a downside, not a plus. C++ can be faster than C. JIT languages (e. g. Java, C#) can be faster than C thanks to their profile-guided optimizations on the fly.
Rust can also be faster than C, for precisely the same reasons why C++ is. C is slower because most of the time you need to manually do dynamic dispatch to do polymorphism. With Rust/C++ you can have parametric polymorphism (generics/templates) that do static dispatch. Also, I've seen comparisons of Java and Rust in terms of performance. It takes several minutes of PGO in very repetitive task for Java to beat Rust. That pretty much never happens in practice. Rust beats Java in latency and performance just because of the initial JIT compilation and periodic GC pauses of Java. It's like the turtle vs. rabbit race, where the Java rabbit takes ridiculous detours and munches on kale every couple of minutes, except the Rust turtle is also a rabbit.
theres some really nice higher level abstractions over graphics APIs, especially wgpu is really nice. my guess is your issues are more with the OpenGL side and not the Rust side?
@@laundmo I don't know it exactly yet. All buffers look right (in renderdoc) but I think there is something fucked up on the rust side because of structs/their members getting allocated on the stack and confusing me.
there are problem spaces rust just really sucks at. rust demands safety inside safe rust but the way opengl contexts work cannot be abstracted within safe rust. same with vulkan for example. its threading model is based around locking functionality while rust locks data. sure locking data is better but it makes me lose most of what makes vulkan fast. also since vulkan doesnt have coherent caches teaching rust about those is also an absolute pain. so either you lose all of the advantages of vulkan by doing it the rust way or you write everything in unsafe and you lose all the advantages of rust.
@@gideonunger7284 You sound much more expert than I on this matter - but my understanding of Rust's `unsafe` system is that it is available to build safe abstractions on unsafe code. Could that be done with Vulkan? Is that not what is done with crates.io/crates/ash ? Also, saying you "lose all the advantages of rust" implies that safety is the only advantage of Rust, which it most certainly isn't: ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Maybe you could try doing what I did: Reading the book cover to cover, but not doing any code examples yet. Then when you're finished (just skip over stuff that doesn't quite make sense) go back with an editor and get stuck IN! doc.rust-lang.org/stable/book/
Hey! Thanks for the in-detail videos. I have two questions: - Which microphone do you have? It’s so good! - I’m graduating soon, and since I work in 3d computer vision & robotics, I need to spend time gaining C++ expertise, but I have been seeing your videos, and I feel Rust is the future. I don’t want to miss out on the Rust bandwagon. How should I gain expertise in C++ and rust together?
1. www.0atman.com/articles/21/make-fiction-podcast 2. Use C++ to make money, and write Rust at home, Robotics isn't quite there for Rust yet, but it will be! Come and chat to me and the community about both these things on my discord! :-)
actually, so far i find designing programs in rust to be exciting because i can come up with such interesting solutions, especially when it comes to enforcing safe usage of my own apis
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel. Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series. Yes Rust is very different from what you're used to. But that's the point. As an example, two features you can't get in any language combined that I think you'll like are Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code. I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html Cheers!
Wikipedia says that Jack and a colleague build the prototype of Twitter "in about two weeks", though I understand that perhaps this isn't the whole picture, and I imgine he will have delegated by the time they scaled up, for sure,
my guess is 20 years at best. Because we are slowly hitting a limit in performance through binary computers. the computers themselves are going to need to start changing is my prediction otherwise a faster programming language wouldn't matter when you you hit a hardware bottleneck.
idk why but having rust never change is reassuring but also scary at the same time. c++ cant change due to C never changing and it being a Super set of C inability to change is scary and a roof but rust is up there currently and i dont think there are many non quality of life changes left to rust.
I didn't say that rust never changes, in fact, I said the opposite, "Code written today will be guaranteed to compile in all future versions of Rust, while still being able to be used with future code we write in new versions of Rust." The system that allows Rust to change without breaking backwards compatibility is genius, and it's called the Editions system. Read about it here: doc.rust-lang.org/edition-guide/editions/index.html
_tehnically_ c++ is not a super set of c, since there are valid c programs which won't be compiled with c++ standards a usual example is the fact that the c standard explicitly allows implicit casting from and to void pointer types, while in c++ these casts must be explicit e.g. int *num = malloc(sizeof(int)); is a valid c statement, but invalid c++. in order to be valid in both, the void pointer must be explicitly casted: int *num = (int *) malloc(sizeof(int));
Ah, Go programmings language. A compiled language with a performance of an interpreted one. Why would someone choose it to write software in beyond my understanding :)
I don't hate Go, though you maybe surprised to hear it. I'd choose it over java every day of the week! But it does not go far enough for my liking, it's a little too bare-bones for me.
Friend, I have great news. I recently tried out crates.io/crates/vst and the demo vst compiled and loaded into my daw (reaper) perfectly! I'd love to know how you go with this - I want to build my own VSTs too. Join my discord and tell me please! noboilerplate.org/discord
Yes, it is possible. Unfortunately VST3 API is so C++ infested, that it doesn't really mesh with Rust in ergonomic way. VST2 works quite fine though. Implementing GUI has also proven to be rather challenging, because you're receiving windows from the DAW instead of the OS/Browser. That not something most GUI crates account for in their low level design.
Ada is a far superior language designed to be reliable, scalable and performant. If Torvalds was truly concerned about reliability, he wouldn't use C, a language which provides no provisions for safety.
The only one reason I still have not made choice between C++ and Rust is c++ web framework drogon has better performance than any production ready rust framework. So I have very difficult choice. I see only one option: make same baas in c++ and rust and give opportunity to choose.
There's not much in it, drogon is indeed faster, but Rust and Cpp crush the competition web-frameworks-benchmark.netlify.app/result?asc=0&l=rust,cpp,python,ruby Rust will give you a MUCH better experience, I promise!
rust isn't "correct" as you said though, it has no support for formal verification for now. i still love rust but i certainly wouldn't say it is the safest language when we got stuff like ada spark.
You're not wrong, but you're also not talking about most software written today. I don't really count spark ada because I can't write a website or an app using it. I studied formal systems at university (Z, B, Coq), and was so sad when I discovered out in the industry that we basically don't use them. Fighter jets and pacemakers, you can count the number of production systems that are formally verified by hand in most years. This is partly due to difficulty, but also partly because the state space of most web apps is too big to be formally verified - the complexity of a single string, for instance, is ENORMOUS. Formal systems work on very small, finite models with small numbers of states. I want to get as much correctness into general purpose programming as possible, and I'm so excited Rust exists to give me this. The ability to encode so much logic into the rich type system (compared to java, typescript and similar) gives me the same feeling of safety I had when using Haskell: I feel like if it compiles, it WORKS!
@@NoBoilerplate that is true, i do really like rust's safety features but it's not the only reason i use it, i'd rather build something in rust than in ada in term of dev experience. also, it's a language where i feel handling errors is much less of an headache than most of the other things out there. i think "correct" may not be a good term to describe rust although it is indeed memory safe, which eliminate a huge chunks of bug already. though there are some ongoing efforts to bring formal verification to rust, but idk if it'll get somewhere. also, since you mentionned haskell, rust is also very functional programming friendly, it does tail call optimization for example. i do want to get into LISP more somedays though, but for now rust is definitely my daily driver for building most things.
@@alkeryn1700 Has TCO support been merged in yet? I'm out of the loop, that's great! I, somehow, wrote lisp professionally for 2 in the mid 2010s, somehow! Clojure's very good, very mature and stable. We were building a startup bank, if you can believe it!
Totally agreed re Data Science - in this field a long-running, heavyweight runtime is a feature, not a liability. Python's the king, of course, though if I were starting out today, I'd take a look at Julia. Rust's not absent from Data Science, do check out ua-cam.com/video/mlcSpxicx-4/v-deo.html ML I'm not sure I agree with you entirely. ML needs to GO FAST. While Rust isn't very active in this field yet, it's early days, I would expect to see much of the C++ fast plumbing of the ML pipelines be written in Rust as we go forward. Rust is *80x* faster than Python, and at some point, you'd rather your stablediffusion run in 1s than 80s!
>Has more packages than NPM did. Dude. This is like saying steam has more games than origin or something. It is an argument AGAINST the platform, when you need to plow through 1000s of packages to find something meaningful is definitely not good.
Nim has the most potential of those three, I'd say, but they all failed to escape the two biggest pitfalls of any programming language: inheritance and null references. However, it also can't be ignored that Rust has the backing of a powerful foundation and a great many sponsors.
Ahmad, Bug: Agreed, I actually came to Rust via Nim (I co-maintain the inim project still). They're all good projects, but Rust is the only one without a garbage collector, and yet unlike C C++ and Zig, doesn't require risky manual memory management. The Borrow Checker, which allows Rust to do compile-guaranteed memory management for you, also gives you superpowers that I talk about in other videos. If you've not seen them, start here ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
@@NoBoilerplate It's just a lot of these claims are very web-development or OS specific. I work in engineering and science and the standards will probably never change from C++/FORTRAN/Matlab. So in that case, Rust is not the perfect programming language everyone should learn and use for everything, it's just a very useful and good tool for specific applications.
Rust has fairly high potential for HPC. One side-effect of borrow-checker is that nearly all pointers have perfect aliasing annotations. It does have some of the toys you'd expect from HPC language, such as inlining/hot/cold/unreachable annotations, parametric polymorphism as the default, safety check overrides, system threads,... The tooling is not quite there yet. There are some early attempts to make Rust compile for GPU (including Rust CUDA) and there are several parallel computing libraries out there (Rayon being the most notable example, modelled after Cilk), which also provide the added benefit of memory safety, that C++ lacks. Rust may very well give Fortan an C++ a run for their money in HPC at some not-so-far point in the future. The current focus is on the low-hanging fruit of web-dev. In there Rust can easily triumph in memory usage and p99 latency just by its lack of garbage collector, and it's CPU performance is not bad either, since it shares compiler back-end with C and C++.
1:59 Here you use Linus to make a point that Rust was good enough to make it into the Linux kernel-but I don't fundamentally think he really endorses it as much as you make it out he does. Mental Outlaw covered the addition of certain Rust-written drivers in the Linux kernel a few weeks ago, and here is what Linus had to say about it: (This first note is a message he is replying to in an email.) > As you know, we're trying to guarantee the absence of undefined > behaviour for code written in Rust. And the context is _really_ > important, so important that leaving it up to comments isn't enough. (Now Linus's response.) "You need to realize that (a) reality trumps fantasy (b) kernel needs trump any Rust needs And the *reality* is that there are no absolute guarantees. Ever. The "Rust is safe" is not some kind of absolute guarantee of code safety. Never has been. Anybody who believes that should probably re-take their kindergarten year, and stop believing in the Easter bunny and Santa Claus. Even "safe" rust code in user space will do things like panic when things go wrong (overflows, allocation failures, etc). If you don't realize that that is NOT some kind of true safely, I don't know what to say. Not completing the operation at all, is *not* really any better than getting the wrong answer, it's only more debuggable. In the kernel, "panic and stop" is not an option (it's actively worse than even the wrong answer, since it's really not debugable), so the kernel version of "panic" is "WARN_ON_ONCE()" and continue with the wrong answer. So this is something that I really *need* the Rust people to understand. That whole reality of "safe" not being some absolute thing, and the reality that the kernel side *requires* slightly different rules than user space traditionally does." He then concludes later: "Deal with it. Or, you know, if you can't deal with the rules that the kernel requires, then just don't do kernel programming. Because in the end it really is that simple. I really need you to understand that Rust in the kernel is dependent on *kernel* rules. Not some other random rules that exist elsewhere." Linus So, his reception does seem very different to how you make it look. "Rust will not fundamentally change the Linux kernel, it is just another alternative language to compose it", appears to be roughly what he's saying-and I would agree. Most of these saintly, user-space features are entirely helpless when you are writing drivers, because things like that are on a monstrously low level. The thesis appears to be that Rust isn't any different than C in such an environment. What do you think?
You're not the first person to suggest this email to me. Linus has his eyes wide open - Rust isn't perfect, Rust is VERY good, but comes with its own set of compromises. Those compromises have added value to kernel development, but it's not magic. I'm so excited by Rust because it's the best tool for the job. It's not perfect, but it's the most perfect tool we have, in my opinion. When something better comes along (for values of 'better' that Linus would approve of, ie not popularity) you'll see me rave about THAT instead. I don't love Rust, I love sleeping through the night without getting paged XD
@@NoBoilerplate Haha. I suppose if Rust had existed when Linux was first developed, things might've looked very differently. Anyway, my apologies to make you reply to the same argument twice. I just wanted to know how to square my impression of Linus's skepticism towards Rust and the wonderful features it appears to provide that'd make things seem a lot simpler than C. Thank you for the reply, and have a great day. ^^
I am careful about Rust, but I have to say - put Rust next to a C++, C and Swift... And you will see quite fast that Rust is the only enjoyable language to write out of these... I am still a beginner coming from TS language, but hell, Rust is like TypeScript with steroids that just feels right...
ERRATA
- Rocket doesn't have a sql framework - I was thinking of using rocket with sqlx - my favourite rust sql tool which DOES compile-check against injection (and sql syntax errors, it's magic)
- Discord uses Elixir, not Erlang, I guess my confusion was they use the same runtime.
I HATE using Rust!
I'm trying to do this super niche thing using zero-copy deserialization (rkyv) to store directed graph data inside de-duplicated bump arenas (bumpalo) and on top of all that I need to deal with trait objects and a bajillion different derive and attribute procedural macros... and do you know what the worst thing about it is? There's no other language I can use that could even begin to try and do half these things as fast or as safely as rust does them 😭😭😭
@@zyansheep so you actually hate that your use case is so hard to do right, and Rust is just the right tool for the job
Google prompts translate to English and makes todo into all
#ERRATA
all!()
4:21
I could be wrong, but there are no for loops in compiled code. Only branching, jumps and infinite loops.
This is one of the reasons why Rust don't have for loops I believe. While/loop and iterators just compile nicer and in fast code.
I’m pretty sure this dude loves rust.
What are talking dude, he is the ambassador of rust Lang
What makes you think that?
I don't know man, he feels more like a PHP kind of guy.
Garbage game for trash people
If I'm the ambassador, fasterthanli.me is the KING
I swear man, every single time I see a video of yours I have to run to my computer and start learning more about Rust. It’s just ridiculous
You and me both. If my backlog at work wasn't so deep, I'd be rewriting our applications in Rust in my free time. Until then, I continue learning in the hopes that one day I can make the switch
@@penguindrummaster one day at a time
I KNOW RIGHT?
Your videos are just too good, I started learning rust thanks to you ahah
Thank you so much!
These videos…. So great... you’re making me want to rewrite my whole PHP backend in rust when all I can do is print formatted strings.
Should I 😬😬???
@@elliotwilliams7523 Do it
You know where to start friend doc.rust-lang.org/stable/book/
@@elliotwilliams7523 If you want some more convincing: At work we have a backend written in PHP with the Laravel framework with a basic nginx and postgres stack. With that, most of our more basic endpoints take somewhere about 50ms per request and despite running multiple processes of PHP for concurrency and PHP 8's new JIT, the whole thing refuses to run past a few hundred requests per second, even with enabling keepalive in the benchmark tool, and just nginx+PHP already consume about 500MB of memory while *idle*.
Since I wanted to test out some Rust web frameworks anyways, I decided to rewrite a little part of our API in one of them as a PoC. After a few short experiments I eventually settled on Axum, with SeaORM for the database access.
The whole rewrite was a breeze, probably most of it was just translating the database migrations, after that SeaORM just generates the models for you and all that's left is copying a starter from the axum examples and writing the logic for the middlewares and handlers. Since I was only using some of the simple endpoints that was barely any work at all. Once rust-analyzer stopped complaining, the whole thing compiled and worked flawlessly. And the performance is a different order of magnitude entirely.
With keepalive, most requests complete in just 0.01ms with about 13000 req/sec, and even without keepalive its about 0.015ms at 8100 req/sec, and the variance of those numbers is also a lot smaller than for PHP. To top it off, the Rust version peaked at just ~43MB of memory under *full load*.
_"There are islands of Mac devices, but Linux is the ocean!_
_There are clouds of windows networks but Linux is the sky"_
- No Boilerplate 2022 🎶🎵☺️
Friends don't tell anyone but I'm literally paraphrasing Audioslave here
ua-cam.com/video/9ZDAYg196x8/v-deo.html
@@NoBoilerplate Still, different and memorable enough that you are on your way to being THE tech quote laureate. I think this will be quoted often; hopefully, with attribution. Now, do one for Rust!
@@BigMTBrain Thank you! My favourite so far is "[these rust projects] are not abandoned, they're DONE"
Well, you can still come by an occasional BSD droplet every now and then
@@mskiptr Ah that's true. Routers tend to be some flavour of BSD
I like how every entry in the speed list is 2x slower that the one before, but python takes two steps.
Don't get me *started* on python. I'm being generous by not including concurrent code - python's 100s of times slower in that, due to the GIL!
Just goes to show how important those ergonomics are. Python beats almost everyone in that category, which is what sells it.
@@Kiaulen what do you mean "beats"?
@@NoBoilerplate Probably that your nose bleeds after using it. XP
@@Kiaulen 🤣 even Javascript is more ergonomic than Python.
I started using Rust earlier this year, I think because I saw one of your videos. It has seriously brought my love of programming to a whole new level.
I totally feel the same way, it's like a renaissance!
Man, few days ago I checked your channel and was very disappointed that you didn’t post but now I’m happy seeing you again.
It's not you - I actually missed a deadline last week because I was not satisfied with the script for this video, it wasn't punchy enough. I like it now :-)
@@NoBoilerplate I love your commitment to this channel! It's amazing that you chose to delay your video to ensure the quality meets your standards 👏🏻
I love seeing commitment like that and is the reason I can always appreciate every video you make, thank you! ♥️
@@mysterry2000 thank you so much 🙂
I've been (casually) studying rust for almost a year. I recently started a school project with it (frontend with rust, webserver, database bind, rabbitmq bind). It's such a pain, but I love it. When it compiles I'm sure what I'm doing will work. It's not gonna crash at the start
You're on the right track - when the pain of learning has ended, you'll just be left with a language that works basically every single time!
C is brilliant, I love it. You do need a couple of crutches to hobble around sometimes. Rust is actually non-boring, and you don't shoot your feet.
I think that’s the point. It’s boring once you learn the borrow checker because it’s difficult to write buggy code. There are many fewer adventures trying to track down segfaults, buffer overflows, etc
@@sploders1019 Oh I know. I once had a gig to shift a bit of C code from an ancient VAX to an HPUX machine. The code was apparently written by a learner using the successive approximation method. It worked on the VAX. I just rewrote it, no big deal, and then spent some happy time working out just why it worked on the VAX in the first place. To do with the way the stack was built. Pure chance.
With rust, those things don't happen so I can concentrate on the metal.
This is the way
The Discord thing never ceases to amuse me. The Go team deciding "No matter what we are going to do a FULL HEAP SCAN every 2 minutes, even if your memory usage has not changed at all."
Like... what. I know they didn't want to add parameters to their GC but that is such an insane arbitrary decision it boggles my mind.
Is it me or is it not possible to write a GC without these pauses? I feel like I've been debugging them in various languages at scale my whole career. I won't miss them!
@@NoBoilerplate this case they could have because they preallocated the memory one time then never altered it. The issue was go assumed something was wrong if it was never scanning the heap so automatically did it every two minutes.
If it allocate everything at once and never change the data there is zero reason to collect.
@@WizardofWestmarch I suppose after "extensive optimisation" Discord couldn't get the data into a good format?
@@NoBoilerplate wasn't about format. The GC just always ran because when they ran into the problem it was hard coded to run every two minutes at a minimum. I've heard newer versions of Go fixed this but I don't use the language so that's hearsay from me.
@@NoBoilerplate there are a couple more recent GCs for the JVM that claim to be pauseless and run completely concurrently with program code. on the other hand, it's on the JVM.
This guy is so good even Tom Hanks has decided to learn Rust, and he is an actor.
Love your enthusiasm and clear explanations of Rust. I’ve been learning it myself for projects and work. It’d be great to see how it’s used in scientific computing and time series analysis - I haven’t seen any other videos or channels who focus on this field
It's actually because that's not an area of strength for Rust.
In data science, having a fat long-running runtime is an asset, not a liability. Julia's my fav language in this field.
@@NoBoilerplate Can you elaborate on this? Are you using data science and scientific computing interchangeably?
Just started learning rust to replace c++, to avoid writing c++ for multiple platforms, and your channel has been the biggest inspiration to get me through the growing pains of learning to work with the borrow checker
Honestly, if you have to fight the borrow checker, your C++ is very likely to have undefined behavior. Rust's rules are not arbitrary and its compiler is that "brutally honest" but friendly dude that says that you're wrong but helps you solve the problems. I wish you luck in your endeavor!
I dont interpret Rin's problem as fighting the borrow checker - just the same initial difficulties we all have when staring rust - unfamiliarity. Sounds like they are getting on top of it though!
@@NoBoilerplate yep, this exactly
Just learning to work with the borrow checker, learning about how long what lives, etc
There's always some growing pains, but I'm well on my way of replacing c++ with rust in our project!
@@RinLovesYou That's it!
I love rust because now people will leave Haskell alone. Haskell is a research language and should remain as such, a place where all new ideas can be explore without fear of losing backwards compatibility, because this is a problem we still haven't fixed how to combine innovation with legacy. And Rust is the language that gets to be a curated selection of the ideas explored in Haskell so people in the industry can get that innovation without being the party poppers for innovation.
I now read Rust documentation in your voice, and it is oh, so soothing.
me too!
My biggest issue is that it's difficult. People say C is difficult but once you understand the concepts of pointers it's not much more difficult than any other language, rust has a lot of syntax that can be really unorthodox which makes it more difficult to write
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel.
Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetime syntax. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series.
Yes Rust is very different from what you're used to. But that's the point. Two features you can't get in C that I think you'll like are (proper!) Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code. I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Cheers!
@@NoBoilerplate yes, like I said very unorthodox. It could age better if it's features become more standardized bur as it is, it's like learning programming from the beginning again. I also really like the enums, with arguements.
@@Zen-rw2fz learning programming from the beginning again is a very good way of putting it!
Not that I'm complaining (exactly), but your videos feel like they're trying to "sell" Rust to the viewer.
Okay, I'm sold. But now I need to know how to _do_ things, and all my experience is with C, a bit of Go, assembly code, and talking to hardware. I think in machine terms. How do you take a mind that thinks in terms of for-loops and pointers to structs describing HW registers and retrain it to think in terms of iterators, closures, and very strict typing? How do you take a blob of bytes received from a serial link whose layout you know and interpret it without resorting to 'unsafe', or to picking it apart byte by byte?
I'd like to see more of the comparisons you did in some previous videos -- "Here's how you've probably done this in JS, and here's how you do it in Rust. And the Rust version won't crash or throw exceptions..."
Was looking for exactly this comment - I agree completely.
The goal of the channel was, and probably still is, to sell rust to his co-workers.
Oh that was easy. I'm now on a mission to sell Rust to the world!
let me be very clear: **My videos are mostly hype by design.**
Most comments on my videos are not by people like you. **They are by total Rust newbies.** Some are even new to programming and are so excited by what they see! If you don't understand Rust, and someone explains it clearly, as I try to, it seems like magic. Rust is the #19th most popular language (redmonk.com/sogrady/2022/03/28/language-rankings-1-22/), but the scale is not linear. There is a lot of work to do if we are to not suffer the same fate as Haskell.
**I want Rust to achieve escape velocity.**
I see my job not as a details person, I am way under-qualified for that, I point people to fasterthanli.me for details. My focus is funnelling new people to Rust, getting them so excited they can't help but push through the learning curve, and then from there language sells itself.
Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor (Shout-out to Alex!) who picked me up and helped me back on the path. Most people don't have this. They need the excitement of my hype videos to break through.
I will eventually run out of hype topics and move on to slightly more detail. But first, there's a few million developers I want to send to rustup.rs :-)
Really appreciate the real world examples. I'd been wondering recently about how Rust is getting on in actual projects. Pretty well, it turns out.
The future's here!
Yo! Wow! I just had to comment. You breathe life into me when you said, “I am tired of writing bullshit that I cannot guarantee.” I felt your pain. It's so refreshing to see a community like this exists! I am now a follower. 🤣😂😂
😂 Still watching and I am hooked. Your delivery is perfect! Your tone is soothing, too.
This is the video I just needed to clear my hesitation on Go and Rust. This is confusion was not about garbage collection, but support and adoption for developers. As I can clearly see from your video, the evidence you present is beyond unreasonable doubt. Thanks!!!
Upon hearing Rust Crates, you reminded me of V-lang. Would you consider making a video analysing V-lang? I would like to see your perspective. I like how you think and order things. It's a humble request. 😊
I can't believe I am considering joining Discord because of you. 😂I just finished watching this video.
Ha! I'd be delighted if you were to say hi on Discord :-)
I'll check out V-lang, I love learning new languages, but it's rare that I'd make a video on them, popularity is a feature you see.
Thank you so much for your kind words, I hope you'll like my other Rust videos, do check out my channel for them.
If you would like to hear me ACTUALLY try to be soothing - I'd love to know what you think of my hopepunk scifi podcast, Lost Terminal, here's the first episode: ua-cam.com/video/p3bDE9kszMc/v-deo.html
Thank you!
You feel like a professional salesman that I constantly revisit to hear more from. On top of this the product you sell is free.
Never have I ever been so excited for something I know so little about.
I just must find time! ⏰😳
You could try reading The Book cover to cover, without doing any programming at all, just let the words into your brain through osmosis - skip over sections you don't understand, and in doing so read most of the book. Then when you're done, it's time to go back and give it a go. This is what I did!
doc.rust-lang.org/stable/book/
@@NoBoilerplate is it propaganda if it's the truth?
curious as to why you picked rocket over axum/actix
Much better Dev experience with rocket imo
@@theLowestPointInMyLife I'd disagree, rocket seems to be mostly unmaintained now. Axum is a much better idea for newer projects.
@@jepcdd I didn't know that about rocket, looked a cool project too, I'm not really keen on any of the rust servers tbh
yeah, axum and warp are better, even better than actix; their memory usage is incredible low but faster.
Friendliest experience - best for a general audience. I agree with your later response - I personally use poem-openapi for my projects. almost as fast as axium, great restfull framework.
I've started to learn Rust and noticed that it has a direct access to the array element, which may produce panic errors. Seems like rust is not so safe as was promised
I too was disappointed about this at first. It's the same with airthmatic - rust does not default to checked math - so divide by zero errors panic at runtime.
However, I've started to understand Rust's comprimises - the language MUST have both fast AND safe methods, such as the checked_math module in the standard library, which has safe methods that return `Result`s.
Vecs for example have .get doc.rust-lang.org/std/vec/struct.Vec.html#method.get
The mention of "perfect code" always puts me off. In university we had a secure programming module, we read case studies on programming errors that cost lives, and a key theme among them all wasn't choice of language or style, it was the assumptions the engineers made about the quality of their code.
I recommend reading the report. It's called "Case Studies of Most Common and Severe Types of Software System Failure", from the International Journal of Advanced Research in Computer Science and Software Engineering.
The perfect code thing was also seen a lot years back in the Haskell sphere, which lead to Haskell code being of significantly less quality than was expected, largely because of the assumptions programmers held about the language.
I sympathise with this thinking, I also studied formal system at university, and have tried for over a decade to find a programming language and ecosystem to let me write GOOD ENOUGH code that had loads of safeguards built-in to the language.
I also thought it was Haskell, but what turned me off wasn't the community attitude, but I do know what you're talking about there, but Haskell's popularity, or lack, thereof.
I need a language that has safety built-in, in a comprehensible way that doesn't scare off normal developers.
My first video in this series is called Your Code Can Be Perfect (ua-cam.com/video/Q3AhzHq8ogs/v-deo.html) and I want to be clear: I don't think Rust is perfect, but I think it's the best language to write perfect code USING, because of the tools it gives you.
As a python programmer language speed hasn't really been something I needed to worry about. I decided to try out Rust in my free time anyway and I couldn't believe how smoothly everything went. It all felt so natural (except the borrowing system, I really don't get that part yet), especially when I tried to do some functional programming. I haven't used it since and I probably don't have much reason to use it anytime soon but I absolutely agree with those people saying it's their favourite language and I still keep it in high regard to this day.
Great that you tried it out, that's how I dipped my toe in, while still doing python day-to-day back in 2020.
Why not combine forces! github.com/PyO3/pyo3
To be clear; Rust is the most loved programming language as voted on by 6625 people with 879 of those saying they dread working with it. It had the highest percentage, but one of the lowest number of voters. This is called selection bias... especially considering the total population of people who voted on it in 2022 was only 9.27% of the voters. Any reasonable person would have excluded it from the results as biased for selection and non-response. The most loved language from that survey with substantial enough voters to consider in the final results is TypeScript with 24,752 voters (34.63% of the sampled population).
I do a lot of Java programming, I have an OCA even. I have been able to use Rust recently for some projects. I am upset with Java. Rust is just as difficult as Java I feel, but Java is a contrived difficulty. Abstractions for the sake of abstractions. I could tell you all about making an abstract class that implements a marker interface. I can override a protected method in a child class allowing runtime polymorphism. And it would still lack null safety, there would be no easy way for me to see if a parameter had it's value changed in the method, if the object returned was new object or something already created. I could have built safer, cleaner, faster just as scalable code in Rust.
Great explanation, thank you
Rust even let’s you have low-cost dynamic typing using traits and boxes, and automates significant amounts of work with the macro system. I have it set up in a personal project to automatically generate a TypeScript API for the frontend by analyzing all of my exported types using macros, which is huge. Whenever I change an API, I just re-run the generator, which enables typescript codegen on all my data types and collects them using linkme before writing a ts file, triggering errors in my frontend anywhere I made a breaking change. I even have an event broker like JS written in rust that avoids copying using Arc and deref proxies that cast the data back into its original type without any safety issues. The fact that I can do that with only a few months of work, completely ironed out and working perfectly, while still maintaining runtime speed of 11x what I need for a real-time application is incredible, and only possible because of Rust
That's fantastic!
Always nice to see more Rust evangelizing in my sub box. I look forward to the day it replaces the terrible tools I use for work!
The revolution could start with you! Have you tried Rust yet? Really great to get started -> rustup.rs
minor errata, Discord uses Elixir instead of Erlang as a primary language.
Primary language varies by the service. Their REST api is primarily python. The gateway uses elixir but the gateway is just a very small part of the puzzle :)
@@billasweather7833 the voice/chat app is they primary service/app, and this is written in Elixir, so I think we can say that Elixir is they primary language
For me, primary language is not about the total lines written in such language, instead I like to think how much those line of code are responsible for the business they are running. And I'm pretty sure that the python part of they stack could be much more easily replaced by rust or any other language than the elixir part, just because os all the good stuff around the elixir and erlang for websocket scalability
Sure. But there are far far far more Microservices than you’re acknowledging and each managed by their own team and lang.
Python is not being replaced due to developer simplicity.
Never have I ever been filled with pure joy while watching a programming language video. With such motivation to learn something new, your videos are truly amazing. You've been my inspiration, these last few weeks, to, whenever I have the time, learn as much Rust as I can. Thank you!
I'm delighted! I trust you've seen my getting started video? ua-cam.com/video/2hXNd6x9sZs/v-deo.html
@@NoBoilerplate I only saw it now, as I came across your channel recently. I already had started a course (google's comprehensive rust), but as soon as I finish it I will follow the steps there. Thanks for the amazing videos! :)
@@MrThirstyx my pleasure!
Awesome videos. Great inspiration to learn Rust.
I've been trying to figure out how to deal with dependencies of dependencies. Let's say my project depends on crate A which depends on B. A uses some of B's types in its interface without re-exporting them or B. Now what? From what I can gather there is no way to tell cargo that my project also need that specific version of B. Am I missing something?
Unlike in other many other languages crates dependencies are independent.
A -> B -> Cv1
and
A -> Cv2
(where '->' means 'depends on')
Is perfectly legal - just specify the version you want in your cargo.toml
Any more questions, come ask in #newbie-advice on my discord!
Nice video! Ok now I want "boring" transition from C# and Blazor to Rust. What libraries and frameworks should I look at? What you guys recommend?
I have a video on that! ua-cam.com/video/pocWrUj68tU/v-deo.html
I have been using Clojure for 3 years and love it but I am very curious about Rust.
There are not much job opening about Clojure and Rust seems to have, as you mentioned, good popularity.
Clojure just made me happy to code like never before but popularity might be the problem indeed, so learning Rust might be a good fallback in case.
Cheers
Try them all! Obviously I prefer Rust, but Go is a fine language.
I wrote Clojure at a startup bank for 2 years in the mid 2010s.
In Rust, the conversation I have with the compiler feels just like the conversation I used to have with the repl in Clojure. I made a little edit, send it along to the kernel/compiler, and get instant feedback, and move forward.
I think Rust is Lisp in C's clothing with Haskell's types, it's really incredible! Watch the intro carefully here: ua-cam.com/video/MWRPYBoCEaY/v-deo.html
Although I'm still in the phase of fighting the compiler, I love rust. I think my favorite things are Options and Results. Idk, but I find the wording of "Option" sooo cute :D. It feels like marrying Some(data type).
Every time you use unwrap_or(), you think: "Yeah, another error handled".
Whetever the use case is, Rust seems to be a great... "Option"! Sorry xD
Isn't it great!
This love letter to rust gave me chills... I'm a react dev and love typescript. This is the first time since switching from linux to mac to that I have ever considered a career change.
You know what you have to do now, right? ua-cam.com/video/2hXNd6x9sZs/v-deo.html
:-)
Wow, that is telling it straight. Performance is not even the game changer for me. The correctness, robustness, predictably, reliability and security of my product is. That is to say "quality". Programmers should take pride in their work, rather than quickly shipping out dross for a quick buck. Our civilisation depends on software, software that works, we should not let civilisation down.
Couldn't agree more here - critical infrastructure should be built with Rust
@@NoBoilerplate Yes, but what is "critical infrastructure"? I want everything to work and work reliably. From the calculator in my phone, to my banking web page and everything behind them. Anything that does not deliver or causes errors can be critical. It's not just aircraft auto-pilots and nuke plant controls. Failures in security can cause grief on a huge scale, above and beyond whatever stupid program they are in. In Rust we trust :)
0:18 Unless I'm missing something, I'm pretty sure Rust does not have 1st class support on GCP. I have been working with it for a hobby/demo app and there is no official SDK or client libraries. It isn't supported in Cloud Functions like it is in AWS Lambda.
The best thing I can find is auto generating gRPC stuff with Tonic
Ah interesting. I can imagine google might be uninterested in making a SDK for a competitor to Go!
However, the Rust community seems to have filled in the gaps here crates.io/search?q=gcp
I imagine you can just deploy a binary to GCP quite easily, just as with Go.
From the outside, I can see Rust has so many advantages, I will pick it up eventually.
One thing I would clearly miss (and I miss in C/C++ as well) is the absence of a REPL. I found a REPL so nice to have (at least in Haskell and Python) that's it's become a favorite tool for me.
Do you miss it too? Any idea if a REPL will ever be part of Rust?
I have excellent news for you, I really dig irust crates.io/crates/irust
and for an even better experience, you can use rust inside a jupyter session with crates.io/crates/evcxr_jupyter
It will never be the same experience as a language with a real long-running REPL, but you might find that, like me, you start learning rust with a repl, and then find that the compiler is so powerful, you don't need it!
@@NoBoilerplate Nice! :D Thanks for the pointers!
When I was about 16, I had a mentor at Mozilla who told me I should start using Rust. I thought exactly what you said. This is a fad language that'll pass. Well, I didn't listen to my mentor. Now I work on a lamp stack.
There's still plenty of time to learn :-) fasterthanli.me/articles/a-half-hour-to-learn-rust
How have you got me SO hyped about a language I’ve never used - even setting all your knowledge aside, cripes are you a good writer.
Thank you! I focus on a good script and good audio so the video is accessible as possible!
I had a 2-year head start on script writing: ua-cam.com/video/p3bDE9kszMc/v-deo.html
The issue I have with benchmarks is that they are so surface level. As a web developer I’d want to see someone comprehensively test something like realworld backend applications in a variety of different languages and frameworks. The realworld application as deals with handling http requests, serialization, database operations, async operations, authentication and more. I’ll add the web frameworks benchmarks are fun but they basically the equivalent of hello world just with http routing.
Yeah, that's a very satisfactory benchmark idea. I like web-frameworks-benchmark.netlify.app/result?asc=0&l=rust,python,ruby,javascript
You speak of superior development ergonomics, and for the most part I agree with what is said, though the speed of Rust's compiler itself is concerningly slow. The Linux kernel already takes a very long time to compile. What if it was all Rust? Do you think the compile time issue will be resolved in the future?
There's two sides to this, one side is that people a misremembering that Rust compile times USED to be extremely slow, and articles from before 2020 might confuse you with this conclusion. The Rust compiler has had enormous optimisations since then, and is now much much faster.
The Second side is that Rust compile times are indeed slower than go or C++ because the compiler does so much more for us. But it is possible to get around this problem with careful module design. The compiler is very smart about caching, and while an initial compile might take the same time, it is possible to speed up recompilation with good techniques.
I highly recommend reading everything that Amos has ever written, starting with fasterthanli.me/articles/when-rustc-explodes
3:35, man, who here remembers Twitter? those were some crazy times. remember Bean Dad?
Was that like a text message you could send to multiple people? Sounds weird to me /j
We're at the point where, if I had to write a native launcher, I would do it in Rust.
If I had to write native glue code to something native, I would use FFI from whatever language the main code is in, because that is more maintainable than dragging along a hand-written native shim, even if that shim were written in Rust.
But actually replacing the Java application with Rust? Not likely. But if we wanted to, here are the main gates in the way:
- Rust's UI libraries are still very rudimentary. Even compared to Elixir, and Elixir is already something we want to use in production, but can't, because _its_ UI library isn't ready.
- Java has a ton of libraries and sometimes it feels like we're using almost all of them
- The quantity of the code that someone would have to migrate somehow
I see what you're saying, but take a step back:
Coders in the top 10 languages all say "You can't replace [my language] with Rust, there's too many essential libraries that I use all the time from [my language's community]".
I've had people say something like what you said in a dozen languages, including languages (like elixir) that are less popular than Rust and have fewer packages.
(Rust: 110,655 packages Elixir: 14,255 packages)
Perhaps you're not as familiar with the Rust ecosystem as you are with Java, or perhaps even Elixir?
Regarding your specific use case, HTML is the standard interface, and with a project like tauri.app making it first-class on desktop and mobile, I don't see the problem.
If your users want NATIVE native, then www.egui.rs is incredible.
@@NoBoilerplate I don't want to use web technologies to make a desktop application, so Tauri is already not an option.
(Their web site is also terrible. I had to visit several pages even to figure out that it was just embedding a web browser. Initially I was reading "you can use whatever frontend framework you want", and thinking, "no, I'm looking for a frontend framework, you absolute buffoons.")
Egui I have discovered before. I'm not so fond of immediate mode UI because when someone comes by to automate testing for it, they usually complain that there is no way to walk the component hierarchy to find a button to click on. I've also played with their example for long enough to realise that foreign languages don't work in their text renderer and that their emoji rendering is terrible.
I'm also aware of Iced, but I haven't looked too closely at that one yet, so I'm not sure. I have read its examples - it is *WAY* more clunky than Jetpack Compose. I'm sure this is because these frameworks are "first attempt" frameworks - they don't have any other Rust frameworks to compete against, so they think they can get away with a somewhat ugly API. But then I come in, comparing with Jetpack Compose, and they look bad.
So to answer your question, no, I'm not as familiar with Rust.
→ The reason I'm not as familiar with Rust is, I haven't used it for 1,000 hours at work.
→ The reason I haven't used it for 1,000 hours at work is, we haven't found a way to adopt it yet.
→ And the reason why we haven't found a way to adopt it yet is that we are still yet to find a good UI framework.
We're also not confident enough to create that UI framework ourselves - so "just make it yourself" isn't really an option either. Just in case you try to argue that angle.
I do acknowledge that 100% of today's code could be rewritten in Rust. It assumes that you're also happy to reimplement all the missing frameworks before you start on the actual code - but the claim is true, with this caveat.
if I happen to be failing at learning c++, should I learn rust?
Why not! You can always go back to C++ later if you would like :-) doc.rust-lang.org/stable/book/
I have decided to study Clojure instead of Rust.
Rust is cool and all but for my personal growth (as a developer) I want the mind-expanding experience of writing in a lisp.
I'll get to Rust eventually.
RUST!
I started to learn Rust 2 months ago. Very steep learning curve but it is designed for speed and complex code.
The syntax may be very wordy, however when you start to realize what it is designed to do then you marvel at its ingeniousness.
The tools are still in its infancy similar like C# 1.0 without Resharper and the ability of break points.
But with the energy crisis, every watt counts. More bare metal power with less energy means cheaper.
However not every developer will survive the transition to learning Rust. The ability to adapt and "unlearn" is vital to the transition.
Very good take. My videos are to get as many people through those first few weeks of pain. It's beautiful the other side!
I listened to this video I like your no bs way of talking, refreshing compared to job life.
You're gonna love a video I'm drafting: A ruthless tear-down of Agile, in the way it's used in large companies
@@NoBoilerplate yeah agile, but the name of the game is to find who to blame when requirements need to change. It's not agile, it's often waterfall in fact.
Very enlightening video! But instead of just talking about the philosophy, maybe make a video or two about rust-unique features (&str vs String, etc)?
There's loads of really great youtubers doing these deep-dives at the moment (try Code To The Moon and The Primeagen)
I may yet do such a deep dive, but I see the gap in the market at the moment is getting people EXCITED about Rust enough to try it. From there the language sells itself.
Have you seen my whole Rust series? ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
Alright, you got me! What does the job landscape look like for Rust these days. Thanks for the great video.
My pleasure! Thank you for commenting. The job market's small, of course, but the big players are all advertising rust positions:
careers.microsoft.com/us/en/search-results?keywords=rust
www.amazon.jobs/en/search?base_query=rust&loc_query=&latitude=&longitude=&loc_group_id=&invalid_location=false&country=&city=®ion=&county=
And the trick is you can very easily make the pitch to write small amount of YOUR COMPANY's app in Rust - just a single lambda, or an event processor, something small. That's how you get'em ;-)
@@NoBoilerplate wow, thanks for the thoughtful and thorough response!!!
While i enjoy your videos as always, you keep saying that rust has a first class support in aws and is production ready, however when i looked it up it seems the aws sdk for rust is only in beta phases and is not recommended for production use.
What am i missing?
You're right, the aws crate is both 'in beta' and production ready. You know, like half the plugins we use in production software!
Rust packages 0.X releases are SO stable compared to other languages, in my experience. That the compiler guarantees SO MUCH makes me very caviller about getting going with pre-1.0 software.
Rust crate developers are super cautious about releasing 1.0, because that comes with stabilizing the API and disallowing any breaking changes (without major version change, ie. 2.0). What you will find is that many crates are not "stable" (as in 1.0), but they are "mature" (0.x, production ready, with breaking changes being minimized).
For those looking to use rust for web dev, do not use rocket. It’s really good and I like it but the problem is it’s not really in active development. It is but if you look at the commits and community activity compared to Axum ( a good replacement for rocket btw) it’s not. Don’t use Rocket I had to end up migrating my backend to Axum because of a lack of database pooling and other features. Though rocket finally added this, it was ready to go for months but never got updated in a new version.
This is unfortunately very true. I've stopped recommending it since this video as development stalled.
I do have a recommended stack, based on Poem, did you see my video? ua-cam.com/video/pocWrUj68tU/v-deo.html
I did! The videos are great! I’m sad rocket doesn’t really update anymore as I really liked the framework! Keep up the great content! I just wanted to make sure nobody else ran into the same problem I did haha
My main issue with Rust is their seemingly immense support from community and so many individuals it’s mind boggling
Yet they will not support certain older architectures.
It boggles my mind
Small price to pay to make the entire linux community happy with the new kernel changes, so why not?
Could you go into detail? There's only so many architectures llvm supports, and then the rust team need to choose a subset of THAT, depending on their available time?
@@NoBoilerplate
My issues stem from the reliance on llvm only. Which I get, llvm is much simpler to work with than the alternatives, but it’s worrying to put all your eggs in one basket.
My other worry is that now, going forward, LLVM being required now by much more code puts the responsibility of keeping older and even newer architectures that will come out solely on LLVM to support. Meaning that future revisions of gentoo and the like won’t support even something simple like ia64, hpaa, s390, among others.
So when I see the massive support for Rust, why haven’t I seen a lot of support for bringing in and expanding llvm support before trying to bring it into the linux kernel? Since rust leans so heavily on llvm, this would be an awesome opportunity to see more arch support for llvm which would benefit many and reduce friction.
You said it yourself, Rust is a mature language that has been around for well over a decade, so then I ask, why isn’t it seeing the arch support that it should.. if the aim is to bring in and replace C components then it should be better in every way or at least meet the standard. Less than optimal arch support will limit reusability and as a result, keep older but critical systems from receiving the proper support, opening up vulnerabilities for businesses and infrastructure.
@@sleaf6 I'm unfamiliar with the low-level discussion, could you give examples of architectures that LLVM doesn't support?
It's possible that the LLVM's team are RIGHT to not support every architecture, reading this blog.yossarian.net/2021/02/28/Weird-architectures-werent-supported-to-begin-with
Can you talk about rust for scientific computing. I have been learning rust recently, and i feel like this is an area that is lacking. Thanks
That's because it kindof is lacking.
In scientific computing, a long-running fat runtime isn't a liability, it's an asset. Loading large datasets into memory and then transforming them is a natural thing for a runtime to do. With Rust it's less natural.
Try this video by friend of the channel, CTTM: ua-cam.com/video/mlcSpxicx-4/v-deo.html
If someone were to ask me what language to learn for data science (if not python) I'd say try Julia, it's really exciting!
Those seem to be good arguments. I am not convinced, yet. I leaned to like scala after having to work it in university. I feel like there are some intersections. What do you think?
Alright, let's go! You have convinced me, my man. I am starting to learn Rust.
Rust is the only language that makes me feel like I can accomplish something *solid.* When writing things in C#, there are exceptions that can just _happen_ and cause the program to come crashing down. Handling exceptions is not very easy either. (While Rust does have the panic!() macro which can be put anywhere, every single competent crate or method I've come across always uses Results, which are inherently explicit and much easier to handle.)
I would MUCH prefer:
`function().unwrap_or()`
than:
`try { v = function(); }
catch (Exception e) { v = ; }`
Not to mention the ? operator.
All of Rust's types and mechanisms are not built into the language. Results, Options, Iterators, Deref, Index, Mul, Add, I could go on and on, are simply traits and enums that _you could make yourself._ While special traits like Deref/Index are syntactically special, it's all syntactic sugar which you can take hold of. This means that they can have a ton of helpful functions like map, filter, fold, chunks, enumerate, and unwrap_or. Rust is boring in the sense everything is made the same way and nothing is special, but that makes creating fun stuff much easier.
rust is such a cool language, i just get annoyed trying to actually write anything with it. i feel like i have to write a ton more code to do things, and i always feel like im doing it wrong (even if the code actually works)
I know what you mean, it's tough to get going, but I hope in my Rust series that I can show folks that it's worth it!
It doesn't seem that way at the start, I agree. The way I think about it is:
In other language simple things are easy and hard things are possible, in Rust simple things are possible and hard things are easy.
I know which way round I'd prefer to build large programs!
@@NoBoilerplate I really do want to get into learning rust, but im struggling with getting my feet off the ground, but im going to keep trying on and off until i get more comfortable.
also, your rust series has helped! it's one of the sole reasons im actually interested in it to begin with
@@whamer100 I presume you already know about the Rust Book? Really great, that's how I learned.
If you want to force yourself to learn, I know of no better method than Rustlings code katas. I learn something new each time I take students through this course! github.com/rust-lang/rustlings
Try it out!
Tried the link to the Discord server. GitHub didn't find the file.
apologies, fixed the link now!
I think Rust is a fantastic language marred by a politically biased community and developers, maybe that is most tech communities, but such political biases have been explicitly embedded by the Rust developers themselves who have repeatedly made progressive political statements in arguably innapropriate contexts (blogposts announcing new Rust releases, for instance).
So for someone who isn´t a progressive (like myself), those biases becomes a Sword of Damocles over our heads, always threatening to fall down on our heads.
Having said that, I still believe Rust is a great technical tool and is worth the attention its getting, its jsut too bad its inherentily attached to politics in such an explicit manner. I would´ve complained all the same if the devs had made a non-progressive political statement (say, if they were conservative), I might´ve agreed with them on the substance of the arguments (just liek progressives agree with them), but wouldn´t have thought those statements were highly innapropriate and out of context.
I wish tech woudn´t become a platform for political posturing like that.
Thank you for your comment, could you say what sort of biases you have seen? 'progressive' means very different things in different countries, so I can't really guess. BUT! You're not the only one to say such things.
I share your sentiment but I’m afraid it’s already too late.
@@ethernet764 What is his sentiment? It's so vague, what have you seen, Eth? I promise I don't ban or block people for having political opinions! 🙂
Rust is a language i _want_ to like but simply cannot. Oh sure, i read through the list of stuff it has/can do and go "wow, this sounds great!", but the moment i try to write it or god forbid _read someone else's rust code_ i suddenly feel as if the language centre of my brain was shut off
barring alien concepts like the borrow checker and ownership malarky, its as if the language designers went "wow, c++ is becoming unreadable! look at how much crap is on one line and how long things get! LETS GO THE DIRECT OPPOSITE DIRECTION".
Like, who thought that a statement without a semicolon being the return value for a scope was a *good* idea? thats the most miserable troll design decision i have ever come across. I'm like 90% sure that breaks _some_ kind of accessibility guideline somewhere (or at least it does for me. whee, mild dyslexia!). there are other readability problems i have with it (jesus christ why is ', and a _singular one_ at that, used outside of the context of strings???) but i think that one's the best example.
Also, it has the same miserable after-school detention "write the same thing on the blackboard 100 times" schtick that c/c++ has. maybe not _as_ bad since there isnt a header/source file split but its still rather agonizing.
if y'all can make effective use of rust then more power to you but unless some saint makes an alternate syntax style for it ill be sticking to my HolyC and GML ; v ;
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel.
Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series. Yes Rust is very different from what you're used to. But that's the point.
Two features you can't get in C++ that I think you'll like are Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code. I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Cheers!
> Like, who thought that a statement without a semicolon being the return value for a scope was a good idea?
Pretty much the entire CS branch of functional programming languages, where that is the norm. Also leaking into non-functional PLs like Ruby.
Also, code-blocks in Rust are not just scopes. They are a combo of scope and comma expression from C. Almost everything in Rust is an expression that returns a value. Which is actually a simplification over C/C++ where there's a semi-arbitrary distinction between expressions and statements.
So i need someone who has worked with Rust and is not biased towards Rust to tell me. Is Rust any good or useful for Artificial Intelligence/ Machine Learning and Computer Graphics and AAA Games Development? Or No??
Python is more geared towards AI development and training, however the libraries required to properly train and actually use the AI will likely need to be written in an extremely fast language to be efficient, as Python does not have speed on its side. They can be built with C, C++, and Rust, or any language at around the same speed, but those three are much more bare metal and give you much better access to the device. For a proper AI, you will definitely need to use the GPU, which is difficult to do without using CUDA/OpenCL, or Rust's gpu crates.
Computer graphics need to be fast and safe. C, C++ and Rust can be used, but Rust is the safest.
AAA game development, unless you're making the engine, Rust is not a very good option. While it is great, C# gives the much needed leniency for game dev (for instance, nulls can be used as an advantage at times when Options are somewhat cumbersome, and the reflection in C# is amazing).
tldr AI and CG _need_ to be fast and safe, enter Rust. AAA games do need to be optimized, but Rust is not required. C# is definitely recommended for game dev.
@@cerulity32k C# is *not* the best for game development, like yeah, unity uses it but it's just... Not the best choice, (unity has to do a lot of stuff to make it happen and even unity is quite a lot of C++ internally). Rust is definitely a good choice, the trouble is that basically every engine is C++, and rust just doesn't have the support from gamedevs that C++ does.
@@cerulity32k also, nulls cause *so many issues* in practice which is *why* rust doesn't have them. There is no good reason to have them. Reflection is a disaster that is really slow and frankly... Unnecessary? If you do the right thing you don't need reflection, it's really only useful for patching problems in existing code.
As someone with a bias towards rust, i can say rust is not currently well suited to AI or games.
Not because it cannot handle these kinds of tasks, but because the relevant libraries are immature.
For AI you likely want python, and for games you want whatever language works with your game engine (C# for unity)
@@lucky-segfault yeah I mean that's true. It's well suited, as a language, to handle those things but the frameworks are immature. That's the only real problem there (and c# is still a bad choice for game development imo, not that C++ is much better.)
Thank you for Boring (not) reminding of why we loving Rust! For Boring (yes). 💖🦀
you are welcome!
For backend
I would still prefer Go
Though, I would like to try Tokyo
Go is a very good language! But it has its limits - check out my previous rust video for a case study where Discord had to switch a service from go to rust, to avoid garbage collection pauses
@@NoBoilerplate yah those garbage collection spike is an thing indeed
"As fast as C" is a downside, not a plus. C++ can be faster than C. JIT languages (e. g. Java, C#) can be faster than C thanks to their profile-guided optimizations on the fly.
Sure, but overall, languages have very predictable performance characteristics, as shown in general-purpose benchmarks.
Rust can also be faster than C, for precisely the same reasons why C++ is. C is slower because most of the time you need to manually do dynamic dispatch to do polymorphism. With Rust/C++ you can have parametric polymorphism (generics/templates) that do static dispatch.
Also, I've seen comparisons of Java and Rust in terms of performance. It takes several minutes of PGO in very repetitive task for Java to beat Rust. That pretty much never happens in practice. Rust beats Java in latency and performance just because of the initial JIT compilation and periodic GC pauses of Java.
It's like the turtle vs. rabbit race, where the Java rabbit takes ridiculous detours and munches on kale every couple of minutes, except the Rust turtle is also a rabbit.
Rust seems to be nice, but now that I am working with it on a little project with OpenGL I have the same issues as I had when using c++.
theres some really nice higher level abstractions over graphics APIs, especially wgpu is really nice.
my guess is your issues are more with the OpenGL side and not the Rust side?
@@laundmo I don't know it exactly yet. All buffers look right (in renderdoc) but I think there is something fucked up on the rust side because of structs/their members getting allocated on the stack and confusing me.
Hit us up on my discord - loads of smart game devs there who might be able to help!
there are problem spaces rust just really sucks at. rust demands safety inside safe rust but the way opengl contexts work cannot be abstracted within safe rust.
same with vulkan for example. its threading model is based around locking functionality while rust locks data. sure locking data is better but it makes me lose most of what makes vulkan fast. also since vulkan doesnt have coherent caches teaching rust about those is also an absolute pain. so either you lose all of the advantages of vulkan by doing it the rust way or you write everything in unsafe and you lose all the advantages of rust.
@@gideonunger7284 You sound much more expert than I on this matter - but my understanding of Rust's `unsafe` system is that it is available to build safe abstractions on unsafe code. Could that be done with Vulkan?
Is that not what is done with crates.io/crates/ash ?
Also, saying you "lose all the advantages of rust" implies that safety is the only advantage of Rust, which it most certainly isn't: ua-cam.com/video/PuMXWc0xrK0/v-deo.html
When you say "entire tech stack"... What about mobile?
Check out egui and (soon afaik) yew!
I'm halfway through the video and if I wasn't convinced yet, I would be now.
11/10
I've been saying this for months: I need to learn Rust. But after seeing this video, I *need* to learn Rust!
Maybe you could try doing what I did: Reading the book cover to cover, but not doing any code examples yet.
Then when you're finished (just skip over stuff that doesn't quite make sense) go back with an editor and get stuck IN!
doc.rust-lang.org/stable/book/
@@NoBoilerplate I will do that! I tried doing the interactive guide but fell off because I don't really like step by step tutorials.
@@nebulousnomad nice, yeah get stuck in!
What are some good projects to do in rust coming from a python background?
Both are big topics, are you from a python webdev background like me? If so, rocket.rs is just like flask!
Hey! Thanks for the in-detail videos.
I have two questions:
- Which microphone do you have? It’s so good!
- I’m graduating soon, and since I work in 3d computer vision & robotics, I need to spend time gaining C++ expertise, but I have been seeing your videos, and I feel Rust is the future. I don’t want to miss out on the Rust bandwagon. How should I gain expertise in C++ and rust together?
1. www.0atman.com/articles/21/make-fiction-podcast
2. Use C++ to make money, and write Rust at home, Robotics isn't quite there for Rust yet, but it will be!
Come and chat to me and the community about both these things on my discord! :-)
Rocket or Activ ? For me that came from RoR and Elixir/Phoenix, I liked more Activ
Actix?
@@NoBoilerplate yup.
things i like most includes new video notification from boilerplate channel
Thank you! I'll try to notify you more frequently :-D
actually, so far i find designing programs in rust to be exciting because i can come up with such interesting solutions, especially when it comes to enforcing safe usage of my own apis
Rust isn't the silver bullet, I think. The compiler is very slow and the language itself is ugly to read. However, it has it's advantages for sure.😉
Rust is extremely different isn't it! No inheritance, new syntax for lifetime annotations and borrows, and the compiler hates a lot of the standard normal patterns we've been using for decades. I know how you feel.
Back in 2020 I crashed out of learning Rust twice. First time due to multiple string types (Haskell's biggest mistake made again, I thought to myself) and second due to lifetimes. At the time I had a great mentor who picked me up and helped me back on the path. Most people don't have this. This is why I made my Rust series.
Yes Rust is very different from what you're used to. But that's the point.
As an example, two features you can't get in any language combined that I think you'll like are Macros and the Unsafe system. Macros are nothing like templates or cmptime (they're more like lisp macros), and the unsafe system is a genius way to ring-fence pointer arithmetic, to allow us to build safe abstractions around unsafe pointer code.
I did a video on both of them here, and I'd love your opinion on it: ua-cam.com/video/PuMXWc0xrK0/v-deo.html
Cheers!
Rust gotta be perfect, but Jack didn’t build twitter tho
Wikipedia says that Jack and a colleague build the prototype of Twitter "in about two weeks", though I understand that perhaps this isn't the whole picture, and I imgine he will have delegated by the time they scaled up, for sure,
my guess is 20 years at best. Because we are slowly hitting a limit in performance through binary computers. the computers themselves are going to need to start changing is my prediction otherwise a faster programming language wouldn't matter when you you hit a hardware bottleneck.
Alright, holy crap, I'll try out Rust. Damn.
WELCOME TO THE CARGO CULT.
The Book is a terrific place to start, it's very approachable doc.rust-lang.org/stable/book/
idk why but having rust never change is reassuring but also scary at the same time.
c++ cant change due to C never changing and it being a Super set of C
inability to change is scary and a roof but rust is up there currently and i dont think there are many non quality of life changes left to rust.
I didn't say that rust never changes, in fact, I said the opposite,
"Code written today will be guaranteed to compile in all future versions of Rust, while still being able to be used with future code we write in new versions of Rust."
The system that allows Rust to change without breaking backwards compatibility is genius, and it's called the Editions system.
Read about it here: doc.rust-lang.org/edition-guide/editions/index.html
_tehnically_ c++ is not a super set of c, since there are valid c programs which won't be compiled with c++ standards
a usual example is the fact that the c standard explicitly allows implicit casting from and to void pointer types, while in c++ these casts must be explicit
e.g. int *num = malloc(sizeof(int)); is a valid c statement, but invalid c++.
in order to be valid in both, the void pointer must be explicitly casted:
int *num = (int *) malloc(sizeof(int));
Ah, Go programmings language. A compiled language with a performance of an interpreted one. Why would someone choose it to write software in beyond my understanding :)
I don't hate Go, though you maybe surprised to hear it. I'd choose it over java every day of the week!
But it does not go far enough for my liking, it's a little too bare-bones for me.
This made me decide to drop go and just focus on rust.
Imagine what the rest of my Rust series will help you do ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
@@NoBoilerplate Thank you
Rust give me nightmare since I work with API alot and MS SQL. The package I was using drop mssql support.
oof, my sympathies!
Since the Twitter takeover, Elon Musk has mandated that all backend code be re-written in Java 11
ew
I definitely have a different definition of boring than Chris Dickinson.
How so?
I am hoping to create VST plugins and various other DSP software, is Rust appropriate for this?
Friend, I have great news. I recently tried out crates.io/crates/vst
and the demo vst compiled and loaded into my daw (reaper) perfectly!
I'd love to know how you go with this - I want to build my own VSTs too. Join my discord and tell me please! noboilerplate.org/discord
Yes, it is possible. Unfortunately VST3 API is so C++ infested, that it doesn't really mesh with Rust in ergonomic way. VST2 works quite fine though.
Implementing GUI has also proven to be rather challenging, because you're receiving windows from the DAW instead of the OS/Browser. That not something most GUI crates account for in their low level design.
Ada is a far superior language designed to be reliable, scalable and performant. If Torvalds was truly concerned about reliability, he wouldn't use C, a language which provides no provisions for safety.
Interesting! Why do you think he did though?
The only one reason I still have not made choice between C++ and Rust is c++ web framework drogon has better performance than any production ready rust framework. So I have very difficult choice. I see only one option: make same baas in c++ and rust and give opportunity to choose.
I finished watching the video and I am so close to choose rust. Hmmm
I dont think the performance differences between drogon and actix-web will be very big at all. Are you use that you need that last bit of performance?
There's not much in it, drogon is indeed faster, but Rust and Cpp crush the competition web-frameworks-benchmark.netlify.app/result?asc=0&l=rust,cpp,python,ruby
Rust will give you a MUCH better experience, I promise!
agreed web-frameworks-benchmark.netlify.app/result?asc=0&l=rust,cpp,python,ruby
Wait a sec
Are you building bigger apps than twitter and cloudflare?
How much more performance you need?
"I am tired of writing bullshit that I cannot guarantee" - can I get an Amen?!
honestly I should get that as a tattoo or tshirt or something!
3:53 Is Rocket basically the Laravel/Django of Rust?
No, Rocket is the Flask/Express/Sinatra equivilant, light and thin web-frameworks-benchmark.netlify.app/result?asc=0&f=express,sinatra,flask,rocket
It was a very good joke and we had a jolly good fun.
rust isn't "correct" as you said though, it has no support for formal verification for now.
i still love rust but i certainly wouldn't say it is the safest language when we got stuff like ada spark.
You're not wrong, but you're also not talking about most software written today. I don't really count spark ada because I can't write a website or an app using it.
I studied formal systems at university (Z, B, Coq), and was so sad when I discovered out in the industry that we basically don't use them. Fighter jets and pacemakers, you can count the number of production systems that are formally verified by hand in most years.
This is partly due to difficulty, but also partly because the state space of most web apps is too big to be formally verified - the complexity of a single string, for instance, is ENORMOUS. Formal systems work on very small, finite models with small numbers of states.
I want to get as much correctness into general purpose programming as possible, and I'm so excited Rust exists to give me this.
The ability to encode so much logic into the rich type system (compared to java, typescript and similar) gives me the same feeling of safety I had when using Haskell: I feel like if it compiles, it WORKS!
@@NoBoilerplate that is true, i do really like rust's safety features but it's not the only reason i use it, i'd rather build something in rust than in ada in term of dev experience.
also, it's a language where i feel handling errors is much less of an headache than most of the other things out there.
i think "correct" may not be a good term to describe rust although it is indeed memory safe, which eliminate a huge chunks of bug already.
though there are some ongoing efforts to bring formal verification to rust, but idk if it'll get somewhere.
also, since you mentionned haskell, rust is also very functional programming friendly, it does tail call optimization for example.
i do want to get into LISP more somedays though, but for now rust is definitely my daily driver for building most things.
@@alkeryn1700 Has TCO support been merged in yet? I'm out of the loop, that's great!
I, somehow, wrote lisp professionally for 2 in the mid 2010s, somehow! Clojure's very good, very mature and stable. We were building a startup bank, if you can believe it!
Not great for ML/DS though. You can nerd out about it all day, but it is only useful for its own paradigm.
Totally agreed re Data Science - in this field a long-running, heavyweight runtime is a feature, not a liability. Python's the king, of course, though if I were starting out today, I'd take a look at Julia.
Rust's not absent from Data Science, do check out ua-cam.com/video/mlcSpxicx-4/v-deo.html
ML I'm not sure I agree with you entirely. ML needs to GO FAST. While Rust isn't very active in this field yet, it's early days, I would expect to see much of the C++ fast plumbing of the ML pipelines be written in Rust as we go forward.
Rust is *80x* faster than Python, and at some point, you'd rather your stablediffusion run in 1s than 80s!
What do you think of Linus letter of response towards Rust developers?
Linux has his eyes wide open. Rust isn't perfect, but perfect is the enemy of good.
>Has more packages than NPM did.
Dude. This is like saying steam has more games than origin or something. It is an argument AGAINST the platform, when you need to plow through 1000s of packages to find something meaningful is definitely not good.
yeah, it's a pretty arbitrary measure - but you'd be surprised the people who care about this number to gauge 'ecosystem maturity'.
I can't understand why rust is way more popular than nim, crystal, or d. Can someone explain?
Nim has the most potential of those three, I'd say, but they all failed to escape the two biggest pitfalls of any programming language: inheritance and null references.
However, it also can't be ignored that Rust has the backing of a powerful foundation and a great many sponsors.
Ahmad, Bug: Agreed, I actually came to Rust via Nim (I co-maintain the inim project still). They're all good projects, but Rust is the only one without a garbage collector, and yet unlike C C++ and Zig, doesn't require risky manual memory management.
The Borrow Checker, which allows Rust to do compile-guaranteed memory management for you, also gives you superpowers that I talk about in other videos. If you've not seen them, start here ua-cam.com/video/Q3AhzHq8ogs/v-deo.html
But like who gives a shit about that when MPI, OpenMP and CUDA are not available for Rust? Fortran and C++ will still be needed for HPC.
I don't mind if Fortran retains the relevance it has today! ;-)
@@NoBoilerplate It's just a lot of these claims are very web-development or OS specific. I work in engineering and science and the standards will probably never change from C++/FORTRAN/Matlab. So in that case, Rust is not the perfect programming language everyone should learn and use for everything, it's just a very useful and good tool for specific applications.
@@nicolasmateogarciaguzman7897 The revolution could start with you! If I were doing HPC, I'd start with crates.io/crates/rayon
Rust has fairly high potential for HPC. One side-effect of borrow-checker is that nearly all pointers have perfect aliasing annotations. It does have some of the toys you'd expect from HPC language, such as inlining/hot/cold/unreachable annotations, parametric polymorphism as the default, safety check overrides, system threads,...
The tooling is not quite there yet. There are some early attempts to make Rust compile for GPU (including Rust CUDA) and there are several parallel computing libraries out there (Rayon being the most notable example, modelled after Cilk), which also provide the added benefit of memory safety, that C++ lacks.
Rust may very well give Fortan an C++ a run for their money in HPC at some not-so-far point in the future. The current focus is on the low-hanging fruit of web-dev. In there Rust can easily triumph in memory usage and p99 latency just by its lack of garbage collector, and it's CPU performance is not bad either, since it shares compiler back-end with C and C++.
1:59 Here you use Linus to make a point that Rust was good enough to make it into the Linux kernel-but I don't fundamentally think he really endorses it as much as you make it out he does. Mental Outlaw covered the addition of certain Rust-written drivers in the Linux kernel a few weeks ago, and here is what Linus had to say about it:
(This first note is a message he is replying to in an email.)
> As you know, we're trying to guarantee the absence of undefined
> behaviour for code written in Rust. And the context is _really_
> important, so important that leaving it up to comments isn't enough.
(Now Linus's response.)
"You need to realize that
(a) reality trumps fantasy
(b) kernel needs trump any Rust needs
And the *reality* is that there are no absolute guarantees. Ever. The
"Rust is safe" is not some kind of absolute guarantee of code safety.
Never has been. Anybody who believes that should probably re-take
their kindergarten year, and stop believing in the Easter bunny and
Santa Claus.
Even "safe" rust code in user space will do things like panic when
things go wrong (overflows, allocation failures, etc). If you don't
realize that that is NOT some kind of true safely, I don't know what
to say.
Not completing the operation at all, is *not* really any better than
getting the wrong answer, it's only more debuggable.
In the kernel, "panic and stop" is not an option (it's actively worse
than even the wrong answer, since it's really not debugable), so the
kernel version of "panic" is "WARN_ON_ONCE()" and continue with the
wrong answer.
So this is something that I really *need* the Rust people to
understand. That whole reality of "safe" not being some absolute
thing, and the reality that the kernel side *requires* slightly
different rules than user space traditionally does."
He then concludes later:
"Deal with it.
Or, you know, if you can't deal with the rules that the kernel
requires, then just don't do kernel programming.
Because in the end it really is that simple. I really need you to
understand that Rust in the kernel is dependent on *kernel* rules. Not
some other random rules that exist elsewhere."
Linus
So, his reception does seem very different to how you make it look. "Rust will not fundamentally change the Linux kernel, it is just another alternative language to compose it", appears to be roughly what he's saying-and I would agree. Most of these saintly, user-space features are entirely helpless when you are writing drivers, because things like that are on a monstrously low level.
The thesis appears to be that Rust isn't any different than C in such an environment. What do you think?
You're not the first person to suggest this email to me. Linus has his eyes wide open - Rust isn't perfect, Rust is VERY good, but comes with its own set of compromises. Those compromises have added value to kernel development, but it's not magic.
I'm so excited by Rust because it's the best tool for the job. It's not perfect, but it's the most perfect tool we have, in my opinion. When something better comes along (for values of 'better' that Linus would approve of, ie not popularity) you'll see me rave about THAT instead.
I don't love Rust, I love sleeping through the night without getting paged XD
@@NoBoilerplate Haha. I suppose if Rust had existed when Linux was first developed, things might've looked very differently. Anyway, my apologies to make you reply to the same argument twice. I just wanted to know how to square my impression of Linus's skepticism towards Rust and the wonderful features it appears to provide that'd make things seem a lot simpler than C. Thank you for the reply, and have a great day. ^^
I am careful about Rust, but I have to say - put Rust next to a C++, C and Swift... And you will see quite fast that Rust is the only enjoyable language to write out of these... I am still a beginner coming from TS language, but hell, Rust is like TypeScript with steroids that just feels right...
Yes! If you need help, do come and ask in #newbie-advice on my discord - Good luck!
Rocket is a pretty bad example right now, development has staled a lot and it's lastest version has been a release candidate for ages
That's a shame! I like poetry as a framework too
@@NoBoilerplate oh, I got to check that out! Really liked rocket, I hope it picks up some steam again sometime soon.