Rust operators

From wikinotes
Revision as of 04:53, 11 February 2023 by Will (talk | contribs) (→‎result?)

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()?;
}

Operator Overloading