File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -124,9 +124,14 @@ lazily initialize the default value.
124124
125125The null-forgiving operator (` ! ` ) does not correspond to an equivalent construct
126126in Rust, as it only affects the compiler's static flow analysis in C#. In Rust,
127- there is no need to use a substitute for it.
127+ there is no need to use a substitute for it. [ ` unwrap ` ] [ opt_unwrap ] is close,
128+ though: it panics if the value is ` None ` . [ ` expect ` ] [ opt_expect ] is similar but allows
129+ you to provide a custom error message. Note that as previously said, panics should
130+ be reserved to unrecoverable situations.
128131
129132[ option ] : https://doc.rust-lang.org/std/option/enum.Option.html
130133[ optmap ] : https://doc.rust-lang.org/std/option/enum.Option.html#method.map
131134[ opt_and_then ] : https://doc.rust-lang.org/std/option/enum.Option.html#method.and_then
132135[ unwrap-or ] : https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap_or
136+ [ opt_unwrap ] : https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap
137+ [ opt_expect ] : https://doc.rust-lang.org/std/option/enum.Option.html#method.expect
You can’t perform that action at this time.
0 commit comments