Rust replaces the concept of `null` with the `Option
There are several idiomatic ways to work with an `Option`. Calling `unwrap()` returns the inner value or panics if it is `None`, which is appropriate only when you are certain the value exists. `unwrap_or(default)` provides a fallback instead of panicking. `if let Some(v) = opt { ... }` and `match` give you explicit control over both branches. The `?` operator applied to an `Option` returns the inner value when it is `Some` and early-returns `None` to the caller otherwise, which keeps chains of fallible optional operations short and readable.
For operations that can fail in a recoverable way, Rust uses `Result
The distinction between `panic!` and `Result` is intentional. A `panic!` is for unrecoverable errors: it unwinds the stack and typically aborts the current thread, which is appropriate for invariant violations and bugs that the program cannot safely continue past. `Result` is for errors the caller should be able to handle, such as a missing file or malformed input. Library code almost always prefers `Result`, while `panic!` is reserved for situations where continuing would corrupt the program's state.