344
rustmas (thelemmy.club)
you are viewing a single comment's thread
view the rest of the comments
[-] mkwt@lemmy.world 46 points 5 months ago

Rust has many container-like objects that may or may contain a value, like Box. Most of these have an unwrap() method that either obtains the inner value or panics the whole application.

[-] locuester@lemmy.zip 34 points 5 months ago

Box is a bad example; it always has a value and can’t be unwrapped. It’s Result and Option that are the primary wrappers.

Result is for Errors, and Option is for nullables. If you consider it that way, the “issues” with unwrap are identical to other languages when errors and nulls aren’t properly handled.

[-] boonhet@sopuli.xyz 16 points 5 months ago

I reckon the person you're replying to knows exactly what unwrap is, because the last big famous Cloudflare outage was caused by it. They were making a joke of their own

[-] littleomid@feddit.org 13 points 5 months ago
[-] expatriado@lemmy.world 10 points 5 months ago

sounds like an error handling issue

[-] brandon@piefed.social 16 points 5 months ago

Yes it is. Typically you'd do some pattern matching to handle every possible case, but Unwrap is often used as a shortcut.

this post was submitted on 18 Dec 2025
344 points (98.9% liked)

Programmer Humor

42256 readers
106 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS