서론
1.
Hello World
❱
1.1.
주석
1.2.
출력 포맷팅
❱
1.2.1.
Debug
1.2.2.
Display
❱
1.2.2.1.
Testcase: List
1.2.3.
포맷팅
2.
기본 요소
❱
2.1.
리터럴, 연산자
2.2.
튜플
2.3.
배열, 슬라이스
3.
커스텀 타입
❱
3.1.
구조체
3.2.
열거형
❱
3.2.1.
use
3.2.2.
C-like
3.2.3.
Testcase: 연결 리스트
3.3.
상수
4.
변수 바인딩
❱
4.1.
가변성
4.2.
스코프, 변수 가리기
4.3.
조기 선언
4.4.
변수 동결
5.
타입
❱
5.1.
형변환
5.2.
리터럴
5.3.
타입 추론
5.4.
타입 별칭
6.
형변환
❱
6.1.
From, Into
6.2.
TryFrom, TryInto
6.3.
문자열 변환
7.
표현식
8.
흐름 제어
❱
8.1.
if/else
8.2.
loop
❱
8.2.1.
중첩, 라벨
8.2.2.
반복문에서 반환하기
8.3.
while
8.4.
for 반복문, 범위
8.5.
match
❱
8.5.1.
해체
❱
8.5.1.1.
튜플
8.5.1.2.
열거형
8.5.1.3.
포인터/참조자
8.5.1.4.
구조체
8.5.2.
매치 가드
8.5.3.
바인딩
8.6.
if let
8.7.
while let
9.
Functions
❱
9.1.
Methods
9.2.
Closures
❱
9.2.1.
Capturing
9.2.2.
As input parameters
9.2.3.
Type anonymity
9.2.4.
Input functions
9.2.5.
As output parameters
9.2.6.
Examples in std
❱
9.2.6.1.
Iterator::any
9.2.6.2.
Searching through iterators
9.3.
Higher Order Functions
9.4.
Diverging functions
10.
Modules
❱
10.1.
Visibility
10.2.
Struct visibility
10.3.
The use declaration
10.4.
super and self
10.5.
File hierarchy
11.
Crates
❱
11.1.
Creating a Library
11.2.
Using a Library
12.
Cargo
❱
12.1.
Dependencies
12.2.
Conventions
12.3.
Tests
12.4.
Build Scripts
13.
Attributes
❱
13.1.
dead_code
13.2.
Crates
13.3.
cfg
❱
13.3.1.
Custom
14.
Generics
❱
14.1.
Functions
14.2.
Implementation
14.3.
Traits
14.4.
Bounds
❱
14.4.1.
Testcase: empty bounds
14.5.
Multiple bounds
14.6.
Where clauses
14.7.
New Type Idiom
14.8.
Associated items
❱
14.8.1.
The Problem
14.8.2.
Associated types
14.9.
Phantom type parameters
❱
14.9.1.
Testcase: unit clarification
15.
Scoping rules
❱
15.1.
RAII
15.2.
Ownership and moves
❱
15.2.1.
Mutability
15.2.2.
Partial moves
15.3.
Borrowing
❱
15.3.1.
Mutability
15.3.2.
Aliasing
15.3.3.
The ref pattern
15.4.
Lifetimes
❱
15.4.1.
Explicit annotation
15.4.2.
Functions
15.4.3.
Methods
15.4.4.
Structs
15.4.5.
Traits
15.4.6.
Bounds
15.4.7.
Coercion
15.4.8.
Static
15.4.9.
Elision
16.
Traits
❱
16.1.
Derive
16.2.
Returning Traits with dyn
16.3.
Operator Overloading
16.4.
Drop
16.5.
Iterators
16.6.
impl Trait
16.7.
Clone
16.8.
Supertraits
16.9.
Disambiguating overlapping traits
17.
macro_rules!
❱
17.1.
Syntax
❱
17.1.1.
Designators
17.1.2.
Overload
17.1.3.
Repeat
17.2.
DRY (Don't Repeat Yourself)
17.3.
DSL (Domain Specific Languages)
17.4.
Variadics
18.
Error handling
❱
18.1.
panic
18.2.
Option & unwrap
❱
18.2.1.
Unpacking options with ?
18.2.2.
Combinators: map
18.2.3.
Combinators: and_then
18.3.
Result
❱
18.3.1.
map for Result
18.3.2.
aliases for Result
18.3.3.
Early returns
18.3.4.
Introducing ?
18.4.
Multiple error types
❱
18.4.1.
Pulling Results out of Options
18.4.2.
Defining an error type
18.4.3.
Boxing errors
18.4.4.
Other uses of ?
18.4.5.
Wrapping errors
18.5.
Iterating over Results
19.
Std library types
❱
19.1.
Box, stack and heap
19.2.
Vectors
19.3.
Strings
19.4.
Option
19.5.
Result
❱
19.5.1.
?
19.6.
panic!
19.7.
HashMap
❱
19.7.1.
Alternate/custom key types
19.7.2.
HashSet
19.8.
Rc
19.9.
Arc
20.
Std misc
❱
20.1.
Threads
❱
20.1.1.
Testcase: map-reduce
20.2.
Channels
20.3.
Path
20.4.
File I/O
❱
20.4.1.
open
20.4.2.
create
20.4.3.
read lines
20.5.
Child processes
❱
20.5.1.
Pipes
20.5.2.
Wait
20.6.
Filesystem Operations
20.7.
Program arguments
❱
20.7.1.
Argument parsing
20.8.
Foreign Function Interface
21.
Testing
❱
21.1.
Unit testing
21.2.
Documentation testing
21.3.
Integration testing
21.4.
Dev-dependencies
22.
Unsafe Operations
23.
Compatibility
❱
23.1.
Raw identifiers
24.
Meta
❱
24.1.
Documentation
24.2.
Playpen
Light (default)
Rust
Coal
Navy
Ayu
Rust By Example
Syntax
In following subsections, we will show how to define macros in Rust. There are three basic ideas:
Patterns and Designators
Overloading
Repetition