Pinned
Olivia π¦
Olivia π¦
@iolivia.me
π©βπ» staff eng π¦ post a lot about rust and rust gamedev βοΈ wrote https://sokoban.iolivia.me π₯ blog at https://iolivia.me π§΅ weekly #rustlang threads every Thursday - subscribe here https://forms.gle/Tcm7cAkLt4NF9ZCZ9
718 followers76 following996 posts
One year in, time to reflect on the #rustlang threads! I wrote 44 total threads, many of you read them, and liked them and almost 100 people subscribed to the newsletter! I couldn't be more thankful for this. But unfortunately, I will stop writing these for now. Why? π
Hey all π This year I'll try to stick to Thread Thursdays, which is every Thursday I'll post a thread about #rustlang fundamentals π¦ My goal is to help you learn 1% more Rust each Thursday, so follow me if you'd like to read them π¦ Here are some of the best threads so far π§΅π
One year in, time to reflect on the #rustlang threads! I wrote 44 total threads, many of you read them, and liked them and almost 100 people subscribed to the newsletter! I couldn't be more thankful for this. But unfortunately, I will stop writing these for now. Why? π
Hey all π This year I'll try to stick to Thread Thursdays, which is every Thursday I'll post a thread about #rustlang fundamentals π¦ My goal is to help you learn 1% more Rust each Thursday, so follow me if you'd like to read them π¦ Here are some of the best threads so far π§΅π
6οΈβ£ Conclusion - Futures are lazy state machines - Async provides concurrency, not necessarily parallelism - Cooperative multitasking: tasks yield at .await points only - Send = safe to move between threads - Sync = safe to share references btwn threads - Use async for I/O-bound, threads for CPU-bound
That's it, we learned the basics of how async programming works in Rust! Hope it helped you learn 1% more Rust today, follow me for more threads like this and subscribe to receive these threads over email forms.gle/vY6zXE21Dkwa... π¦ π¦
0οΈβ£ Blocking vs Async Code Let's see what happens when 3 students request transcripts using traditional blocking code. Not only is everything sequential, so each student needs to wait for all transcripts to finish before getting theirs, but also if we are on the main thread we'd be freezing the UI
That's it, we looked at how to do basic error handling in rust and then improved it using anyhow for context and thiserror w error types. Hope it helped you learn 1% more Rust today, follow me for more threads like this and subscribe to receive these threads over email forms.gle/vY6zXE21Dkwa... π¦ π¦
0οΈβ£ The evolution from panic to Result Let's explore error handling approaches using a university database with Student and Course structs, and a Database holding students, courses and an enrollments HashMap. Now let's explore 3 implementations for error handling: V1 - Panic V2 - Bool V3 - Result
#rustlang Thursday Threads recap Organising larger projects w workspaces bsky.app/profile/ioli... Memory layout bsky.app/profile/ioli... Panics bsky.app/profile/ioli... π Subscribe to receive these threads over email π¦ π¦ forms.gle/vY6zXE21Dkwa...
π± Panic in #rustlang What is a panic in Rust, how should you handle it when it happens and when should you use it intentionally in your code? Let's explore panic in more detail π§΅π
That's it, we learned how to use the std::fs module for basic file IO operations in Rust. Hope it helped you learn 1% more Rust today, follow me for more threads like this and subscribe to receive these threads over email forms.gle/vY6zXE21Dkwa... π¦ π¦
5οΈβ£ Parsing contents into structured data Technically not part of the std::fs API but another common pattern is to read a file and then parse its contents into a structured format. Here's how we can read back the grades file. We could also use JSON/CSV+real parser, this is just a simple example.