0Pricing
Learn Rust Coding · Lesson

Binding with @

Capture and test.

The @ Binding Operator

The @ operator lets you test a value against a pattern and bind it to a name at the same time. You get both the check and the value.

The Problem It Solves

With a range pattern you know a value fell in range, but you lose access to the specific value. @ captures it while still testing the range.

All lessons in this course

  1. match Deep Dive
  2. if let and while let
  3. Binding with @
  4. Destructuring
← Back to Learn Rust Coding