1. 들어가며
  2. 1. 인사하기
    ❱
    1. 1.1. 코멘트
    2. 1.2. 형식을 지정하는 출력
      ❱
      1. 1.2.1. 디버그
      2. 1.2.2. Display
        ❱
        1. 1.2.2.1. 테스트 케이스: List
      3. 1.2.3. 출력 형식
  3. 2. 기본 자료형
    ❱
    1. 2.1. 변수와 연산자
    2. 2.2. 튜플
    3. 2.3. 배열과 슬라이스
  4. 3. 사용자 정의 자료형
    ❱
    1. 3.1. 구조체
    2. 3.2. 열거형
      ❱
      1. 3.2.1. use
      2. 3.2.2. C-like
      3. 3.2.3. Testcase: linked-list
    3. 3.3. 상수
  5. 4. 변수 바인딩
    ❱
    1. 4.1. Mutability
    2. 4.2. Scope and Shadowing
    3. 4.3. Declare first
    4. 4.4. Freezing
  6. 5. 자료형
    ❱
    1. 5.1. Casting
    2. 5.2. Literals
    3. 5.3. Inference
    4. 5.4. Aliasing
  7. 6. 형변환
    ❱
    1. 6.1. From and Into
    2. 6.2. TryFrom and TryInto
    3. 6.3. To and from Strings
  8. 7. 표현식
  9. 8. 제어문
    ❱
    1. 8.1. if/else
    2. 8.2. loop
      ❱
      1. 8.2.1. Nesting and labels
      2. 8.2.2. Returning from loops
    3. 8.3. while
    4. 8.4. for and range
    5. 8.5. match
      ❱
      1. 8.5.1. Destructuring
        ❱
        1. 8.5.1.1. tuples
        2. 8.5.1.2. enums
        3. 8.5.1.3. pointers/ref
        4. 8.5.1.4. structs
      2. 8.5.2. Guards
      3. 8.5.3. Binding
    6. 8.6. if let
    7. 8.7. while let
  10. 9. 함수
    ❱
    1. 9.1. Methods
    2. 9.2. Closures
      ❱
      1. 9.2.1. Capturing
      2. 9.2.2. As input parameters
      3. 9.2.3. Type anonymity
      4. 9.2.4. Input functions
      5. 9.2.5. As output parameters
      6. 9.2.6. Examples in std
        ❱
        1. 9.2.6.1. Iterator::any
        2. 9.2.6.2. Searching through iterators
    3. 9.3. Higher Order Functions
    4. 9.4. Diverging functions
  11. 10. 모듈
    ❱
    1. 10.1. Visibility
    2. 10.2. Struct visibility
    3. 10.3. The use declaration
    4. 10.4. super and self
    5. 10.5. File hierarchy
  12. 11. 크레이트(Crate)
    ❱
    1. 11.1. Creating a Library
    2. 11.2. Using a Library
  13. 12. 카고(Cargo)
    ❱
    1. 12.1. Dependencies
    2. 12.2. Conventions
    3. 12.3. Tests
    4. 12.4. Build Scripts
  14. 13. Attributes
    ❱
    1. 13.1. dead_code
    2. 13.2. Crates
    3. 13.3. cfg
      ❱
      1. 13.3.1. Custom
  15. 14. Generics
    ❱
    1. 14.1. Functions
    2. 14.2. Implementation
    3. 14.3. Traits
    4. 14.4. Bounds
      ❱
      1. 14.4.1. Testcase: empty bounds
    5. 14.5. Multiple bounds
    6. 14.6. Where clauses
    7. 14.7. New Type Idiom
    8. 14.8. Associated items
      ❱
      1. 14.8.1. The Problem
      2. 14.8.2. Associated types
    9. 14.9. Phantom type parameters
      ❱
      1. 14.9.1. Testcase: unit clarification
  16. 15. Scoping rules
    ❱
    1. 15.1. RAII
    2. 15.2. Ownership and moves
      ❱
      1. 15.2.1. Mutability
      2. 15.2.2. Partial moves
    3. 15.3. Borrowing
      ❱
      1. 15.3.1. Mutability
      2. 15.3.2. Aliasing
      3. 15.3.3. The ref pattern
    4. 15.4. Lifetimes
      ❱
      1. 15.4.1. Explicit annotation
      2. 15.4.2. Functions
      3. 15.4.3. Methods
      4. 15.4.4. Structs
      5. 15.4.5. Traits
      6. 15.4.6. Bounds
      7. 15.4.7. Coercion
      8. 15.4.8. Static
      9. 15.4.9. Elision
  17. 16. Traits
    ❱
    1. 16.1. Derive
    2. 16.2. Returning Traits with dyn
    3. 16.3. Operator Overloading
    4. 16.4. Drop
    5. 16.5. Iterators
    6. 16.6. impl Trait
    7. 16.7. Clone
    8. 16.8. Supertraits
    9. 16.9. Disambiguating overlapping traits
  18. 17. macro_rules!
    ❱
    1. 17.1. Syntax
      ❱
      1. 17.1.1. Designators
      2. 17.1.2. Overload
      3. 17.1.3. Repeat
    2. 17.2. DRY (Don't Repeat Yourself)
    3. 17.3. DSL (Domain Specific Languages)
    4. 17.4. Variadics
  19. 18. Error handling
    ❱
    1. 18.1. panic
    2. 18.2. Option & unwrap
      ❱
      1. 18.2.1. Unpacking options with ?
      2. 18.2.2. Combinators: map
      3. 18.2.3. Combinators: and_then
    3. 18.3. Result
      ❱
      1. 18.3.1. map for Result
      2. 18.3.2. aliases for Result
      3. 18.3.3. Early returns
      4. 18.3.4. Introducing ?
    4. 18.4. Multiple error types
      ❱
      1. 18.4.1. Pulling Results out of Options
      2. 18.4.2. Defining an error type
      3. 18.4.3. Boxing errors
      4. 18.4.4. Other uses of ?
      5. 18.4.5. Wrapping errors
    5. 18.5. Iterating over Results
  20. 19. Std library types
    ❱
    1. 19.1. Box, stack and heap
    2. 19.2. Vectors
    3. 19.3. Strings
    4. 19.4. Option
    5. 19.5. Result
      ❱
      1. 19.5.1. ?
    6. 19.6. panic!
    7. 19.7. HashMap
      ❱
      1. 19.7.1. Alternate/custom key types
      2. 19.7.2. HashSet
    8. 19.8. Rc
    9. 19.9. Arc
  21. 20. Std misc
    ❱
    1. 20.1. Threads
      ❱
      1. 20.1.1. Testcase: map-reduce
    2. 20.2. Channels
    3. 20.3. Path
    4. 20.4. File I/O
      ❱
      1. 20.4.1. open
      2. 20.4.2. create
      3. 20.4.3. read lines
    5. 20.5. Child processes
      ❱
      1. 20.5.1. Pipes
      2. 20.5.2. Wait
    6. 20.6. Filesystem Operations
    7. 20.7. Program arguments
      ❱
      1. 20.7.1. Argument parsing
    8. 20.8. Foreign Function Interface
  22. 21. Testing
    ❱
    1. 21.1. Unit testing
    2. 21.2. Documentation testing
    3. 21.3. Integration testing
    4. 21.4. Dev-dependencies
  23. 22. Unsafe Operations
  24. 23. Compatibility
    ❱
    1. 23.1. Raw identifiers
  25. 24. Meta
    ❱
    1. 24.1. Documentation
    2. 24.2. Playpen

예제로 배우는 러스트 (Rust by Example) 한국어판

Destructuring

A match block can destructure items in a variety of ways.

  • Destructuring Tuples
  • Destructuring Enums
  • Destructuring Pointers
  • Destructuring Structures