Decrusting the serde crate
Ғылым және технология
In this stream, we peel back the crust on the serde crate - github.com/serde-rs/serde/ - and explore its interface, structure, and mechanisms. We talk about Serialize/Deserialize, Serializer/Deserializer, and the Visitor trait. We also get into the serde data model, and in particular the separation between data types, serde data values, and data formats.
For more details about serde, see serde.rs/.
I use `cargo expand` extensively in this video, which you can find here: github.com/dtolnay/cargo-expand
The streaming calendar is at calendar.google.com/calendar/..., with some other formats listed in / 1602067723986513920 .
0:00:00 Introduction to "decrusted"
0:01:51 Regular streaming schedule
0:02:43 serde
0:04:28 The serde data model
0:14:51 Exploring serde's derived impls
0:17:05 Derived impl Serialize
0:27:56 Derived impl Deserialize
0:53:55 serde derive attributes
1:02:50 (De)serializing enum variants
1:07:31 Enum variant representations
1:24:32 Variant attributes
1:25:54 serde(borrow)
1:38:43 Writing data formats
1:49:48 Closing thoughts
Live version with chat: • Decrusting the serde c...
Пікірлер: 51
It's nice that Serde included this video in their homepage.
@cat-.-
Жыл бұрын
honestly having someone to hold your hands and walk you through it feels sooo good.
I remember when I first used serde. I just couldn’t believe how incredible it was, and I still can’t.
I think this is one of the best programming channels I've ever seen. Not only among rust channels, but all programming channels. Complicated stuff explained simply and in depth at the same time. Thank you, Jon
great stream as always, i feel so humbled over that there are such intelligent people that can write stuff like serde, and for you who can actually read the code and understand what it does. Wish i could get to that level one day.
@DavidJamesQ
6 ай бұрын
I agree -- recognizing the goal and aspiring to writing great abstractions and being humble about it suggests to me like you're already well on your way!
Thx, really high value content. Amazing. There are so many crates out there, so that I'd love to see more than 1 video in 4 weeks. Thx for your work and effort!
Maybe it is mentioned later in the video (have not finished it yet), but out of curiosity I was wondering why this is not a 'Crust of Rust'. More importantly, I'm grateful for this kind of content. Demystifying code/digging in to the core is always interesting, but guided by an expert makes it more fun and you learn more and quicker. Thank you and cheers!
@llblumire
Жыл бұрын
Crust of rust is standard library & core language features. "decrusted" is community created crates
@MRECoelho
Жыл бұрын
@@llblumire Ah, I see. Thanks for the clarification!
@cat-.-
Жыл бұрын
I thought serde was some sort of standard lol
Rust code digging content is rare, this is top notch, can't wait for more Decrusting!
Another amazing Rust video to watch!
Amazing vídeo! Thanks! Turns learning Rust (and Serde) into an exciting adventure !
Wow, Awesome 😍 been waiting for this
Defenestration... One of the best words in the english language.
Thanks for the stream.
Another great stream 👍 Can I ask to make the next video about LLVM? I'm really eager to see your insight on that 🤗
This video is on the front page of the serde website.
Thanks!
This was very dense, but you made a great job explaining each part. I have been breaking my head trying to write a custom deserializer for my enum format, and there is very little documentation about it,
I highly agree to use BLUE as reference to Types!
Thank you for this fantastic exploration of serde! I noticed that the Github code section/tab you have is different from mine (for example, the directory tree remains on the left side when you open a file and you can search within the file). Is this achieved with a browser extension or is it a setting on Github?
Thank you!
Heya this was really helpful and obviously you have a lot of deep knowledge. FWIW I felt like you breeze over the parts you consider obvious or easy, because they are the common case, and spend more time digging into the nitty gritty weird edge cases that are more complicated. I would actually appreciate if you did the inverse for videos like this. I am most interested in getting solid fundamentals about the common/obvious case since those are where I'll spend the vast majority of my time. And spending so much time on the niche/weird stuff makes it harder for me to remember the basics of how this crate works. EG you never actually write an example of a trivial custom desterilize method here. This made it hard for me to connect the macro generated deserialize to what my custom deserialize might practically look like. Just my 2 cents. Thanks!
@jonhoo
2 ай бұрын
Thanks for the feedback! I tend to focus on the more nitty-gritty bits because the documentation tends to be quite helpful for the simpler cases. Take serde.rs/custom-serialization.html for example, or the code snippets listed under serde.rs/examples.html.
Thanks for the great video! So Serde Data Model is akin to LLVM IR? If so, when serializing, we have 1 front-end (for Rust) and multiple back-ends (one for JSON, one for TOML, etc.). Is that true?
I wish there can be a serde2 that addresses serde's numerous footguns on its attributes.
Beard
The part that went into the `from` attribute on the specific fields is exactly what I wanted to do, but it only exists at the container level, not field level. You may have made a mistake here...
57:03 I’m not seeing why you would care about the additional bound: supposedly, derive serialize would insert “where Bar: Radical”, and wouldn’t care in which specific cases is the where clause fulfilled.
@jonhoo
Жыл бұрын
The issue is if the derived code will only typecheck for subsets of the type where the bound holds.
YOU SHAVED AAAAHHHH
Other suggestions for crate names: serdefied, serdefication, inserded
Hi Jon! Is it possible for you to make a similar video on `tokio` crate?
❤️💙
It would be amazing if you could make one of these for Tauri :)
nice
I've always pronounced it “sErde” with “e” as in “sErialize”. it sounds great for me
Lost opportunity to call the project serdeeznuts
Can you do winit next?
@gabrielmachado5708
Жыл бұрын
Or wgpu
49:26 let's just say that this is all too big brain I petition for more examples to the docs.
+1 for AXUM
yeye
Dk if its just me but Jon looked better with a beard
Give me my lasagna, Jon.
The name serde looks Spanish to me, so I pronounce it like they would: sayr-day
Please decrust cargo or even rust itself
Beard
Beard