this post was submitted on 18 Dec 2025
320 points (98.8% liked)
Programmer Humor
39542 readers
54 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Is this just like the equivalent of a getter method in C++?
It's more like a method that can throw an exception. Rust doesn't really have exceptions, but if you have a Result or Option type you can Unwrap it to get just the T. But if there's no T to get (in the case of an Error type for Result for None for Option) the call panics.
so you have to wrap everything in a try/catch?
It's worse than that. In C++, if you fail to catch an exception, then std::terminate() is called. In Rust the only options are roughly equivalent to C++ noexcept, or std::terminate() [panic in Rust]. There's nothing in between.
i've been meaning to get into rust; but i'm learning that i lack motivation if it's not part of my job and becoming a sysadmin again doesn't require it.