Rust 1.72.0

  Рет қаралды 2,812

Nathan Stocks

Nathan Stocks

Күн бұрын

Пікірлер: 25
@Benni1000games
@Benni1000games Жыл бұрын
I assume the endian lints have been added so you can discourage people from accidentially breaking portability between platforms by them assuming something will use BE or LE down the line. Like using to_be_bytes and then using that result somewhere the native platform expects LE byte order
@zperk13
@zperk13 Жыл бұрын
Yep! I was working on a network protocol, and two computers communicating could be using different endianness, so you don't want to use native endianness in that. Also, it's possible to accidently type (especially with code completion) the wrong one. For instance, in my thing, I'm always using little endian, but maybe while typing fast and using code completion, I accidently type big endian instead. If that happened, this lint would stop me.
@NathanStocks
@NathanStocks Жыл бұрын
@@zperk13 I love that you found this video and filled us in on the details! 😄
@birraasmile9722
@birraasmile9722 Жыл бұрын
Thanks Nathan for all your videos that relates to new version of Rust and its top additions/changes
@NathanStocks
@NathanStocks Жыл бұрын
You're welcome!
@Dygear
@Dygear Жыл бұрын
As far as the ne/le/be lint -- The use case that comes to mind is a byte format for a file or network stream that you want to ensure is consistent. Having a Raspberry Pi talk to a Windows machine, you want to make sure the byte order is consistent between these two different archs and their different byte orders. In theory, everything over the wire would be translated to network byte order, but I don't think that is guaranteed.
@zperk13
@zperk13 Жыл бұрын
Yep! I was working on a network protocol when I suggested the lint
@NathanStocks
@NathanStocks Жыл бұрын
@@zperk13 Just out of curiosity, can you share what network protocol you were working on?
@zperk13
@zperk13 Жыл бұрын
@@NathanStocks I was just experimenting with tcp hole punching. Nothing formal/official
@NathanStocks
@NathanStocks Жыл бұрын
@@zperk13 Cool, thanks for sharing!
@zperk13
@zperk13 Жыл бұрын
14:20 Yay! It made it in! I had a non-zero amount of influence on that. To answer your question as to why: I was working on a communication protocol between computers and in it, I needed to decode/encode information, and to do that, I needed to convert multiple bytes into one integer. Now, if you're doing this, it's very important that you always use the same endianness when encoding/decoding, and it's possible you could mess that up. So in my thing, I used little endian. If at some point I accidently used big endian, which would make the encoder encode stuff wrong, now clippy can warn me!
@NathanStocks
@NathanStocks Жыл бұрын
Ah! Thank you for the explanation!
@realth000
@realth000 Жыл бұрын
24 new lints, that's why I love clippy
@NathanStocks
@NathanStocks Жыл бұрын
Seriously, it's so good.
@RenderingUser
@RenderingUser Жыл бұрын
Damn. This is a sentence that would have been entirely unimaginable almost 2 decades ago.
@NathanStocks
@NathanStocks Жыл бұрын
​@@RenderingUser 🤣Seriously. The original clippy that it is named after was a disaster!
@NathanStocks
@NathanStocks Жыл бұрын
Seriously, the *other* clippy from long ago was...not well loved.
@meka4996
@meka4996 Жыл бұрын
Thank you!
@NathanStocks
@NathanStocks Жыл бұрын
You're welcome!
@Dygear
@Dygear Жыл бұрын
I've never used Manually Drop before -- So the underlying details are not known to me at this time -- I would have thought that dropping with the drop function would actually cause the drop to happen ... Whereas it going out of scope would _not_ drop it because there was no manual drop statement there. I believe this is due to the ManuallyDrop value actually belonging to the interior of the Struct, but I do think that intiatively a drop function should work on ManuallyDrop. I would love to know why that was actually not considered acceptable or if it's a language limitation.
@NathanStocks
@NathanStocks Жыл бұрын
The ManuallyDrop struct is "A wrapper to inhibit compiler from automatically calling T’s destructor." -- so whether you explicitly drop it inline with the drop() function or let it go out of scope makes no difference. For more details, check out doc.rust-lang.org/stable/std/mem/struct.ManuallyDrop.html
@TehGettinq
@TehGettinq Жыл бұрын
thanks!
@NathanStocks
@NathanStocks Жыл бұрын
No problem!
@meowsqueak
@meowsqueak Жыл бұрын
Returning Ok on an unsuccessful kill seems like a Bad Idea to me. It assumes that kill is only used to terminate a process. But what if it's useful to know whether a process was actually killed or not? This is throwing away information. EDIT: oh, it's due to a Windows compatibility thing. Great 😕
@NathanStocks
@NathanStocks Жыл бұрын
If you want to know the status of the child process (whether it has already exited), call try_wait. doc.rust-lang.org/std/process/struct.Child.html#method.try_wait
Rust 1.72.1
1:29
Nathan Stocks
Рет қаралды 499
Rust Releases! Rust 1.71.0
10:48
Nathan Stocks
Рет қаралды 12 М.
amazing#devil #lilith #funny #shorts
00:15
Devil Lilith
Рет қаралды 18 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 57 МЛН
Rust 1.73.0: Everything Revealed in 16 Minutes
16:32
Nathan Stocks
Рет қаралды 7 М.
Rust 1.75.0: 54 highlights in 20 minutes
20:00
Nathan Stocks
Рет қаралды 16 М.
Rust 1.78.0: Last Rust News Video...ever?
16:21
Nathan Stocks
Рет қаралды 9 М.
Operating System using Rust and aarch64 - The beginnings (1)
37:11
ArrynDoesTech
Рет қаралды 2,9 М.
Rust: Iterators
20:07
The Dev Method
Рет қаралды 15 М.
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 319 М.
5 traits your Rust types must implement
10:39
Let's Get Rusty
Рет қаралды 61 М.
Why Rust is bad, actually*
11:53
UWCS - University of Warwick Computing Society
Рет қаралды 44 М.
Rust's Most Important Containers 📦 10 Useful Patterns
17:11
Code to the Moon
Рет қаралды 127 М.
Rust's iterators are more interesting than they look
22:46
timClicks
Рет қаралды 9 М.