Expressions

operator expression #

OperatorExpression :
      BorrowExpression
   | DereferenceExpression
   | ErrorPropagationExpression
   | NegationExpression
   | ArithmeticOrLogicalExpression
   | ComparisonExpression
   | LazyBooleanExpression
   | TypeCastExpression
   | AssignmentExpression
   | CompoundAssignmentExpression

问号操作符 (question mark operator) #

  • 一元后缀操作符
  • 只针对 Result<T, E> 或者 Option<T>
  • 取出其中有效的值或者继续抛出错误

Err(e) => Err(From::from(e)) Ok(x) => x None => None Some(x) => x