Rust: Your code can be PERFECT

  Рет қаралды 110,610

No Boilerplate

No Boilerplate

Күн бұрын

(this is a re-upload of my original version)
A 6-minute lightning talk explaining how you can write perfect code with rust.
If you would like to support what I do, I have set up a patreon here: / noboilerplate Thank you!
Start your Rust journey here: doc.rust-lang.org/stable/book/
Transcripts for all videos here: github.com/0atman/noboilerplate
This is a re-upload of my first Rust video (original here • [archived] Rust: Your ... ), now with a font that you can read on mobile, and some minor fixes. There are still some remaining problems that I didn't want to put time into fixing (I'd rather make new videos). As ever, all corrections are in the pinned ERRATA comment.
CREDITS & PROMO
My name is Tris Oaten and I produce fast, technical videos.
Follow me here / 0atman
If you like sci-fi, I also produce a hopepunk podcast narrated by a little satellite, videos written in Rust! www.lostterminal.com
If urban fantasy is more your thing, I also produce a podcast of modern folktales www.modemprometheus.com

Пікірлер: 342
@NoBoilerplate
@NoBoilerplate Жыл бұрын
ERRATA This is a re-upload of my first Rust video (original here kzbin.info/www/bejne/f3KXomOir9KsnK8), now with a font that you can read on mobile, and some minor fixes. There are still some remaining problems that I didn't want to put time into fixing (I'd rather make new videos). As ever, all corrections are here: - typo'd "unwrap" at 00:34, classic me. - Memory leaks are still possible, but you have to REALLY TRY HARD to make them. - I use the word "safe" interchangeably to mean "memory safety" and "doesn't crash". - Despite changing the wording, it still sounds like `forbid(unsafe_code)` forbids the unsafe block in app dependencies - it does not, it only stops using unsafe IN YOUR APP, not the crates you link to. - 3:05 "Tris" should be a &str, not a String.
@eduardsukhavenka9750
@eduardsukhavenka9750 Жыл бұрын
After reading all of this, I concluded that rust isn't absolutely perfect, memory leaks are still possible, and unsafe code in dependencies still runs. It's slightly disappointing, does it mean perfect language cannot exist at all? Or maybe those problems are insignificant, and we can even forget them and count rust as a truly perfect language?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@eduardsukhavenka9750 When I wrote this talk (I didn't change much on re-upload) I also thought this. (it's why I was so excited that I thought you could block unsafe code everywhere). The real genius of Rust is that unsafe is 1. possible and 2. highly contained. Imagine if your language didn't have unsafe. That's easy, think of Python or Ruby or JS. If you want low-level access for hardware or speed, you have to write a C extension... and throw away all your safety anyway. But now, you're in a worse situation: You're writing an entirely new language that most of your developers can't audit. Rust's genius isn't that the whole language is safe, or that the whole language is not safe, it's that the unsafe system allows you to write not safe code in a more safe way than any other language. Do check out my follow-up video kzbin.info/www/bejne/ZqOtameol8mnm6c and the 2 others, I have learned much since this video. Thank you!
@eduardsukhavenka9750
@eduardsukhavenka9750 Жыл бұрын
@@NoBoilerplate so you're saying that rust has some issues anyway, but they are easier to deal with than in other languages. And maybe it's not an ideal language, but it's totally new stage of development. Thank you for reply. And I'll definitely watch your other videos. (P.s.: Already done :D) For some reason my last so-colled conversations in KZbin didn't go well. Each time I tried to write comments, people reacted like they didn't understand what I'm talking about. I'm glad that you found time and answered in such a long form!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@eduardsukhavenka9750 my pleasure ☺ the KZbin comments system is really difficult to follow! Yeah, rust isn't perfect, but it's the best way to write perfect code 👌
@whatever990
@whatever990 Жыл бұрын
You wrote "unrwap" at 0:34, time for a re-re-upload ;-)
@Robin_Goodfellow
@Robin_Goodfellow Жыл бұрын
Fireship is my favorite channel about web programming, and I wanted you to know I consider you to be my Fireship for Rust. Same clear, concise format, same excitement about what can be done with code when I've finished watching.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! I'll check them out!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@June@97 Right! I didn't anticipate going quite so deep into Rust, but there's STILL loads more I want to talk about. I've got plans for non-rust technical videos, but they'll have to wait until I'm not so excited by Rust XD
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@June@97 interesting!
@bellmar2000
@bellmar2000 10 ай бұрын
​@@NoBoilerplatethe fact that you're not familiar with fireship just shows how much you Excell at being a creator and not a consumer of content and media. Keep building shit.
@NoBoilerplate
@NoBoilerplate 10 ай бұрын
@@bellmar2000 I mean, that was 11 months ago, I'm very familiar now! 😁 Consumption is not evil, to write one must have read extensively, right?
@ombrezz7030
@ombrezz7030 Жыл бұрын
5:33 there's no closing bracket and now you'll never unsee it
@NoBoilerplate
@NoBoilerplate Жыл бұрын
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
@ivanjermakov
@ivanjermakov Жыл бұрын
Don't worry. Rust compiler will guide you :)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@ivanjermakov Yeah, after this video I started running all the examples through the compiler!
@jdiehl2236
@jdiehl2236 Жыл бұрын
Tris makes even the word "bullshit" sound elegant and meaningful
@NoBoilerplate
@NoBoilerplate Жыл бұрын
You're too kind!
@mateuscortianoschwarz7276
@mateuscortianoschwarz7276 Жыл бұрын
let's watch it one more time then. love your content.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I mean, you don't have to, but at least this time you can read it! XD
@isweartofuckinggod
@isweartofuckinggod Жыл бұрын
the irony of this video being the one that needed a fixed re-upload is not lost on me.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I never said my video skills were perfect XD
@hassanmohameddiab
@hassanmohameddiab Жыл бұрын
the video was not created using rust, so makes sense.
@nextlifeonearth
@nextlifeonearth Жыл бұрын
Rust's GC is so good it figured out it should clean itself up.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
ha!
@raiguard
@raiguard Жыл бұрын
I really like rust. I love how by the time my code compiles, it usually works. It does so much compile time analysis that's it's almost scary. The tooling is very modern, and it mostly just works with no fuss. However, it's not perfect. Error handling can be a chore when you have errors of different types. The language is very complex, and has lots of obscure syntax. And the borrow checker, while incredibly useful, also has annoying limitations that straight up prevent me from writing code that I know will work, but that Rust does not. Rust is the first in a new generation of programming languages. It laid the foundations and invented the borrow checker. I can't wait to see what other languages are created to improve on its concepts!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Given the flexibility of rust's macro system and the constant improvements to the language, I'm excited for rust to improve those concepts itself!
@weirdo911aw
@weirdo911aw Жыл бұрын
With the nature of Rust, it can improve itself again and again. Sort of like an AI, it might have infinite potential. So there is probably no need for any other language any time soon. It is literally any open-source developer's wet dream come alive. Which is apt because it was created purely from open-source. Yes, it is a difficult language but when C first came out 50 years ago, people probably said the same thing. And now it is the foundation of all languages.
@za012345678998765432
@za012345678998765432 Жыл бұрын
Can't you just use the unsafe keyword for code that you know will work but rust doesn't?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@weirdo911aw Love the optimism! I don't need the language to be perfect forever (and it probably won't be!) but 40 years seems plausible!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@za012345678998765432 My understanding is that unsafe should be a last resort. It MIGHT even be better to go with safer, but slower, code if it avoids unsafe. Personally, I've written whole websites without ever dipping into unsafe. Of course, the FRAMEWORKS I've built those websites in have used unsafe for a few foundational pieces (perhaps a fast router within the server), and my application is better for it, and yet doesn't rely on C!.
@costelinha1867
@costelinha1867 Жыл бұрын
"The Rust community has re-written all of these in pure Rust" Something: Exists. Rust fans in Borg Voice: You'll be assimilated.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I guess the whole "rewite it in rust" meme started because Rust was literally designed to overcome the problems of C, and people did exactly that. However, I think this has spread into the higher-level languages too, because Rust is ALSO a high-level language (as explained in my 'turtles' video)
@costelinha1867
@costelinha1867 Жыл бұрын
@@NoBoilerplate Sometimes it's really easy for me to forget that Rust is high level, maybe because my mostly Python only experience. I just automatically think of Python when I think "High Level Language" lmao.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@costelinha1867 if there's one huge takeaway from videos is that: rust is sneakily high level!
@costelinha1867
@costelinha1867 Жыл бұрын
@@NoBoilerplate Yeah. To be fair, I feel more and more drawn to Rust, despite never trying it yet. Even if it's just to do some random stuff that run in web assembly. And besides those error messages. I wish Python had error messages like that lmao.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@costelinha1867 look out for my next video, I show how to set up a kick ass rust setup!
@skyeelliot2601
@skyeelliot2601 Жыл бұрын
When I write Rust code that works, it's always so incredibly satisfying that it gives me a warm, fuzzy feeling inside. This video expertly captures that feeling.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Most loved language for 7 years! (also, note that Rust 1.0 has been our for the same amount of time COINCIDENCE?)
@muizzsiddique
@muizzsiddique Жыл бұрын
It feels so good being able to read and understand the code on my third time watching this video versus the first time when I just about started reading The Book!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I too hope one day to understand the code here XD
@sharletkurien
@sharletkurien Жыл бұрын
Wonderful how you've taken the time to introduce these fixes, enjoyed the content and I wish you the very best in all of your endevours! Thank you, have a blessed one
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! There were TOO MANY errors in the first one XD
@sharletkurien
@sharletkurien Жыл бұрын
@@NoBoilerplateHaha yep, always pleased to support someone amazing!
@dakata2416
@dakata2416 Жыл бұрын
A monad is just a monoid in the category of endofunctors
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Can you even imagine. Now, I like Haskell, but I like a language that I don't feel embarrassed to explain more 😂 I was sad when I saw that rust doesn't have pure functuons. Then I learned about its immutabiity by default, and then the unsafe system, and then const functuons. And then I realised it kinda does!
@itellyouforfree7238
@itellyouforfree7238 Жыл бұрын
a monad is just an anagram of nomad. that's right, haskell developers should be homeless and wander around the country
@theherk
@theherk Жыл бұрын
Your channel is outstanding and I hope it grows quickly. You presentation in pacing, voice, and graphics are superb... and of course the subject is excellent.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much for saying so! I've had a lot of practice in doing weekly editing of my hopepunk podcast, did you see it? kzbin.info/www/bejne/pmTFdXhvoNitg8U
@theherk
@theherk Жыл бұрын
@@NoBoilerplate I wasn't aware of it, but it is interesting. There are loads of episodes. Thank you.
@DrIngo1980
@DrIngo1980 Жыл бұрын
Man, I am so happy I subscribed to your channel. Great content with no bullshit. I love it! Thank you! Keep that Rust content coming.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! Will do, new video Thursday!
@irlshrek
@irlshrek Жыл бұрын
You're the reason I'm learning rust! High level content
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Fantastic! This is entirely the point: This language can do SO MUCH MORE than most people talk about. It's not just a better C++, it's a better python, a better javascript! Hit me up on twitter if you want any advice!
@irlshrek
@irlshrek Жыл бұрын
@@NoBoilerplate I will thank you!!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@Fawaz Shaikh both!
@ivy8483
@ivy8483 4 ай бұрын
@@NoBoilerplate is there a course you recommend? I’m new to coding and I’m really sold on rust for its diversity and growing community; paid or free I’d appreciate the advice !
@TheGreatKingChaos
@TheGreatKingChaos Жыл бұрын
Your videos have inspired me to pursue programing again. The prospect of using Rust to build fast and safe applications is really exciting! Thank you!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Go for it!
@user-rr8hc8ls5n
@user-rr8hc8ls5n Жыл бұрын
I can watch your videos every time you reupload them
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! I'll try not to do it too often - I'd rather make new videos! Have you seen my hopepunk podcast? kzbin.info/www/bejne/pmTFdXhvoNitg8U
@emreaka3965
@emreaka3965 Жыл бұрын
I started to learn Rust a few days ago. Thanks for the videos!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My pleasure! It's tough to get started, keep going, and watch my videos for inspiration! :-)
@philippefutureboy7348
@philippefutureboy7348 Жыл бұрын
0:18 My first reaction: A mine field 🤣
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Absolute minefield! And this kind of code is in production EVERYWHERE!!!
@philippefutureboy7348
@philippefutureboy7348 Жыл бұрын
It’s so horrendous it’s almost comical!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@philippefutureboy7348 Nothing funny about our brothers and sisters working in the python mines. One day soon we'll liberate them!
@itellyouforfree7238
@itellyouforfree7238 Жыл бұрын
and let's just hope nobody did "int = str" before that! :D
@jonnyso1
@jonnyso1 Жыл бұрын
@@NoBoilerplate Guilty.
@Hellhound_RedFox
@Hellhound_RedFox Жыл бұрын
I've been reading the Rust documentation and watching a lot of videos for some month and today I started development of a Discord bot for my friends and I, using Rust. I already did this project using Python some time ago, and the first thing I saw was that despite the many calls to different APIs, Rust does not let me down. The rust analyzer is an awesome tool that lets you see where the code might fail and where it will definitely fail. I feel like I've made a program with good code quality without trying too hard. It's a really good language to teach you how to think better about building software.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
You've got it exactly. I wrote "Rust makes you feel like a genius" exactly because of this experience!
@lukeg9891
@lukeg9891 Жыл бұрын
After this video, I thought "What a baller, I could be best friends with this guy!" I love the way you explain things. It's like you're reading my mind.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! If you like scifi, you can hear more of my voice in my podcast, which I'd love to know your thoughts on kzbin.info/www/bejne/pmTFdXhvoNitg8U
@ImrazorZodd
@ImrazorZodd Жыл бұрын
Damn I haven't been hyped about something this much in a while. Thanks for selling me on the idea of trying rust.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My pleasure! Check out my other videos too, especially this one kzbin.info/www/bejne/hqawiYqZZd2lgZI
@Panakotta000
@Panakotta000 Жыл бұрын
Your videos inspired me to learn rust, i did a lot of in-depth c++ development... I have some things i struggle with: 1. Finding a good project that would make sense to be made in Rust, I first wanted to try to do a simple motion graphics sofware but the GUI landscape isnt great yet, mainly experimental approaches to GUIs, or GTK... the Qt binding is practically non existent... I never had a good experience with GTK even in C++ and a look at the Rust binding doesnt make it better (especially in terms of custom widgets), result was, I wanted to investigate GUI frameworks them self on how they work, so i wanted to make my own little one... but there i struggle to adapt the concepts from OOP to a Rust environment (I know, different world, you do things differently etc. that doesnt help to adapt the concepts) which leads us to the seccond thing: 2. Can you make a video about design patterns in rust, specific rust patterns but also how to da adapt patterns from the OOP world to rust, or alternatives to those... I especially struggle with missing inheritance... right now to mee it seems... i have to write a lot of boilerplate code, especially to give data access... 3. Can you talk about... heap... we have Boxes, okay... but how do they work exactly, how can we use them... stuff like doubly linked lists etc. how does this work with the borrow checker? If its reference counted, wouldnt that mean you can still create memory leaks? (A having Smart Pointer to B, B having smart pointer to A)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
1. I can IMMEDIATELY help you with your native app desires: tauri.app just went 1.0 - have fun! 2. Rust patterns are functional patterns, try searching for "functional patterns for object oriented people". My tip is to entirely abandon OOP, I am beginning to suspect it was never good for us... I'm well-versed in the Gang of Four design patterns - and nearly all of them can be replaced with first-class functions (like rust has). 3. This is too low-level for me, I am very happy for other people to make a good quality implementation that I can use. Rust is 80x faster than Python, so I just don't worry too much about optimisation! (I will be doing a video on this soon)
@BrazenNL
@BrazenNL Жыл бұрын
Ad 3) Search for Jon Gjengset's channel Crust of Rust.
@Panakotta000
@Panakotta000 Жыл бұрын
​@@NoBoilerplate 1. Na, tauri also is not something I want, the whole point of why I would want to choose native GUI development is to detach me from the Web Stack, and Tauri seems to be just a neat wrapper around all the web clutter... I want something that runs more low level, less abstractions... If i would want to use the web stack... i nearly dont see a point in using Rust except if I need to run some stuff using web-assembly, but I still would ned JS and all that other stuff... no... i need a native non-web solution 2. TBH... I hate it if people declare people something as completely bad, or you should abandon something... You cant categorize stuff polar as good or bad... everything is a mix... so in my experience.... the mix of the paradigms is key... "entirely abandon OOP" is the wrong approach in my opinion... its not like we abandond structural programming even tho you could say OOP is the chronological following paradigm... OOP was/is success full because it makes specific things easier... but in some aspects it makes it worse... the ideal thing is to incooperate the different unique things of the different paradigms and create sultions using these different ways to solve a problem... there is a reason why OOP is successful even tho there is some stuff that is "garbage", instead of abandoning OOP, we should take the stuff we learned from OOP, what really went well... and extend upon them with the other paradigms... many languages nowadays are multi paradigm languages... we just havent managed to create a coherent way of using the different sultions for problems... nobody would say procedural or structural programming is bad... and the same can be said about OOP... the mix... its always the mix that is important... same as for programming languages... there is not a single programming languages that is best suited for all problems... different projects, different requirements are best suited with different languages... the ideal state would be... when each aspect of a system gets implemented with the language that is best suited for that specific problem... instead of forcing the different languages to solve issues, it not really was designed to solve... 3. I meant not in sense of optimization, i ment in sense of... bugs... I ment if stuff like this is possible using Box'es: stackoverflow.com/questions/38298008/possible-memory-leaks-with-smart-pointers
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@Panakotta000hmm. 1. If you're on windows, a simple soliton is to use the windows crate to make native windows, I think? There's a few other options, check out crates.io 2. I like that Rust isn't cluttered with multiple paradigms all jammed in together - look at java for that! I am delighted they have chosen functional as the main influence. I really think that data and functions is superior. 3. I am glad that smart people are working out how to do these things safely, so they can package then up into crates that simpler people such as myself can just use! 😁
@Panakotta000
@Panakotta000 Жыл бұрын
​@@NoBoilerplate 1. I will just try to do my own simple GUI framework... I will rely on some windows stuff, on some othter cross-platform crates (like "winit") and some other safe and unsafe bindings like "skia-safe" and "skia-unsafe"... there is a nice blog poste about that sort of stuff on what you should all consider... and I think its great learning oppotunity to learn how input handling and other stuff works on a OS User Space leverl 2. At the current state I think you cant say much if something superior or not and its all more subjective as functional stuff is still relatively new (and not so wide-spread), I to cant say that OOP is superior... as said... I'm new to rust and languages where I dont have many OOP patterns, so I'm not at a spot to judge... but I assume the mix is important... as for many many many things 3. But then I think we go into the direction where you then constantly choose the "convinient stuff" which often results in less performance, than if you try to use a tailored approach for something... and as said... the docs say the Box'es are refrence counted... following RAII... then that should mean you can run into that sort of memory leak...
@duhby
@duhby 5 ай бұрын
> Not even OpenSSL has escaped oxidation (5:53) I love this quote lol
@shrestha0144
@shrestha0144 Жыл бұрын
I love your content style
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much, I practice very carefully to make it as good as I can :-)
@erikschiegg68
@erikschiegg68 Жыл бұрын
Ok dude, that convinced me. Thanks for showing us around.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My pleasure! Do check out the rest of my Rust series, there's WAY MORE cool stuff here! Playlist: kzbin.info/www/bejne/h2Skma1-pp2indU
@erikschiegg68
@erikschiegg68 Жыл бұрын
@@NoBoilerplate Already in my stored mediapool. Rust forced me to...
@Elliot.2591
@Elliot.2591 Жыл бұрын
started learning rust because of you :) i love it, just wish some libraries were just as elegant as python counterparts.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
At least you can rest assured that they're much better performing XD I was SO sad when the python foundation said that they were not removing the GIL for Python 4 :-(
@Elliot.2591
@Elliot.2591 Жыл бұрын
@@NoBoilerplate Something that helps me learn new languages, is going through intermediate projects(because they can usually be done in any language) like webservers, system integrations, computational puzzles, etc that i’ve already solved in one language then solving it in the new one. I feel like new languages can be scary for a lot of people because they are worried it’ll be just as difficult or slow to learn as their first/second language, but there are neat tricks like this to get them through it.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@Elliot.2591 That's a really great way of looking at it :-D
@Elliot.2591
@Elliot.2591 Жыл бұрын
@@NoBoilerplate i had another reply that i sent that disappeared i guess. my other one seems outta place haha.
@Elliot.2591
@Elliot.2591 Жыл бұрын
@@NoBoilerplate It’d be amazing if you could followup these videos with a presentation of things Rust does differently from high level languages. Examples: - An iter object can only use the .any method once whereas a vector has the ability to do it multiple times. - There CAN be runtime errors. The compiler doesn’t force you to handle all of them. For example, opening/creating a file from a user provided path. I tested this and wasn’t alerted at compile time that there are possible ways the code can panic. - The println macro doesn’t have to be flushed whereas the print macro does. There are technical reasons for this design choice but its still a misconception. All these little things had me scratching my head, wondering why my code wasn’t working even though my experience tells me it should. Pointers and memory management wasn’t as difficult to grasp as errors that don’t resemble most languages(comparing to C#, Java, Python, Javascript(ts, jq…), and Swift). It could just be that im stupid, but after getting through a lot of the issues i noticed a pattern.
@Lord2225
@Lord2225 Жыл бұрын
You reupload and fixed errors but keept biggest mistake - forbid(unsafe_code) does blocks unsafe code ONLY in code you have written. Most libraries and even some std modules will still use unsafe code bsc they have to. Rust cannot guarateen all code to be safe and optimal in same time - so for some optimalizations programer has to do some 'unsafe' assumptions - these don't have to be dangerous, but compiler cannot see that.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
AGH! I did try to fix that, I removed the "your app and all its dependencies" wording, but now that you point it out, it STILL IMPLIES THAT. I'm so sorry. I'll re-add it to the errata comment. ugh.
@decathorpe
@decathorpe Жыл бұрын
I have one more errata to add to the list 😅 libpq, openssl, etc. have, in fact, *not* been oxidized / rewritten in Rust. the "pq-sys" and "openssl-sys" crates are bindings to the existing libraries. There's of course ongoing efforts to create pure-Rust alternatives, but the bindings for "native" / C libraries are still much more popular and feature-complete in most cases.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I'm specifically talking about rustls and tokio-postgres
@decathorpe
@decathorpe Жыл бұрын
@@NoBoilerplate Granted, tokio-postgres seems to be pure Rust. Rustls, on the other hand, depends on the "ring" crate for cryptograhy - and ring is a fork of BoringSSL - mostly written in C and Assembly.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@decathorpe Oh is it! Thank you for letting me know, I didn't know that. I note that 14.0% of ring is c, and an ASTONISHING amount is assembly, and 1/3rd Rust. I fear we're playing an increasingly pedantic game here! I will change my examples for pure rust, even though the VAST MAJORITY of rustls is pure Rust. I wonder what the assembly is for...
@decathorpe
@decathorpe Жыл бұрын
@@NoBoilerplate As far as I know, the assembly is used for highly optimized implementations of cryptographic algorithms on various CPU platforms :)
@dinophage
@dinophage Жыл бұрын
Love the content! I'm curious, as a previously (sounds like) heavy user of python - have you experimented with Nim at all? I'm learning rust, but I am also interested in Nim. I know there is Py03, but with Nim being incredibly fast as well, and being able to convert module imports to (near?) native python imports (with nimporter/nimpy usage) it seems like a very easy transition. I'm curious though, how it stacks up in terms of how 'perfect' code can be as compared to rust - which I agree is amazing at making you make near-perfect code.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Nim was my gateway to Rust. I'm even a co-maintainer of github.com/inim-repl/INim (which you should use!) However, Rust beats Nim on a few key features: Popularity, bare-metal, and no GC. Yes, I know there's arc/rc options in Nim, but for me, lifetime annotations are a FEATURE, not a punishment. More details on this in the next video!
@dinophage
@dinophage Жыл бұрын
@@NoBoilerplate Awesome, thanks for the insight. That makes sense, as that's the trajectory I'm on as well. I'm pretty surprised nim doesn't have a bigger following given its position on the continuum between python and rust. Looking forward to the next video, cheers.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@dinophage Corporate backing counts for a lot, sadly! Go has Google, Rust has (had?) Mozilla etc
@chip11656
@chip11656 Жыл бұрын
I am sold!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Yes! Have a look at my other Rust videos, there's even more incredible stuff here kzbin.info/www/bejne/pYqTiaqDhLitp5Y
@jaka6926
@jaka6926 Жыл бұрын
@no boilerplate are you using reveal.js? looks awesome
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I am! I can't take any credit, I'm using Obsidian.md (where my brain lives) and using the Advanced Slides plugin so I can use inline css to tweak the font size. Obsidian is incredible, everyone should use it!
@thanatosor
@thanatosor Жыл бұрын
Is this guy dedicating this channel to Rust ? Worth it.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
When I learned Rust, I had a mentor to help me through the steep learning curve. Most people aren't so lucky, so I made these videos to help :-)
@thanatosor
@thanatosor Жыл бұрын
@@NoBoilerplate Respect ! I also learned Rust by the hard way for 2 weeks by making something useful in real life. Perhaps having a proper mentor can shorten that amount of time.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@thanatosor I'm building a community around the discord server, if you want some help, come and chat in #newbie-advice! Links on noboilerplate.org
@thanatosor
@thanatosor Жыл бұрын
@@NoBoilerplate may have a look. thx
@WackoMcGoose
@WackoMcGoose Жыл бұрын
3:05 NullIndexException: Enum "Planet" expected 9 entries, found 8.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
RIP kzbin.info/www/bejne/hpTWhIeZjbKiotk
@connorkapooh2002
@connorkapooh2002 Жыл бұрын
This is pretty sick actually, do you know what the general status of DL is within the Rust community? That'd be the main thing keeping me to Python
@IamusTheFox
@IamusTheFox Жыл бұрын
I want to start off by saying; I really enjoy your videos! I do think Rust is a lovely language, and there are many times I suggest people use it. I will heartedly agree that rust has a lot of correct defaults. My one problem is, I've never seen a compelling case to move from C++. Worst I've not yet I've only heard suggestions or reasons that I don't find to be all that "true" (for lack of a better word). You can do many things in C++ exactly as safe as you can in rust as an example. You can just do a lot of things in C++ that you shouldn't. And I have found the rust community to be extremely passionate and thoroughly love their language. Defending it even when they don't know enough C++ to make meaningful points. I don't mean to say C++ is better, it's not. I just want to have a good reason to switch.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Here's the problem: You sound wise and smart, and know to use the safe features of C++, but not everyone is: Your faith in the intelligence of C/C++ developers is not shared by Microsoft, Google, or the OpenSSL team. They experience the growing pains of the language's flexibility: Once your program becomes non-trivial, it appears to be impossible to avoid memory nightmares, which manifest as security holes so terrible that we give them names: Slammer worm, WannaCry, Trident exploit, HeartBleed, Stagefrieght, Ghost
@IamusTheFox
@IamusTheFox Жыл бұрын
@@NoBoilerplate I want to be clear, I've met many C++ programmers who honestly shouldn't use c++. I would also argue it's the age of the project, not the size, that are the heart of the issue, but the age. It feels like a large group of people think that modern c++ is c++03. (Obviously not counting you in this number) I fully agree with older code bases switching to rust because clearly those programmers can't be trusted, lol. I also don't really see Rust as a direct C++ replacement, but more as a C replacement. I've said for years, and I will die on this hill. Between Rust, C++, and even micropython, C doesn't have a home. Long story, but I recently went back to school for C++ after already having a mastery of it. What they were teaching was at time barely c++03. For those who don't know, the C++ version is named after the year it was standardized, e.g., C++03 is nearly 20 years old. I had to turn off warnings on my IDE and in compiler to complete the assignments. If this is the C++ being taught I would welcome it being replaced with rust. I do genuinely think, while you had a valid point with those exploits, I think you were off with the cause. I'm honestly not that smart, C++ just has really good tools, and gives you enough information to avoid issues. Thank you for your time, and wonderful videos @No Boilerplate
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@IamusTheFox Yeah, I think so too. I've got a draft video in my backlog with the title "Rust can't replace C++, but it can for YOU", with the same points you've noted above. Thank you!
@IamusTheFox
@IamusTheFox Жыл бұрын
@@NoBoilerplate I am really looking forward to it! Keep up what you do, you're fantastic at it!
@jonnyso1
@jonnyso1 Жыл бұрын
@@IamusTheFox Honestly, its a HUGE problem in the tech world how schools can't keep up with the tech and just teach outaded stuff. But they can't really prelude the course with "Most things you learn here are kinda useless at this point".
@RoamingAdhocrat
@RoamingAdhocrat Жыл бұрын
0:34 the `10`, is that a default, or a magical "decode string assuming it's a decimal value" parameter? edit: d'oh, it is a radix, and indeed means "treat string as a base-10 representation of a number"
@lucky-segfault4219
@lucky-segfault4219 Жыл бұрын
looking forward to when re-upload fixes can be avoided thanks to a video! macro
@NoBoilerplate
@NoBoilerplate Жыл бұрын
That would be perfect!
@sru3957
@sru3957 Жыл бұрын
Классно совмещать 2 дела, учить английский благодаря прекрасному голосу спикера и изучать при этом любимый язык программирования! Спасибо друг, береги себя!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you! I try to speak clearly and carefully. If you would like to read and listen, I publish transcripts on my repo here: github.com/0atman/noboilerplate If you would like to listen to more of my clear voice, with text too, I'd love to know what you think of my sci-fi podcast, Lost Terminal: kzbin.info/www/bejne/pmTFdXhvoNitg8U (10 seasons so far!)
@theseangle
@theseangle 4 ай бұрын
Это, кажется, британский акцент. Ещё есть канал "Tom Scott". Он тоже британец и его видосы офигенны. К сожалению, он улетел в закат.
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
Do you know any good ssh/scp library for rust that supports connecting through jump hosts?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Not familiar, however maybe one of these will work for you? crates.io/search?q=Ssh I especially like the look of stund
@Rogueixpresents
@Rogueixpresents Жыл бұрын
7 seconds ago haha, hello man love ur vids! more rust pleaseee!! :D
@NoBoilerplate
@NoBoilerplate Жыл бұрын
DEAL
@Megalcristo2
@Megalcristo2 Жыл бұрын
I would like Rust to have: static associated members, anonymous structs, standard way to have a lazily initialized value, alias for type bounds…. And there are a lot of methods and functions that are still unstable since 2017. It's a great language, but there is still a lot to do.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I couldn't agree more. But it's SO GOOD already!
@svelterust
@svelterust 11 ай бұрын
Why anonyomus structs?
@cerulity32k
@cerulity32k Жыл бұрын
If you go down to the CPU level, computers are literally just moving numbers. There really isn't much else to it. Playing audio: Moving samples into a sound buffer, a special spot in memory. Displaying graphics: Moving vertices, shaders, colors, and matrices into the GPU in it's video memory, and putting that memory somewhere else. There are two types of errors: Semantic errors e.g. impossible to parse strings (e.g. trying to parse "Hello" as an i32) Segmentation faults e.g. list[10] when the length is only 4, leading you to access memory you aren't allowed to access If you can figure out an efficient way to prevent segfaults while still being non-limiting, you have essentially solved half the errors in programming. The borrow checker does this. If you can figure out how to catch and prevent all errors, you have solved the other half. The exhaustive branching with compiler enforcement does this. Rust has essentially solved programming.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Ah, if only! Have you tried Rust? Totally recommend the book if not, that's how I started.
@analisamelojete1966
@analisamelojete1966 Жыл бұрын
Rust is a really great language, not to mention that cargo solves a huge python problem which is dependency management.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I get so embaressed when I explain python package management to people XD (even my favourite, Poetry, is built on poor fundamentals)
@analisamelojete1966
@analisamelojete1966 Жыл бұрын
@@NoBoilerplate I feel you, I use poetry on my job, and it’s been dependency hell (some versions do not support backwards compatibility, I guess it’s 1.3 or so).
@leonmatt4799
@leonmatt4799 Жыл бұрын
hahaha, yea, i remember when i watched it the first time, i was on my phone. It was hard, good thing you fixed on the next videos cheers
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thanks for sticking with me while I figure out this whole KZbin thing 😂
@AlexSmith-jj9ul
@AlexSmith-jj9ul Жыл бұрын
I was wondering how rust prevents sql injection at 5:22. From what I understand about how sql works the query would all be processed by sql at run time. This would mean that a user could, in theory, inject code into the query e.g. select * from forms where Id=‘123; drop database example’;. (‘’ for inserted user response) This would force you to filter user input to avoid the vulnerability in a similar way to other languages.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My mistake here, this is my oldest video and it's not very clear. I should have said that using SQLx's Query type defends against injections github.com/launchbadge/sqlx#querying
@AlexSmith-jj9ul
@AlexSmith-jj9ul Жыл бұрын
@@NoBoilerplate No worries, The only reason why I ask is because I might learn something new to improve my code.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@AlexSmith-jj9ul Apart from injection, SQLx Is the best sql framework because of its compile-time verification of queries. - Have you grokked this feature? github.com/launchbadge/sqlx#compile-time-verification
@gangov
@gangov Жыл бұрын
You gave rocket.rs as an example in your video - how's the support for async these days and how would you compare it to actix-web
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Actix is one of the fastest web frameworks on the planet. It's a little scary to use for newbies. Rocket is extremely friendly for newbies, and is faster than most dynamic language's frameworks. Do check out Poem - it's nearly as fast as actix, and has really nice REST support. It's my favourite.
@gangov
@gangov Жыл бұрын
@@NoBoilerplate thank you!
@sodiboo
@sodiboo Жыл бұрын
3:05 I don't think this snippet compiles. "Tris" should be a &str, not a String, at least from my knowledge. Was that intentional?
@Hellhound_RedFox
@Hellhound_RedFox Жыл бұрын
Yeah I think it should be String::from("Tris")
@sodiboo
@sodiboo Жыл бұрын
@@Hellhound_RedFox or just "Tris".into(), for a slightly less verbose syntax
@NoBoilerplate
@NoBoilerplate Жыл бұрын
D'oh! Missed that on my driveby corrections. I'll add it to the ERRATA comment. In all future videos I try to compile everything XD
@AceofSpades5757
@AceofSpades5757 Жыл бұрын
Fantastic and funny
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My pleasure! This is my first videos, despite the re-upload there's much better subsequent ones, I'd love to know what you think of them!
@unusedTV
@unusedTV Жыл бұрын
I'm so sorry to say this, given that it's a re-upload, but at 0:35 there's a typo in "unrwap" (w and r swapped) at the bottom.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Aye, its in the errata pinned comment, sorry about that! The quality of my early videos was a bit hit and miss, but the excitement is real :-)
@unusedTV
@unusedTV Жыл бұрын
@@NoBoilerplate Ah, I missed that! Either way, cheers for the rust videos. I haven't adopted it yet, but the calling code being responsible for sending the right types sounds like an absolute joy coming from Python.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@unusedTV It sure is! I also have come from Python, did web dev with it for 10 years. Check out my whole series: kzbin.info/www/bejne/pYqTiaqDhLitp5Y
@JorgetePanete
@JorgetePanete Жыл бұрын
0:32 now unwrap is misspelled 😫
@NoBoilerplate
@NoBoilerplate Жыл бұрын
ikr absolutely fml
@vedantnn7
@vedantnn7 Жыл бұрын
loved it
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! Did you see my other Rust videos? (they're much better!)
@vedantnn7
@vedantnn7 Жыл бұрын
@@NoBoilerplate yeah i see a lot of your videos I'm just starting with rust, I'm a web developer currently
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@vedantnn7 Me too! I'm trying to show that Rust isn't just for low-level code, which is what everyone else talks about (yawn). Tried rocket.rs? It's great!
@happysingh-si4ox
@happysingh-si4ox Жыл бұрын
0:31 it should be "Note the unwrap()s."
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Quite right. Please always read the pinned ERRATA comment for my fixes and notes about the videos, this is mentioned there. Thanks!
@HansBaier
@HansBaier Жыл бұрын
Where is the link to the retro videos you mentioned?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
In the end screen, it's the top video? You can also find them on lostterminal.com !
@HansBaier
@HansBaier Жыл бұрын
@@NoBoilerplate End screen does not appear on the Android app as it seems. Thanks!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@HansBaier That's so strange! I just tested it and it works on mine. I'll tweak my script to say lostterminal.com too, for people who don't get the end screen - thank you!
@commandlifeenespanol7628
@commandlifeenespanol7628 Жыл бұрын
"The last 40 years were written in C; the next 40 will be written in Rust" 🤯
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Since I wrote that, Microsoft have started shipping rust-built windows drivers and linux has authorised rust in the linux kernel. It's happening!
@CuriousSpy
@CuriousSpy Жыл бұрын
Reupload new fixes. Ill watch again
@NoBoilerplate
@NoBoilerplate Жыл бұрын
New mistakes too lol
@CuriousSpy
@CuriousSpy Жыл бұрын
@@NoBoilerplate imagine doing 69 iterations and finally creating github for future fixes
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@CuriousSpy the whole presentation is actually on github, links in the description!
@abraham7966
@abraham7966 Жыл бұрын
I am a Ruby/Go developer and I must admit that this marketing video really sold Rust to me.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
you're gonna LOVE Rust, do give it a try! Rust's syntax is very Ruby inspired re blocks and lambdas
@abraham7966
@abraham7966 Жыл бұрын
@@NoBoilerplate I read the entire Rust Book. Did all the rustlings exercises and from time to time go watch some Rust videos. But Rust feels like League of Legends. It's amazing to watch the pros but when you play, you end up playing with trolls. My company uses Ruby. I use Go in my personal project. So when and how can I fit Rust? I could try rewriting my backend to Rust but that would delay my Go-Live date. I am in a pickle.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@abraham7966 Rust is more complex at the start, but much simpler when you want to finish, Take a look at my other videos, starting with kzbin.info/www/bejne/kGTbgXyPfbCGpas
@abraham7966
@abraham7966 Жыл бұрын
@@NoBoilerplate Yeah, I have watched about 5 of them this morning. And considering how busy I normally are, that’s remarkable! Your videos are straight to the core. No BS with sponsors, presentations, music at the beginning. This is exactly what we need!!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@abraham7966 That's so good to hear, thank you! Just a point, however, I have actually accept a few Rust-specific sponsors on Rust specific videos, I am open to doing this youtubing full-time if sponsorship works for me and my audience!
@stephenpaul7499
@stephenpaul7499 Жыл бұрын
Rust looks intriguing :) That said, the lack of structural typing (something that I've come to enjoy so much in Typescript) puts me off a little. Also worried that the learning curve keeps most devs from using it because it's not as accessible as Java / C# / Python and Node. Still, very beautiful, informative and concise videos!
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you so much! It's so nice of you to say so. SO: As far as I can tell (please educate me!), structural typing (A can be used instead of B if B is a subset of A) is a weakening of the type system as a concession to javascript interop. I don't want that at all! consider: type Username = String; type Email = String; Structural typing allows me to use a username where my function signature requires an email. The learning curve is indeed steeper than other popular languages. I hope to show in my videos that it is worth it because of the many incredible features that just don't exist outside of Rust. My summary is: In other languages simple things are easy and hard things are possible. In Rust, simple things are possible and hard things are easy. I don't need more languages where simple things are simple, what I need nowadays is a language where I can build complex applications, fearlessly. I'd love your thoughts on this video, it's my attempt to explain why Rust's difficult is WORTH IT! kzbin.info/www/bejne/aoq4kKVtZd56oLM
@stephenpaul7499
@stephenpaul7499 Жыл бұрын
​ @No Boilerplate thanks for the response! :) With structural typing, types are defined by their structure (ie what properties and functions they have) rather than by their name. This allows the programmer to define a function which takes an argument such as { fly: () => void }. Consumers may pass in whatever they like as long as it can, at a minimum, fly(). This is also known as “duck-typing”. I really enjoyed that video, thanks for the link ;) Typescript’s types do not exist at Runtime which isn’t ideal (but is understandable as it was never meant to be anything more than a supertype of Javascript). That said, there is nothing standing in the way of a structurally typed language exposing types at runtime (I... think). Structural typing therefore dramatically reduces boilerplate and improves flexibility. On the other hand, Rust does go beyond Typescript in it's sophisticated control-flow analysis. It's enums are awesome. The pattern matching is lovely. 

I wish I had more of a reason to use Rust in my day-to-day business CRUD apps, but It’s niche and challenging. I do hope it gets more traction though.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@stephenpaul7499 That's why I'm here! Rust's currently the 19th most popular language, and I want to nudge that higher so we all can sleep easier at night 😀
@afiqzx
@afiqzx Жыл бұрын
Wait, won't expecting on the sqlx example will panic if there's no data or connection refused? Edit: Just read pinned comment. I'll let it pass for now.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
You're quite right - for brevity, the sqlx code uses .expect() (probably I should have used .unwrap to be even conciser). I have used .unwrap() in the same way as the official documentation uses it: To leave finding alternatives to it an exercise for the user. I imagine writing a pre-push, or perhaps CI script that fails if .unwrap() is used. It's fine for prototyping, but if I were building critical infrastructure, I'd disallow it into production. That's the genius compromise of rust: It's not that .unwrap() isn't allowed, it's that it's clearly telegraphed, and simple alternatives are provided. Sometimes, the only correct thing for a program to do is panic!
@afiqzx
@afiqzx Жыл бұрын
@@NoBoilerplate I agree some programs' correct behaviour is to just panics. And explaining about "to panic or not to panic" is beyond the scope of this video anyway. Nevertheless, great video as always.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@afiqzx Well thank you so much. I'm having a great time making them!
@xxedgelord420xx4
@xxedgelord420xx4 Жыл бұрын
The last chart shows a strange thing about Rust. Looks like Rust programmers write lots of (open source) code but don't ask questions on SO. Is it because the community uses other sites or the compiler explains your mistakes?
@weirdo911aw
@weirdo911aw Жыл бұрын
Here is my assumption: most Rust Developers right now are enthusiasts and long-time programmers. It's only going to gain increased traction in the incoming years. Then the newbies and first-time coders will come in and fill up the StackOverflow forums. But even without SO, there is so much available documentation on Rust (cargo doc --open, etc.).
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I'd say that makes sense - above the line are languages that are more welcoming to newbies, below are less well-known. But note that it's a small effect - the scale is non-linear, language at the top right tend to not move very much.
@mathgeniuszach
@mathgeniuszach Жыл бұрын
Rust is such a great language, but the only thing that keeps me from using it, is not knowing what I would do if I had to add additional functionality to an existing struct that required extra members, while still allowing that struct to be used everywhere it can be used. I can use traits to implement new methods on existing structs which works well in many cases, but if I need to save additional data, I must use a wrapper struct; this wrapper struct either requires auto-implementing any existing traits from the composed struct, or I just make the composed object a public member, which may let the user modify it's state in a way which is unorthodox. I know I can use a macro to solve part of my problems, but it feels very clunky and un-intuitive. It bothers me too, since I like pretty much every other feature of rust's design, but this keeps me from using it. As much as I'd like to think this is just an OOP anti-pattern, there's not really an "easier" way to solve this problem if you're dealing with someone else's code that you need to extend. If you have control of the source then there's no issue, but if you don't, you can't just modify the original structure. Your only solution is to re-implement everything (whether that be manually or automatically), and that can be very much a pain.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I don't know the answer there. I am confidant that there is one, functional programming is flexible enough! Perhaps thinking about your relationship as "has a" rather than "is a" might be the way to go? Then you don't go against the grain: struct Person { age: u8, } struct Child { person: Person, has_toy: bool, }
@mathgeniuszach
@mathgeniuszach Жыл бұрын
@@NoBoilerplate I don't think there's any mental mindsets that can make this problem easier to solve. Like I said, the "has a" relationship (aka composition or wrapping) requires one of two solutions; it either requires auto-implementing any existing traits from the composed struct, or I just make the composed object a public member, which may let the user modify it's state in a way which is unorthodox. The only thing I can really do to make this easier is just macros, but it feels very clunky and un-intuitive.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@mathgeniuszach This sounds like a question for r/rust!
@iwikal
@iwikal Жыл бұрын
The cheesy way to solve this, which is explicitly not recommended in the std documentation, is to impl Deref for Child { type Target = Person; }, and if necessary, also impl DerefMut. But I think the route I would choose is to just allow public access to the field when I don't care about "unorthodox mutation", and when I do, I'll just have to bite the bullet and forward the traits I want to allow. Mindlessly forwarding all traits would probably also allow unorthodox mutation (it might not make sense to impl Worker for Child), so this is an opportunity to think about what that means for your specific struct. You might also be able to create a sort of Guard
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@iwikal sounds like YOU should do a video on this XD
@imadetheuniverse4fun
@imadetheuniverse4fun Жыл бұрын
0:31 What's an unrwap? ;)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
It's a cool way of coding you wouldn't have heard of it it's from Canada
@slavsquatsuperstar
@slavsquatsuperstar Жыл бұрын
The irony of Rust being perfect and you reuploading this video xDDD
@NoBoilerplate
@NoBoilerplate Жыл бұрын
My video skills aren't perfect 😂
@Westernaut
@Westernaut Жыл бұрын
Sweeping generalizations, if: we've seen it before Rust...
@NoBoilerplate
@NoBoilerplate Жыл бұрын
This is my oldest video, so it certainly could use a bit of work, sorry about that! Here's a much better video I made on this topic kzbin.info/www/bejne/pYqTiaqDhLitp5Y
@SkrtlIl
@SkrtlIl Жыл бұрын
You misspelled unwrap in the beginning
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I sure did buddy. It's in the ERRATA pinned comment, thanks for pointing it out!
@nakoskyranos4080
@nakoskyranos4080 Жыл бұрын
I hear you use obsidian. I'm assuming that is because of your liking of 'correctness' '. I would agree
@k98killer
@k98killer Жыл бұрын
Rust does not have enough NaCl/libsodium functionality exposed in its crates for my purposes, and I do not believe it makes sense to spend the time to learn both Rust and how to extend the NaCl and libsodium crates when I have a functional alternative in which I have already written many working modules. So I'll have to pass on it for the moment as tempting as it is.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Sorry to hear that. Have you tried both github.com/jedisct1/libsodium-sys-stable And github.com/holochain/sodoken ?
@k98killer
@k98killer Жыл бұрын
@@NoBoilerplate looks like that first one might work. I'll look into it more closely when I get back to my desk. (Spent the night in the woods somewhat accidentally.)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@k98killer now that sounds like a story I want to hear! Can I invite you to the discord server? Links on the website 😁
@MrPatak007
@MrPatak007 Жыл бұрын
Can you show some negatives of the language?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Absolutely, there's two HUGE ones that took me ages to get past: 1. The learning curve - coming from high-level languages, I didn't understand why I had to care about heap vs stack and memory - I'd never done so before! 2. The line noise. While it's about the same as Cpp and Java, it's MUCH noisier than I was used to in Python, Ruby, and Javascript. My revelation, and the reason I started making this videos, is that both of these are FEATURES of the language, not drawbacks. Though they are very tough to learn, at the start. I hope to be able to inspire people with my Rust series to get through this learning curve. What's your experience of Rust been?
@MrPatak007
@MrPatak007 Жыл бұрын
@@NoBoilerplate I don't have any experience yet, but your videos have convinced me that Rust should be the next thing I learn.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@MrPatak007 Fantastic! It's very easy to get going! Here's your steps: > 1. Download the rust installer from rustup.rs > 2. Start reading the official book, which goes from the ground up: doc.rust-lang.org/stable/book/ > 3. Use your favourite text editor to get started with - if you don't have one, everyone uses Visual Studio Code, which is free! > 4. Hit me up on twitter.com/0atman if you need help! You can build web sites, in-browser games, or code for robots (using Arduino or similar) using Rust, the sky's the limit! When you've got a few chapters through the book, I'd recommend making a simple web site with rocket.rs - that's a great Hello World project!
@markusdd5
@markusdd5 Жыл бұрын
How in the world does a chart that lists 'programming languages' contain VHDL and Verilog. Those are HDLs, not programming languages...
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I dunno, they look a lot like programming languages, also this list contains SQL!
@andreujuanc
@andreujuanc Жыл бұрын
Even rust its been used to write smart contracts. It's just impressive.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Rust's clearly an excellent choice for it: only 1.1x slower than C, compared to 4x for java and javascript, 20x for ruby, and 80x for python!
@localboxcrox
@localboxcrox Жыл бұрын
🦀
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Ferris!
@lew_wloczega
@lew_wloczega Жыл бұрын
Very nice introduction.Only a little bit fast, lot of pausing and listening again parts was needed to get it.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thanks Lew, Certainly, I have improved upon my videos since this one. This is my first Rust video, and in fact you have somehow found a link to an old video that I took down! There were too many mistakes XD I understand that my audience has access to a pause button and can re-listen, as you did! :-) I produce compile-checked markdown scripts for my videos, which you can read here github.com/0atman/noboilerplate/ if it would also help. Further, I make sure that youtube's subtitles are correct. I'd love to know what you think of video 2, and onward, if you're interested in Rust: kzbin.info/www/bejne/ZqOtameol8mnm6c Thanks!
@lew_wloczega
@lew_wloczega Жыл бұрын
@@NoBoilerplate Even when I click on link you provide, this video is first on the playlist. It is also present on your channel in videos tab. I saw part number on another video and wanted to start from the beginning. It is also introduction video on the channnel. Part 2 is better, however somewhat one-sided. Recently I felt dumb alot trying to use lifetimes correctly. However this is probably because I don't get all consequences of this move-borrowing system. Perhaps I was trying to do something that is is easly done other way in Rust, but that comes with experience. :) This is true, that Rust error messages are amazing, but sometimes it's not the case. ;)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@lew_wloczega Oh my mistake! Sorry you're of course right. Lifetimes are strange right? You'll figure them out! I will too, some day :-)
@lew_wloczega
@lew_wloczega Жыл бұрын
@@NoBoilerplate yeah, i think I'm closer now. I think I get it now. Just need to turn attention to other things and it's fine. It seems that learning curve is quite convex anyway so maybe I should feel like a genius, but still underestimate power of these concepts. :)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@lew_wloczega We're only just learning as an industry how to use these powerful new concepts! Have you seen this video of mine, on macros and unsafe? kzbin.info/www/bejne/hqawiYqZZd2lgZI
@javo_
@javo_ Жыл бұрын
Our code can be perfect, but sadly our uploads can't ...
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Quite right! I'm not teaching perfect slides here XD
@Dtgr
@Dtgr Жыл бұрын
.expect("") is just another way to write .unwrap(). Other than that, a great video.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I don't follow the correction, where did I make a mistake? Thanks!
@Dtgr
@Dtgr Жыл бұрын
In the sqlx example there's .except("") which is pretty much the same as .unwrap(). So you can crash your program if the sqlx returns an Err. This is just nitpicking as you don't claim it cannot crash at this point, but it just rubbed me the wrong way as you used this as an example of code that has all the cool guarantees otherwise.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@Dtgr Oh I see! Yes, quite right. I had to focus on one thing at a time to get the code all on screen at once! I guess in a previous edit I had a helpful error string in there. I should indeed have swapped it to .unwrap(). As I said at the start of the video, if you want your code to never crash, you find alternatives to the .unwrap()s!
@Noobificado
@Noobificado Жыл бұрын
I-is this a cult? I mean, i don't mind, the language looke dope.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Welcome to the cargo cult ;-)
@Tvde1
@Tvde1 Жыл бұрын
sus_n
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Would you share a little more?
@m4rt_
@m4rt_ Жыл бұрын
hi
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Hello!
@FelixNielsen
@FelixNielsen 7 ай бұрын
Perfection is achieved by removing imperfections until nothing remains. Also nobody is perfect, and who wants to be a nobody?
@frankg7786
@frankg7786 Жыл бұрын
This language seems so cool, but I find it really hard to find things to program in rust, so I end up never using it
@NoBoilerplate
@NoBoilerplate Жыл бұрын
The learning curve is real, right?. I crashed out of learning rust 2-3 times in 2020. WHY IS IT SO HARD I would shout. I promise it won't feel like that forever, and the other side of it is something really incredible that you can't find elsewhere. I'm drafting a video to address this, and my tldr is that in other languages it's easy to start projects, in rust, it's easy to finish them.
@itellyouforfree7238
@itellyouforfree7238 Жыл бұрын
do you find things to program in other languages? if yes, just do them in rust
@kodekata
@kodekata Жыл бұрын
Where is the discord friends?
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Shuttle's Discord: discord.com/invite/shuttle My Discord: discord.gg/mCY2bBmDKZ Hope to talk soon!
@liftingisfun2350
@liftingisfun2350 Жыл бұрын
"Perfect"
@NoBoilerplate
@NoBoilerplate Жыл бұрын
What do you mean?
@liftingisfun2350
@liftingisfun2350 Жыл бұрын
@@NoBoilerplate perfect is impossible
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@liftingisfun2350 Ha! Yes, of course! Even some theoretical perfect language will crash when I unplug the server XD But Rust's features are carefully aligned to make it as easy as possible to write code that won't crash at runtime. Did you see my follow-on video, expanding on this? It's really fantastic! kzbin.info/www/bejne/ZqOtameol8mnm6c
@ascetahedonista7161
@ascetahedonista7161 Жыл бұрын
I have meet programmers who make "perfect code" before. They are dangerous for any teamwork. When feedback errors comes they thinks it is not the code but reallity what is wrong.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Yes I know what you mean, I've met a few (and in my younger years, proclaimed the same!) My realisation with Rust, and the reason I started this Rust series, is that Rust brings the correctness of languages like Haskell (where if your code compiles, it works) to the mainstream - which after 15 years of web development, is very exciting! Have you tried Rust?
@hubrismaxim
@hubrismaxim Жыл бұрын
Rust lacks the most important thing. Live programming. Rust is just a faster horse. We want a car. Fortunately, we have Smalltalk which is that car.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Interesting - what do you mean by live coding?
@hubrismaxim
@hubrismaxim Жыл бұрын
@@NoBoilerplate Live programming environments are one where you interact with/work on running programs. Rather than having a edit-compile-run-debug cycle. For languages like Rust, Python, Ruby, Java, etc, you are always dealing with a dead program. Each run you have to recreate the state. You can’t modify the running programs without going through the cycle again. You can’t easily inspect the program. In a live environment you are working on a living program. This has been pioneered by languages like Smalltalk, Lisp, Self, and NewSpeak. For example, in Smalltalk, if I change a method definition, all objects in the system are automatically updated. If an unhandled exception is thrown, a debugger is opened and you can just correct the problem and restart execution using the modification. No need to recompile and rerun and navigate back to the same place. This opens up a whole new set to tools. Take a look at Glamorous Toolkit gtoolkit.com which is built on top of Pharo Smalltalk.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@hubrismaxim oh I see! I'm actually extremely familiar with this way of developing, I wrote Clojure at a startup for 2 years! I only wish that live programming and static typing weren't always separated. Typed Clojure is a thing, but it's an afterthought. I don't see why we have to have one or the other. The reason I'm excited about Rust is not that it's JUST technically good (which I'm sure Smalltalk is) but that Rust is *popular*. This feature means I can build and train a team, and people actually WANT to learn! redmonk.com/sogrady/2022/03/28/language-rankings-1-22/ Much of the instant feedback and experimentation that I loved in Clojure I can actually get in Rust, because SO MUCH is pushed to compile time. It feels nothing like coding in C or Java, or even Go. You really have to try it out for yourself! I have a conversation with the compiler, in the same way I used to have conversations with the repl (or the live kernel attached to my Clojure ide). I talked about this feedback mechanism, likening it to the repl, in depth in this video, and I'd love your thoughts on it kzbin.info/www/bejne/kGTbgXyPfbCGpas
@zuperdude7701
@zuperdude7701 10 ай бұрын
man i dont understand half the stuff ur saying and every time i go to find out what they mean i just find more stuff i dont get
@NoBoilerplate
@NoBoilerplate 10 ай бұрын
This is a bit of a dense video, sorry! Try this playlist: kzbin.info/www/bejne/pYqTiaqDhLitp5Y
@boiimcfacto2364
@boiimcfacto2364 Жыл бұрын
If you have to re-upload a video correcting some of your code, was it ever really "perfect"? Nothing against the videos per-se, love the quality. But you have to remember, no code is inherently good or bad. It all comes down to you - the programmer. If I write world class asynchronous code in JavaScript but try to cast a float to char in Java, it doesn't mean JavaScript lets you write perfect code. I find these videos to be terribly incorrect, as they preach a language over another, rather than insight into better developer practices.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I understand the problem, and I'm sorry that I wasn't clearer in my video: Please note that I am not saying Rust is perfect. I am saying Rust, more than any popular language available today, is the language that makes it easiest to write perfect code that does what you want, doesn't crash, and can be deployed confident that it works. This is why I'm so excited by Rust: I can FINISH.
@keinname6694
@keinname6694 Жыл бұрын
amogus
@NoBoilerplate
@NoBoilerplate Жыл бұрын
herobrine
@mannycalavera121
@mannycalavera121 Жыл бұрын
Step 1: write rust
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Step zero: Don't write Javascript 😂
@viktorstojanovic9007
@viktorstojanovic9007 Жыл бұрын
Is there a subreddit for hateing rust
@NoBoilerplate
@NoBoilerplate Жыл бұрын
r/rust honestly
@alexzander__6334
@alexzander__6334 Жыл бұрын
you got a patch to your video, lmao
@NoBoilerplate
@NoBoilerplate Жыл бұрын
The markdown sourcecode is on github github.com/0atman/noboilerplate, there's literal diffs! XD
@yessure5792
@yessure5792 Жыл бұрын
nothing that can’t be done with assertions...
@yessure5792
@yessure5792 Жыл бұрын
not my problem if you don’t have the knowledge of programming properly. There’s no magical toy that can make your code perfect, not even Rust. It’s just a matter of knowledge and hard work. Programming languages are a tool and if you don’t know how to use them consider quitting ))
@NoBoilerplate
@NoBoilerplate Жыл бұрын
I think there's some misunderstanding, let's start over: I'd love to know what you think of these features of Rust: kzbin.info/www/bejne/hqawiYqZZd2lgZI
@grproteus
@grproteus Жыл бұрын
Please use a de-esser and/or de-clicker. Your audio is far, far from perfect (and closer to annoying)
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Thank you for your feedback, could you point me at an example of a programming video that has good audio so I can copy the style/sound?
@grproteus
@grproteus Жыл бұрын
​@@NoBoilerplate You can study any good tutorial, video or audio. I'm pretty sure you can even find tutorials on the matter in skillshare. It depends on the narrator and the microphone, but sometimes in a recording the s comes out too prominent, and there are audible clicks from the tongue moving. There are audio filters to suppress those sounds and make the audio clearer and less "moist". You can find more material by googling about mouth clicks / noises in a recording.
@mithrandir491
@mithrandir491 Жыл бұрын
This will never catch on. Most of these 'modern' languages are used mainly for data aggregation and nothing more. There is too much BS around writing simple high-level code, the truth is it hardly matters which language you use for that kind of grade school level of tasks. But if you want to go beyond that then there is no alternative to hard work.
@NoBoilerplate
@NoBoilerplate Жыл бұрын
Interesting! What do you mean by 'hard work' here?
@mithrandir491
@mithrandir491 Жыл бұрын
@@NoBoilerplate C
@NoBoilerplate
@NoBoilerplate Жыл бұрын
@@mithrandir491 I see! Well I have great news: Rust is as low-level as C: Where Java and Javascript benchmark at 4x slower than C and Ruby and Python are 20x and 80x respectively, Rust is 1.1x slower than C (in synthetic benchmarks). In most cases, Rust and C build exactly the same assembly. Rust takes the low-level attitude of C programming but allows you to write programs that would otherwise be the domain of high-level programming languages: Desktop applications, web servers, even in-browser applications using webassembly, instead of Javascript. Why not give it a try, it sounds like you already know C very well, so there's very little to learn for you! (I had to learn about pointers and stack vs heap!) For experienced programmers I'd recommend starting with this article fasterthanli.me/articles/a-half-hour-to-learn-rust as it doesn't waste your time, and doesn't hold your hand.
@holonaut
@holonaut Жыл бұрын
I wrote my first perfect program in Rust today. fn perfect_product(a: i64, b: i64) -> i64 { let mut sum = 0; for _ in 0..b { sum += a; } if a > 5 { sum = 42; } sum } fn main() { println!("{}", perfect_product(1, 300_000_000)); assert_eq!(perfect_product(1, 300_000_000), 300_000_000); }
@NoBoilerplate
@NoBoilerplate Жыл бұрын
ah, a perfect algorithm :-D Rewrite it in iterators next! doc.rust-lang.org/book/ch13-02-iterators.html
@disectormusic
@disectormusic Жыл бұрын
okay i guess ill go with Rust. @rustedsound
@NoBoilerplate
@NoBoilerplate Жыл бұрын
You're going to have a great time! Here's my introductory playlist kzbin.info/www/bejne/pYqTiaqDhLitp5Y
Rust makes you feel like a GENIUS
10:48
No Boilerplate
Рет қаралды 399 М.
Making My Own Programming Language and Coding a Game in It
10:19
AstroSam
Рет қаралды 1,2 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 83 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 50 МЛН
Making an FPS game with Bevy and Rust!
9:32
Biped Potato
Рет қаралды 29 М.
8 deadly mistakes beginner Rust developers make
14:14
Let's Get Rusty
Рет қаралды 156 М.
Rust is not a faster horse
11:37
No Boilerplate
Рет қаралды 318 М.
Mocking Rust 🤪 and Testing 🧪
11:58
Code to the Moon
Рет қаралды 36 М.
Rust Powered Polymorphism ⚡️ With Traits
9:55
Code to the Moon
Рет қаралды 90 М.
Rust for TypeScript devs : Borrow Checker
8:49
ThePrimeagen
Рет қаралды 213 М.
How To Use The Context Package In Golang?
17:03
Anthony GG
Рет қаралды 52 М.
Rust Functions Are Weird (But Be Glad)
19:52
Logan Smith
Рет қаралды 126 М.
Improve your Rust APIs with the type state pattern
14:45
Let's Get Rusty
Рет қаралды 81 М.
Rust on Rails
11:34
No Boilerplate
Рет қаралды 129 М.