this post was submitted on 26 Feb 2025
46 points (92.6% liked)

Rust Programming

8414 readers
69 users here now

founded 5 years ago
MODERATORS
 
top 7 comments
sorted by: hot top controversial new old
[–] [email protected] 18 points 2 days ago

You see, a monad is like a burrito...

[–] [email protected] 4 points 1 day ago

It's super useful for TryStreams with next(). I often want to ? the result up, so that I can have a clean item in my while let loop

[–] [email protected] 7 points 2 days ago (1 children)

@Ephera you have to be a connoisseur to understand this one 🙂

[–] [email protected] 3 points 21 hours ago (2 children)

Care to explain for the uninitiated like me? It feels like a meme, but conceptually an Option is very different from a Result, maybe I'm overthinking but to me an Option None means no action was taken (e.g. a function that runs every loop to take an action every second will return None most times and Some when it executes), whereas an Ok(None) means an action was taken and it has nothing to return (e.g. a function that safely reads a value from a JSON file, it didn't failed reading the file so it's an Ok, but the value wasn't there so it's None).

[–] [email protected] 7 points 20 hours ago (1 children)

You can use transpose() to go from Option<Result<T>> to Result<Option<T>> and vice versa.

The "meme" is a trans pride flag and a human pose.

[–] howrar 5 points 18 hours ago

Ah, so a trans pose.

Nice.

[–] [email protected] 2 points 16 hours ago

It's just a "joke" about the method name.