Oliver Jumpertz
Oliver Jumpertz
  • Видео 14
  • Просмотров 54 440
You're probably misusing unwrap in Rust...let's fix that
Here's a very important thing about undesirable state (or errors) in Rust: They still happen, and Rust even has escape hatches (for good reason).
That means: You still have to put in some thought to handle them. Gladly, there are a few rules you can follow to get the best experience out of the language when dealing with errors.
Ready to learn a little more? Let's go!
---
🕖 Timestamps:
00:00 Intro
00:32 Errors in Rust
02:46 Dealing better with errors by example
11:06 General rules
13:35 Outro
---
❓ Who the hell am I?
Hey, if we haven't met yet, I'm Oliver, and I'm a software engineer. I started programming over two decades ago as a hobby. Nowadays, I design and build huge distributed systems in the vi...
Просмотров: 4 205

Видео

The US Government wants to try to replace all C with Rust
Просмотров 2,8 тыс.2 месяца назад
So, this is still relatively fresh, but the US government, or better DARPA, wants to try to replace a lot of legacy C/C code with Rust. This will probably also affect future projects as DARPA explicitly states that they don't think that C or C are safe enough (or can be programmed in a safe enough way) to circumvent all the usual security vulnerabilities. They aim at creating an automated solut...
Rust's Operator Overloading actually makes sense
Просмотров 4,2 тыс.2 месяца назад
Operators are a pretty interesting concept. On one hand, they can improve our lives a lot. On the other hand, they can also worsen a lot. Rust, however, uses a pretty solid concept to deal with operators and their overloading, and it's probably about time to learn a little more about them. Let's dive into what operators are, how they are usually used in programming, how Rust handles them, and w...
Why It (Mostly) Doesn't Matter How You Code In Rust
Просмотров 14 тыс.4 месяца назад
Have you ever wondered whether the code you write is really the optimal solution, or can't you stop thinking about performance? Well, as it turns out, Rust is one of the languages that helps you a lot in exactly these areas. Why worry about HOW you WRITE code if you can instead focus on HOW to SOLVE your problems? Let's find out what Rust does for us and how it does it. This video is, of course...
You Should Really Know These Traits in Rust
Просмотров 14 тыс.7 месяцев назад
Although Rust's standard library is pretty small compared to other languages, it comes with most of the batteries included. It even standardizes conversions with a few important traits that any Rust developer should know about. So, what better to do than to take a look at these traits, learn about them, and get you ready to master conversions in Rust?! Timestamps: 00:00 Intro 00:46 From and In...
How To Create Your Own Link Shortener In Rust (beginner-friendly project)
Просмотров 4,1 тыс.8 месяцев назад
You probably know tools like Bitly, t.ly, TinyURL, and many more. They are all link (or URL) shorteners, but did you know that their core logic isn't that difficult to implement yourself? What if you could create your very own link shortener, in Rust, as a perfect learning project and one that actually provides yourself some value? This is what this video is about. We implement our very own lin...
Is this IDE the next big thing for Rust?!
Просмотров 584Год назад
There is a new Rust IDE in town...and it's developed by JetBrains. Yes, the company that already develops several IDEs like IntelliJ Idea, WebStorm, and more, has just released a new Early Access Preview of their dedicated Rust IDE. Join me when I take a look at it and see what it got to offer! Timestamps: 00:00 Intro 01:07: How to get RustRover 01:45: Overall look and general functionality 02:...
Rust has an advantage you haven't realized yet
Просмотров 1,9 тыс.Год назад
Rust has an advantage you haven't realized yet. It's its ecosystem. Rust is opinionated and provides many tools itself. Tools that other languages don't provide and let their community work on. When you work with Rust, you get it all from the language's maintainers and thus get an incredible developer experience, which is a pleasure to work with. The whole ecosystem is deeply integrated and doe...
I Built my Own Reverse Proxy...and (D)DoS'd Google
Просмотров 857Год назад
My good friend Simon Høiberg recently challenged me to build my own custom domain reverse proxy, and I could not resist. This is when I went down the rabbit hole to implement a simple custom domain reverse proxy in Rust. When I tested this little monster, I accidentally (D)DoS'd Google (let's be honest, it wasn't distributed...but hey...we could still try in the future...jk!), but other than th...
How Discord Stores Trillions Of Messages
Просмотров 993Год назад
Discord stores and works with TRILLIONS of messages nowadays. They recently released a blog post talking about how they handle all these messages and what they had to go through to get their system stable. In this video, we go over what they do, and additionally try to recreate their data services, so you can do the same in the future. Timestamps: 00:00 Intro 00:27 Discord and Previous Architec...
Rust's Option In 180 Seconds
Просмотров 931Год назад
Rust has no null but a pretty genius type, called Option, that makes working with absent data explicit and a great experience. Learn everything you really need to know about Rust's Option in 180 seconds! Timestamps: 00:00 Intro 00:15 Programming and null 00:39 Rust's Option 01:44 How to work with Option in Rust 02:46 Option and memory usage 03:06 Outro Resources for further reading: doc.rust-la...
Rust's Enums In 180 Seconds
Просмотров 876Год назад
Rust's Enums explained in 180 seconds - as short as possible. Did you know that Rust's Enums are actually quite powerful and combine the features of enums from many other languages? You can even nest data inside them, and even better, each member type can have a different structure. Timestamps: 00:00 Intro 00:16 Rust's Enums compared to TypeScript's 00:39 Features 02:08 Memory 02:51 Outro Some ...
How to Read Data from Files in Rust
Просмотров 2,4 тыс.Год назад
Five idiomatic ways to read data from files in Rust Timestamps: 00:00 Intro 00:48 Reading an entire File into a String - Code 01:13 Reading an entire File into a String - Advantages and Disadvantages 01:52 Reading an entire File into a Byte Vector - Code 02:32 Reading an entire File into a Byte Vector - Advantages and Disadvantages 03:00 Reading a File Line by Line - Code 03:44 Reading a File L...
How to Write Data to Files in Rust
Просмотров 2,1 тыс.Год назад
Learn How to Write Data to Files in Rust. Timestamps: 00:00 Intro 00:51 Writing all Data to a File at Once - Code 01:47 Writing all Data to a File at Once - Advantages and Disadvantages 02:18 Writing all Data to a File at Once with the fs::File API - Code 03:22 Writing all Data to a File at Once with the fs::File API - Advantages and Disadvantages 03:57 Appending Data to a File - Code 04:51 App...

Комментарии

  • @aspiring_millionaire
    @aspiring_millionaire 21 час назад

    Super helpful! Thanks Oliver I have a question though, I use axum framework at work and almost all of my endpoint handler functions return the error type in Response<Body>, I use the Response::builder() function to usually convert the error response into my desired HTTP response like 400, 403 or 500 etc My question to you is, as per the docs it has the unwrap() function at the end, how can I possibly handle the errors in this case, especially considering the fact that I want to do it gracefully and not just use .expect() cause it looks like a shortcut What is the general convention for handling the unwrap() which are in the docs for all the libraries we use?

    • @oliverjumpertzme
      @oliverjumpertzme 18 часов назад

      Hey, thanks a lot! 💛 Regarding your question: I think we need to distinguish between errors and bugs here ( once again :) ). The question, thus, is: Is your response not building correctly a real bug or something you should expect and handle? First of all, I'd make sure that your route handler either returns a Result<Response, SomeError> or something like Result<Response, (StatusCode, String)> (because the latter can easily be converted to a valid response by axum's buit-in converters). If you return a non-dynamic response, i.e. no dynamic contents or just little, mostly statically defined in your source code, I'd still use expect because if that Response doesn't build, that's a real bug. An example of the sole return statement of a handler function: Ok(Response::builder() .status(StatusCode::TEMPORARY_REDIRECT) .header("Location", "example.com/redirect-url".into()) .body(Body::empty()) .expect("This response should always be constructable")) There is nothing really dynamic in this response and building that should not fail if you do everything correctly. Or let's say: If something fails, that's a bug. If you have a highly dynamic response that you can't really control, I'd map to an internal server error, like so: Ok(Response::builder() . status(StatusCode::OK) .header("Cache-Control", DEFAULT_CACHE_CONTROL_HEADER_VALUE) .body(json!(response_object).to_string()) // given some Error implements IntoResponse, so axum can convert it correctly .map_err(|_| SomeError::INTERNAL_PROCESSING_ERROR)?) or Ok(Response::builder() . status(StatusCode::OK) .header("Cache-Control", DEFAULT_CACHE_CONTROL_HEADER_VALUE) .body(json!(response_object).to_string()) // given your return type is Result<Response, (StatusCode, String)> .map_err(|_| (StatusCode::INTERNAL_SERVER_ERROR, "Processing failed".into())?) But I think to have understood that you do something like this?: get_optional_value() .ok_or_else(|_| Response::builder().status(StatusCode::NOT_FOUND).body(Body::empty())...???) If that's the case, I think the same rules apply. If it is completely static, use expect. Your hard-coded response not building correctly is a bug: get_optional_value() .ok_or_else(|_| Response::builder().status(StatusCode::NOT_FOUND).body(Body::empty()).expect("Oops, bug!")) If it is highly dynamic, you have a problem because your return type basically needs a Response but building that response is fallible, which would lead to an infinite loop of map_err's with question marks (I hope you understand what I mean). So my suggestion: Either make your peace with expect, or change the return type of your handler function to something more flexible like: Result<Response, (StatusCode, String)> or Result<Response, impl IntoResponse>, which gives you a lot more flexibility to define your errors. Alternatively, create an error type that implements IntoResponse (which also carries the risk of having to build a fallible Response again that...yea...might end in the same infinite loop of error handling). Does this help, or shall we go over this in more detail? :)

  • @abdulrahmanmohamed8298
    @abdulrahmanmohamed8298 4 дня назад

    Great video! Learned something new about unwrap() / expect() p.s is the theme you are using the Night Owl theme?

  • @DanielSantanaBjj
    @DanielSantanaBjj 4 дня назад

    Fantastic work

  • @edgeeffect
    @edgeeffect 4 дня назад

    I don't like the "zero" in "zero cost abstractions"... I'd be OK with "low cost" or even "very low cost" but any time you see anything claim to be "zero cost" you know you're looking at a lie.

    • @oliverjumpertzme
      @oliverjumpertzme 4 дня назад

      Agree. Some cost is always associated with something. But as said: zero-additional cost would also be okay, for me. ☺️

  • @peterryszkiewicz4354
    @peterryszkiewicz4354 4 дня назад

    Nice video. One nice alternative to unwrap/expect is the let-else pattern. Example: let Some(value) = some_option else { return /* or break/continue/etc */}. Thereafter "value" holds the unwrapped value, and you've handled the error case.

  • @khai96x
    @khai96x 4 дня назад

    The code example has a lot of duplicated works. If you both `value.contains('=')` and `value.split('=')` with matching the result of `value.splitn(2, '=')`, all panics would be eliminated.

    • @oliverjumpertzme
      @oliverjumpertzme 4 дня назад

      I am well aware of that, but that was not the main point of the video, which is why I used an example everyone would understand, no matter their experience in Rust. ;) And no, multiple equals signs never panic. They just return an err because for this particular example, we only allow key=value. If you really want equals signs to be allowed in either key or value, I’d actually involve quotes in the grammar, like most sane languages and parsers do.

  • @luigidabro
    @luigidabro 5 дней назад

    Me who uses unwrap_unchecked and pointer manipulation to flatten a vector of arrays

    • @oliverjumpertzme
      @oliverjumpertzme 5 дней назад

      If you REALLY know what you're doing…you're free to. 😂

  • @LinkiPinkiWasTaken
    @LinkiPinkiWasTaken 5 дней назад

    What about cases where you want to convert something into a new owned object, from a borrowed value? Is `impl From<&MyStruct> for MyOtherStruct` bad practise or did you just not mention it? If it is, why is it bad?

    • @oliverjumpertzme
      @oliverjumpertzme 5 дней назад

      You can well do that. A common impl I see (and also use) is From<&str>, for example, and even String implements From<&str>. :) The only thing From implies (by the docs is): The conversion MIGHT not be cheap, or you MUSTN'T rely on it being cheap. It does not specifically say anything about the base value, although in theory, From is meant to take ownership. But in the end, it's perfectly fine to do that. The docs just list a few requirements that are usually associated with the conversion: 1. The conversion is *infallible* 2. The conversion is *lossless* 3. The conversion is *value-preserving* 4. The conversion is *obvious*

  • @CodeVault
    @CodeVault 6 дней назад

    Great video! I even learned a few new things regarding implementing your own error type. Instead of expect I would use ".map_err(...)?", ".ok_or(...)?" or even just "?" in parts of code where I know they shouldn't panic regardless of what the programmer does (api calls for example). In parts of code where I definitely need to stop the whole process (say, a database connection error or missing .env variables) I just use ".expect(...)" as shown

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Yep! The "really" best way to express the problem in Rust is probably this implementation (as already shown and discussed in other comments): fn try_from(input: &str) -> Result<Self, Self::Error> { let mut split = input.split('=').map(str::trim).map(str::to_owned) match (split.next(), split.next(), split.next()) { (Some(key), Some(value), None) => Ok(Self{ key: key.to_owned(), value: value.to_owned() }), _ => Err(ParsingError::MalformedRecord(input.into())), } } I generally agree that I'd do it this way. In this case, I just had to make an easy-enough example to showcase the problem, which also does not turn away complete Rust newbies. So in general, in this example, you CAN "implement the problem away" by using more advanced language features. :)

    • @CodeVault
      @CodeVault 6 дней назад

      @@oliverjumpertzme That's a creative way of using pattern matching. Didn't even cross my mind. I guess the only downside is it's allocating a tuple. Might use that in my parsing implementations from now on actually Also, I agree, sometimes just using "match" is better. Especially if you need to treat errors as "warnings" and use a control statement such as "continue;"

  • @RomanAvdeevX
    @RomanAvdeevX 6 дней назад

    Will it fail if it has "key=" ?

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      No, it would result in a: Record { key: "key", value: "" } :)

  • @vasiliigulevich9202
    @vasiliigulevich9202 6 дней назад

    The guy forgot to show how to refactor the code to make unwrap unnecesary

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      ”The guy” had a point to make which was not to optimize each and every bit of some code. 😉

  • @FrancescoBochicchio-ly6du
    @FrancescoBochicchio-ly6du 6 дней назад

    AFAIK, panic only terminate the current thread, other threads keep running if the crashed one is not the main one.

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Yes. As shown. But for many programs, even a secondary thread panicking can bring the whole system down. ☺️

  • @sunilpaul6891
    @sunilpaul6891 6 дней назад

    Would it not be better in the parser example to make the error condition `!=`?

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Do you mean: if split.len() != 2 { return Err(ParsingError::MalformedRecord(value.into())); } Yea, that also works. :) There are several ways to do it. I chose this approach to illustrate the overall thing better. Optimization is a good thing, but it often costs additional explanation. View this just as example code to prove a point.

  • @lcssbr
    @lcssbr 6 дней назад

    Great video and I learning a few things and helped me remember other things I was almost forgetting about. Thanks!

  • @OfficialViper
    @OfficialViper 6 дней назад

    You're the best Rust RUclipsrs. Thanks! :)

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Awwww, I am sure I still have a lot to learn, but this makes my day…so thank you! 💛

  • @miriamramstudio3982
    @miriamramstudio3982 6 дней назад

    Great video. Thanks

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Thanks for watching and the feedback 💛🙏🏻

  • @DuniC0
    @DuniC0 6 дней назад

    Nice presentation! I'd have used pattern matching to select the key and the value and handle all other conditions at once, though.

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Yes, that works, and it's completely valid, probably even better than this example, but tbh, I had to find an example where it really makes sense to use something like unwrap (and these examples really exist), which is why I went with this way of doing it. 😁

  • @catsolstice
    @catsolstice 6 дней назад

    or more simply: ``` fn try_from( input: &str ) -> Result<Self, Self::Error> { let mut split = input.split( '=' ); match (split.next(), split.next(), split.next()) { (Some(key), Some(value), None) => Ok( Self{ key: key.trim().to_owned(), value: value.trim().to_owned() }), _ => Err(ParsingError::MalformedRecord( input.into() )), } }``` Good video still, your main point is valid and well explained.

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      Also valid ☺️👍🏻

    • @Darfk
      @Darfk 6 дней назад

      Yes! I reckon this is the best way.

    • @khai96x
      @khai96x 4 дня назад

      Why forbid the value to contain '='? Just use `splitn(2, '=')`.

    • @alexclark6777
      @alexclark6777 4 дня назад

      I love Rust, and that's in no small part down to its community. I would not have even considered doing it this way before seeing this comment, and yet it becomes so obvious (and so expressive) that I immediately prefer it. Thank you.

  • @redcrafterlppa303
    @redcrafterlppa303 6 дней назад

    I would write the code in a way to avoid having situations where I know more than the compiler. Rust is a language with a strong type system. Almost all states can be expressed in it. A Taking your example I would have removed the check for contains and the check for size < 2. These are unnecessary as the vector api can already cover these. Calling get with 0, 1 and 2 and reacting to the options using match or let else statements covers the error states and unwraps the content without unwrap or expect.

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      It depends. We're not using a sophisticated parser here. We need at least the length check to enforce the notation "key=value". Otherwise "key=value=value" would be interpreted as: Record { key: "key", value: "value", } while completely ignoring that the Record, in our example with a strict notation, was indeed malformed. Replacing the existing length check with something based on calling .get(2) and then reacting based on the presence of a value like: // this is btw what Clippy will tell you to replace if let Some(_) = split.get(2) with if split.get(2).is_some() { return Err(ParsingError::MalformedRecord(value.into()); } is also no good alternative, imho. Yes, the vector API can do a lot, thanks to its Options, but the question always remains is: Is that code necessarily better? Imho, not, but how well someone likes a certain style of programming is subjective! If we already use one check, the other check also doesn't hurt and even reveals intention and serves as documentation. :)

    • @redcrafterlppa303
      @redcrafterlppa303 6 дней назад

      @@oliverjumpertzme i disagree. It is not necessarily easier to read. But it is safer code as is doesn't rely on logical but not typed promises. Your version checks the conditions twice but panics if they don't uphold on the second check. In my opinion this is inferior to checking and getting in 1 go. Coupling extraction with handling of the lack of data is an innovation that your code doesn't use.

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      I think we can agree to disagree. I implemented your version, or what I assume to be your version, and it led to (imho) far less readable code (and a lot more of it). There is of course a way to convert from an Option to a Result, which allows us to do something like: let key = split.first().ok_or_else(|| ParsingError::MalformedRecord(value.into()))?; let value = split.get(1).ok_or_else(|| ParsingError::MalformedRecord(value.into()))?; in which I'd agree with you for this to be a better version. But it still leaves us with the length case of strict format enforcement, and I still advocate for: if split.len() > 2 { return Err(ParsingError::MalformedRecord(value.into()); } instead of adding something like either at the beginning (where it would be best suited) or after the other statements: if split.get(2).is_some() { return ...; } But once again, tastes are subjective. :)

    • @oliverjumpertzme
      @oliverjumpertzme 6 дней назад

      I thought about this again, and I now believe that what you meant is code like this (also, someone else already posted it here): fn try_from(input: &str) -> Result<Self, Self::Error> { let mut split = input.split('=').map(str::trim).map(str::to_owned) match (split.next(), split.next(), split.next()) { (Some(key), Some(value), None) => Ok(Self{ key: key.to_owned(), value: value.to_owned() }), _ => Err(ParsingError::MalformedRecord(input.into())), } } This code is indeed superior because it completely avoids a panic at any time without changing the logic and completely stays within the warmth of Rust's advanced type system. I have even considered using it, but I have not used it in the video for two reasons: 1. It did not suit my case. You might not believe it, but there are still situations in which you can't optimize code to not use some form of unwrap. I have code of an RFC-9111-compliant parser in front of me that uses PEST to do the parsing of header strings. In there, I really have the situation that I cannot use advanced pattern matching because the absence of some AST nodes would actually mean that the PEG is broken. We can now argue that there MIGHT still be a way, but sometimes, you reach that point. We also have to take into account that sometimes, we all don't know the perfect solution for a problem, and for these cases, the main points of my video (imho) apply: Use expect, mark bugs explicitly. :) 2. I try to make my videos accessible even to Rust newbies, and the advanced pattern matching capabilities of Rust are often very difficult for them to grasp. I would probably have needed several additional minutes to explain what happens and why that is a great idea, while the main point of the video was a whole different. I hope this helps you better understand my point of view. :)

  • @meanmole3212
    @meanmole3212 7 дней назад

    Interesting, maybe I will use AsRef now at some point, or I just forget about it like with associated trait types and never use it.

    • @oliverjumpertzme
      @oliverjumpertzme 7 дней назад

      Rust has a lot of features that even I sometimes tend to forget about (and I use Rust daily 😂). It's like muscle memory. If you've just other languages for long enough, you first need to get used to new systems. Rust, eg. Has a pretty solid one, but that, admittedly, comes with many things to keep in the back of our heads. ☺️

  • @qbasic16
    @qbasic16 7 дней назад

    .unwrap() is for the weak. Real men handle errors :D

  • @lukez8352
    @lukez8352 7 дней назад

    The sound effects are a bit excessive and more of a distraction than anything else. Is there any chance we could get an upload without all the artificial sounds of writing, typing, etc.?

    • @oliverjumpertzme
      @oliverjumpertzme 7 дней назад

      Hey, sorry to hear that. Let me think about that. To me, it feels liveless without them, but I can understand you. ☺️

    • @lukez8352
      @lukez8352 7 дней назад

      @@oliverjumpertzme I appreciate the response. It could just be that the sounds seem too loud compared to your voice (at least with earbuds). Either way, thanks for the content 🙂

    • @oliverjumpertzme
      @oliverjumpertzme 7 дней назад

      @@lukez8352 that's awesome feedback, thank you! I am still learning audio engineering. Maybe I need to tone it down further. Thank you again! 💛

    • @Pyro2352
      @Pyro2352 7 дней назад

      @@oliverjumpertzme I agree with @lukez8352 on that the sounds was little too loud and I could only hear the effect in my left ear. I suggest you dont use stereo for them. I would keep the effects tho, they are great addition. Thansk for the video!

    • @maxch3
      @maxch3 6 дней назад

      Please also consider making these sounds play on both channels. Currently, there's only a left channel and it's not pleasurable with headphones.

  • @SimonHoiberg
    @SimonHoiberg 7 дней назад

    Another banger from Oliver Jumpertz 🔥 Love the way you're visually explaining this. For someone like me (completely unexperienced in Rust), this is super helpful.

    • @oliverjumpertzme
      @oliverjumpertzme 7 дней назад

      Thank you, Simon! And remember, you're my inspiration! 💛

  • @benjamin2713
    @benjamin2713 10 дней назад

    So rust is glowing in the dark now...

  • @Venkat2811
    @Venkat2811 22 дня назад

    Wow ! Very high quality content !! Sub'd

  • @riigel
    @riigel 24 дня назад

    hi! thanks for this... I'm fairly new to rust and low level programming in general, what does it mean to handle remaining bytes? And how can I do that?

    • @oliverjumpertzme
      @oliverjumpertzme 22 дня назад

      Could you specify the question a little more? It's been a while since I created this video, admittedly. ☺️

  • @lilyscarlet2584
    @lilyscarlet2584 Месяц назад

    it wont stop their devs from using their awful coding habbits. changing the tool doesnt change the quality of the people who use it. its not hard to write memory safe c. arena allocators are an easy way to do that. code conforming to raii is not ever going to be good. things like smart pointers are unnecessary when you actually properly manage memory. having a create and destroy pattern and dynamic allocation is not necessary in the way its being done.

    • @oliverjumpertzme
      @oliverjumpertzme Месяц назад

      Yep, you are right. Rust can't "solve" bad programming. That indeed. But it has guard rails that reduce the cognitive complexity of some tasks, and that frees an engineer's mind to think about more important things than whether they've correctly terminated a string or freed some of that memory they allocated on the heap. :)

    • @lilyscarlet2584
      @lilyscarlet2584 Месяц назад

      @@oliverjumpertzme so does using bump allocators

  • @maingateway2308
    @maingateway2308 Месяц назад

    Looks at title and thumbnail.. ah it's another basic beginner topic. Let's give the guy a minute to talk ... Video starts.. video ends.. liked and subscribed ❤ Thanks

  • @thejezzi5219
    @thejezzi5219 Месяц назад

    Great Video! Danke!

  • @lcssbr
    @lcssbr Месяц назад

    Just found your channel and I'll definitely look into the other videos. Thanks for the content!

  • @ebmpinyuri
    @ebmpinyuri Месяц назад

    the level of detail in explaining the what and why around patterns in rust is high level ....keep the good work

  • @Mempler
    @Mempler 2 месяца назад

    The US Government literally said: "Lets rewrite C in Rust"

  • @colinmaharaj
    @colinmaharaj 2 месяца назад

    How about going from C to Rust and back to C. Will a well formed code transcompiler do a good job of maintaining safety if you move from Rust to C. One step further, why not just take the Rust compile time checks and somehow put that in a c compiler say in a CLANG compiler.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      But wouldn't that make the language end ip being a lot like Rust? Most syntax it has is there for a reason. 😁

  • @theretroman3862
    @theretroman3862 2 месяца назад

    And obviously you all told them to go fak them selves, right? We do not need faster robots!

  • @yapayzeka
    @yapayzeka 2 месяца назад

    16:59 very important graph

  • @CallistoPili
    @CallistoPili 2 месяца назад

    At this point why not ADA, they already use that language for everything safety critical related to miltary stuff. imho.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      Even as a hardcore Rustacean, I agree, but I guess it also has to do with economics of finding and attracting talent. 🤷🏻‍♂️

    • @CallistoPili
      @CallistoPili 2 месяца назад

      @@oliverjumpertzme ADA devs are well paid, find them is gold. Rust will be cheaper in the long term due to mass adoption. Rust is young, I used a bit for internal R&D but I already use VHDL, so reading ADA is personally much simpler than Rust for me to understand.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      @@CallistoPilithat might be the issue then, yea. ☺️ And totally understandable you feel this way!

  • @JimRohn-u8c
    @JimRohn-u8c 2 месяца назад

    What about Zig? I keep hearing about Zig being the replacement for C…

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      It does not have all the guarantees of Rust, and a smaller community/ecosystem. Rust has marketed itself pretty well, imho, and it has a very active community. Those are plus points in a comparison. ☺️

    • @falex3489
      @falex3489 2 месяца назад

      ​@@oliverjumpertzmeWhat about Carbon? Wasn't that going for a safe superset of C++? It's also backed by Google.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      @@falex3489yes, but it is way too young right now, imho. I think Rust has the luck to tick all the right boxes for the moment. As a Rustacean, I'm happy, but no one can tell how it'll be in 5 years. ☺️

  • @mdabdulaziz6589
    @mdabdulaziz6589 2 месяца назад

    Just use ada

  • @Mempler
    @Mempler 2 месяца назад

    Just rewrite Rust in Rust

  • @Solo-mon
    @Solo-mon 2 месяца назад

    lol the hypocrisy continues…. All this talk about energy efficiency and they want to use a language that uses way more energy than C lol.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      In the end, it’s about safety 🤷🏻‍♂️

  • @me_12-vw1vi
    @me_12-vw1vi 2 месяца назад

    if the us governments wants me to then i’ll never do it

  • @anotherelvis
    @anotherelvis 2 месяца назад

    c2rust already exists. The output is somewhat ugly and unsafe, but allegedly some people have fund it useful.

  • @riigel
    @riigel 2 месяца назад

    Hoping to get a good paying Rust job so I can own a house without borrowing it for its entire 'lifetime 😅

  • @qbasic16
    @qbasic16 2 месяца назад

    Wonderful content! Thank you so much :)

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      Super happy to read that. Thank you! 💛

  • @mintx1720
    @mintx1720 2 месяца назад

    in fact you can do this in rust, which makes perfect sense cin >> &mut string;

  • @barrynorman5070
    @barrynorman5070 2 месяца назад

    Awesome Oli! THX

  • @Heater-v1.0.0
    @Heater-v1.0.0 2 месяца назад

    Just because one can easily have sound effects as things appear and disappear does not mean that one has to or that it is a good idea. I find all these superfluous noises really annoying. As are the random images that flash up for no particular reason.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      K

    • @Heater-v1.0.0
      @Heater-v1.0.0 2 месяца назад

      @@oliverjumpertzme Sorry, I was a bit harsh there. I liked your vid, perhaps I'm oversensitive to these details.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      @@Heater-v1.0.0 the critique itself is right. I wanted to release it without any overly hefty sound, but someone convinced me not to. Watching other tech creators' content shows that most don't use effects because it probably distracts too much. I’m think I am better off without the sound effects, and I will tone down the animations. I won't go without them, but I will tune the ADHD level down a bit. 😉

    • @Heater-v1.0.0
      @Heater-v1.0.0 2 месяца назад

      @@oliverjumpertzme I feel that one of the most important things in a vid is the creator, their character, personality, style. That has to shine through. Almost as important as the actual informational content. The extra fluff of sound effects, animations etc is unnecessary. That's not to say some sprinkling of animations/sounds cannot be entertaining and useful. But I feel they have to be appropriate, imaginative, preferably unique, and reflect the creators personality. A difficult thing to pull off I'm sure. Anyway wishing you the best for your work.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      @@Heater-v1.0.0 thank you. Happy we could sort this out. ☺️

  • @IlikeDaCookie
    @IlikeDaCookie 2 месяца назад

    What do you use to do your animations?

  • @edgeeffect
    @edgeeffect 2 месяца назад

    I love the example code at 3:54! Is that actual real code, or something you have summarised, or something you've made up yourself just as an illustration???

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      It's demonstrational code, but how I would probably implement a naive version of an integer addition with inline assembly. ☺️ Or in other words: with all my examples, I try to spend a lot of time trying to come with something realistic, which doesn't feel too constructed. Admittedly, I don't always to succeed, but it makes me happy to read that you like this particular example. ☺️

    • @edgeeffect
      @edgeeffect 2 месяца назад

      @@oliverjumpertzme Yes... a "nice" piece of example code is an art-form. :)

  • @pup4301
    @pup4301 2 месяца назад

    If I want use trait functionality on a external data type I wrap it in a function pointer and in the trait I have a function to get the data type so that I can use it in the functions of the trait.

    • @oliverjumpertzme
      @oliverjumpertzme 2 месяца назад

      Yep, basically also a form of the new-type idiom to work around orphan rules. 😁