Introduction to Operators

Introduction to Operators


  • An operator is a symbol that takes one or more values and outputs another. It tells the compiler to perform some sort of operation.

Types of Operators

  • Different operators are available in Rust for performing different operations. Based on the number of operands, the operators can be categorized into binary and unary operators:

Unary Operators

  • The operators that act upon a single operand are unary operators.

  • Types
    • Borrow Expression
    • Dereference Expression
    • Negation Expression
    • Logical Negation Expression

Binary Operators

  • The operators that deal with two operands are binary operators.

  • Types
    • Arithmetic Expression
    • Logical Expression
    • Comparison Expression
    • Bitwise Expressions
    • Assignment Expression
    • Compound Assignment Expression
    • Typecast Expression