Rust operators: Difference between revisions
From wikinotes
Line 6: | Line 6: | ||
= Result Operators = | = Result Operators = | ||
<blockquote> | <blockquote> | ||
== result? == | == ${result}? == | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="rust"> | <syntaxhighlight lang="rust"> |
Revision as of 04:53, 11 February 2023
Arithmetic
Result Operators
${result}?
// bind 'Ok-val' to bar, // if 'Err-val', return-early with Err(Err-val) fn foo() -> Result<_, _> { let bar = get_result()?; }