51
submitted 2 weeks ago by Ephera@lemmy.ml to c/rust@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] ubik@fedi.turbofish.cc 7 points 2 weeks ago

@Ephera you have to be a connoisseur to understand this one ๐Ÿ™‚

[-] Nibodhika@lemmy.world 5 points 2 weeks ago

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).

[-] SWW13@lemmy.brief.guru 11 points 2 weeks ago

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@lemmy.ca 8 points 2 weeks ago

Ah, so a trans pose.

Nice.

[-] badmin@lemm.ee 4 points 2 weeks ago

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

this post was submitted on 26 Feb 2025
51 points (100.0% liked)

Rust Programming

8545 readers
8 users here now

founded 5 years ago
MODERATORS