From 0e4df4b50536a1b300d4618ea13390869aeb4ba7 Mon Sep 17 00:00:00 2001 From: Jiyong Park <55639800+jiyongp@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:53:27 +0900 Subject: [PATCH] ko: Update translation (#1116) --- po/ko.po | 16713 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 10815 insertions(+), 5898 deletions(-) diff --git a/po/ko.po b/po/ko.po index b6533650..4ead7487 100644 --- a/po/ko.po +++ b/po/ko.po @@ -5,28 +5,25 @@ msgstr "" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" +"Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: ko\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.3.2\n" -#: src/SUMMARY.md:3 src/welcome.md:1 +#: src/SUMMARY.md:4 src/index.md:1 msgid "Welcome to Comprehensive Rust ๐Ÿฆ€" msgstr "Comprehensive Rust์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค ๐Ÿฆ€" -#: src/SUMMARY.md:4 src/running-the-course.md:1 +#: src/SUMMARY.md:5 src/running-the-course.md:1 msgid "Running the Course" msgstr "๊ฐ•์˜ ์ง„ํ–‰" -#: src/SUMMARY.md:5 src/running-the-course/course-structure.md:1 +#: src/SUMMARY.md:6 src/running-the-course/course-structure.md:1 msgid "Course Structure" msgstr "๊ฐ•์˜ ๊ตฌ์„ฑ" -#: src/SUMMARY.md:6 src/running-the-course/day-4.md:1 -msgid "Day 4" -msgstr "4์ผ์ฐจ" - #: src/SUMMARY.md:7 src/running-the-course/keyboard-shortcuts.md:1 msgid "Keyboard Shortcuts" msgstr "๋‹จ์ถ•ํ‚ค" @@ -55,7 +52,8 @@ msgstr "์นด๊ณ (Cargo) ์ˆ˜ํ–‰ํ•˜๊ธฐ" msgid "Day 1: Morning" msgstr "1์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:19 src/SUMMARY.md:75 src/SUMMARY.md:128 src/SUMMARY.md:184 +#: src/SUMMARY.md:19 src/SUMMARY.md:76 src/SUMMARY.md:130 src/SUMMARY.md:187 +#: src/SUMMARY.md:213 src/SUMMARY.md:263 msgid "Welcome" msgstr "๊ฐœ์š”" @@ -119,713 +117,949 @@ msgstr "String๊ณผ str" msgid "Functions" msgstr "ํ•จ์ˆ˜" -#: src/SUMMARY.md:35 src/SUMMARY.md:82 src/basic-syntax/methods.md:1 +#: src/SUMMARY.md:35 src/basic-syntax/rustdoc.md:1 +msgid "Rustdoc" +msgstr "Rustdoc" + +#: src/SUMMARY.md:36 src/SUMMARY.md:83 src/basic-syntax/methods.md:1 #: src/methods.md:1 msgid "Methods" msgstr "๋ฉ”์„œ๋“œ" -#: src/SUMMARY.md:36 +#: src/SUMMARY.md:37 msgid "Overloading" msgstr "์˜ค๋ฒ„๋กœ๋”ฉ" -#: src/SUMMARY.md:37 src/SUMMARY.md:66 src/SUMMARY.md:90 src/SUMMARY.md:119 -#: src/SUMMARY.md:148 src/SUMMARY.md:176 src/SUMMARY.md:199 src/SUMMARY.md:226 -#: src/exercises/day-4/morning.md:1 src/exercises/day-4/android.md:1 +#: src/SUMMARY.md:38 src/SUMMARY.md:67 src/SUMMARY.md:91 src/SUMMARY.md:121 +#: src/SUMMARY.md:150 src/SUMMARY.md:179 src/SUMMARY.md:206 src/SUMMARY.md:227 +#: src/SUMMARY.md:255 src/SUMMARY.md:277 src/SUMMARY.md:298 +#: src/exercises/android/morning.md:1 src/exercises/bare-metal/morning.md:1 +#: src/exercises/bare-metal/afternoon.md:1 +#: src/exercises/concurrency/morning.md:1 +#: src/exercises/concurrency/afternoon.md:1 msgid "Exercises" msgstr "์—ฐ์Šต๋ฌธ์ œ" -#: src/SUMMARY.md:38 src/exercises/day-1/implicit-conversions.md:1 +#: src/SUMMARY.md:39 src/exercises/day-1/implicit-conversions.md:1 msgid "Implicit Conversions" msgstr "๋ฌต์‹œ์  ํ˜•๋ณ€ํ™˜" -#: src/SUMMARY.md:39 +#: src/SUMMARY.md:40 msgid "Arrays and for Loops" msgstr "๋ฐฐ์—ด๊ณผ for ๋ฐ˜๋ณต๋ฌธ" -#: src/SUMMARY.md:41 +#: src/SUMMARY.md:42 msgid "Day 1: Afternoon" msgstr "1์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:43 src/basic-syntax/variables.md:1 +#: src/SUMMARY.md:44 src/basic-syntax/variables.md:1 msgid "Variables" msgstr "๋ณ€์ˆ˜" -#: src/SUMMARY.md:44 src/basic-syntax/type-inference.md:1 +#: src/SUMMARY.md:45 src/basic-syntax/type-inference.md:1 msgid "Type Inference" msgstr "ํƒ€์ž… ์ถ”๋ก " -#: src/SUMMARY.md:45 +#: src/SUMMARY.md:46 msgid "static & const" msgstr "์ •์ ๋ณ€์ˆ˜(static)์™€ ์ƒ์ˆ˜(const)" -#: src/SUMMARY.md:46 src/basic-syntax/scopes-shadowing.md:1 +#: src/SUMMARY.md:47 src/basic-syntax/scopes-shadowing.md:1 msgid "Scopes and Shadowing" msgstr "๋ฒ”์œ„(Scopes)์™€ ์‰๋„์ž‰(Shadowing)" -#: src/SUMMARY.md:47 src/memory-management.md:1 +#: src/SUMMARY.md:48 src/memory-management.md:1 msgid "Memory Management" msgstr "๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ" -#: src/SUMMARY.md:48 +#: src/SUMMARY.md:49 msgid "Stack vs Heap" msgstr "์Šคํƒ(Stack)๊ณผ ํž™(Heap)" -#: src/SUMMARY.md:49 src/memory-management/stack.md:1 +#: src/SUMMARY.md:50 msgid "Stack Memory" msgstr "์Šคํƒ ๋ฉ”๋ชจ๋ฆฌ" -#: src/SUMMARY.md:50 src/memory-management/manual.md:1 +#: src/SUMMARY.md:51 src/memory-management/manual.md:1 msgid "Manual Memory Management" msgstr "์ˆ˜๋™ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ" -#: src/SUMMARY.md:51 src/memory-management/scope-based.md:1 +#: src/SUMMARY.md:52 src/memory-management/scope-based.md:1 msgid "Scope-Based Memory Management" msgstr "๋ฒ”์œ„๊ธฐ๋ฐ˜ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ" -#: src/SUMMARY.md:52 +#: src/SUMMARY.md:53 msgid "Garbage Collection" msgstr "๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜" -#: src/SUMMARY.md:53 +#: src/SUMMARY.md:54 msgid "Rust Memory Management" msgstr "๋Ÿฌ์ŠคํŠธ์˜ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ" -#: src/SUMMARY.md:54 src/memory-management/comparison.md:1 +#: src/SUMMARY.md:55 src/memory-management/comparison.md:1 msgid "Comparison" msgstr "๋น„๊ต" -#: src/SUMMARY.md:55 src/ownership.md:1 +#: src/SUMMARY.md:56 src/ownership.md:1 msgid "Ownership" msgstr "์†Œ์œ ๊ถŒ" -#: src/SUMMARY.md:56 src/ownership/move-semantics.md:1 +#: src/SUMMARY.md:57 src/ownership/move-semantics.md:1 msgid "Move Semantics" msgstr "Move ๋ฌธ๋ฒ•" -#: src/SUMMARY.md:57 src/ownership/moved-strings-rust.md:1 +#: src/SUMMARY.md:58 src/ownership/moved-strings-rust.md:1 msgid "Moved Strings in Rust" msgstr "๋Ÿฌ์ŠคํŠธ์—์„œ์˜ ๋ฌธ์ž์—ด ์ด๋™" -#: src/SUMMARY.md:58 src/ownership/double-free-modern-cpp.md:1 +#: src/SUMMARY.md:59 msgid "Double Frees in Modern C++" msgstr "Modern C++์—์„œ ์ด์ค‘ํ•ด์ œ ๋ฌธ์ œ" -#: src/SUMMARY.md:59 src/ownership/moves-function-calls.md:1 +#: src/SUMMARY.md:60 src/ownership/moves-function-calls.md:1 msgid "Moves in Function Calls" msgstr "ํ•จ์ˆ˜ ํ˜ธ์ถœ์—์„œ์˜ ์ด๋™(Move)" -#: src/SUMMARY.md:60 src/ownership/copy-clone.md:1 +#: src/SUMMARY.md:61 src/ownership/copy-clone.md:1 msgid "Copying and Cloning" msgstr "๋ณต์‚ฌ์™€ ๋ณต์ œ" -#: src/SUMMARY.md:61 src/ownership/borrowing.md:1 +#: src/SUMMARY.md:62 src/ownership/borrowing.md:1 msgid "Borrowing" msgstr "๋นŒ๋ฆผ" -#: src/SUMMARY.md:62 src/ownership/shared-unique-borrows.md:1 +#: src/SUMMARY.md:63 src/ownership/shared-unique-borrows.md:1 msgid "Shared and Unique Borrows" msgstr "๊ณต์œ ์™€ ๊ณ ์œ  ๋นŒ๋ฆผ" -#: src/SUMMARY.md:63 src/ownership/lifetimes.md:1 +#: src/SUMMARY.md:64 src/ownership/lifetimes.md:1 msgid "Lifetimes" msgstr "์ˆ˜๋ช…" -#: src/SUMMARY.md:64 src/ownership/lifetimes-function-calls.md:1 +#: src/SUMMARY.md:65 src/ownership/lifetimes-function-calls.md:1 msgid "Lifetimes in Function Calls" msgstr "ํ•จ์ˆ˜ ํ˜ธ์ถœ์—์„œ์˜ ์ˆ˜๋ช…" -#: src/SUMMARY.md:65 src/ownership/lifetimes-data-structures.md:1 +#: src/SUMMARY.md:66 src/ownership/lifetimes-data-structures.md:1 msgid "Lifetimes in Data Structures" msgstr "๊ตฌ์กฐ์ฒด์—์„œ์˜ ์ˆ˜๋ช…" -#: src/SUMMARY.md:67 src/exercises/day-1/book-library.md:1 -#: src/exercises/day-1/solutions-afternoon.md:3 -msgid "Designing a Library" -msgstr "๋„์„œ๊ด€ ์„ค๊ณ„" +#: src/SUMMARY.md:68 src/exercises/day-1/book-library.md:1 +msgid "Storing Books" +msgstr "์ฑ… ์ €์žฅํ•˜๊ธฐ" -#: src/SUMMARY.md:68 src/exercises/day-1/iterators-and-ownership.md:1 +#: src/SUMMARY.md:69 src/exercises/day-1/iterators-and-ownership.md:1 msgid "Iterators and Ownership" msgstr "๋ฐ˜๋ณต์ž์™€ ์†Œ์œ ๊ถŒ" -#: src/SUMMARY.md:71 +#: src/SUMMARY.md:72 msgid "Day 2: Morning" msgstr "2์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:76 src/structs.md:1 +#: src/SUMMARY.md:77 src/structs.md:1 msgid "Structs" msgstr "๊ตฌ์กฐ์ฒด" -#: src/SUMMARY.md:77 src/structs/tuple-structs.md:1 +#: src/SUMMARY.md:78 src/structs/tuple-structs.md:1 msgid "Tuple Structs" msgstr "ํŠœํ”Œ" -#: src/SUMMARY.md:78 src/structs/field-shorthand.md:1 +#: src/SUMMARY.md:79 src/structs/field-shorthand.md:1 msgid "Field Shorthand Syntax" msgstr "ํ•„๋“œ ํ• ๋‹น ๋‹จ์ถ• ๋ฌธ๋ฒ•" -#: src/SUMMARY.md:79 src/enums.md:1 +#: src/SUMMARY.md:80 src/enums.md:1 msgid "Enums" msgstr "์—ด๊ฑฐํ˜•" -#: src/SUMMARY.md:80 src/enums/variant-payloads.md:1 +#: src/SUMMARY.md:81 src/enums/variant-payloads.md:1 msgid "Variant Payloads" msgstr "๋ฐ์ดํ„ฐ๋ฅผ ํฌํ•จํ•˜๋Š” ์—ด๊ฑฐํ˜•(Variant Payloads)" -#: src/SUMMARY.md:81 src/enums/sizes.md:1 +#: src/SUMMARY.md:82 src/enums/sizes.md:1 msgid "Enum Sizes" msgstr "์—ด๊ฑฐํ˜•์˜ ํฌ๊ธฐ" -#: src/SUMMARY.md:83 src/methods/receiver.md:1 +#: src/SUMMARY.md:84 src/methods/receiver.md:1 msgid "Method Receiver" msgstr "๋ฉ”์„œ๋“œ ๋ฆฌ์‹œ๋ฒ„(Receiver)" -#: src/SUMMARY.md:84 src/SUMMARY.md:159 src/SUMMARY.md:194 +#: src/SUMMARY.md:85 src/SUMMARY.md:161 src/SUMMARY.md:276 #: src/methods/example.md:1 src/concurrency/shared_state/example.md:1 msgid "Example" msgstr "์˜ˆ์ œ" -#: src/SUMMARY.md:85 src/pattern-matching.md:1 +#: src/SUMMARY.md:86 src/pattern-matching.md:1 msgid "Pattern Matching" msgstr "ํŒจํ„ด ๋งค์นญ" -#: src/SUMMARY.md:86 src/pattern-matching/destructuring-enums.md:1 +#: src/SUMMARY.md:87 src/pattern-matching/destructuring-enums.md:1 msgid "Destructuring Enums" msgstr "์—ด๊ฑฐํ˜• ๋ถ„ํ•ด(์—ญ๊ตฌ์กฐํ™”)" -#: src/SUMMARY.md:87 src/pattern-matching/destructuring-structs.md:1 +#: src/SUMMARY.md:88 src/pattern-matching/destructuring-structs.md:1 msgid "Destructuring Structs" msgstr "๊ตฌ์กฐ์ฒด ๋ถ„ํ•ด(์—ญ๊ตฌ์กฐํ™”)" -#: src/SUMMARY.md:88 src/pattern-matching/destructuring-arrays.md:1 +#: src/SUMMARY.md:89 src/pattern-matching/destructuring-arrays.md:1 msgid "Destructuring Arrays" msgstr "๋ฐฐ์—ด ๋ถ„ํ•ด(์—ญ๊ตฌ์กฐํ™”)" -#: src/SUMMARY.md:89 src/pattern-matching/match-guards.md:1 +#: src/SUMMARY.md:90 src/pattern-matching/match-guards.md:1 msgid "Match Guards" msgstr "๋งค์น˜ ๊ฐ€๋“œ" -#: src/SUMMARY.md:91 src/exercises/day-2/health-statistics.md:1 +#: src/SUMMARY.md:92 src/exercises/day-2/health-statistics.md:1 msgid "Health Statistics" msgstr "๊ฑด๊ฐ•์ƒํƒœ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ" -#: src/SUMMARY.md:92 src/exercises/day-2/solutions-morning.md:3 +#: src/SUMMARY.md:93 src/exercises/day-2/solutions-morning.md:3 msgid "Points and Polygons" msgstr "์ ๊ณผ ๋‹ค๊ฐํ˜•" -#: src/SUMMARY.md:94 +#: src/SUMMARY.md:95 msgid "Day 2: Afternoon" msgstr "2์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:96 src/control-flow.md:1 +#: src/SUMMARY.md:97 src/SUMMARY.md:290 src/control-flow.md:1 msgid "Control Flow" msgstr "ํ๋ฆ„ ์ œ์–ด" -#: src/SUMMARY.md:97 src/control-flow/blocks.md:1 +#: src/SUMMARY.md:98 src/control-flow/blocks.md:1 msgid "Blocks" msgstr "๋ธ”๋ก" -#: src/SUMMARY.md:98 +#: src/SUMMARY.md:99 msgid "if expressions" msgstr "if ํ‘œํ˜„์‹" -#: src/SUMMARY.md:99 +#: src/SUMMARY.md:100 msgid "if let expressions" msgstr "if let ํ‘œํ˜„์‹" -#: src/SUMMARY.md:100 +#: src/SUMMARY.md:101 msgid "while expressions" msgstr "while ํ‘œํ˜„์‹" -#: src/SUMMARY.md:101 +#: src/SUMMARY.md:102 msgid "while let expressions" msgstr "while let ํ‘œํ˜„์‹" -#: src/SUMMARY.md:102 +#: src/SUMMARY.md:103 msgid "for expressions" msgstr "for ํ‘œํ˜„์‹" -#: src/SUMMARY.md:103 +#: src/SUMMARY.md:104 msgid "loop expressions" msgstr "loop ํ‘œํ˜„์‹" -#: src/SUMMARY.md:104 +#: src/SUMMARY.md:105 msgid "match expressions" msgstr "match ํ‘œํ˜„์‹" -#: src/SUMMARY.md:105 +#: src/SUMMARY.md:106 msgid "break & continue" msgstr "break์™€ continue" -#: src/SUMMARY.md:106 src/std.md:1 +#: src/SUMMARY.md:107 src/std.md:1 msgid "Standard Library" msgstr "ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ" -#: src/SUMMARY.md:107 +#: src/SUMMARY.md:108 msgid "Option and Result" msgstr "Option๊ณผ Result" -#: src/SUMMARY.md:108 src/std/string.md:1 +#: src/SUMMARY.md:109 src/std/string.md:1 msgid "String" msgstr "String" -#: src/SUMMARY.md:109 +#: src/SUMMARY.md:110 msgid "Vec" msgstr "Vec" -#: src/SUMMARY.md:110 +#: src/SUMMARY.md:111 msgid "HashMap" msgstr "HashMap" -#: src/SUMMARY.md:111 +#: src/SUMMARY.md:112 msgid "Box" msgstr "Box" -#: src/SUMMARY.md:112 +#: src/SUMMARY.md:113 msgid "Recursive Data Types" msgstr "์žฌ๊ท€์  ์ž๋ฃŒ๊ตฌ์กฐ" -#: src/SUMMARY.md:113 src/std/box-niche.md:1 +#: src/SUMMARY.md:114 src/std/box-niche.md:1 msgid "Niche Optimization" msgstr "๋‹ˆ์น˜(ํ‹ˆ์ƒˆ) ์ตœ์ ํ™”(Niche Optimization)" -#: src/SUMMARY.md:114 +#: src/SUMMARY.md:115 msgid "Rc" msgstr "Rc" -#: src/SUMMARY.md:115 src/modules.md:1 +#: src/SUMMARY.md:116 +msgid "Cell/RefCell" +msgstr "Cell๊ณผ RefCell" + +#: src/SUMMARY.md:117 src/modules.md:1 msgid "Modules" msgstr "๋ชจ๋“ˆ" -#: src/SUMMARY.md:116 src/modules/visibility.md:1 +#: src/SUMMARY.md:118 src/modules/visibility.md:1 msgid "Visibility" msgstr "๊ฐ€์‹œ์„ฑ" -#: src/SUMMARY.md:117 src/modules/paths.md:1 +#: src/SUMMARY.md:119 src/modules/paths.md:1 msgid "Paths" msgstr "๊ฒฝ๋กœ" -#: src/SUMMARY.md:118 src/modules/filesystem.md:1 +#: src/SUMMARY.md:120 src/modules/filesystem.md:1 msgid "Filesystem Hierarchy" msgstr "ํŒŒ์ผ์‹œ์Šคํ…œ ๊ณ„์ธต" -#: src/SUMMARY.md:120 src/exercises/day-2/luhn.md:1 +#: src/SUMMARY.md:122 src/exercises/day-2/luhn.md:1 #: src/exercises/day-2/solutions-afternoon.md:3 msgid "Luhn Algorithm" msgstr "๋ฃฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜" -#: src/SUMMARY.md:121 src/exercises/day-2/strings-iterators.md:1 -#: src/exercises/day-2/solutions-afternoon.md:98 +#: src/SUMMARY.md:123 src/exercises/day-2/strings-iterators.md:1 +#: src/exercises/day-2/solutions-afternoon.md:97 msgid "Strings and Iterators" msgstr "๋ฌธ์ž์—ด๊ณผ ๋ฐ˜๋ณต์ž" -#: src/SUMMARY.md:124 +#: src/SUMMARY.md:126 msgid "Day 3: Morning" msgstr "3์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:129 src/traits.md:1 -msgid "Traits" -msgstr "ํŠธ๋ ˆ์ž‡(Trait)" - -#: src/SUMMARY.md:130 src/traits/deriving-traits.md:1 -msgid "Deriving Traits" -msgstr "ํŠธ๋ ˆ์ž‡ ์ƒ์†ํ•˜๊ธฐ" - -#: src/SUMMARY.md:131 src/traits/default-methods.md:1 -msgid "Default Methods" -msgstr "๊ธฐ๋ณธ ๋ฉ”์„œ๋“œ" - -#: src/SUMMARY.md:132 src/traits/important-traits.md:1 -msgid "Important Traits" -msgstr "์ค‘์š”ํ•œ ํŠธ๋ ˆ์ž‡" - -#: src/SUMMARY.md:133 -msgid "Iterator" -msgstr "Iterator" - -#: src/SUMMARY.md:134 src/traits/from-iterator.md:1 -msgid "FromIterator" -msgstr "FromIterator" - -#: src/SUMMARY.md:135 -msgid "From and Into" -msgstr "From๊ณผ Into" - -#: src/SUMMARY.md:136 -msgid "Read and Write" -msgstr "Read์™€ Write" - -#: src/SUMMARY.md:137 -msgid "Add, Mul, ..." -msgstr "Add, Mul, ..." - -#: src/SUMMARY.md:138 -msgid "Drop" -msgstr "Drop" - -#: src/SUMMARY.md:139 -msgid "Default" -msgstr "Default" - -#: src/SUMMARY.md:140 src/generics.md:1 +#: src/SUMMARY.md:131 src/generics.md:1 msgid "Generics" msgstr "์ œ๋„ค๋ฆญ" -#: src/SUMMARY.md:141 src/generics/data-types.md:1 +#: src/SUMMARY.md:132 src/generics/data-types.md:1 msgid "Generic Data Types" msgstr "์ œ๋„ค๋ฆญ ๋ฐ์ดํ„ฐ ํƒ€์ž…" -#: src/SUMMARY.md:142 src/generics/methods.md:1 +#: src/SUMMARY.md:133 src/generics/methods.md:1 msgid "Generic Methods" msgstr "์ œ๋„ค๋ฆญ ๋ฉ”์„œ๋“œ" -#: src/SUMMARY.md:143 src/generics/trait-bounds.md:1 -msgid "Trait Bounds" -msgstr "์ œ๋„ค๋ฆญ ํƒ€์ž… ์ œํ•œ(ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„)" - -#: src/SUMMARY.md:144 -msgid "impl Trait" -msgstr "ํŠธ๋ ˆ์ž‡ ๊ตฌํ˜„ํ•˜๊ธฐ" - -#: src/SUMMARY.md:145 src/generics/closures.md:1 -msgid "Closures" -msgstr "ํด๋กœ์ €" - -#: src/SUMMARY.md:146 src/generics/monomorphization.md:1 +#: src/SUMMARY.md:134 src/generics/monomorphization.md:1 msgid "Monomorphization" msgstr "๋‹จํ˜•ํ™”" -#: src/SUMMARY.md:147 src/generics/trait-objects.md:1 +#: src/SUMMARY.md:135 src/traits.md:1 +msgid "Traits" +msgstr "ํŠธ๋ ˆ์ž‡(Trait)" + +#: src/SUMMARY.md:136 src/traits/trait-objects.md:1 msgid "Trait Objects" msgstr "ํŠธ๋ ˆ์ž‡ ๊ฐ์ฒด" -#: src/SUMMARY.md:149 src/exercises/day-3/simple-gui.md:1 +#: src/SUMMARY.md:137 src/traits/deriving-traits.md:1 +msgid "Deriving Traits" +msgstr "ํŠธ๋ ˆ์ž‡ ์ƒ์†ํ•˜๊ธฐ" + +#: src/SUMMARY.md:138 src/traits/default-methods.md:1 +msgid "Default Methods" +msgstr "๊ธฐ๋ณธ ๋ฉ”์„œ๋“œ" + +#: src/SUMMARY.md:139 src/traits/trait-bounds.md:1 +msgid "Trait Bounds" +msgstr "์ œ๋„ค๋ฆญ ํƒ€์ž… ์ œํ•œ(ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„)" + +#: src/SUMMARY.md:140 +msgid "impl Trait" +msgstr "ํŠธ๋ ˆ์ž‡ ๊ตฌํ˜„ํ•˜๊ธฐ" + +#: src/SUMMARY.md:141 src/traits/important-traits.md:1 +msgid "Important Traits" +msgstr "์ค‘์š”ํ•œ ํŠธ๋ ˆ์ž‡" + +#: src/SUMMARY.md:142 +msgid "Iterator" +msgstr "Iterator" + +#: src/SUMMARY.md:143 src/traits/from-iterator.md:1 +msgid "FromIterator" +msgstr "FromIterator" + +#: src/SUMMARY.md:144 +msgid "From and Into" +msgstr "From๊ณผ Into" + +#: src/SUMMARY.md:145 +msgid "Read and Write" +msgstr "Read์™€ Write" + +#: src/SUMMARY.md:146 +msgid "Drop" +msgstr "Drop" + +#: src/SUMMARY.md:147 +msgid "Default" +msgstr "Default" + +#: src/SUMMARY.md:148 +msgid "Operators: Add, Mul, ..." +msgstr "์—ฐ์‚ฐ์ž: Add, Mul, ..." + +#: src/SUMMARY.md:149 +msgid "Closures: Fn, FnMut, FnOnce" +msgstr "ํด๋กœ์ €: Fn, FnMut, FnOnce" + +#: src/SUMMARY.md:151 src/exercises/day-3/simple-gui.md:1 #: src/exercises/day-3/solutions-morning.md:3 msgid "A Simple GUI Library" msgstr "๊ฐ„๋‹จํ•œ GUI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ" -#: src/SUMMARY.md:151 +#: src/SUMMARY.md:153 msgid "Day 3: Afternoon" msgstr "3์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:153 src/error-handling.md:1 +#: src/SUMMARY.md:155 src/error-handling.md:1 msgid "Error Handling" msgstr "์˜ค๋ฅ˜์ฒ˜๋ฆฌ" -#: src/SUMMARY.md:154 src/error-handling/panics.md:1 +#: src/SUMMARY.md:156 src/error-handling/panics.md:1 msgid "Panics" msgstr "ํŒจ๋‹‰" -#: src/SUMMARY.md:155 +#: src/SUMMARY.md:157 msgid "Catching Stack Unwinding" msgstr "์Šคํƒ ๋˜๊ฐ๊ธฐ" -#: src/SUMMARY.md:156 +#: src/SUMMARY.md:158 msgid "Structured Error Handling" msgstr "๊ตฌ์กฐํ™”๋œ ์˜ค๋ฅ˜์ฒ˜๋ฆฌ" -#: src/SUMMARY.md:157 +#: src/SUMMARY.md:159 msgid "Propagating Errors with ?" msgstr "'?'๋ฅผ ์ด์šฉํ•œ ์˜ค๋ฅ˜ ์ „ํŒŒ" -#: src/SUMMARY.md:158 src/error-handling/converting-error-types.md:1 +#: src/SUMMARY.md:160 src/error-handling/converting-error-types.md:1 #: src/error-handling/converting-error-types-example.md:1 msgid "Converting Error Types" msgstr "์˜ค๋ฅ˜ํƒ€์ž… ๋ณ€ํ™˜" -#: src/SUMMARY.md:160 src/error-handling/deriving-error-enums.md:1 +#: src/SUMMARY.md:162 src/error-handling/deriving-error-enums.md:1 msgid "Deriving Error Enums" msgstr "๋˜๋‹ค๋ฅธ ์˜ค๋ฅ˜ ์—ด๊ฑฐํ˜•" -#: src/SUMMARY.md:161 src/error-handling/dynamic-errors.md:1 +#: src/SUMMARY.md:163 src/error-handling/dynamic-errors.md:1 msgid "Dynamic Error Types" msgstr "๋™์ ์ธ ์—๋Ÿฌ ํƒ€์ž…" -#: src/SUMMARY.md:162 src/error-handling/error-contexts.md:1 +#: src/SUMMARY.md:164 src/error-handling/error-contexts.md:1 msgid "Adding Context to Errors" msgstr "์˜ค๋ฅ˜์— ์ƒํ™ฉ์ •๋ณด ์ถ”๊ฐ€" -#: src/SUMMARY.md:163 src/testing.md:1 +#: src/SUMMARY.md:165 src/testing.md:1 msgid "Testing" msgstr "ํ…Œ์ŠคํŠธ" -#: src/SUMMARY.md:164 src/testing/unit-tests.md:1 +#: src/SUMMARY.md:166 src/testing/unit-tests.md:1 msgid "Unit Tests" msgstr "๋‹จ์œ„ ํ…Œ์ŠคํŠธ" -#: src/SUMMARY.md:165 src/testing/test-modules.md:1 +#: src/SUMMARY.md:167 src/testing/test-modules.md:1 msgid "Test Modules" msgstr "ํ…Œ์ŠคํŠธ ๋ชจ๋“ˆ" -#: src/SUMMARY.md:166 src/testing/doc-tests.md:1 +#: src/SUMMARY.md:168 src/testing/doc-tests.md:1 msgid "Documentation Tests" msgstr "๋ฌธ์„œํ™”์ฃผ์„ ํ…Œ์ŠคํŠธ" -#: src/SUMMARY.md:167 src/testing/integration-tests.md:1 +#: src/SUMMARY.md:169 src/testing/integration-tests.md:1 msgid "Integration Tests" msgstr "ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ" -#: src/SUMMARY.md:168 src/unsafe.md:1 +#: src/SUMMARY.md:170 src/bare-metal/useful-crates.md:1 +msgid "Useful crates" +msgstr "์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" + +#: src/SUMMARY.md:171 src/unsafe.md:1 msgid "Unsafe Rust" msgstr "์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๋Ÿฌ์ŠคํŠธ" -#: src/SUMMARY.md:169 src/unsafe/raw-pointers.md:1 +#: src/SUMMARY.md:172 src/unsafe/raw-pointers.md:1 msgid "Dereferencing Raw Pointers" msgstr "์›์‹œ ํฌ์ธํ„ฐ ์—ญ์ฐธ์กฐ(๋”ฐ๋ผ๊ฐ€๊ธฐ)" -#: src/SUMMARY.md:170 src/unsafe/mutable-static-variables.md:1 +#: src/SUMMARY.md:173 src/unsafe/mutable-static-variables.md:1 msgid "Mutable Static Variables" msgstr "์ •์  ๊ฐ€๋ณ€ ๋ณ€์ˆ˜" -#: src/SUMMARY.md:171 src/unsafe/unions.md:1 +#: src/SUMMARY.md:174 src/unsafe/unions.md:1 msgid "Unions" msgstr "Unions" -#: src/SUMMARY.md:172 src/unsafe/calling-unsafe-functions.md:1 +#: src/SUMMARY.md:175 src/unsafe/calling-unsafe-functions.md:1 msgid "Calling Unsafe Functions" msgstr "์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํ•จ์ˆ˜ ํ˜ธ์ถœ" -#: src/SUMMARY.md:173 src/unsafe/writing-unsafe-functions.md:1 +#: src/SUMMARY.md:176 src/unsafe/writing-unsafe-functions.md:1 msgid "Writing Unsafe Functions" msgstr "์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํ•จ์ˆ˜ ์ž‘์„ฑํ•˜๊ธฐ" -#: src/SUMMARY.md:174 +#: src/SUMMARY.md:177 msgid "Extern Functions" msgstr "์™ธ๋ถ€(๋‹ค๋ฅธ์–ธ์–ด) ํ•จ์ˆ˜๋“ค" -#: src/SUMMARY.md:175 src/unsafe/unsafe-traits.md:1 +#: src/SUMMARY.md:178 src/unsafe/unsafe-traits.md:1 msgid "Implementing Unsafe Traits" msgstr "์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํŠธ๋ ˆ์ž‡ ๊ตฌํ˜„ํ•˜๊ธฐ" -#: src/SUMMARY.md:177 src/exercises/day-3/safe-ffi-wrapper.md:1 +#: src/SUMMARY.md:180 src/exercises/day-3/safe-ffi-wrapper.md:1 #: src/exercises/day-3/solutions-afternoon.md:3 msgid "Safe FFI Wrapper" msgstr "FFI๋ž˜ํผ" -#: src/SUMMARY.md:180 -msgid "Day 4: Morning" -msgstr "4์ผ์ฐจ ์˜ค์ „" - -#: src/SUMMARY.md:185 -msgid "Concurrency" -msgstr "๋™์‹œ์„ฑ" - -#: src/SUMMARY.md:186 src/concurrency/threads.md:1 -msgid "Threads" -msgstr "์Šค๋ ˆ๋“œ" - -#: src/SUMMARY.md:187 src/concurrency/scoped-threads.md:1 -msgid "Scoped Threads" -msgstr "๋ฒ”์œ„ ์Šค๋ ˆ๋“œ(Scoped Threads)" - -#: src/SUMMARY.md:188 src/concurrency/channels.md:1 -msgid "Channels" -msgstr "์ฑ„๋„" - -#: src/SUMMARY.md:189 src/concurrency/channels/unbounded.md:1 -msgid "Unbounded Channels" -msgstr "๋ฌด๊ฒฝ๊ณ„ ์ฑ„๋„" - -#: src/SUMMARY.md:190 src/concurrency/channels/bounded.md:1 -msgid "Bounded Channels" -msgstr "๊ฒฝ๊ณ„ ์ฑ„๋„" - -#: src/SUMMARY.md:191 src/concurrency/shared_state.md:1 -msgid "Shared State" -msgstr "์ƒํƒœ ๊ณต์œ " - -#: src/SUMMARY.md:192 -msgid "Arc" -msgstr "Arc" - -#: src/SUMMARY.md:193 -msgid "Mutex" -msgstr "Mutex" - -#: src/SUMMARY.md:195 -msgid "Send and Sync" -msgstr "Send์™€ Sync" - -#: src/SUMMARY.md:195 -msgid "Send" -msgstr "Send" - -#: src/SUMMARY.md:195 -msgid "Sync" -msgstr "Sync" - -#: src/SUMMARY.md:198 src/concurrency/send-sync/examples.md:1 -msgid "Examples" -msgstr "์˜ˆ์ œ" - -#: src/SUMMARY.md:200 src/exercises/day-4/dining-philosophers.md:1 -#: src/exercises/day-4/solutions-morning.md:3 -msgid "Dining Philosophers" -msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž๋“ค" - -#: src/SUMMARY.md:201 src/exercises/day-4/link-checker.md:1 -msgid "Multi-threaded Link Checker" -msgstr "๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ" - -#: src/SUMMARY.md:203 -msgid "Day 4: Afternoon (Android)" -msgstr "4์ผ์ฐจ ์˜คํ›„ (์•ˆ๋“œ๋กœ์ด๋“œ)" - -#: src/SUMMARY.md:203 src/running-the-course/day-4.md:15 src/android.md:1 +#: src/SUMMARY.md:183 src/SUMMARY.md:253 +#: src/running-the-course/course-structure.md:16 src/bare-metal/android.md:1 msgid "Android" msgstr "์•ˆ๋“œ๋กœ์ด๋“œ" -#: src/SUMMARY.md:208 src/android/setup.md:1 +#: src/SUMMARY.md:188 src/android/setup.md:1 msgid "Setup" msgstr "์„ค์น˜" -#: src/SUMMARY.md:209 src/android/build-rules.md:1 +#: src/SUMMARY.md:189 src/android/build-rules.md:1 msgid "Build Rules" msgstr "๋นŒ๋“œ ๊ทœ์น™" -#: src/SUMMARY.md:210 +#: src/SUMMARY.md:190 msgid "Binary" msgstr "๋ฐ”์ด๋„ˆ๋ฆฌ" -#: src/SUMMARY.md:211 +#: src/SUMMARY.md:191 msgid "Library" msgstr "๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ" -#: src/SUMMARY.md:212 src/android/aidl.md:1 +#: src/SUMMARY.md:192 src/android/aidl.md:1 msgid "AIDL" msgstr "AIDL" -#: src/SUMMARY.md:213 +#: src/SUMMARY.md:193 msgid "Interface" msgstr "AIDL ์ธํ„ฐํŽ˜์ด์Šค" -#: src/SUMMARY.md:214 +#: src/SUMMARY.md:194 msgid "Implementation" msgstr "์„œ๋น„์Šค ๊ตฌํ˜„" -#: src/SUMMARY.md:215 +#: src/SUMMARY.md:195 msgid "Server" msgstr "AIDL ์„œ๋ฒ„" -#: src/SUMMARY.md:216 src/android/aidl/deploy.md:1 +#: src/SUMMARY.md:196 src/android/aidl/deploy.md:1 msgid "Deploy" msgstr "๋ฐฐํฌ" -#: src/SUMMARY.md:217 +#: src/SUMMARY.md:197 msgid "Client" msgstr "ํด๋ผ์ด์–ธํŠธ" -#: src/SUMMARY.md:218 src/android/aidl/changing.md:1 +#: src/SUMMARY.md:198 src/android/aidl/changing.md:1 msgid "Changing API" msgstr "API ์ˆ˜์ •" -#: src/SUMMARY.md:219 src/android/logging.md:1 +#: src/SUMMARY.md:199 src/SUMMARY.md:243 src/android/logging.md:1 +#: src/bare-metal/aps/logging.md:1 msgid "Logging" msgstr "๋กœ๊น…" -#: src/SUMMARY.md:220 src/android/interoperability.md:1 +#: src/SUMMARY.md:200 src/android/interoperability.md:1 msgid "Interoperability" msgstr "์ƒํ˜ธ์šด์šฉ์„ฑ" -#: src/SUMMARY.md:221 +#: src/SUMMARY.md:201 msgid "With C" msgstr "C์™€์˜ ์ƒํ˜ธ์šด์šฉ์„ฑ" -#: src/SUMMARY.md:222 +#: src/SUMMARY.md:202 msgid "Calling C with Bindgen" msgstr "Bindgen์„ ์‚ฌ์šฉํ•œ Cํ˜ธ์ถœ" -#: src/SUMMARY.md:223 +#: src/SUMMARY.md:203 msgid "Calling Rust from C" msgstr "C์—์„œ ๋Ÿฌ์ŠคํŠธ ํ˜ธ์ถœ" -#: src/SUMMARY.md:224 src/android/interoperability/cpp.md:1 +#: src/SUMMARY.md:204 src/android/interoperability/cpp.md:1 msgid "With C++" msgstr "C++์™€์˜ ์ƒํ˜ธ์šด์šฉ์„ฑ" -#: src/SUMMARY.md:225 +#: src/SUMMARY.md:205 msgid "With Java" msgstr "Java์™€์˜ ์ƒํ˜ธ์šด์šฉ์„ฑ" -#: src/SUMMARY.md:228 +#: src/SUMMARY.md:209 +msgid "Bare Metal: Morning" +msgstr "Bare Metal ์˜ค์ „" + +#: src/SUMMARY.md:214 +msgid "no_std" +msgstr "no_std" + +#: src/SUMMARY.md:215 +msgid "A Minimal Example" +msgstr "์ž‘์€ ์˜ˆ์ œ" + +#: src/SUMMARY.md:216 +msgid "alloc" +msgstr "alloc" + +#: src/SUMMARY.md:217 src/bare-metal/microcontrollers.md:1 +msgid "Microcontrollers" +msgstr "๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ" + +#: src/SUMMARY.md:218 src/bare-metal/microcontrollers/mmio.md:1 +msgid "Raw MMIO" +msgstr "์›์‹œ MMIO" + +#: src/SUMMARY.md:219 +msgid "PACs" +msgstr "PAC" + +#: src/SUMMARY.md:220 +msgid "HAL Crates" +msgstr "HAL ํฌ๋ ˆ์ดํŠธ" + +#: src/SUMMARY.md:221 +msgid "Board Support Crates" +msgstr "๋ณด๋“œ ์ง€์› ํฌ๋ ˆ์ดํŠธ" + +#: src/SUMMARY.md:222 +msgid "The Type State Pattern" +msgstr "Type State ํŒจํ„ด" + +#: src/SUMMARY.md:223 +msgid "embedded-hal" +msgstr "embedded-hal" + +#: src/SUMMARY.md:224 +msgid "probe-rs, cargo-embed" +msgstr "progo-rs, cargo-embed" + +#: src/SUMMARY.md:225 src/bare-metal/microcontrollers/debugging.md:1 +msgid "Debugging" +msgstr "๋””๋ฒ„๊น…" + +#: src/SUMMARY.md:226 src/SUMMARY.md:246 +msgid "Other Projects" +msgstr "๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ" + +#: src/SUMMARY.md:228 src/exercises/bare-metal/compass.md:1 +#: src/exercises/bare-metal/solutions-morning.md:3 +msgid "Compass" +msgstr "๋‚˜์นจ๋ฐ˜" + +#: src/SUMMARY.md:230 +msgid "Bare Metal: Afternoon" +msgstr "Bare Metal ์˜คํ›„" + +#: src/SUMMARY.md:232 +msgid "Application Processors" +msgstr "์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ" + +#: src/SUMMARY.md:233 src/bare-metal/aps/entry-point.md:1 +msgid "Getting Ready to Rust" +msgstr "Rust ์ˆ˜ํ–‰ ์ค€๋น„" + +#: src/SUMMARY.md:234 +msgid "Inline Assembly" +msgstr "์ธ๋ผ์ธ ์–ด์…ˆ๋ธ”๋ฆฌ" + +#: src/SUMMARY.md:235 +msgid "MMIO" +msgstr "MMIO" + +#: src/SUMMARY.md:236 +msgid "Let's Write a UART Driver" +msgstr "UART ๋“œ๋ผ์ด๋ฒ„ ์ž‘์„ฑ" + +#: src/SUMMARY.md:237 +msgid "More Traits" +msgstr "๋” ๋งŽ์€ ํŠธ๋ ˆ์ž‡" + +#: src/SUMMARY.md:238 +msgid "A Better UART Driver" +msgstr "๋” ๋‚˜์€ UART ๋“œ๋ผ์ด๋ฒ„" + +#: src/SUMMARY.md:239 src/bare-metal/aps/better-uart/bitflags.md:1 +msgid "Bitflags" +msgstr "๋น„ํŠธํ”Œ๋ž˜๊ทธ" + +#: src/SUMMARY.md:240 +msgid "Multiple Registers" +msgstr "๋” ๋งŽ์€ ๋ ˆ์ง€์Šคํ„ฐ" + +#: src/SUMMARY.md:241 src/bare-metal/aps/better-uart/driver.md:1 +msgid "Driver" +msgstr "๋“œ๋ผ์ด๋ฒ„" + +#: src/SUMMARY.md:242 src/SUMMARY.md:244 +msgid "Using It" +msgstr "์‚ฌ์šฉํ•ด ๋ณด๊ธฐ" + +#: src/SUMMARY.md:245 src/bare-metal/aps/exceptions.md:1 +msgid "Exceptions" +msgstr "์˜ˆ์™ธ" + +#: src/SUMMARY.md:247 +msgid "Useful Crates" +msgstr "์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" + +#: src/SUMMARY.md:248 +msgid "zerocopy" +msgstr "zerocopy" + +#: src/SUMMARY.md:249 +msgid "aarch64-paging" +msgstr "aarch64-paging" + +#: src/SUMMARY.md:250 +msgid "buddy_system_allocator" +msgstr "buddy_system_allocator" + +#: src/SUMMARY.md:251 +msgid "tinyvec" +msgstr "tinyvec" + +#: src/SUMMARY.md:252 +msgid "spin" +msgstr "ํšŒ์ „" + +#: src/SUMMARY.md:254 src/bare-metal/android/vmbase.md:1 +msgid "vmbase" +msgstr "vmbase" + +#: src/SUMMARY.md:256 +msgid "RTC Driver" +msgstr "RTC ๋“œ๋ผ์ด๋ฒ„" + +#: src/SUMMARY.md:259 +msgid "Concurrency: Morning" +msgstr "๋™์‹œ์„ฑ ์˜ค์ „" + +#: src/SUMMARY.md:264 src/concurrency/threads.md:1 +msgid "Threads" +msgstr "์Šค๋ ˆ๋“œ" + +#: src/SUMMARY.md:265 src/concurrency/scoped-threads.md:1 +msgid "Scoped Threads" +msgstr "๋ฒ”์œ„ ์Šค๋ ˆ๋“œ(Scoped Threads)" + +#: src/SUMMARY.md:266 src/concurrency/channels.md:1 +msgid "Channels" +msgstr "์ฑ„๋„" + +#: src/SUMMARY.md:267 src/concurrency/channels/unbounded.md:1 +msgid "Unbounded Channels" +msgstr "๋ฌด๊ฒฝ๊ณ„ ์ฑ„๋„" + +#: src/SUMMARY.md:268 src/concurrency/channels/bounded.md:1 +msgid "Bounded Channels" +msgstr "๊ฒฝ๊ณ„ ์ฑ„๋„" + +#: src/SUMMARY.md:269 +msgid "Send and Sync" +msgstr "Send์™€ Sync" + +#: src/SUMMARY.md:269 +msgid "Send" +msgstr "Send" + +#: src/SUMMARY.md:269 +msgid "Sync" +msgstr "Sync" + +#: src/SUMMARY.md:272 src/concurrency/send-sync/examples.md:1 +msgid "Examples" +msgstr "์˜ˆ์ œ" + +#: src/SUMMARY.md:273 src/concurrency/shared_state.md:1 +msgid "Shared State" +msgstr "์ƒํƒœ ๊ณต์œ " + +#: src/SUMMARY.md:274 +msgid "Arc" +msgstr "Arc" + +#: src/SUMMARY.md:275 +msgid "Mutex" +msgstr "Mutex" + +#: src/SUMMARY.md:278 src/SUMMARY.md:299 +#: src/exercises/concurrency/dining-philosophers.md:1 +#: src/exercises/concurrency/solutions-morning.md:3 +msgid "Dining Philosophers" +msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž๋“ค" + +#: src/SUMMARY.md:279 src/exercises/concurrency/link-checker.md:1 +msgid "Multi-threaded Link Checker" +msgstr "๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ" + +#: src/SUMMARY.md:281 +msgid "Concurrency: Afternoon" +msgstr "๋™์‹œ์„ฑ ์˜คํ›„" + +#: src/SUMMARY.md:283 +msgid "Async Basics" +msgstr "๋น„๋™๊ธฐ ๊ด€๋ จ ๊ธฐ๋ณธ์‚ฌํ•ญ" + +#: src/SUMMARY.md:284 +msgid "async/await" +msgstr "async/await" + +#: src/SUMMARY.md:285 src/async/futures.md:1 +msgid "Futures" +msgstr "Future" + +#: src/SUMMARY.md:286 src/async/runtimes.md:1 +msgid "Runtimes" +msgstr "๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„๋“ค" + +#: src/SUMMARY.md:287 src/async/runtimes/tokio.md:1 +msgid "Tokio" +msgstr "Tokio" + +#: src/SUMMARY.md:288 src/exercises/concurrency/link-checker.md:126 +#: src/exercises/concurrency/chat-app.md:140 src/async/tasks.md:1 +msgid "Tasks" +msgstr "ํƒœ์Šคํฌ" + +#: src/SUMMARY.md:289 src/async/channels.md:1 +msgid "Async Channels" +msgstr "๋น„๋™๊ธฐ ์ฑ„๋„" + +#: src/SUMMARY.md:291 src/async/control-flow/join.md:1 +msgid "Join" +msgstr "Join" + +#: src/SUMMARY.md:292 src/async/control-flow/select.md:1 +msgid "Select" +msgstr "Select" + +#: src/SUMMARY.md:293 +msgid "Pitfalls" +msgstr "ํ•จ์ •" + +#: src/SUMMARY.md:294 +msgid "Blocking the Executor" +msgstr "Executor ๋ธ”๋กœํ‚น ํ•˜๊ธฐ" + +#: src/SUMMARY.md:295 src/async/pitfalls/pin.md:1 +msgid "Pin" +msgstr "Pin" + +#: src/SUMMARY.md:296 src/async/pitfalls/async-traits.md:1 +msgid "Async Traits" +msgstr "๋น„๋™๊ธฐ ํŠธ๋ ˆ์ž‡" + +#: src/SUMMARY.md:297 src/async/pitfalls/cancellation.md:1 +msgid "Cancellation" +msgstr "์ทจ์†Œ" + +#: src/SUMMARY.md:300 src/exercises/concurrency/chat-app.md:1 +#: src/exercises/concurrency/solutions-afternoon.md:119 +msgid "Broadcast Chat Application" +msgstr "์ฑ„ํŒ… ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜" + +#: src/SUMMARY.md:303 msgid "Final Words" msgstr "๋์œผ๋กœ..." -#: src/SUMMARY.md:230 src/thanks.md:1 +#: src/SUMMARY.md:307 src/thanks.md:1 msgid "Thanks!" msgstr "๊ฐ์‚ฌ์ธ์‚ฌ" -#: src/SUMMARY.md:231 +#: src/SUMMARY.md:308 msgid "Other Resources" msgstr "๋Ÿฌ์ŠคํŠธ ์ฐธ๊ณ  ์ž๋ฃŒ" -#: src/SUMMARY.md:232 src/credits.md:1 +#: src/SUMMARY.md:309 src/credits.md:1 msgid "Credits" msgstr "๋„์™€์ฃผ์‹  ๋ถ„๋“ค" -#: src/SUMMARY.md:236 src/exercises/solutions.md:1 +#: src/SUMMARY.md:312 src/exercises/solutions.md:1 msgid "Solutions" msgstr "ํ•ด๋‹ต" -#: src/SUMMARY.md:241 +#: src/SUMMARY.md:317 msgid "Day 1 Morning" msgstr "1์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:242 +#: src/SUMMARY.md:318 msgid "Day 1 Afternoon" msgstr "1์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:243 +#: src/SUMMARY.md:319 msgid "Day 2 Morning" msgstr "2์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:244 +#: src/SUMMARY.md:320 msgid "Day 2 Afternoon" msgstr "2์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:245 +#: src/SUMMARY.md:321 msgid "Day 3 Morning" msgstr "3์ผ์ฐจ ์˜ค์ „" -#: src/SUMMARY.md:246 +#: src/SUMMARY.md:322 msgid "Day 3 Afternoon" msgstr "3์ผ์ฐจ ์˜คํ›„" -#: src/SUMMARY.md:247 -msgid "Day 4 Morning" -msgstr "4์ผ์ฐจ ์˜ค์ „" +#: src/SUMMARY.md:323 +msgid "Bare Metal Rust Morning" +msgstr "Bare Metal ์˜ค์ „" -#: src/welcome.md:3 +#: src/SUMMARY.md:324 src/exercises/bare-metal/solutions-afternoon.md:1 +msgid "Bare Metal Rust Afternoon" +msgstr "์ „Bare Metal ์˜คํ›„" + +#: src/SUMMARY.md:325 +msgid "Concurrency Morning" +msgstr "๋™์‹œ์„ฑ ์˜ค์ „" + +#: src/SUMMARY.md:326 +msgid "Concurrency Afternoon" +msgstr "๋™์‹œ์„ฑ ์˜คํ›„" + +#: src/index.md:3 msgid "" "[![Build workflow](https://img.shields.io/github/actions/workflow/status/" "google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml)" +"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain)" msgstr "" +"[![Build workflow](https://img.shields.io/github/actions/workflow/status/" +"google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" +"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain)" -#: src/welcome.md:3 +#: src/index.md:3 msgid "Build workflow" msgstr "๋นŒ๋“œ ์›Œํฌํ”Œ๋กœ" -#: src/welcome.md:3 +#: src/index.md:3 msgid "" "[![Build workflow](https://img.shields.io/github/actions/workflow/status/" "google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml) [![GitHub " -"contributors](https://img.shields.io/github/contributors/google/" +"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [!" +"[GitHub contributors](https://img.shields.io/github/contributors/google/" "comprehensive-rust?style=flat-square)](https://github.com/google/" "comprehensive-rust/graphs/contributors)" msgstr "" "[![Build workflow](https://img.shields.io/github/actions/workflow/status/" "google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml) [![GitHub " -"contributors](https://img.shields.io/github/contributors/google/" +"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [!" +"[GitHub contributors](https://img.shields.io/github/contributors/google/" "comprehensive-rust?style=flat-square)](https://github.com/google/" "comprehensive-rust/graphs/contributors)" -#: src/welcome.md:4 +#: src/index.md:4 msgid "GitHub contributors" msgstr "GitHub ์ฐธ์—ฌ์ž" -#: src/welcome.md:4 +#: src/index.md:4 msgid "" "[![GitHub contributors](https://img.shields.io/github/contributors/google/" "comprehensive-rust?style=flat-square)](https://github.com/google/" @@ -839,11 +1073,11 @@ msgstr "" "io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." "com/google/comprehensive-rust/stargazers)" -#: src/welcome.md:5 +#: src/index.md:5 msgid "GitHub stars" msgstr "GitHub stars" -#: src/welcome.md:5 +#: src/index.md:5 msgid "" "[![GitHub stars](https://img.shields.io/github/stars/google/comprehensive-" "rust?style=flat-square)](https://github.com/google/comprehensive-rust/" @@ -853,18 +1087,16 @@ msgstr "" "rust?style=flat-square)](https://github.com/google/comprehensive-rust/" "stargazers)" -#: src/welcome.md:7 +#: src/index.md:7 msgid "" -"This is a four day Rust course developed by the Android team. The course " -"covers the full spectrum of Rust, from basic syntax to advanced topics like " -"generics and error handling. It also includes Android-specific content on " -"the last day." +"This is a free Rust course developed by the Android team at Google. The " +"course covers the full spectrum of Rust, from basic syntax to advanced " +"topics like generics and error handling." msgstr "" -"์ด 4์ผ์งœ๋ฆฌ ๋Ÿฌ์ŠคํŠธ ๊ฐ•์˜๋Š” ์•ˆ๋“œ๋กœ์ด๋“œ ํŒ€์ด ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๋ฌธ๋ฒ•๋ถ€ํ„ฐ ์ œ๋„ค๋ฆญ, " -"์—๋Ÿฌ ํ•ธ๋“ค๋ง๊ณผ ๊ฐ™์€ ๊ณ ๊ธ‰์ฃผ์ œ๊นŒ์ง€ ๋Ÿฌ์ŠคํŠธ์˜ ๋ชจ๋“  ๊ฒƒ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰ ๋‚ ์—๋Š” " -"์•ˆ๋“œ๋กœ์ด๋“œ์— ๋Œ€ํ•œ ๊ฒƒ ๊นŒ์ง€ ๋‹ค๋ฃน๋‹ˆ๋‹ค." +"์ด ๊ฐ•์˜๋Š” ๋ฌด๋ฃŒ์ด๋ฉฐ, Google์˜ Android ํŒ€์ด ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๋ฌธ๋ฒ•๋ถ€ํ„ฐ ์ œ๋„ค" +"๋ฆญ, ์—๋Ÿฌ ํ•ธ๋“ค๋ง๊ณผ ๊ฐ™์€ ๊ณ ๊ธ‰์ฃผ์ œ๊นŒ์ง€ ๋Ÿฌ์ŠคํŠธ์˜ ๋ชจ๋“  ๊ฒƒ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค." -#: src/welcome.md:11 +#: src/index.md:11 msgid "" "The goal of the course is to teach you Rust. We assume you don't know " "anything about Rust and hope to:" @@ -872,50 +1104,60 @@ msgstr "" "๊ฐ•์˜๋Š” ๋‹น์‹ ์ด ๋Ÿฌ์ŠคํŠธ์— ๋Œ€ํ•ด์„œ ์•„๋ฌด๊ฒƒ๋„ ๋ชจ๋ฅธ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ณ  ์•„๋ž˜์˜ ๋ชฉํ‘œ๋ฅผ ๊ฐ€์ง€" "๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/welcome.md:14 +#: src/index.md:14 msgid "Give you a comprehensive understanding of the Rust syntax and language." msgstr "๋Ÿฌ์ŠคํŠธ ๊ตฌ๋ฌธ๊ณผ ์–ธ์–ด์— ๋Œ€ํ•œ ํฌ๊ด„์ ์ธ ์ดํ•ด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." -#: src/welcome.md:15 +#: src/index.md:15 msgid "Enable you to modify existing programs and write new programs in Rust." msgstr "๊ธฐ์กด ํ”„๋กœ๊ทธ๋žจ์„ ์ˆ˜์ •ํ•˜๊ณ  ๋Ÿฌ์ŠคํŠธ์—์„œ ์ƒˆ ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/welcome.md:16 +#: src/index.md:16 msgid "Show you common Rust idioms." msgstr "์ผ๋ฐ˜์ ์ธ ๋Ÿฌ์ŠคํŠธ ๊ด€์šฉ๊ตฌ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." -#: src/welcome.md:18 -msgid "On Day 4, we will cover Android-specific things such as:" -msgstr "4์ผ์ฐจ ๊ฐ•์˜์— ์šฐ๋ฆฌ๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ์•ˆ๋“œ๋กœ์ด๋“œ ํŠนํ™”๋œ ๋‚ด์šฉ๋“ค๋„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค:" +#: src/index.md:18 +msgid "We call the first three course days Rust Fundamentals." +msgstr "๊ฐ•์˜์˜ ์ฒซ 3์ผ ๋™์•ˆ์—๋Š” Rust์˜ ๊ธฐ์ดˆ๋ฅผ ๋‹ค์ง‘๋‹ˆ๋‹ค." -#: src/welcome.md:20 -msgid "Building Android components in Rust." -msgstr "๋Ÿฌ์ŠคํŠธ์—์„œ Android ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๊ตฌ์ถ•." - -#: src/welcome.md:21 -msgid "AIDL servers and clients." -msgstr "AIDL ์„œ๋ฒ„ ๋ฐ ํด๋ผ์ด์–ธํŠธ." - -#: src/welcome.md:22 -msgid "Interoperability with C, C++, and Java." -msgstr "C, C++ ๋ฐ Java์™€์˜ ์ƒํ˜ธ ์šด์šฉ์„ฑ." - -#: src/welcome.md:24 +#: src/index.md:20 msgid "" -"It is important to note that this course does not cover Android " -"**application** development in Rust, and that the Android-specific parts " -"are specifically about writing code for Android itself, the operating " -"system. " -msgstr "" -"์ด ๊ฐ•์˜์—์„œ๋Š” ๋Ÿฌ์ŠคํŠธ๋กœ ์•ˆ๋“œ๋กœ์ด๋“œ **์• ํ”Œ๋ฆฌ์ผ€์ด์…˜**์„ ๊ฐœ๋ฐœํ•˜๋Š” ๊ฒƒ์€ ๋‹ค๋ฃจ์ง€ ์•Š" -"์Šต๋‹ˆ๋‹ค. ์ด ๊ฐ•์˜์—์„œ ๋‹ค๋ฃจ๋Š” ์•ˆ๋“œ๋กœ์ด๋“œ ํŠนํ™”๋œ ๋‚ด์šฉ์€ ์•ˆ๋“œ๋กœ์ด๋“œ OS์˜ ์ผ๋ถ€๋ฅผ ๋Ÿฌ" -"์ŠคํŠธ๋กœ ๊ฐœ๋ฐœํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. " +"Building on this, you're invited to dive into one or more specialized topics:" +msgstr "๊ทธ ํ›„์—๋Š”, ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฐœ๋ณ„ ์ฃผ์ œ๋ฅผ ์‹ฌํ™”ํ•ด์„œ ๊ณต๋ถ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/welcome.md:28 +#: src/index.md:22 +msgid "" +"[Android](android.md): a half-day course on using Rust for Android platform " +"development (AOSP). This includes interoperability with C, C++, and Java." +msgstr "" +"[Android](android.md): Android ํ”Œ๋žซํผ ๊ฐœ๋ฐœ(AOSP) ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ ๋ฐ˜๋‚˜์ ˆ " +"๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” C, C++, Java์™€์˜ ์ƒํ˜ธ ์šด์šฉ์„ฑ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค." + +#: src/index.md:24 +msgid "" +"[Bare-metal](bare-metal.md): a whole-day class on using Rust for bare-metal " +"(embedded) development. Both microcontrollers and application processors are " +"covered." +msgstr "" +"[Bare-metal](bare-metal.md): bare-metal(์ž„๋ฒ ๋””๋“œ) ๊ฐœ๋ฐœ ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ ์ข…" +"์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ๋ฅผ ๋ชจ๋‘ ๋‹ค๋ฃน๋‹ˆ๋‹ค." + +#: src/index.md:27 +msgid "" +"[Concurrency](concurrency.md): a whole-day class on concurrency in Rust. We " +"cover both classical concurrency (preemptively scheduling using threads and " +"mutexes) and async/await concurrency (cooperative multitasking using " +"futures)." +msgstr "" +"[๋™์‹œ์„ฑ](concurrency.md): Rust์˜ ๋™์‹œ์„ฑ์— ๊ด€ํ•œ ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” ๊ณ ์ „" +"์ ์ธ ๋™์‹œ์„ฑ(์Šค๋ ˆ๋“œ์™€ ๋ฎคํ…์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„ ์ ํ˜• ์Šค์ผ€์ค„๋ง์„ ํ•˜๋Š” ๊ฒƒ)๊ณผ async/" +"await ๋™์‹œ์„ฑ(future๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ˜‘๋ ฅ์ ์ธ ๋ฉ€ํ‹ฐํƒœ์Šคํ‚น)์„ ๋ชจ๋‘ ๋‹ค๋ฃน๋‹ˆ๋‹ค." + +#: src/index.md:33 msgid "Non-Goals" msgstr "์ œ์™ธ์‚ฌํ•ญ" -#: src/welcome.md:30 +#: src/index.md:35 msgid "" "Rust is a large language and we won't be able to cover all of it in a few " "days. Some non-goals of this course are:" @@ -923,50 +1165,39 @@ msgstr "" "๋Ÿฌ์ŠคํŠธ๋Š” ๋ฉฐ์น ๋งŒ์— ๋ชจ๋“  ๊ฒƒ์„ ๋‹ค๋ฃจ๊ธฐ์—๋Š” ๋„ˆ๋ฌด ํฐ ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์•„๋ž˜์™€ ๊ฐ™์€" "๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" -#: src/welcome.md:33 +#: src/index.md:38 msgid "" -"Learn how to use async Rust --- we'll only mention async Rust when covering " -"traditional concurrency primitives. Please see [Asynchronous Programming in " -"Rust](https://rust-lang.github.io/async-book/) instead for details on this " -"topic." -msgstr "" -"๋น„๋™๊ธฐ์  ๋Ÿฌ์ŠคํŠธ ์‚ฌ์šฉ๋ฒ•. ๊ฐ„๋‹จํ•˜๊ฒŒ ์–ธ๊ธ‰์ •๋„๋Š” ํ•˜๊ฒ ์ง€๋งŒ ์ข€ ๋” ์ž์„ธํ•œ ๋‚ด์šฉ์€ " -"[Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/)" -"๋ฅผ ์ฐธ์กฐํ•ด์ฃผ์„ธ์š”." - -#: src/welcome.md:37 -msgid "" -"Learn how to develop macros, please see [Chapter 19.5 in the Rust Book]" +"Learning how to develop macros: please see [Chapter 19.5 in the Rust Book]" "(https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by Example]" "(https://doc.rust-lang.org/rust-by-example/macros.html) instead." msgstr "" -"๋งคํฌ๋กœ๋ฅผ ๊ฐœ๋ฐœํ•˜๋Š” ๋ฐฉ๋ฒ•. [Chapter 19.5 in the Rust Book](https://doc.rust-" -"lang.org/book/ch19-06-macros.html)์™€ [Rust by Example](https://doc.rust-lang." -"org/rust-by-example/macros.html)๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”." +"๋งคํฌ๋กœ ๋งŒ๋“ค๊ธฐ: ๋งคํฌ๋กœ์™€ ๊ด€๋ จํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ [๋Ÿฌ์ŠคํŠธ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด, 19.1์ ˆ]" +"(https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html)๊ณผ [Rustonomicon]" +"(https://doc.rust-lang.org/nomicon/)๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”." -#: src/welcome.md:41 +#: src/index.md:42 msgid "Assumptions" msgstr "๋…์ž ์ˆ˜์ค€์— ๋Œ€ํ•œ ๊ฐ€์ •" -#: src/welcome.md:43 +#: src/index.md:44 msgid "" "The course assumes that you already know how to program. Rust is a " -"statically typed language and we will sometimes make comparisons with C and " +"statically-typed language and we will sometimes make comparisons with C and " "C++ to better explain or contrast the Rust approach." msgstr "" "๋ณธ ๊ฐ•์˜๋Š” ์—ฌ๋Ÿฌ๋ถ„์ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ž์ฒด์— ๋Œ€ํ•ด์„œ๋Š” ์•Œ๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ" "๋Š” ์ •์ ํƒ€์ž… ์–ธ์–ด์ด๋ฉฐ, ๊ฐ•์ขŒ์—์„œ๋Š” C/C++ ์™€์˜ ๋น„๊ต, ๋Œ€์กฐ๋ฅผ ํ†ตํ•ด ๋Ÿฌ์ŠคํŠธ๋ฅผ ์„ค๋ช…" "ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค." -#: src/welcome.md:47 +#: src/index.md:48 msgid "" -"If you know how to program in a dynamically typed language such as Python or " +"If you know how to program in a dynamically-typed language such as Python or " "JavaScript, then you will be able to follow along just fine too." msgstr "" "C/C++์„ ๋ชจ๋ฅด๋”๋ผ๋„ ๋™์  ํƒ€์ž… ์–ธ์–ด(Python์ด๋‚˜ JavaScript ๋“ฑ) ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ฒฝํ—˜" "์ด ์žˆ๋‹ค๋ฉด ๋”ฐ๋ผ์˜ค๋Š”๋ฐ ํฐ ๋ฌธ์ œ๋Š” ์—†์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค." -#: src/welcome.md:52 +#: src/index.md:53 msgid "" "This is an example of a _speaker note_. We will use these to add additional " "information to the slides. This could be key points which the instructor " @@ -977,7 +1208,6 @@ msgstr "" "ํ‚ค ํฌ์ธํŠธ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/running-the-course.md:3 src/running-the-course/course-structure.md:3 -#: src/running-the-course/day-4.md:3 msgid "This page is for the course instructor." msgstr "๊ฐ•์‚ฌ๋ฅผ ์œ„ํ•œ ์•ˆ๋‚ด ํŽ˜์ด์ง€์ž…๋‹ˆ๋‹ค." @@ -1008,26 +1238,20 @@ msgstr "" #: src/running-the-course.md:16 msgid "" -"Select your topic for the afternoon of the fourth day. This may be based on " -"the audience you expect, or on your own expertise." +"Decide on the dates. Since the course takes at least three full days, we " +"recommend that you schedule the days over two weeks. Course participants " +"have said that they find it helpful to have a gap in the course since it " +"helps them process all the information we give them." msgstr "" -"4์ผ์ฐจ ์˜คํ›„์˜ ์ฃผ์ œ๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ์ˆ˜๊ฐ•์ƒ๋“ค์ด ์›ํ•˜๋Š”, ํ˜น์€ ์—ฌ๋Ÿฌ๋ถ„์ด ์ž์‹ ์žˆ๋Š” ์ฃผ" -"์ œ๋ฅผ ๊ณ ๋ฅด์„ธ์š”." +"๊ฐ•์˜ ๋‚ ์งœ๋ฅผ ์ •ํ•ฉ๋‹ˆ๋‹ค. ์ตœ์†Œ 3์ผ์— ๊ฑธ์ณ์„œ ์ง„ํ–‰์ด ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ๋‘ ์ฃผ์— ๊ฑธ์ณ์„œ ์Šค" +"์ผ€์ค„์„ ์žก๋Š” ๊ฒƒ์„ ๊ถŒํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด ๊ฐ•์˜ ์ˆ˜๊ฐ•์ƒ๋“ค์˜ ํ”ผ๋“œ๋ฐฑ์— ๋”ฐ๋ฅด๋ฉด, ์—ฐ๋‹ฌ์•„์„œ ๊ฐ•" +"์˜๋ฅผ ์ง„ํ–‰ํ•˜๋Š” ๊ฒƒ ๋ณด๋‹ค, ๊ฐ•์˜๋ฅผ ๋„์—„๋„์—„ ํ•˜๋Š” ๊ฒƒ์ด ๊ฐ•์˜ ๋‚ด์šฉ์„ ์†Œํ™”ํ•˜๋Š”๋ฐ ๋” ๋„" +"์›€์ด ๋˜์—ˆ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค." -#: src/running-the-course.md:19 -msgid "" -"Decide on the dates. Since the course is large, we recommend that you " -"schedule the four days over two weeks. Course participants have said that " -"they find it helpful to have a gap in the course since it helps them process " -"all the information we give them." -msgstr "" -"๊ฐ•์˜ ๋‚ ์งœ๋ฅผ ์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์˜ ๋‚ด์šฉ์ด ๋งŽ๊ณ  ์ˆ˜๊ฐ•์ƒ๋“ค์ด ๋ชจ๋“  ์ •๋ณด๋ฅผ ๊ณต๋ถ€ํ•  ์ˆ˜ ์žˆ๋„" -"๋ก ์ค‘๊ฐ„์— ํ‹ˆ์„ ๋‘์–ด 2์ฃผ์— ๊ฑธ์ณ 4์ผ์„ ์žก๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค." - -#: src/running-the-course.md:24 +#: src/running-the-course.md:21 msgid "" "Find a room large enough for your in-person participants. We recommend a " -"class size of 15-20 people. That's small enough that people are comfortable " +"class size of 15-25 people. That's small enough that people are comfortable " "asking questions --- it's also small enough that one instructor will have " "time to answer the questions. Make sure the room has _desks_ for yourself " "and for the students: you will all need to be able to sit and work with your " @@ -1035,11 +1259,11 @@ msgid "" "instructor, so a lectern won't be very helpful for you." msgstr "" "์ถฉ๋ถ„ํ•œ ๊ณต๊ฐ„์„ ํ™•๋ณดํ•ฉ๋‹ˆ๋‹ค. 15์—์„œ 20๋ช… ๊ทœ๋ชจ์˜ ๊ณต๊ฐ„์„ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค. ์ˆ˜๊ฐ•์ƒ๊ณผ ๊ฐ•์‚ฌ" -"๊ฐ€ ์งˆ์˜๋ฅผ ํ•˜๊ธฐ์— ์ถฉ๋ถ„ํ•œ ์‹œ๊ฐ„๊ณผ ๊ณต๊ฐ„์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์‚ฌ๋‚˜ ์ˆ˜๊ฐ•์ƒ ๋ชจ๋‘ ์ฑ…์ƒ์„ " -"์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ•์˜์‹ค์ด๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค. ๊ฐ•์˜ ์ค‘์— ๊ฐ•์‚ฌ๊ฐ€ ๋ผ์ด๋ธŒ ์ฝ”๋”ฉ์„ ํ•˜๊ฒŒ ๋  ๊ฒฝ" -"์šฐ๊ฐ€ ๋งŽ์œผ๋ฉฐ, ์ด๋•Œ ์ž๋ฆฌ์— ์•‰์•„ ๋…ธํŠธ๋ถ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค." +"๊ฐ€ ์งˆ์˜๋ฅผ ํ•˜๊ธฐ์— ์ถฉ๋ถ„ํ•œ ์‹œ๊ฐ„๊ณผ ๊ณต๊ฐ„์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์‚ฌ๋‚˜ ์ˆ˜๊ฐ•์ƒ ๋ชจ๋‘ \\_์ฑ…์ƒ_" +"์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ•์˜์‹ค์ด๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค. ๊ฐ•์˜ ์ค‘์— ๊ฐ•์‚ฌ๊ฐ€ ๋ผ์ด๋ธŒ ์ฝ”๋”ฉ์„ ํ•˜๊ฒŒ " +"๋  ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์œผ๋ฉฐ, ์ด๋•Œ ์ž๋ฆฌ์— ์•‰์•„ ๋…ธํŠธ๋ถ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค." -#: src/running-the-course.md:32 +#: src/running-the-course.md:29 msgid "" "On the day of your course, show up to the room a little early to set things " "up. We recommend presenting directly using `mdbook serve` running on your " @@ -1048,31 +1272,30 @@ msgid "" "as you change pages. Using your laptop will also allow you to fix typos as " "you or the course participants spot them." msgstr "" -"๊ฐ•์˜ ๋‹น์ผ ์กฐ๊ธˆ ์ผ์ฐ ์™€์„œ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์‚ฌ ๋…ธํŠธ๋ถ์—์„œ `mdbook serve -d book/" -"ko`๋ฅผ ์ด์šฉํ•ด ์ง์ ‘ ํ”„๋ ˆ์  ํ…Œ์ด์…˜ ํ•˜๋ฉด ํŽ˜์ด์ง€ ์ด๋™ ์‹œ์˜ ์ง€์—ฐ์ด ์—†์Šต๋‹ˆ๋‹ค.([์„ค์น˜ " -"๋ฐฉ๋ฒ•](https://github.com/google/comprehensive-rust#building)์„ ์ฐธ์กฐํ•˜์„ธ์š”.) " -"๋˜ํ•œ, ๊ทธ๋ ‡๊ฒŒ ํ•˜๋ฉด ๊ฐ•์˜ ๋„์ค‘ ์˜คํƒ€๋ฅผ ๋ฐœ๊ฒฌํ–ˆ์„ ๋•Œ ๊ทธ ์ž๋ฆฌ์—์„œ ๋ฐ”๋กœ ์ˆ˜์ • ๊ฐ€๋Šฅํ•˜๋‹ค" -"๋Š” ์žฅ์ ๋„ ์žˆ์Šต๋‹ˆ๋‹ค." +"๊ฐ•์˜ ๋‹น์ผ ์กฐ๊ธˆ ์ผ์ฐ ์™€์„œ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์‚ฌ ๋…ธํŠธ๋ถ์—์„œ `mdbook serve`๋ฅผ ์ด์šฉํ•ด " +"์ง์ ‘ ํ”„๋ ˆ์  ํ…Œ์ด์…˜ ํ•˜๋ฉด ํŽ˜์ด์ง€ ์ด๋™ ์‹œ์˜ ์ง€์—ฐ์ด ์—†์Šต๋‹ˆ๋‹ค.([์„ค์น˜ ๋ฐฉ๋ฒ•](https://" +"github.com/google/comprehensive-rust#building)์„ ์ฐธ์กฐํ•˜์„ธ์š”.) ๋˜ํ•œ, ๊ทธ๋ ‡๊ฒŒ ํ•˜" +"๋ฉด ๊ฐ•์˜ ๋„์ค‘ ์˜คํƒ€๋ฅผ ๋ฐœ๊ฒฌํ–ˆ์„ ๋•Œ ๊ทธ ์ž๋ฆฌ์—์„œ ๋ฐ”๋กœ ์ˆ˜์ • ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ์žฅ์ ๋„ ์žˆ์Šต" +"๋‹ˆ๋‹ค." -#: src/running-the-course.md:38 +#: src/running-the-course.md:35 msgid "" -"Let people solve the exercises by themselves or in small groups. Make sure " -"to ask people if they're stuck or if there is anything you can help with. " -"When you see that several people have the same problem, call it out to the " -"class and offer a solution, e.g., by showing people where to find the " -"relevant information in the standard library." +"Let people solve the exercises by themselves or in small groups. We " +"typically spend 30-45 minutes on exercises in the morning and in the " +"afternoon (including time to review the solutions). Make sure to ask people " +"if they're stuck or if there is anything you can help with. When you see " +"that several people have the same problem, call it out to the class and " +"offer a solution, e.g., by showing people where to find the relevant " +"information in the standard library." msgstr "" -"์ˆ˜๊ฐ•์ƒ๋“ค์ด ์ง์ ‘ (๊ฐœ๋ณ„ ํ˜น์€ ๊ทธ๋ฃน์œผ๋กœ) ์—ฐ์Šต๋ฌธ์ œ๋ฅผ ํ’€๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์ง„ํ–‰์ด ๋ง‰ํ˜€ ๋„" -"์›€์„ ํ•„์š”๋กœ ํ•˜๋Š” ์ˆ˜๊ฐ•์ƒ์ด ์—†๋Š”์ง€ ์ˆ˜์‹œ๋กœ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ์—ฌ๋Ÿฌ ์‚ฌ" -"๋žŒ์ด ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด, ๊ทธ ๋ฌธ์ œ๋ฅผ ๊ฐ•์˜์‹ค ์ „์ฒด ์ธ์›์—๊ฒŒ ์•Œ๋ฆฌ๊ณ  ํ•ด๊ฒฐ์ฑ…์„ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค. " -"์˜ˆ๋ฅผ ๋“ค์–ด ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์–ด๋””์— ๊ฐ€๋ฉด ๊ทธ ๋ฌธ์ œ์— ๋Œ€ํ•œ ํ•ด๋‹ต์„ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ" -"๋ ค ์ค๋‹ˆ๋‹ค." +"์ˆ˜๊ฐ•์ƒ๋“ค์ด ์ง์ ‘ (๊ฐœ๋ณ„ ํ˜น์€ ๊ทธ๋ฃน์œผ๋กœ) ์—ฐ์Šต๋ฌธ์ œ๋ฅผ ํ’€๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ๋Œ€์ฒด๋กœ ์˜ค์ „, " +"์˜คํ›„์— ๊ฐ๊ฐ 30-45๋ถ„ ์ •๋„๋ฅผ ์—ฐ์Šต๋ฌธ์ œ์— ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค (์ด๋Š” ํ•ด๋‹ต์„ ๋ณด๊ณ  ์„ค๋ช…ํ•˜๋Š” " +"์‹œ๊ฐ„๊นŒ์ง€ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค). ๋ง‰ํ˜€ ๋„์›€์„ ํ•„์š”๋กœ ํ•˜๋Š” ์ˆ˜๊ฐ•์ƒ์ด ์—†๋Š”์ง€ ์ˆ˜์‹œ๋กœ ํ™•์ธํ•ฉ๋‹ˆ" +"๋‹ค. ๋งŒ์•ฝ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ์—ฌ๋Ÿฌ ์‚ฌ๋žŒ์ด ๊ฒช๊ณ  ์žˆ๋‹ค๋ฉด, ๊ทธ ๋ฌธ์ œ๋ฅผ ๊ฐ•์˜์‹ค ์ „์ฒด ์ธ์›์—๊ฒŒ " +"์•Œ๋ฆฌ๊ณ  ํ•ด๊ฒฐ์ฑ…์„ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์–ด๋””์— ๊ฐ€๋ฉด ๊ทธ ๋ฌธ์ œ์— " +"๋Œ€ํ•œ ํ•ด๋‹ต์„ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ๋ ค ์ค๋‹ˆ๋‹ค." -#: src/running-the-course.md:44 -msgid "Prepare anything you need to have available for the afternoon of day 4." -msgstr "4์ผ์ฐจ ์˜คํ›„์— ํ•„์š”ํ•œ ๊ฒƒ๋“ค์„ ์ค€๋น„ํ•˜์„ธ์š”." - -#: src/running-the-course.md:46 +#: src/running-the-course.md:43 msgid "" "That is all, good luck running the course! We hope it will be as much fun " "for you as it has been for us!" @@ -1080,7 +1303,7 @@ msgstr "" "์ด์ œ ์ค€๋น„๋Š” ๋๋‚ฌ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ๊ทธ๋žฌ๋“ฏ์ด ์—ฌ๋Ÿฌ๋ถ„๋“ค๋„ ์ด ๊ฐ•์˜๋ฅผ ์ฆ๊ธฐ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ" "๋‹ค!" -#: src/running-the-course.md:49 +#: src/running-the-course.md:46 msgid "" "Please [provide feedback](https://github.com/google/comprehensive-rust/" "discussions/86) afterwards so that we can keep improving the course. We " @@ -1099,72 +1322,52 @@ msgstr "๊ฐ•์˜๋Š” ๋น ๋ฅธ ์†๋„๋กœ ์ง„ํ–‰๋˜๋ฉฐ, ์•„๋ž˜ ๋‚ด์šฉ๋“ค์„ ๋‹ค๋ฃน๋‹ˆ #: src/running-the-course/course-structure.md:7 msgid "Day 1: Basic Rust, ownership and the borrow checker." -msgstr "1์ผ์ฐจ: ๋Ÿฌ์ŠคํŠธ ๊ธฐ๋ณธ, ์†Œ์œ ๊ถŒ(ownership)๊ณผ ๋นŒ๋ฆผ(borrow) ์ฒดํฌ" +msgstr "1์ผ์ฐจ: ๋Ÿฌ์ŠคํŠธ ๊ธฐ๋ณธ, ์†Œ์œ ๊ถŒ(ownership)๊ณผ ๋นŒ๋ฆผ(borrow) ์ฒดํฌ." #: src/running-the-course/course-structure.md:8 msgid "Day 2: Compound data types, pattern matching, the standard library." -msgstr "2์ผ์ฐจ: ๋ณตํ•ฉ ๋ฐ์ดํ„ฐ ์œ ํ˜•, ํŒจํ„ด ๋งค์นญ, ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ" +msgstr "2์ผ์ฐจ: ๋ณตํ•ฉ ๋ฐ์ดํ„ฐ ์œ ํ˜•, ํŒจํ„ด ๋งค์นญ, ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ." #: src/running-the-course/course-structure.md:9 msgid "Day 3: Traits and generics, error handling, testing, unsafe Rust." msgstr "" "3์ผ์ฐจ: ํŠธ๋ ˆ์ž‡(trait)์™€ ์ œ๋„ค๋ฆญ(generic), ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ, ํ…Œ์ŠคํŠธ, ์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๋Ÿฌ์Šค" -"ํŠธ" +"ํŠธ." -#: src/running-the-course/course-structure.md:10 -msgid "Day 4: Concurrency in Rust and seeing Rust in action." -msgstr "4์ผ์ฐจ: ๋Ÿฌ์ŠคํŠธ์˜ ๋™์‹œ์„ฑ ๋ฐ ๋Ÿฌ์ŠคํŠธ๊ฐ€ ์‹ค์ œ ํ™œ์šฉ๋˜๋Š” ์‚ฌ๋ก€ ์‚ดํŽด๋ณด๊ธฐ" +#: src/running-the-course/course-structure.md:11 +msgid "Deep Dives" +msgstr "์‹ฌํ™” ํ•™์Šต" -#: src/running-the-course/course-structure.md:12 -msgid "Format" -msgstr "๊ฐ•์˜ ํ˜•์‹" - -#: src/running-the-course/course-structure.md:14 +#: src/running-the-course/course-structure.md:13 msgid "" -"The course is meant to be very interactive and we recommend letting the " -"questions drive the exploration of Rust!" -msgstr "" -"์ด ๊ฐ•์˜๋Š” ๊ฐ•์‚ฌ์™€ ์ˆ˜๊ฐ•์ƒ์ด ์–‘๋ฐฉํ–ฅ์œผ๋กœ ์†Œํ†ตํ•˜๋ฉด์„œ ์ง„ํ–‰ํ•˜๋„๋ก ๋””์ž์ธ ๋˜์—ˆ์Šต๋‹ˆ" -"๋‹ค. ๋‹ค์–‘ํ•œ ์งˆ๋ฌธ์„ ํ†ตํ•ด ๋Ÿฌ์ŠคํŠธ์˜ ์—ฌ๋Ÿฌ ๋ถ€๋ถ„์„ ํƒํ—˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜์„ธ์š”!" +"In addition to the 3-day class on Rust Fundamentals, we cover some more " +"specialized topics:" +msgstr "Rust ๊ธฐ์ดˆ์— ๊ด€ํ•œ 3์ผ ๊ณผ์ • ์ดํ›„์—๋Š”, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ „๋ฌธ ์ฃผ์ œ๋ฅผ ๋‹ค๋ฃน๋‹ˆ๋‹ค:" -#: src/running-the-course/day-4.md:5 +#: src/running-the-course/course-structure.md:18 msgid "" -"The afternoon of the fourth day should cover a topic of your choice. Include " -"the topic in the announcement of the course, so that participants know what " -"to expect." +"The [Android Deep Dive](../android.md) is a half-day course on using Rust " +"for Android platform development. This includes interoperability with C, C+" +"+, and Java." msgstr "" -"4์ผ์ฐจ ์˜คํ›„์—๋Š” ์—ฌ๋Ÿฌ๋ถ„์˜ ์„ ํƒ์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์ฃผ์ œ๋ฅผ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ•์˜๋ฅผ ์•ˆ๋‚ด" -"ํ•  ๋•Œ 4์ผ์ฐจ ์˜คํ›„์˜ ์ฃผ์ œ๋ฅผ ํฌํ•จํ•˜์—ฌ ์ˆ˜๊ฐ•์ƒ๋“ค์ด ๋ฏธ๋ฆฌ ์•Œ ์ˆ˜ ์žˆ๊ฒŒ ํ•˜์„ธ์š”." +"[Android ์‹ฌํ™” ํ•™์Šต](../android.md)๋Š” Android ํ”Œ๋žซํผ ๊ฐœ๋ฐœ ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ " +"๋ฐ˜๋‚˜์ ˆ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” C, C++, Java์™€์˜ ์ƒํ˜ธ ์šด์šฉ์„ฑ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค." -#: src/running-the-course/day-4.md:9 +#: src/running-the-course/course-structure.md:22 msgid "" -"This phase of the course is a chance for participants to see Rust in action " -"on a codebase they might be familiar with. You can choose from the topics " -"already defined here, or plan your own." +"You will need an [AOSP checkout](https://source.android.com/docs/setup/" +"download/downloading). Make a checkout of the [course repository](https://" +"github.com/google/comprehensive-rust) on the same machine and move the `src/" +"android/` directory into the root of your AOSP checkout. This will ensure " +"that the Android build system sees the `Android.bp` files in `src/android/`." msgstr "" -"4์ผ์ฐจ ์ฏค์ด๋ฉด, ์‹ค์ œ ์ฝ”๋“œ ๋ฒ ์ด์Šค๋ฅผ ํ†ตํ•ด ๋Ÿฌ์ŠคํŠธ๊ฐ€ ํ™œ์šฉ๋˜๋Š” ๋ชจ์Šต์„ ์‚ดํŽด๋ณด๋ฉด ์ข‹์Šต" -"๋‹ˆ๋‹ค. ์ด๋ฏธ ์ค€๋น„๋œ ์ฃผ์ œ ์ค‘์—์„œ ๊ณ ๋ฅผ ์ˆ˜๋„ ์žˆ๊ณ , ์—ฌ๋Ÿฌ๋ถ„์ด ์ง์ ‘ ์ค€๋น„ํ•œ ์ฃผ์ œ๋ฅผ ๋‹ค" -"๋ฃฐ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค." +"[AOSP ์ฝ”๋“œ](https://source.android.com/docs/setup/download/downloading)๋ฅผ ์—ฌ" +"๋Ÿฌ๋ถ„์˜ ์ปดํ“จํ„ฐ์— ์ฒดํฌ์•„์›ƒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ, ๊ทธ ์ปดํ“จํ„ฐ์—์„œ [๊ณผ์ • ์ €์žฅ์†Œ]" +"(https://github.com/google/comprehensive-rust)๋ฅผ ์ฒดํฌ์•„์›ƒํ•˜๊ณ  `src/android/` " +"๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ AOSP ์ฝ”๋“œ์˜ ๋ฃจํŠธ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์•ˆ๋“œ๋กœ์ด๋“œ ๋นŒ๋“œ ์‹œ์Šคํ…œ" +"์—์„œ ๊ณผ์ œ์šฉ์œผ๋กœ ์ถ”๊ฐ€๋œ `Android.bp`ํŒŒ์ผ์„ ์ธ์‹ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/running-the-course/day-4.md:13 -msgid "Some topics need additional preparation:" -msgstr "์ค€๋น„๋œ ์ฃผ์ œ (์–ด๋–ค ์ฃผ์ œ๋Š” ์ถ”๊ฐ€์ ์ธ ์ค€๋น„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค):" - -#: src/running-the-course/day-4.md:17 -msgid "" -"If you chose Android for Day 4 afternoon, you will need an \\[AOSP " -"checkout\\]\\[1\\]. Make a checkout of the \\[course repository\\]\\[2\\] on " -"the same machine and move the `src/android/` directory into the root of your " -"AOSP checkout. This will ensure that the Android build system sees the " -"`Android.bp` files in `src/android/`." -msgstr "" -"4์ผ์ฐจ ์˜คํ›„์— ์•ˆ๋“œ๋กœ์ด๋“œ๋ฅผ ๋‹ค๋ฃจ๊ธฐ๋กœ ํ–ˆ๋‹ค๋ฉด, \\[AOSP ์ฝ”๋“œ\\]\\[1\\]๋ฅผ ์ฒดํฌ์•„์›ƒ" -"ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ, ๊ฐ™์€ ์ปดํ“จํ„ฐ์—์„œ \\[๊ณผ์ • ์ €์žฅ์†Œ\\]\\[2\\]๋ฅผ ์ฒดํฌ์•„์›ƒํ•˜" -"๊ณ  `src/android/` ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ AOSP ์ฝ”๋“œ์˜ ๋ฃจํŠธ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์•ˆ๋“œ" -"๋กœ์ด๋“œ ๋นŒ๋“œ ์‹œ์Šคํ…œ์—์„œ ๊ณผ์ œ์šฉ์œผ๋กœ ์ถ”๊ฐ€๋œ `Android.bp`ํŒŒ์ผ์„ ์ธ์‹ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ" -"๋‹ค." - -#: src/running-the-course/day-4.md:22 +#: src/running-the-course/course-structure.md:27 msgid "" "Ensure that `adb sync` works with your emulator or real device and pre-build " "all Android examples using `src/android/build_all.sh`. Read the script to " @@ -1175,23 +1378,83 @@ msgstr "" "๋ณด์„ธ์š”. ๊ทธ ์‰˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ฝ๊ณ , ๊ทธ ์•ˆ์—์„œ ์ˆ˜ํ–‰๋˜๋Š” ๋ช…๋ น์–ด๋“ค์„ ํ™•์ธํ•œ ํ›„ ๊ฐ ๋ช…" "๋ น์–ด๋“ค์„ ์ˆ˜๋™์œผ๋กœ ์‹คํ–‰ํ•ด๋„ ์ž˜ ๋˜๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”." -#: src/running-the-course/day-4.md:26 -msgid "Async" -msgstr "๋น„๋™๊ธฐ" +#: src/running-the-course/course-structure.md:34 +msgid "Bare-Metal" +msgstr "Bare-Metal" -#: src/running-the-course/day-4.md:28 +#: src/running-the-course/course-structure.md:36 msgid "" -"If you chose Async for Day 4 afternoon, you will need a fresh crate set up " -"and the dependencies downloaded and ready to go. You can then copy/paste the " -"examples into `src/main.rs` to experiment with them." +"The [Bare-Metal Deep Dive](../bare-metal.md): a full day class on using Rust " +"for bare-metal (embedded) development. Both microcontrollers and application " +"processors are covered." msgstr "" -"4์ผ ์ฐจ ์˜คํ›„์— ๋น„๋™๊ธฐ๋ฅผ ๋‹ค๋ฃจ๊ธฐ๋กœ ํ–ˆ๋‹ค๋ฉด, ์ƒˆ ํฌ๋ ˆ์ดํŠธ๋ฅผ ์„ค์ •ํ•˜๊ณ  ๋ช‡ ๊ฐ€์ง€ ์˜์กด์„ฑ" -"์„ ๋‹ค์šด๋กœ๋“œํ•ด ๋‘์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ ์˜ˆ์ œ๋ฅผ `src/main.rs`์— ๋ณต์‚ฌ/๋ถ™์—ฌ๋„ฃ๊ธฐ " -"ํ•˜์—ฌ ์‹คํ—˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"[Bare-Metal ์‹ฌํ™” ํ•™์Šต](../bare-metal.md): bare-metal(์ž„๋ฒ ๋””๋“œ) ๊ฐœ๋ฐœ ์‹œ Rust " +"์‚ฌ์šฉ์— ๊ด€ํ•œ ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ๋ฅผ ๋ชจ๋‘ " +"๋‹ค๋ฃน๋‹ˆ๋‹ค." + +#: src/running-the-course/course-structure.md:40 +msgid "" +"For the microcontroller part, you will need to buy the [BBC micro:bit]" +"(https://microbit.org/) v2 development board ahead of time. Everybody will " +"need to install a number of packages as described on the [welcome page](../" +"bare-metal.md)." +msgstr "" +"๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ ํŒŒํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” [BBC micro:bit](https://microbit." +"org/) v2 ๊ฐœ๋ฐœ ๋ณด๋“œ๋ฅผ ๋ฏธ๋ฆฌ ๊ตฌ๋งคํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์‚ฌ์šฉ์ž๋Š” [์‹œ์ž‘ ํŽ˜์ด์ง€](../" +"bare-metal.md)์— ์„ค๋ช…๋œ ๋Œ€๋กœ ๊ฐ์ข… ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/running-the-course/course-structure.md:45 +msgid "Concurrency" +msgstr "๋™์‹œ์„ฑ" + +#: src/running-the-course/course-structure.md:47 +msgid "" +"The [Concurrency Deep Dive](../concurrency.md) is a full day class on " +"classical as well as `async`/`await` concurrency." +msgstr "" +"[๋™์‹œ์„ฑ ์‹ฌํ™”ํ•™์Šต](../concurrency.md)์€ ๊ณ ์ „์ ์ธ ๋™์‹œ์„ฑ ๋ฐ `async`/`await` ๋™" +"์‹œ์„ฑ์„ ๋‹ค๋ฃจ๋Š” ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค." + +#: src/running-the-course/course-structure.md:50 +msgid "" +"You will need a fresh crate set up and the dependencies downloaded and ready " +"to go. You can then copy/paste the examples into `src/main.rs` to experiment " +"with them:" +msgstr "" +"์ƒˆ ํฌ๋ ˆ์ดํŠธ๋ฅผ ์„ค์ •ํ•˜๊ณ  ๋ช‡ ๊ฐ€์ง€ ์˜์กด์„ฑ์„ ๋‹ค์šด๋กœ๋“œํ•ด ๋‘์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ " +"์˜ˆ์ œ๋ฅผ `src/main.rs`์— ๋ณต์‚ฌ/๋ถ™์—ฌ๋„ฃ๊ธฐ ํ•˜์—ฌ ํ…Œ์ŠคํŠธ ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/running-the-course/course-structure.md:54 +msgid "" +"```shell\n" +"cargo init concurrency\n" +"cd concurrency\n" +"cargo add tokio --features full\n" +"cargo run\n" +"```" +msgstr "" +"```shell\n" +"cargo init concurrency\n" +"cd concurrency\n" +"cargo add tokio --features full\n" +"cargo run\n" +"```" + +#: src/running-the-course/course-structure.md:61 +msgid "Format" +msgstr "๊ฐ•์˜ ํ˜•์‹" + +#: src/running-the-course/course-structure.md:63 +msgid "" +"The course is meant to be very interactive and we recommend letting the " +"questions drive the exploration of Rust!" +msgstr "" +"์ด ๊ฐ•์˜๋Š” ๊ฐ•์‚ฌ์™€ ์ˆ˜๊ฐ•์ƒ์ด ์–‘๋ฐฉํ–ฅ์œผ๋กœ ์†Œํ†ตํ•˜๋ฉด์„œ ์ง„ํ–‰ํ•˜๋„๋ก ๋””์ž์ธ ๋˜์—ˆ์Šต๋‹ˆ" +"๋‹ค. ๋‹ค์–‘ํ•œ ์งˆ๋ฌธ์„ ํ†ตํ•ด ๋Ÿฌ์ŠคํŠธ์˜ ์—ฌ๋Ÿฌ ๋ถ€๋ถ„์„ ํƒํ—˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜์„ธ์š”!" #: src/running-the-course/keyboard-shortcuts.md:3 msgid "There are several useful keyboard shortcuts in mdBook:" -msgstr "mdBook ์‹œ์Šคํ…œ(ํ˜„ ์‚ฌ์ดํŠธ)์—์„œ ์œ ์šฉํ•œ ๋‹จ์ถ•ํ‚ค๋“ค ์ž…๋‹ˆ๋‹ค:" +msgstr "๋‹ค์Œ์€, mdBook ์‹œ์Šคํ…œ(ํ˜„ ์‚ฌ์ดํŠธ)์—์„œ ์œ ์šฉํ•œ ๋‹จ์ถ•ํ‚ค๋“ค ์ž…๋‹ˆ๋‹ค:" #: src/running-the-course/keyboard-shortcuts.md:5 msgid "Arrow-Left" @@ -1231,30 +1494,29 @@ msgid "" "The course has been translated into other languages by a set of wonderful " "volunteers:" msgstr "" -"์ด ๊ณผ์ •์€ ๋‹ค๋ฅธ ์–ธ์–ด๋กœ๋„ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ๊ด„ํ˜ธ ์•ˆ์€ ๋ฒˆ์—ญ์— ๋„์›€ ์ฃผ์‹  ๋ถ„๋“ค์ž…๋‹ˆ๋‹ค." +"์ด ๊ณผ์ •์€ ๋‹ค๋ฅธ ์–ธ์–ด๋กœ๋„ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. ๊ด„ํ˜ธ ์•ˆ์€ ๋ฒˆ์—ญ์— ๋„์›€ ์ฃผ์‹  ๋ถ„๋“ค์ž…๋‹ˆ๋‹ค:" #: src/running-the-course/translations.md:6 -#, fuzzy msgid "" "[Brazilian Portuguese](https://google.github.io/comprehensive-rust/pt-BR/) " -"by [@rastringer](https://github.com/rastringer) and [@hugojacob](https://" -"github.com/hugojacob)." -msgstr "[์˜์–ด](https://google.github.io/comprehensive-rust/)" +"by [@rastringer](https://github.com/rastringer), [@hugojacob](https://github." +"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes) and " +"[@henrif75](https://github.com/henrif75)." +msgstr "" +"[๋ธŒ๋ผ์งˆ ํฌ๋ฅดํˆฌ๊ฐˆ์–ด](https://google.github.io/comprehensive-rust/pt-BR/): " +"[@rastringer](https://github.com/rastringer), [@hugojacob](https://github." +"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes) ๊ทธ๋ฆฌ๊ณ  " +"[@henrif75](https://github.com/henrif75)๊ฐ€ ์ œ๊ณต." #: src/running-the-course/translations.md:7 -#, fuzzy msgid "" "[Korean](https://google.github.io/comprehensive-rust/ko/) by [@keispace]" "(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp) and " "[@jooyunghan](https://github.com/jooyunghan)." msgstr "" -"[๋ธŒ๋ผ์งˆ ํฌ๋ฅดํˆฌ๊ฐˆ์–ด](https://google.github.io/comprehensive-rust/pt-BR/) " -"([@rastringer](https://github.com/rastringer), [@hugojacob](https://github." -"com/hugojacob)).\n" -"\n" -"[ํ•œ๊ตญ์–ด](https://google.github.io/comprehensive-rust/ko/) ([@keispace]" -"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp), " -"[@jooyunghan](https://github.com/jooyunghan))" +"[ํ•œ๊ตญ์–ด](https://google.github.io/comprehensive-rust/ko/): [@keispace]" +"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp) ๊ทธ๋ฆฌ๊ณ  " +"[@jooyunghan](https://github.com/jooyunghan)๊ฐ€ ์ œ๊ณต." #: src/running-the-course/translations.md:9 msgid "" @@ -1262,6 +1524,52 @@ msgid "" msgstr "ํŽ˜์ด์ง€ ์˜ค๋ฅธ์ชฝ ์œ„์˜ ๋ฉ”๋‰ด๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ์–ธ์–ด๋กœ ์ „ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/running-the-course/translations.md:11 +msgid "Incomplete Translations" +msgstr "๋ฒˆ์—ญ ๋ฌธ์ œ" + +#: src/running-the-course/translations.md:13 +msgid "" +"There is a large number of in-progress translations. We link to the most " +"recently updated translations:" +msgstr "" +"์ง„ํ–‰ ์ค‘์ธ ๋ฒˆ์—ญ์ด ๋งŽ์Šต๋‹ˆ๋‹ค. ์ตœ๊ทผ์— ์—…๋ฐ์ดํŠธ๋œ ๋ฒˆ์—ญ๋ณธ์œผ๋กœ ์—ฐ๊ฒฐ๋˜๋Š” ๋งํฌ๋Š” ๋‹ค์Œ" +"๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" + +#: src/running-the-course/translations.md:16 +msgid "" +"[Bengali](https://google.github.io/comprehensive-rust/bn/) by [@raselmandol]" +"(https://github.com/raselmandol)." +msgstr "" +"[๋ฒต๊ฐˆ์–ด](https://google.github.io/comprehensive-rust/bn/): [@raselmandol]" +"(https://github.com/raselmandol) ์ œ๊ณต." + +#: src/running-the-course/translations.md:17 +msgid "" +"[French](https://google.github.io/comprehensive-rust/fr/) by [@KookaS]" +"(https://github.com/KookaS) and [@vcaen](https://github.com/vcaen)." +msgstr "" +"[ํ”„๋ž‘์Šค์–ด](https://google.github.io/comprehensive-rust/fr/): [@KookaS]" +"(https://github.com/KookaS) ๋ฐ [@vcaen](https://github.com/vcaen) ์ œ๊ณต." + +#: src/running-the-course/translations.md:18 +msgid "" +"[German](https://google.github.io/comprehensive-rust/de/) by [@Throvn]" +"(https://github.com/Throvn) and [@ronaldfw](https://github.com/ronaldfw)." +msgstr "" +"[๋…์ผ์–ด](https://google.github.io/comprehensive-rust/de/): [@Throvn](https://" +"github.com/Throvn) ๋ฐ [@ronaldfw](https://github.com/ronaldfw) ์ œ๊ณต." + +#: src/running-the-course/translations.md:19 +msgid "" +"[Japanese](https://google.github.io/comprehensive-rust/ja/) by [@CoinEZ-JPN]" +"(https://github.com/CoinEZ) and [@momotaro1105](https://github.com/" +"momotaro1105)." +msgstr "" +"[์ผ๋ณธ์–ด](https://google.github.io/comprehensive-rust/ja/): [@CoinEZ-JPN]" +"(https://github.com/CoinEZ) ๋ฐ [@momotaro1105](https://github.com/" +"momotaro1105) ์ œ๊ณต." + +#: src/running-the-course/translations.md:21 msgid "" "If you want to help with this effort, please see [our instructions](https://" "github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md) for how to " @@ -1273,108 +1581,6 @@ msgstr "" "์ค‘์ธ ๋ฒˆ์—ญ ์ž‘์—…์— ๋Œ€ํ•œ ๋‚ด์šฉ์€ [์ด์Šˆ ํŠธ๋ž˜์ปค](https://github.com/google/" "comprehensive-rust/issues/282)๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”." -#: src/running-the-course/translations.md:13 -msgid "" -"There is a large number of in-progress translations. We link to the most " -"recently updated translations:" -msgstr "" -"์ง„ํ–‰ ์ค‘์ธ ๋ฒˆ์—ญ์ด ๋งŽ์Šต๋‹ˆ๋‹ค. ์ตœ๊ทผ์— ์—…๋ฐ์ดํŠธ๋œ ๋ฒˆ์—ญ๋ณธ์œผ๋กœ ์—ฐ๊ฒฐ๋˜๋Š” ๋งํฌ๋Š” ๋‹ค์Œ" -"๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค." - -#: src/running-the-course/translations.md:16 -msgid "" -"[French](https://google.github.io/comprehensive-rust/fr/) by [@KookaS]" -"(https://github.com/KookaS) and [@vcaen](https://github.com/vcaen)." -msgstr "" -"[French](https://google.github.io/comprehensive-rust/fr/): [@KookaS](https://" -"github.com/KookaS) ๋ฐ [@vcaen](https://github.com/vcaen) ์ œ๊ณต" - -#: src/running-the-course/translations.md:17 -msgid "" -"[German](https://google.github.io/comprehensive-rust/de/) by [@Throvn]" -"(https://github.com/Throvn) and [@ronaldfw](https://github.com/ronaldfw)." -msgstr "" -"[German](https://google.github.io/comprehensive-rust/de/): [@Throvn](https://" -"github.com/Throvn) ๋ฐ [@ronaldfw](https://github.com/ronaldfw) ์ œ๊ณต" - -#: src/running-the-course/translations.md:18 -msgid "" -"[Japanese](https://google.github.io/comprehensive-rust/ja/) by [@CoinEZ-JPN]" -"(https://github.com/CoinEZ) and [@momotaro1105](https://github.com/" -"momotaro1105)." -msgstr "" -"[Japanese](https://google.github.io/comprehensive-rust/ja/): [@CoinEZ-JPN]" -"(https://github.com/CoinEZ) ๋ฐ [@momotaro1105](https://github.com/" -"momotaro1105) ์ œ๊ณต" - -#: src/running-the-course/course-structure.md:11 -msgid "Deep Dives" -msgstr "์‹ฌํ™” ํ•™์Šต" - -#: src/running-the-course/course-structure.md:13 -msgid "" -"In addition to the 3-day class on Rust Fundamentals, we cover some more " -"specialized topics:" -msgstr "Rust ๊ธฐ์ดˆ์— ๊ด€ํ•œ 3์ผ ๊ณผ์ • ์™ธ์—๋„ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ „๋ฌธ ์ฃผ์ œ๋ฅผ ๋‹ค๋ฃน๋‹ˆ๋‹ค." - -#: src/running-the-course/course-structure.md:18 -msgid "" -"The [Android Deep Dive](../android.md) is a half-day course on using Rust " -"for Android platform development. This includes interoperability with C, C+" -"+, and Java." -msgstr "" -"[Android ์‹ฌํ™” ํ•™์Šต](../android.md)๋Š” Android ํ”Œ๋žซํผ ๊ฐœ๋ฐœ ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ " -"๋ฐ˜๋‚˜์ ˆ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” C, C++, Java์™€์˜ ์ƒํ˜ธ ์šด์šฉ์„ฑ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค." - -#: src/running-the-course/course-structure.md:34 -msgid "Bare-Metal" -msgstr "Bare-Metal" - -#: src/running-the-course/course-structure.md:36 -msgid "" -"The [Bare-Metal Deep Dive](../bare-metal.md): a full day class on using Rust " -"for bare-metal (embedded) development. Both microcontrollers and application " -"processors are covered." -msgstr "" -"[Bare-Metal ์‹ฌํ™” ํ•™์Šต](../bare-metal.md): bare-metal(์ž„๋ฒ ๋””๋“œ) ๊ฐœ๋ฐœ ์‹œ Rust " -"์‚ฌ์šฉ์— ๊ด€ํ•œ ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ๋ฅผ ๋ชจ๋‘ " -"๋‹ค๋ฃน๋‹ˆ๋‹ค." - -#: src/running-the-course/course-structure.md:40 -msgid "" -"For the microcontroller part, you will need to buy the [BBC micro:bit]" -"(https://microbit.org/) v2 development board ahead of time. Everybody will " -"need to install a number of packages as described on the [welcome page](../" -"bare-metal.md)." -msgstr "" -"๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ ํŒŒํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” [BBC micro:bit](https://microbit." -"org/) v2 ๊ฐœ๋ฐœ ๋ณด๋“œ๋ฅผ ๋ฏธ๋ฆฌ ๊ตฌ๋งคํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์‚ฌ์šฉ์ž๋Š” [์‹œ์ž‘ ํŽ˜์ด์ง€](../" -"bare-metal.md)์— ์„ค๋ช…๋œ ๋Œ€๋กœ ๊ฐ์ข… ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." - -#: src/running-the-course/course-structure.md:47 -msgid "" -"The [Concurrency Deep Dive](../concurrency.md) is a full day class on " -"classical as well as `async`/`await` concurrency." -msgstr "" -"[๋™์‹œ์„ฑ ์‹ฌํ™”ํ•™์Šต](../concurrency.md)์€ ๊ณ ์ „์ ์ธ ๋™์‹œ์„ฑ ๋ฐ `async`/`await` ๋™" -"์‹œ์„ฑ์„ ๋‹ค๋ฃจ๋Š” ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค." - -#: src/running-the-course/course-structure.md:54 -msgid "" -"```shell\n" -"cargo init concurrency\n" -"cd concurrency\n" -"cargo add tokio --features full\n" -"cargo run\n" -"```" -msgstr "" -"```shell\n" -"cargo init concurrency\n" -"cd concurrency\n" -"cargo add tokio --features full\n" -"cargo run\n" -"```" - #: src/cargo.md:3 msgid "" "When you start reading about Rust, you will soon meet [Cargo](https://doc." @@ -1393,65 +1599,53 @@ msgid "Installation" msgstr "์„ค์น˜ํ•˜๊ธฐ" #: src/cargo.md:10 -msgid "Rustup (Recommended)" -msgstr "Rustup (์ถ”์ฒœ)" +msgid "**Please follow the instructions on .**" +msgstr "**์˜ ์„ค์น˜ ๋ฐฉ๋ฒ•์„ ๋”ฐ๋ฅด์„ธ์š”.**" #: src/cargo.md:12 msgid "" -"You can follow the instructions to install cargo and rust compiler, among " -"other standard ecosystem tools with the [rustup](https://rust-analyzer." -"github.io/) tool, which is maintained by the Rust Foundation." +"This will give you the Cargo build tool (`cargo`) and the Rust compiler " +"(`rustc`). You will also get `rustup`, a command line utility that you can " +"use to install/switch toolchains, setup cross compilation, etc." msgstr "" -"๋Ÿฌ์ŠคํŠธ ์žฌ๋‹จ์—์„œ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋Š” [rustup](https://rust-analyzer.github.io/) ๋„๊ตฌ" -"๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์นด๊ณ  ๋ฐ ๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ ๋“ฑ ํ‘œ์ค€ ๋„๊ตฌ๋ฅผ ์„ค์น˜ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/cargo.md:14 -msgid "" -"Along with cargo and rustc, Rustup will install itself as a command line " -"utility that you can use to install/switch toolchains, setup cross " -"compilation, etc." -msgstr "" -"์นด๊ณ (cargo)์™€ ๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ(rustc)์™€ ํ•จ๊ป˜, rustup์€ ํˆด์ฒด์ธ์„ ์„ค์น˜ํ•˜๊ณ , ๋‹ค" +"์œ„ ์„ค์น˜ ๋ฐฉ๋ฒ•์„ ๋”ฐ๋ฅด๋ฉด, ๋นŒ๋“œ ์‹œ์Šคํ…œ์ธ ์นด๊ณ (`cargo`)์™€ ๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ(`rustc`)" +"๊ฐ€ ์„ค์น˜๋ฉ๋‹ˆ๋‹ค. ์ด์™€ ํ•จ๊ป˜, `rustup`๋„ ์„ค์น˜๋˜๋Š”๋ฐ ์ด ํˆด์€ ํˆด์ฒด์ธ์„ ์„ค์น˜ํ•˜๊ณ , ๋‹ค" "๋ฅธ ํˆด์ฒด์ธ์œผ๋กœ ์ „ํ™˜ํ•˜๊ณ , ํฌ๋กœ์Šค ์ปดํŒŒ์ผ ์„ค์ •์„ ํ•˜๋Š” ์ผ์„ ๋‹ด๋‹นํ•˜๋Š” ์ปค๋งจ๋“œ ๋ผ์ธ " "์œ ํ‹ธ๋ฆฌํ‹ฐ ์ž…๋‹ˆ๋‹ค." #: src/cargo.md:16 -msgid "Package Managers" -msgstr "ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ €" +msgid "" +"On Debian/Ubuntu, you can also install Cargo, the Rust source and the [Rust " +"formatter](https://github.com/rust-lang/rustfmt) via `apt`. However, this " +"gets you an outdated rust version and may lead to unexpected behavior. The " +"command would be:" +msgstr "" +"๋ฐ๋น„์•ˆ/์šฐ๋ถ„ํˆฌ ์‹œ์Šคํ…œ์—์„œ๋Š” `apt`๋ฅผ ์ด์šฉํ•ด์„œ ์นด๊ณ , ๋Ÿฌ์ŠคํŠธ ์†Œ์Šค, [๋Ÿฌ์ŠคํŠธ ํฌ๋งค" +"ํ„ฐ](https://github.com/rust-lang/rustfmt)๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ฐฉ" +"๋ฒ•์„ ๋”ฐ๋ฅผ ๊ฒฝ์šฐ ์ตœ์‹  ๋ฒ„์ „์ด ์•„๋‹Œ ๋Ÿฌ์ŠคํŠธ๋ฅผ ์‚ฌ์šฉ๊ฒŒ๋˜๋ฉฐ, ๊ทธ ๊ฒฐ๊ณผ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ฌธ์ œ" +"๋ฅผ ๊ฒช์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์„ค์น˜ ๋ช…๋ น์–ด๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค:" #: src/cargo.md:18 -msgid "Debian" -msgstr "๋ฐ๋น„์•ˆ" - -#: src/cargo.md:20 msgid "" -"On Debian/Ubuntu, you can install Cargo, the Rust source and the [Rust " -"formatter](https://github.com/rust-lang/rustfmt) with" +"```shell\n" +" sudo apt install cargo rust-src rustfmt\n" +"```" msgstr "" -"๋ฐ๋น„์•ˆ์ด๋‚˜ ์šฐ๋ถ„ํˆฌ์—์„œ cargo, ๋Ÿฌ์ŠคํŠธ ์†Œ์Šค์ฝ”๋“œ, [๋Ÿฌ์ŠคํŠธ ํฌ๋งคํ„ฐ](https://github." -"com/rust-lang/rustfmt)๋ฅผ ์•„๋ž˜ ์ปค๋งจ๋“œ๋กœ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค." +"```shell\n" +"$ sudo apt install cargo rust-src rustfmt\n" +"```" #: src/cargo.md:22 msgid "" -"```shell\n" -"$ sudo apt install cargo rust-src rustfmt\n" -"```" +"We suggest using [VS Code](https://code.visualstudio.com/) to edit the code " +"(but any LSP compatible editor works with rust-analyzer[3](https://rust-" +"analyzer.github.io/))." msgstr "" -"```shell\n" -"$ sudo apt install cargo rust-src rustfmt\n" -"```" +"์šฐ๋ฆฌ๋Š” ์ฝ”๋“œ ์—๋””ํ„ฐ๋กœ [VS Code](https://code.visualstudio.com/)๋ฅผ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค. " +"๊ทธ๋Ÿฌ๋‚˜ LSP๋ฅผ ์ง€์›ํ•˜๋Š” (๊ทธ๋ž˜์„œ rust-analyzer[3](https://rust-analyzer.github." +"io/)์™€ ์—ฐ๋™์ด ๊ฐ€๋Šฅํ•œ) ์—๋””ํ„ฐ๋ผ๋ฉด ์–ด๋–ค ๊ฒƒ์ด๋ผ๋„ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค." -#: src/cargo.md:26 -msgid "" -"This will allow \\[rust-analyzer\\]\\[1\\] to jump to the definitions. We " -"suggest using [VS Code](https://code.visualstudio.com/) to edit the code " -"(but any LSP compatible editor works)." -msgstr "" -"์ด๋ ‡๊ฒŒ ํ•˜๋ฉด \\[rust-analyzer\\]\\[1\\]๋ฅผ ์ด์šฉํ•ด์„œ ํŠน์ • ์‹ฌ๋ณผ์ด ์ •์˜๋œ ์œ„์น˜๋กœ " -"์‰ฝ๊ฒŒ ์ด๋™ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” ์—๋””ํ„ฐ๋กœ [VS Code](https://code.visualstudio." -"com/)๋ฅผ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค๋งŒ, ์‚ฌ์‹ค LSP๋ฅผ ์ง€์›ํ•œ๋‹ค๋ฉด ์–ด๋–ค ์—๋””ํ„ฐ๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/cargo.md:29 +#: src/cargo.md:24 msgid "" "Some folks also like to use the [JetBrains](https://www.jetbrains.com/" "clion/) family of IDEs, which do their own analysis but have their own " @@ -1487,14 +1681,14 @@ msgstr "" #: src/cargo/rust-ecosystem.md:8 msgid "" "`cargo`: the Rust dependency manager and build tool. Cargo knows how to " -"download dependencies hosted on and it will pass them to " -"`rustc` when building your project. Cargo also comes with a built-in test " -"runner which is used to execute unit tests." +"download dependencies, usually hosted on , and it will " +"pass them to `rustc` when building your project. Cargo also comes with a " +"built-in test runner which is used to execute unit tests." msgstr "" -"`cargo`: ๋Ÿฌ์ŠคํŠธ ์˜์กด์„ฑ ๊ด€๋ฆฌ์ž ๋ฐ ๋นŒ๋“œ๋„๊ตฌ ์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๋ถ„์˜ ํ”„๋กœ์ ํŠธ์— ๋ช…์‹œ๋œ " -"์˜์กด์„ฑ๋“ค์„ ์—์„œ ์ž๋™์œผ๋กœ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ณ , ๊ทธ ์†Œ์Šค์ฝ”๋“œ๋ฅผ " -"`rustc`๋กœ ์ „๋‹ฌํ•˜์—ฌ ๋นŒ๋“œ๋ฅผ ์‹œํ‚ต๋‹ˆ๋‹ค. ๋˜ํ•œ ์œ ๋‹› ํ…Œ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ํ…Œ์ŠคํŠธ ๋Ÿฌ๋„ˆ" -"๋ฅผ ๋‚ด์žฅํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค." +"`cargo`: ๋Ÿฌ์ŠคํŠธ ์˜์กด์„ฑ ๊ด€๋ฆฌ์ž์ด์ž ๋นŒ๋“œ ์‹œ์Šคํ…œ ์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๋ถ„์˜ ํ”„๋กœ์ ํŠธ์— ๋ช…" +"์‹œ๋œ ์˜์กด์„ฑ๋“ค์„ ์—์„œ ์ž๋™์œผ๋กœ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ณ , ๊ทธ ์†Œ์Šค์ฝ”๋“œ" +"๋ฅผ `rustc`๋กœ ์ „๋‹ฌํ•˜์—ฌ ๋นŒ๋“œ๋ฅผ ์‹œํ‚ต๋‹ˆ๋‹ค. ๋˜ํ•œ ์œ ๋‹› ํ…Œ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ํ…Œ์ŠคํŠธ ๋Ÿฌ" +"๋„ˆ๋ฅผ ๋‚ด์žฅํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค." #: src/cargo/rust-ecosystem.md:13 msgid "" @@ -1504,19 +1698,20 @@ msgid "" "standard library. You can have multiple versions of Rust installed at once " "and `rustup` will let you switch between them as needed." msgstr "" -"`rustup`: ๋Ÿฌ์ŠคํŠธ ํˆด์ฒด์ธ ์„ค์น˜ ํ”„๋กœ๊ทธ๋žจ ๋ฐ ์—…๋ฐ์ดํŠธ ํ”„๋กœ๊ทธ๋žจ. ์ด ๋„๊ตฌ๋Š” ์ƒˆ ๋ฒ„์ „" -"์˜ ๋Ÿฌ์ŠคํŠธ๊ฐ€ ์ถœ์‹œ๋  ๋•Œ `rustc` ๋ฐ `cargo` ์„ค์น˜ํ•˜๊ณ  ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ" -"๋‹ค. ๋˜ํ•œ `rustup`์€ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•œ ๋ฌธ์„œ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. " -"ํ•œ ๋ฒˆ์— ์—ฌ๋Ÿฌ ๋ฒ„์ „์˜ ๋Ÿฌ์ŠคํŠธ๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ `rustup`์„ ํ†ตํ•ด ํ•„์š”์— ๋”ฐ๋ผ ์ด" -"๋“ค ๋ฒ„์ „์„ ์ „ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"`rustup`: ๋Ÿฌ์ŠคํŠธ ํˆด์ฒด์ธ ์„ค์น˜ ํ”„๋กœ๊ทธ๋žจ์ด์ž ์—…๋ฐ์ดํŠธ ํ”„๋กœ๊ทธ๋žจ ์ž…๋‹ˆ๋‹ค. ์ด ๋„๊ตฌ" +"๋Š” ์ƒˆ ๋ฒ„์ „์˜ ๋Ÿฌ์ŠคํŠธ๊ฐ€ ์ถœ์‹œ๋  ๋•Œ `rustc` ๋ฐ `cargo` ์„ค์น˜ํ•˜๊ณ  ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐ " +"์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ `rustup`์€ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•œ ๋ฌธ์„œ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜๋„ ์žˆ" +"์Šต๋‹ˆ๋‹ค. ํ•œ ๋ฒˆ์— ์—ฌ๋Ÿฌ ๋ฒ„์ „์˜ ๋Ÿฌ์ŠคํŠธ๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ `rustup`์„ ์ด์šฉํ•ด์„œ ์‹ค" +"์ œ๋กœ ์‚ฌ์šฉํ•  ๋ฒ„์ „์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/cargo/rust-ecosystem.md:21 src/hello-world.md:25 #: src/hello-world/small-example.md:27 src/why-rust/runtime.md:10 #: src/why-rust/modern.md:21 src/basic-syntax/compound-types.md:30 +#: src/basic-syntax/references.md:23 #: src/pattern-matching/destructuring-enums.md:35 -#: src/error-handling/try-operator.md:50 +#: src/error-handling/try-operator.md:48 #: src/error-handling/converting-error-types-example.md:50 -#: src/concurrency/threads.md:30 +#: src/concurrency/threads.md:30 src/async/async-await.md:25 msgid "Key points:" msgstr "ํ‚ค ํฌ์ธํŠธ:" @@ -1544,6 +1739,14 @@ msgstr "" #: src/cargo/rust-ecosystem.md:32 msgid "" +"Dependencies can also be resolved from alternative [registries](https://doc." +"rust-lang.org/cargo/reference/registries.html), git, folders, and more." +msgstr "" +"์˜์กด์„ฑ์€ ๋‹ค์–‘ํ•œ [์ €์žฅ์†Œ](registries), git ํ”„๋กœ์ ํŠธ, ๋””๋ ‰ํ„ฐ๋ฆฌ ๋“ฑ์—์„œ ์ œ๊ณต๋  " +"์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/cargo/rust-ecosystem.md:34 +msgid "" "Rust also has [editions](https://doc.rust-lang.org/edition-guide/): the " "current edition is Rust 2021. Previous editions were Rust 2015 and Rust 2018." msgstr "" @@ -1551,13 +1754,13 @@ msgstr "" "ํ˜„์žฌ๋Š” Rust 2021 ์—๋””์…˜์ž…๋‹ˆ๋‹ค. ์ด ์ „ ์—๋””์…˜์œผ๋กœ Rust 2015์™€ Rust 2018์ด ์žˆ์Šต" "๋‹ˆ๋‹ค." -#: src/cargo/rust-ecosystem.md:35 +#: src/cargo/rust-ecosystem.md:37 msgid "" "The editions are allowed to make backwards incompatible changes to the " "language." msgstr "์—๋””์…˜์€ ์ด์ „ ์—๋””์…˜๊ณผ ํ˜ธํ™˜์ด ๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/cargo/rust-ecosystem.md:38 +#: src/cargo/rust-ecosystem.md:40 msgid "" "To prevent breaking code, editions are opt-in: you select the edition for " "your crate via the `Cargo.toml` file." @@ -1565,7 +1768,7 @@ msgstr "" "์—๋””์…˜์ด ๋ฐ”๋€Œ๋ฉด์„œ ํ”„๋กœ๊ทธ๋žจ์ด ์˜๋„์น˜ ์•Š๊ฒŒ ๊นจ์ง€๋Š” ๋ฌธ์ œ๋ฅผ ๋ง‰๊ธฐ ์œ„ํ•ด, ๊ฐ ํ”„๋กœ๊ทธ๋žจ" "์€ ์ž์‹ ์ด ๋นŒ๋“œ๋  ์—๋””์…˜์„ ๋ช…์‹œ์ ์œผ๋กœ `Cargo.toml`์— ์ง€์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." -#: src/cargo/rust-ecosystem.md:41 +#: src/cargo/rust-ecosystem.md:43 msgid "" "To avoid splitting the ecosystem, Rust compilers can mix code written for " "different editions." @@ -1573,7 +1776,7 @@ msgstr "" "๋Ÿฌ์ŠคํŠธ ์ƒํƒœ๊ณ„๊ฐ€ ์—๋””์…˜ ๋ณ„๋กœ ํŒŒํŽธํšŒ ๋˜๋Š” ๊ฒƒ์„ ๋ง‰๊ธฐ ์œ„ํ•ด, ๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ์„œ" "๋กœ ๋‹ค๋ฅธ ์—๋””์…˜์—์„œ ์ž‘์„ฑ๋œ ์ฝ”๋“œ๋“ค์„ ํ•˜๋‚˜์˜ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ๋ฌถ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/cargo/rust-ecosystem.md:44 +#: src/cargo/rust-ecosystem.md:46 msgid "" "Mention that it is quite rare to ever use the compiler directly not through " "`cargo` (most users never do)." @@ -1581,51 +1784,51 @@ msgstr "" "`cargo`๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋Š” ๊ฑฐ์˜ ์—†์Œ์„ ์–ธ๊ธ‰ํ•ด ์ฃผ" "์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." -#: src/cargo/rust-ecosystem.md:46 +#: src/cargo/rust-ecosystem.md:48 msgid "" "It might be worth alluding that Cargo itself is an extremely powerful and " "comprehensive tool. It is capable of many advanced features including but " "not limited to: " msgstr "" "์นด๊ณ  ์ž์ฒด๊ฐ€ ๋งค์šฐ ๊ฐ•๋ ฅํ•˜๊ณ  ํฌ๊ด„์ ์ธ ๋„๊ตฌ์ž„์„ ์ ๊ทน์ ์œผ๋กœ ์•Œ๋ฆฌ์„ธ์š”. ์นด๊ณ ๋Š” ๋‹ค์Œ" -"๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." +"๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค: " -#: src/cargo/rust-ecosystem.md:47 +#: src/cargo/rust-ecosystem.md:49 msgid "Project/package structure" msgstr "ํ”„๋กœ์ ํŠธ/ํŒจํ‚ค์ง€ ๊ตฌ์กฐํ™”" -#: src/cargo/rust-ecosystem.md:48 +#: src/cargo/rust-ecosystem.md:50 msgid "[workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)" msgstr "" "[์›Œํฌ์ŠคํŽ˜์ด์Šค](https://doc.rust-lang.org/cargo/reference/workspaces.html)" -#: src/cargo/rust-ecosystem.md:49 +#: src/cargo/rust-ecosystem.md:51 msgid "Dev Dependencies and Runtime Dependency management/caching" msgstr "๊ฐœ๋ฐœ/๋Ÿฐํƒ€์ž„ ์ข…์†์„ฑ ๊ด€๋ฆฌ ๋ฐ ์บ์‹ฑ" -#: src/cargo/rust-ecosystem.md:50 +#: src/cargo/rust-ecosystem.md:52 msgid "" "[build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts." "html)" msgstr "" "[๋นŒ๋“œ ์Šคํฌ๋ฆฝํŠธ](https://doc.rust-lang.org/cargo/reference/build-scripts.html)" -#: src/cargo/rust-ecosystem.md:51 +#: src/cargo/rust-ecosystem.md:53 msgid "" "[global installation](https://doc.rust-lang.org/cargo/commands/cargo-install." "html)" msgstr "" "[์ „์—ญ ์„ค์น˜](https://doc.rust-lang.org/cargo/commands/cargo-install.html)" -#: src/cargo/rust-ecosystem.md:52 +#: src/cargo/rust-ecosystem.md:54 msgid "" "It is also extensible with sub command plugins as well (such as [cargo " "clippy](https://github.com/rust-lang/rust-clippy))." msgstr "" "[cargo clippy](https://github.com/rust-lang/rust-clippy)์™€ ๊ฐ™์€ ํ•˜์œ„ ํ”Œ๋Ÿฌ๊ทธ์ธ" -"์œผ๋กœ ํ™•์žฅ ๊ฐ€๋Šฅ" +"์œผ๋กœ ํ™•์žฅ ๊ฐ€๋Šฅ." -#: src/cargo/rust-ecosystem.md:53 +#: src/cargo/rust-ecosystem.md:55 msgid "" "Read more from the [official Cargo Book](https://doc.rust-lang.org/cargo/)" msgstr "" @@ -1680,7 +1883,7 @@ msgstr "์ฝ”๋“œ ๋ธ”๋ก์— ํฌ์ปค์Šค๋ฅผ ๋‘๊ณ  " #: src/cargo/code-samples.md:19 msgid " to execute the code when focus is in the text box." -msgstr "๋ฅผ ๋ˆŒ๋Ÿฌ ์‹คํ–‰ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr " ๋ฅผ ๋ˆŒ๋Ÿฌ ์‹คํ–‰ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/cargo/code-samples.md:24 msgid "" @@ -1743,24 +1946,32 @@ msgstr "" #: src/cargo/running-locally.md:15 msgid "" -"With this is in place, then follow these steps to build a Rust binary from " -"one of the examples in this training:" +"You can use any later version too since Rust maintains backwards " +"compatibility." msgstr "" -"์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๊ฐ€ ๋˜์—ˆ์œผ๋ฉด ๊ฐ•์˜์˜ ์ฝ”๋“œ ๋ธ”๋ก์ค‘ ํ•˜๋‚˜๋ฅผ ์•„๋ž˜ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ ๋กœ์ปฌ์—" -"์„œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +"์ด ๋ฒ„์ „๋ณด๋‹ค ๋” ์ตœ์‹ ์˜ ๋ฒ„์ „์ด์–ด๋„ ์ƒ๊ด€ ์—†์Šต๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ๋Š” ํ•˜์œ„ ํ˜ธํ™˜์„ฑ์„ ์ง€์›ํ•ฉ" +"๋‹ˆ๋‹ค." -#: src/cargo/running-locally.md:18 +#: src/cargo/running-locally.md:17 +msgid "" +"With this in place, follow these steps to build a Rust binary from one of " +"the examples in this training:" +msgstr "" +"์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๊ฐ€ ๋˜์—ˆ์œผ๋ฉด, ๊ฐ•์˜ ์˜ˆ์ œ์ค‘ ํ•˜๋‚˜๋ฅผ ๋Ÿฌ์ŠคํŠธ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ๋นŒ๋“œํ•ด ๋ด…์‹œ" +"๋‹ค:" + +#: src/cargo/running-locally.md:20 msgid "Click the \"Copy to clipboard\" button on the example you want to copy." msgstr "์˜ˆ์‹œ ๋ธ”๋ก์— ์žˆ๋Š” \"Copy to clipboard\" ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด์„œ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค." -#: src/cargo/running-locally.md:20 +#: src/cargo/running-locally.md:22 msgid "" "Use `cargo new exercise` to create a new `exercise/` directory for your code:" msgstr "" "ํ„ฐ๋ฏธ๋„์—์„œ `cargo new exercise`๋ฅผ ์ž…๋ ฅํ•ด์„œ ์ƒˆ๋กœ์šด `exercise/` ํด๋”๋ฅผ ๋งŒ๋“ญ๋‹ˆ" "๋‹ค:" -#: src/cargo/running-locally.md:22 +#: src/cargo/running-locally.md:24 msgid "" "```shell\n" "$ cargo new exercise\n" @@ -1772,12 +1983,12 @@ msgstr "" " Created binary (application) `exercise` package\n" "```" -#: src/cargo/running-locally.md:27 +#: src/cargo/running-locally.md:29 msgid "" "Navigate into `exercise/` and use `cargo run` to build and run your binary:" msgstr "`exercise/` ํด๋”๋กœ ์ด๋™ํ•œ ํ›„, `cargo run` ์ปค๋งจ๋“œ๋กœ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" -#: src/cargo/running-locally.md:29 +#: src/cargo/running-locally.md:31 msgid "" "```shell\n" "$ cd exercise\n" @@ -1797,7 +2008,7 @@ msgstr "" "Hello, world!\n" "```" -#: src/cargo/running-locally.md:38 +#: src/cargo/running-locally.md:40 msgid "" "Replace the boiler-plate code in `src/main.rs` with your own code. For " "example, using the example on the previous page, make `src/main.rs` look like" @@ -1805,7 +2016,7 @@ msgstr "" "`src/main.rs`์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์ด์ „ ํŽ˜์ด์ง€์˜ ์†Œ์Šค๋ฅผ ์•„๋ž˜์™€ ๊ฐ™" "์ด `src/main.rs`์— ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค" -#: src/cargo/running-locally.md:41 +#: src/cargo/running-locally.md:43 msgid "" "```rust\n" "fn main() {\n" @@ -1819,11 +2030,11 @@ msgstr "" "}\n" "```" -#: src/cargo/running-locally.md:47 +#: src/cargo/running-locally.md:49 msgid "Use `cargo run` to build and run your updated binary:" msgstr "`cargo run`์ปค๋งจ๋“œ๋กœ ์†Œ์Šค๋ฅผ ๋นŒ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" -#: src/cargo/running-locally.md:49 +#: src/cargo/running-locally.md:51 msgid "" "```shell\n" "$ cargo run\n" @@ -1841,7 +2052,7 @@ msgstr "" "Edit me!\n" "```" -#: src/cargo/running-locally.md:57 +#: src/cargo/running-locally.md:59 msgid "" "Use `cargo check` to quickly check your project for errors, use `cargo " "build` to compile it without running it. You will find the output in `target/" @@ -1853,7 +2064,7 @@ msgstr "" "์žˆ์Šต๋‹ˆ๋‹ค. `cargo build --release`์ปค๋งจ๋“œ๋Š” ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „์šฉ ์ตœ์ ํ™”๋ฅผ ์ผœ์„œ ์ปดํŒŒ์ผ" "ํ•˜๋ฉฐ `target/release/`ํด๋”์—์„œ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/cargo/running-locally.md:62 +#: src/cargo/running-locally.md:64 msgid "" "You can add dependencies for your project by editing `Cargo.toml`. When you " "run `cargo` commands, it will automatically download and compile missing " @@ -1862,7 +2073,7 @@ msgstr "" "`Cargo.toml`ํŒŒ์ผ์—๋Š” ์˜์กด์„ฑ ํŒจํ‚ค์ง€๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. `cargo`์ปค๋งจ๋“œ๋ฅผ ์‹คํ–‰" "ํ•˜๋ฉด ์ž๋™์œผ๋กœ ์˜์กด์„ฑ ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์ปดํŒŒ์ผ ๊นŒ์ง€ ํ•ด ์ค๋‹ˆ๋‹ค." -#: src/cargo/running-locally.md:70 +#: src/cargo/running-locally.md:72 msgid "" "Try to encourage the class participants to install Cargo and use a local " "editor. It will make their life easier since they will have a normal " @@ -1878,7 +2089,7 @@ msgstr "1์ผ์ฐจ ๊ฐœ์š”" #: src/welcome-day-1.md:3 msgid "" -"This is the first day of Comprehensive Rust. We will cover a lot of ground " +"This is the first day of Rust Fundamentals. We will cover a lot of ground " "today:" msgstr "๊ฐ•์˜ ์ฒซ ๋‚ ์ž…๋‹ˆ๋‹ค. ์˜ค๋Š˜ ๋ฐฐ์šธ ๊ฒƒ์ด ์ฐธ ๋งŽ์Šต๋‹ˆ๋‹ค:" @@ -1916,14 +2127,15 @@ msgstr "๊ถ๊ธˆํ•œ ์ ์ด ์žˆ์œผ๋ฉด ์ฃผ์ €ํ•˜์ง€ ๋ง๊ณ  ์งˆ๋ฌธ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." msgid "" "The class is meant to be interactive and discussions are very much " "encouraged!" -msgstr "์ด ์ˆ˜์—…์€ ์ƒํ˜ธ์ž‘์šฉ์ด ์ค‘์š”ํ•˜๊ณ  ํ† ๋ก ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค." +msgstr "์ด ์ˆ˜์—…์€ ์ƒํ˜ธ์ž‘์šฉ์ด ์š”ํ•ฉ๋‹ˆ๋‹ค. ํ† ๋ก ์„ ๋ง์„ค์ด์ง€ ๋งˆ์„ธ์š”!" #: src/welcome-day-1.md:20 msgid "" "As an instructor, you should try to keep the discussions relevant, i.e., " -"keep the related to how Rust does things vs some other language. It can be " -"hard to find the right balance, but err on the side of allowing discussions " -"since they engage people much more than one-way communication." +"keep the discussions related to how Rust does things vs some other " +"language. It can be hard to find the right balance, but err on the side of " +"allowing discussions since they engage people much more than one-way " +"communication." msgstr "" "๊ฐ•์‚ฌ๋กœ์„œ ํ† ๋ก ์ด ์˜†๊ธธ๋กœ ์ƒˆ์ง€ ์•Š๊ฒŒ ์ฃผ์˜ํ•˜์„ธ์š”. ์˜ˆ๋ฅผ ๋“ค์–ด ๋Ÿฌ์ŠคํŠธ์™€ ๋‹ค๋ฅธ ์–ธ์–ด๋“ค" "์„ ๋น„๊ตํ•œ๋‹ค๋“ ์ง€ ํ•˜๋Š” ๊ฒƒ์€ ์ข‹์Šต๋‹ˆ๋‹ค. ์ ์ ˆํ•œ ๊ท ํ˜•์„ ์ฐพ๊ธฐ ์• ๋งคํ•œ ๊ฒฝ์šฐ๋ผ๋ฉด ํ† ๋ก " @@ -1989,7 +2201,7 @@ msgstr "" #: src/welcome-day-1/what-is-rust.md:5 msgid "Rust is a statically compiled language in a similar role as C++" -msgstr "๋Ÿฌ์ŠคํŠธ๋Š” C++์™€ ์œ ์‚ฌํ•œ ์ •์  ์ปดํŒŒ์ผ ์–ธ์–ด์ž…๋‹ˆ๋‹ค." +msgstr "๋Ÿฌ์ŠคํŠธ๋Š” C++์™€ ์œ ์‚ฌํ•œ ์ •์  ์ปดํŒŒ์ผ ์–ธ์–ด์ž…๋‹ˆ๋‹ค" #: src/welcome-day-1/what-is-rust.md:6 msgid "`rustc` uses LLVM as its backend." @@ -1999,7 +2211,7 @@ msgstr "`rustc`๋Š” LLVM์„ ๋ฐฑ์—”๋“œ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." msgid "" "Rust supports many [platforms and architectures](https://doc.rust-lang.org/" "nightly/rustc/platform-support.html):" -msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ๋‹ค์–‘ํ•œ ํ”Œ๋žซํผ๊ณผ ์•„ํ‚คํ…์ณ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." +msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ๋‹ค์–‘ํ•œ ํ”Œ๋žซํผ๊ณผ ์•„ํ‚คํ…์ณ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค:" #: src/welcome-day-1/what-is-rust.md:9 msgid "x86, ARM, WebAssembly, ..." @@ -2019,19 +2231,19 @@ msgstr "ํŽŒ์›จ์–ด์™€ ๋ถ€ํŠธ๋กœ๋”(์ž„๋ฒ ๋””๋“œ)" #: src/welcome-day-1/what-is-rust.md:13 msgid "smart displays," -msgstr "์Šค๋งˆํŠธ ๋””์Šคํ”Œ๋ ˆ์ด" +msgstr "์Šค๋งˆํŠธ ๋””์Šคํ”Œ๋ ˆ์ด," #: src/welcome-day-1/what-is-rust.md:14 msgid "mobile phones," -msgstr "์Šค๋งˆํŠธํฐ" +msgstr "์Šค๋งˆํŠธํฐ," #: src/welcome-day-1/what-is-rust.md:15 msgid "desktops," -msgstr "๋ฐ์Šคํฌํƒ‘" +msgstr "๋ฐ์Šคํฌํƒ‘," #: src/welcome-day-1/what-is-rust.md:16 msgid "servers." -msgstr "์„œ๋ฒ„" +msgstr "์„œ๋ฒ„." #: src/welcome-day-1/what-is-rust.md:21 msgid "Rust fits in the same area as C++:" @@ -2043,11 +2255,12 @@ msgstr "๋†’์€ ์œ ์—ฐ์„ฑ." #: src/welcome-day-1/what-is-rust.md:24 msgid "High level of control." -msgstr "๋†’์€ ๋ ˆ๋ฒจ ์ˆ˜์ค€์˜ ์ œ์–ด." +msgstr "๋†’์€ ์ˆ˜์ค€์˜ ์ œ์–ด." #: src/welcome-day-1/what-is-rust.md:25 -msgid "Can be scaled down to very constrained devices like mobile phones." -msgstr "ํœด๋Œ€ํฐ๊ณผ ๊ฐ™์€ ๋งค์šฐ ์ œํ•œ๋œ ์žฅ์น˜๋กœ ์Šค์ผ€์ผ ๋‹ค์šด ๊ฐ€๋Šฅ." +msgid "" +"Can be scaled down to very constrained devices such as microcontrollers." +msgstr "๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ ๊ฐ™์€ ๋งค์šฐ ์ œํ•œ๋œ ์žฅ์น˜๋กœ ์Šค์ผ€์ผ ๋‹ค์šด ๊ฐ€๋Šฅ." #: src/welcome-day-1/what-is-rust.md:26 msgid "Has no runtime or garbage collection." @@ -2066,12 +2279,17 @@ msgstr "" #: src/hello-world.md:6 msgid "" -"```rust\n" +"```rust,editable\n" "fn main() {\n" " println!(\"Hello ๐ŸŒ!\");\n" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"Hello ๐ŸŒ!\");\n" +"}\n" +"```" #: src/hello-world.md:12 msgid "What you see:" @@ -2104,21 +2322,20 @@ msgstr "" #: src/hello-world.md:22 msgid "" "This slide tries to make the students comfortable with Rust code. They will " -"see a ton of it over the next four days so we start small with something " +"see a ton of it over the next three days so we start small with something " "familiar." msgstr "" -"์ด ์Šฌ๋ผ์ด๋“œ๋Š” ํ•™์ƒ๋“ค์ด ๋Ÿฌ์ŠคํŠธ ์ฝ”๋“œ์— ์ต์ˆ™ํ•ด์ง€๊ธฐ ์œ„ํ•ด ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์•ž์œผ๋กœ 4" +"์ด ์Šฌ๋ผ์ด๋“œ๋Š” ํ•™์ƒ๋“ค์ด ๋Ÿฌ์ŠคํŠธ ์ฝ”๋“œ์— ์ต์ˆ™ํ•ด์ง€๊ธฐ ์œ„ํ•ด ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์•ž์œผ๋กœ 3" "์ผ ๋™์•ˆ ๋งŽ์€ ์ฝ”๋“œ๋ฅผ ์ ‘ํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์šฐ์„  ์นœ์ˆ™ํ•œ ์ฝ”๋“œ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค." #: src/hello-world.md:27 msgid "" "Rust is very much like other languages in the C/C++/Java tradition. It is " -"imperative (not functional) and it doesn't try to reinvent things unless " -"absolutely necessary." +"imperative and it doesn't try to reinvent things unless absolutely necessary." msgstr "" "๋Ÿฌ์ŠคํŠธ๋Š” C/C++/Java์™€ ๊ฐ™์€ ์ „ํ†ต์ ์ธ ๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ๋Š” ์ ˆ" -"์ฐจ์ (ํ•จ์ˆ˜ํ˜• ์•„๋‹˜) ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ์ •๋ง๋กœ ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด, ๋Ÿฌ์ŠคํŠธ๋Š” ์ด๋ฏธ ์กด" -"์žฌํ•˜๋Š” ๊ฒƒ์„ ์ƒˆ๋กœ ๊ตฌํ˜„ํ•˜๋ ค๊ณ  ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +"์ฐจ์  ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ์ •๋ง๋กœ ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด, ๋Ÿฌ์ŠคํŠธ๋Š” ์ด๋ฏธ ์กด์žฌํ•˜๋Š” ๊ฒƒ์„ " +"์ƒˆ๋กœ ๊ตฌํ˜„ํ•˜๋ ค๊ณ  ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." #: src/hello-world.md:31 msgid "Rust is modern with full support for things like Unicode." @@ -2136,13 +2353,26 @@ msgstr "" msgid "" "Macros being 'hygienic' means they don't accidentally capture identifiers " "from the scope they are used in. Rust macros are actually only [partially " -"hygenic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html)." +"hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene." +"html)." msgstr "" "๋˜‘๋˜‘ํ•œ ๋งคํฌ๋กœ(hygienic macro)๋Š” ๋งคํฌ๋กœ๊ฐ€ ์‚ฌ์šฉ๋˜๋Š” ์Šค์ฝ”ํ”„์—์„œ ์˜๋„์น˜ ์•Š๊ฒŒ ๋ณ€์ˆ˜" "๋ฅผ ๊ฐ€๋กœ์ฑ„์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์‹ค ๋Ÿฌ์ŠคํŠธ ๋งคํฌ๋กœ๋Š” ์™„์ „ํžˆ hygenicํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. [๋ง" "ํฌ](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html)๋ฅผ ์ฐธ" "๊ณ ํ•˜์„ธ์š”." +#: src/hello-world.md:40 +msgid "" +"Rust is multi-paradigm. For example, it has powerful [object-oriented " +"programming features](https://doc.rust-lang.org/book/ch17-00-oop.html), and, " +"while it is not a functional language, it includes a range of [functional " +"concepts](https://doc.rust-lang.org/book/ch13-00-functional-features.html)." +msgstr "" +"๋Ÿฌ์ŠคํŠธ๋Š” ๋ฉ€ํ‹ฐ ํŒจ๋Ÿฌ๋‹ค์ž„ ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ๊ฐ•๋ ฅํ•œ [๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ธฐ" +"๋Šฅ](https://doc.rust-lang.org/book/ch17-00-oop.html)์„ ์ง€์›ํ•˜๊ธฐ๋„ ํ•˜๋ฉฐ, ํ•จ์ˆ˜" +"ํ˜• ์–ธ์–ด๋กœ ๋ถ„๋ฅ˜๋˜์ง€๋Š” ์•Š์ง€๋งŒ ํญ๋„“์€ ๋ฒ”์œ„์˜ [ํ•จ์ˆ˜ํ˜• ์ปจ์…‰](https://doc.rust-" +"lang.org/book/ch13-00-functional-features.html)์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." + #: src/hello-world/small-example.md:3 msgid "Here is a small example program in Rust:" msgstr "๋Ÿฌ์ŠคํŠธ๋กœ ์ž‘์„ฑ๋œ ์ž‘์€ ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค:" @@ -2231,6 +2461,14 @@ msgstr "" "๋งทํŒ… ์–ธ์–ด์˜ ๋ฌธ๋ฒ•์„ ์•Œ๊ธฐ ์œ„ํ•ด `std::fmt`๋ฅผ ๊ฒ€์ƒ‰ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ๊ฐ€๋ฅด์น˜์„ธ์š”.ํ•™" "์ƒ๋“ค์ด ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์— ์ต์ˆ™ํ•ด ์ง€๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค." +#: src/hello-world/small-example.md:44 +msgid "" +"In a shell `rustup doc std::fmt` will open a browser on the local std::fmt " +"documentation" +msgstr "" +"์‰˜์—์„œ `rustup doc std::fmt`๋ฅผ ์ˆ˜ํ–‰ํ•˜๋ฉด ๋กœ์ปฌ ๋ธŒ๋ผ์šฐ์ €๋กœ `std:fmt`์— ๋Œ€ํ•œ ๋ฌธ" +"์„œ๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค" + #: src/why-rust.md:3 msgid "Some unique selling points of Rust:" msgstr "๋Ÿฌ์ŠคํŠธ๋งŒ์˜ ๋…ํŠนํ•œ ์„ธ์ผ์ฆˆ ํฌ์ธํŠธ(์žฅ์ ):" @@ -2323,13 +2561,13 @@ msgstr "" #: src/why-rust/compile-time.md:19 msgid "" -"You can for use [`Box::leak`](https://doc.rust-lang.org/std/boxed/struct.Box." +"You can use [`Box::leak`](https://doc.rust-lang.org/std/boxed/struct.Box." "html#method.leak) to leak a pointer. A use of this could be to get runtime-" "initialized and runtime-sized static variables" msgstr "" "[`Box::leak`](https://doc.rust-lang.org/std/boxed/struct.Box.html#method." "leak)์„ ์ด์šฉํ•˜์—ฌ ํฌ์ธํ„ฐ๋ฅผ ์˜๋„์ ์œผ๋กœ ๋ˆ„์ถœ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•ด์„œ ๋Ÿฐํƒ€" -"์ž„์ด ์ƒ์„ฑํ•˜๊ณ  ๋Ÿฐํƒ€์ž„์ด ํฌ๊ธฐ๋ฅผ ์ •ํ•œ ์ •์  ๋ณ€์ˆ˜๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"์ž„์ด ์ƒ์„ฑํ•˜๊ณ  ๋Ÿฐํƒ€์ž„์ด ํฌ๊ธฐ๋ฅผ ์ •ํ•œ ์ •์  ๋ณ€์ˆ˜๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค" #: src/why-rust/compile-time.md:21 msgid "" @@ -2371,25 +2609,29 @@ msgstr "๋Ÿฐํƒ€์ž„ ์‹œ ์ •์˜๋˜์ง€ ์•Š์Œ(undefined) ๋™์ž‘ ์—†์Œ:" #: src/why-rust/runtime.md:5 msgid "Array access is bounds checked." -msgstr "๋ฐฐ์—ด ์ ‘๊ทผ์‹œ ๊ฒฝ๊ณ„ ์ฒดํฌ" +msgstr "๋ฐฐ์—ด ์ ‘๊ทผ์‹œ ๊ฒฝ๊ณ„ ์ฒดํฌ." #: src/why-rust/runtime.md:6 -msgid "Integer overflow is defined." +msgid "Integer overflow is defined (panic or wrap-around)." msgstr "์ •์ˆ˜ํ˜• ํƒ€์ž…์˜ ๋ณ€์ˆ˜์—์„œ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋ฐœ์ƒ์‹œ ๋™์ž‘์ด ์ž˜ ์ •์˜๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค." #: src/why-rust/runtime.md:12 msgid "" -"Integer overflow is defined via a compile-time flag. The options are either " -"a panic (a controlled crash of the program) or wrap-around semantics. By " -"default, you get panics in debug mode (`cargo build`) and wrap-around in " -"release mode (`cargo build --release`)." +"Integer overflow is defined via the [`overflow-checks`](https://doc.rust-" +"lang.org/rustc/codegen-options/index.html#overflow-checks) compile-time " +"flag. If enabled, the program will panic (a controlled crash of the " +"program), otherwise you get wrap-around semantics. By default, you get " +"panics in debug mode (`cargo build`) and wrap-around in release mode (`cargo " +"build --release`)." msgstr "" -"์ •์ˆ˜ํ˜• ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋Š” ์ปดํŒŒ์ผ ํƒ€์ž„ ํ”Œ๋ ˆ๊ทธ๋ฅผ ํ†ตํ•ด ์ •์˜๋ฉ๋‹ˆ๋‹ค. ์˜ต์…˜์€ ํŒจ๋‹‰(ํ”„๋กœ๊ทธ" -"๋žจ ํฌ๋ ˆ์‹œ) ํ˜น์€ ์˜ฌ๋ฆผ(wrap-around)์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ๋””๋ฒ„๊ทธ ๋ชจ๋“œ(`cargo " -"build`)์—์„œ๋Š” ํŒจ๋‹‰์ด, ๋ฆด๋ฆฌ์ฆˆ ๋ชจ๋“œ(`cargo build --release`)์—์„œ๋Š” wrap-around" -"๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค." +"์ •์ˆ˜ํ˜• ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋Š” [`overflow-checks`](https://doc.rust-lang.org/rustc/" +"codegen-options/index.html#overflow-checks) ์ปดํŒŒ์ผ ํƒ€์ž„ ํ”Œ๋ž˜๊ทธ๋ฅผ ํ†ตํ•ด ์ •์˜๋ฉ" +"๋‹ˆ๋‹ค. ์ด ํ”Œ๋ž˜๊ทธ๊ฐ€ ์ผœ์ง€๋ฉด, ํ”„๋กœ๊ทธ๋žจ์€ ์ •์ˆ˜ํ˜• ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋ฐœ์ƒ์‹œ panic (ํ”„๋กœ๊ทธ๋žจ" +"์„ ํฌ๋ž˜์‹œ ์‹œํ‚ค๋Š” ์ž˜ ์ •์˜๋œ ๋ฐฉ๋ฒ•) ํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”Œ๋ž˜๊ทธ๊ฐ€ ๊บผ์ง€๋ฉด, ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋Š” " +"wrap-around ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ๋””๋ฒ„๊ทธ ๋ชจ๋“œ(`cargo build`)์—์„œ๋Š” ํŒจ๋‹‰์ด, ๋ฆด" +"๋ฆฌ์ฆˆ ๋ชจ๋“œ(`cargo build --release`)์—์„œ๋Š” wrap-around๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค." -#: src/why-rust/runtime.md:17 +#: src/why-rust/runtime.md:18 msgid "" "Bounds checking cannot be disabled with a compiler flag. It can also not be " "disabled directly with the `unsafe` keyword. However, `unsafe` allows you to " @@ -2401,37 +2643,29 @@ msgstr "" "๊ฐ™์€ ํ•จ์ˆ˜๋Š” ๊ฒฝ๊ณ„ ๊ฒ€์‚ฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." #: src/why-rust/modern.md:3 -msgid "Rust is built with all the experience gained in the last 40 years." +msgid "Rust is built with all the experience gained in the last decades." msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ์ง€๋‚œ 40๋…„๊ฐ„์˜ ๋ชจ๋“  (ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด๋“ค์˜) ๊ฒฝํ—˜์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค." +"๋Ÿฌ์ŠคํŠธ๋Š” ์ง€๋‚œ ์ˆ˜์‹ญ๋…„๊ฐ„์˜ ๋ชจ๋“  (ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด๋“ค์˜) ๊ฒฝํ—˜์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค." #: src/why-rust/modern.md:5 msgid "Language Features" msgstr "์–ธ์–ด์  ํŠน์ง•" #: src/why-rust/modern.md:7 -#, fuzzy msgid "Enums and pattern matching." msgstr "์—ด๊ฑฐํ˜•๊ณผ ํŒจํ„ด ๋งค์นญ." #: src/why-rust/modern.md:8 -#, fuzzy msgid "Generics." msgstr "์ œ๋„ค๋ฆญ." #: src/why-rust/modern.md:9 -#, fuzzy msgid "No overhead FFI." msgstr "FFI ๋Ÿฐํƒ€์ž„ ์˜ค๋ฒ„ํ—ค๋“œ ์—†์Œ." #: src/why-rust/modern.md:10 -#, fuzzy msgid "Zero-cost abstractions." -msgstr "" -"_์—ญ์ฃผ: FFI: Foreign Function Interface. ํƒ€ ์–ธ์–ด ์ฝ”๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด" -"์Šค_\n" -"\n" -"์ œ๋กœ ์ฝ”์ŠคํŠธ ์ถ”์ƒํ™”." +msgstr "๋น„์šฉ์ด ๋“ค์ง€ ์•Š๋Š” ์ถ”์ƒํ™”." #: src/why-rust/modern.md:12 msgid "Tooling" @@ -2574,12 +2808,13 @@ msgid "Variable assignment is done with `=`, comparison is done with `==`." msgstr "๋ณ€์ˆ˜ ํ• ๋‹น์€ `=`, ๋น„๊ต๋Š” `==`๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." #: src/basic-syntax/scalar-types.md:3 src/basic-syntax/compound-types.md:3 +#: src/exercises/day-3/safe-ffi-wrapper.md:16 msgid "Types" msgstr "ํƒ€์ž…" #: src/basic-syntax/scalar-types.md:3 src/basic-syntax/compound-types.md:3 msgid "Literals" -msgstr "์Šค์นผ๋ผ ๋ฆฌํ„ฐ๋Ÿด ๊ฐ’" +msgstr "๋ฆฌํ„ฐ๋Ÿด ๊ฐ’" #: src/basic-syntax/scalar-types.md:5 msgid "Signed integers" @@ -2590,8 +2825,8 @@ msgid "`i8`, `i16`, `i32`, `i64`, `i128`, `isize`" msgstr "`i8`, `i16`, `i32`, `i64`, `i128`, `isize`" #: src/basic-syntax/scalar-types.md:5 -msgid "`-10`, `0`, `1_000`, `123i64`" -msgstr "`-10`, `0`, `1_000`, `123i64`" +msgid "`-10`, `0`, `1_000`, `123_i64`" +msgstr "`-10`, `0`, `1_000`, `123_i64`" #: src/basic-syntax/scalar-types.md:6 msgid "Unsigned integers" @@ -2602,8 +2837,8 @@ msgid "`u8`, `u16`, `u32`, `u64`, `u128`, `usize`" msgstr "`u8`, `u16`, `u32`, `u64`, `u128`, `usize`" #: src/basic-syntax/scalar-types.md:6 -msgid "`0`, `123`, `10u16`" -msgstr "`0`, `123`, `10u16`" +msgid "`0`, `123`, `10_u16`" +msgstr "`0`, `123`, `10_u16`" #: src/basic-syntax/scalar-types.md:7 msgid "Floating point numbers" @@ -2614,8 +2849,8 @@ msgid "`f32`, `f64`" msgstr "`f32`, `f64`" #: src/basic-syntax/scalar-types.md:7 -msgid "`3.14`, `-10.0e20`, `2f32`" -msgstr "`3.14`, `-10.0e20`, `2f32`" +msgid "`3.14`, `-10.0e20`, `2_f32`" +msgstr "`3.14`, `-10.0e20`, `2_f32`" #: src/basic-syntax/scalar-types.md:8 msgid "Strings" @@ -2626,8 +2861,8 @@ msgid "`&str`" msgstr "`&str`" #: src/basic-syntax/scalar-types.md:8 -msgid "`\"foo\"`, `r#\"\\\\\"#`" -msgstr "`\"foo\"`, `r#\"\\\\\"#`" +msgid "`\"foo\"`, `\"two\\nlines\"`" +msgstr "`\"foo\"`, `\"two\\nlines\"`" #: src/basic-syntax/scalar-types.md:9 msgid "Unicode scalar values" @@ -2642,59 +2877,96 @@ msgid "`'a'`, `'ฮฑ'`, `'โˆž'`" msgstr "`'a'`, `'ฮฑ'`, `'โˆž'`" #: src/basic-syntax/scalar-types.md:10 -msgid "Byte strings" -msgstr "๋ฐ”์ดํŠธ ๋ฌธ์ž" - -#: src/basic-syntax/scalar-types.md:10 -msgid "`&[u8]`" -msgstr "`&[u8]`" - -#: src/basic-syntax/scalar-types.md:10 -msgid "`b\"abc\"`, `br#\" \" \"#`" -msgstr "`b\"abc\"`, `br#\" \" \"#`" - -#: src/basic-syntax/scalar-types.md:11 msgid "Booleans" msgstr "๋ถˆ๋ฆฌ์–ธ" -#: src/basic-syntax/scalar-types.md:11 +#: src/basic-syntax/scalar-types.md:10 msgid "`bool`" msgstr "`bool`" -#: src/basic-syntax/scalar-types.md:11 +#: src/basic-syntax/scalar-types.md:10 msgid "`true`, `false`" msgstr "`true`, `false`" -#: src/basic-syntax/scalar-types.md:13 +#: src/basic-syntax/scalar-types.md:12 msgid "The types have widths as follows:" msgstr "๊ฐ ํƒ€์ž…์˜ ํฌ๊ธฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" -#: src/basic-syntax/scalar-types.md:15 -#, fuzzy +#: src/basic-syntax/scalar-types.md:14 msgid "`iN`, `uN`, and `fN` are _N_ bits wide," -msgstr "" -"์ •์ˆ˜(`i`) ๋ฐ ๋ถ€๋™์†Œ์ˆ˜ํ˜•(`f`)์€ ๋’ค์˜ ์ˆซ์ž์™€ ๊ฐ™์€ ๋น„ํŠธ ์ˆ˜ ์ž…๋‹ˆ๋‹ค. (`i8` = 8๋น„" -"ํŠธ)" +msgstr "`iN`, `uN`, `fN`์€ ๋ชจ๋‘ _N_๋น„ํŠธ ์ž…๋‹ˆ๋‹ค." + +#: src/basic-syntax/scalar-types.md:15 +msgid "`isize` and `usize` are the width of a pointer," +msgstr "`isize` ์™€ `usize` ๋Š” ํฌ์ธํ„ฐ์™€ ๊ฐ™์€ ํฌ๊ธฐ์ž…๋‹ˆ๋‹ค," #: src/basic-syntax/scalar-types.md:16 -#, fuzzy -msgid "`isize` and `usize` are the width of a pointer," -msgstr "`isize` ์™€ `usize` ๋Š” ํฌ์ธํ„ฐ์™€ ๊ฐ™์€ ํฌ๊ธฐ์ž…๋‹ˆ๋‹ค." +msgid "`char` is 32 bits wide," +msgstr "`char` 32 ๋น„ํŠธ ์ž…๋‹ˆ๋‹ค," #: src/basic-syntax/scalar-types.md:17 -#, fuzzy -msgid "`char` is 32 bit wide," -msgstr "" -"_์—ญ์ฃผ: 32 ๋น„ํŠธ ์‹œ์Šคํ…œ์—์„œ๋Š” 32 ๋น„ํŠธ, 64 ๋น„ํŠธ ์‹œ์Šคํ…œ์—์„œ๋Š” 64 ๋น„ํŠธ. C์˜ `int`" -"์™€ ๊ฐ™์Œ._" +msgid "`bool` is 8 bits wide." +msgstr "`bool`์€ 8 ๋น„ํŠธ ์ž…๋‹ˆ๋‹ค." -#: src/basic-syntax/scalar-types.md:18 -#, fuzzy -msgid "`bool` is 8 bit wide." +#: src/basic-syntax/scalar-types.md:21 +msgid "There are a few syntaxes which are not shown above:" +msgstr "์œ„์— ํ‘œ์‹œ๋˜์ง€ ์•Š์€ ๋ช‡ ๊ฐ€์ง€ ๋ฌธ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/basic-syntax/scalar-types.md:23 +msgid "" +"Raw strings allow you to create a `&str` value with escapes disabled: " +"`r\"\\n\" == \"\\\\n\"`. You can embed double-quotes by using an equal " +"amount of `#` on either side of the quotes:" msgstr "" -"`char` 32 ๋น„ํŠธ ์ž…๋‹ˆ๋‹ค.\n" -"\n" -"`bool`์€ 8 ๋น„ํŠธ ์ž…๋‹ˆ๋‹ค." +"Raw strings allow you to create a `&str` value with escapes disabled: " +"`r\"\\n\" == \"\\\\n\"`. You can embed double-quotes by using an equal " +"amount of `#` on either side of the quotes:" + +#: src/basic-syntax/scalar-types.md:27 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" println!(r#\"link\"#);\n" +" println!(\"link\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"fn main() {\n" +" println!(r#\"link\"#);\n" +" println!(\"link\");\n" +"}\n" +"```" + +#: src/basic-syntax/scalar-types.md:34 +msgid "Byte strings allow you to create a `&[u8]` value directly:" +msgstr "Byte strings allow you to create a `&[u8]` value directly:" + +#: src/basic-syntax/scalar-types.md:36 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"{:?}\", b\"abc\");\n" +" println!(\"{:?}\", &[97, 98, 99]);\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"{:?}\", b\"abc\");\n" +" println!(\"{:?}\", &[97, 98, 99]);\n" +"}\n" +"```" + +#: src/basic-syntax/scalar-types.md:43 +msgid "" +"All underscores in numbers can be left out, they are for legibility only. So " +"`1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written " +"as `123i64`." +msgstr "" +"All underscores in numbers can be left out, they are for legibility only. So " +"`1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written " +"as `123i64`." #: src/basic-syntax/compound-types.md:5 msgid "Arrays" @@ -2770,10 +3042,10 @@ msgstr "๋ฐฐ์—ด:" #: src/basic-syntax/compound-types.md:34 msgid "" -"Arrays have elements of the same type, `T`, and length, `N`, which is a " -"compile-time constant. Note that the length of the array is _part of its " -"type_, which means that `[u8; 3]` and `[u8; 4]` are considered two different " -"types." +"A value of the array type `[T; N]` holds `N` (a compile-time constant) " +"elements of the same type `T`. Note that the length of the array is _part of " +"its type_, which means that `[u8; 3]` and `[u8; 4]` are considered two " +"different types." msgstr "" "๋ฐฐ์—ด์€, ๊ฐ™์€ ํƒ€์ž… `T`์˜ ๊ฐ’์ด `N`๊ฐœ ์žˆ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ `N`์€ ์ปดํŒŒ์ผ ํƒ€์ž„์— " "๊ฒฐ์ •๋œ ๊ฐ’์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ธธ์ด๋„ ํƒ€์ž…์˜ ์ผ๋ถ€์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, `[u8; 3]`์™€ " @@ -2828,7 +3100,7 @@ msgid "" msgstr "" "๋น„์–ด์žˆ๋Š” ํŠœํ”Œ`()`์€ ๋‹จ์œ„ ํƒ€์ž…(unit type)์ด๋ผ๊ณ ๋„ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ํƒ€์ž…์ด๋ฉด์„œ ํ•ด" "๋‹น ํƒ€์ž…์˜ ์œ ์ผํ•˜๋ฉฐ ์œ ํšจํ•œ ๊ฐ’์ž…๋‹ˆ๋‹ค. ์ฆ‰ ํƒ€์ž…๊ณผ ๊ฐ’์ด ๋ชจ๋‘ `()`์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค" -"์–ด ํ•จ์ˆ˜๋‚˜ ์‹์—์„œ ๋ฐ˜ํ™˜ ๊ฐ’์ด ์—†์Œ์„ ๋‚˜ํƒ€๋‚ผ ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." +"์–ด ํ•จ์ˆ˜๋‚˜ ์‹์—์„œ ๋ฐ˜ํ™˜ ๊ฐ’์ด ์—†์Œ์„ ๋‚˜ํƒ€๋‚ผ ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. " #: src/basic-syntax/compound-types.md:59 msgid "" @@ -2887,7 +3159,7 @@ msgid "" msgstr "" "`mut`๋กœ ์„ ์–ธ๋œ ์ฐธ์กฐ๋Š” ๊ทธ ๋ณ€์ˆ˜๊ฐ€ ์‚ด์•„์žˆ๋Š” ๋™์•ˆ ๋‹ค๋ฅธ ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/basic-syntax/references.md:24 +#: src/basic-syntax/references.md:25 msgid "" "Be sure to note the difference between `let mut ref_x: &i32` and `let ref_x: " "&mut i32`. The first one represents a mutable reference which can be bound " @@ -2951,10 +3223,11 @@ msgstr "์Šฌ๋ผ์ด์Šค๋Š” ํฐ ์ปฌ๋ž™์…˜์˜ ์ผ๋ถ€(ํ˜น์€ ์ „์ฒด)๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” msgid "" "```rust,editable\n" "fn main() {\n" -" let a: [i32; 6] = [10, 20, 30, 40, 50, 60];\n" +" let mut a: [i32; 6] = [10, 20, 30, 40, 50, 60];\n" " println!(\"a: {a:?}\");\n" "\n" " let s: &[i32] = &a[2..4];\n" +"\n" " println!(\"s: {s:?}\");\n" "}\n" "```" @@ -2969,15 +3242,15 @@ msgstr "" "}\n" "```" -#: src/basic-syntax/slices.md:15 +#: src/basic-syntax/slices.md:16 msgid "Slices borrow data from the sliced type." msgstr "์Šฌ๋ผ์ด์Šค๋Š” ๋‹ค๋ฅธ(์Šฌ๋ผ์ด์Šค ๋œ) ํƒ€์ž…์œผ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ '๋นŒ๋ ค'์˜ต๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:16 -msgid "Question: What happens if you modify `a[3]`?" -msgstr "์งˆ๋ฌธ: `a[3]`์„ ์ˆ˜์ •ํ•˜๋ฉด ๋ฌด์Šจ ์ผ์ด ์žˆ์–ด๋‚ ๊นŒ์š”?" +#: src/basic-syntax/slices.md:17 +msgid "Question: What happens if you modify `a[3]` right before printing `s`?" +msgstr "์งˆ๋ฌธ: `s`๋ฅผ ์ถœ๋ ฅํ•˜๊ธฐ ์ „์— `a[3]`์„ ์ˆ˜์ •ํ•˜๋ฉด ๋ฌด์Šจ ์ผ์ด ์žˆ์–ด๋‚ ๊นŒ์š”?" -#: src/basic-syntax/slices.md:20 +#: src/basic-syntax/slices.md:21 msgid "" "We create a slice by borrowing `a` and specifying the starting and ending " "indexes in brackets." @@ -2985,7 +3258,7 @@ msgstr "" "์Šฌ๋ผ์ด์Šค๋Š” ์šฐ์„  `a`๋ฅผ ๋นŒ๋ฆฐ๋‹ค์Œ, ์‹œ์ž‘๊ณผ ๋ ์ธ๋ฑ์Šค๋ฅผ ๋ธŒ๋ž˜ํ‚ท(`[]`)์•ˆ์— ์ง€์ •ํ•ด์„œ " "๋งŒ๋“ญ๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:22 +#: src/basic-syntax/slices.md:23 msgid "" "If the slice starts at index 0, Rustโ€™s range syntax allows us to drop the " "starting index, meaning that `&a[0..a.len()]` and `&a[..a.len()]` are " @@ -2994,7 +3267,7 @@ msgstr "" "์Šฌ๋ผ์ด์Šค๊ฐ€ ์ธ๋ฑ์Šค 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•œ๋‹ค๋ฉด ์‹œ์ž‘ ์ธ๋ฑ์Šค๋Š” ์ƒ๋žต ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰ `&a[0.." "a.len()]`์™€ `&a[..a.len()]` ๋Š” ๋™์ผํ•ฉ๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:24 +#: src/basic-syntax/slices.md:25 msgid "" "The same is true for the last index, so `&a[2..a.len()]` and `&a[2..]` are " "identical." @@ -3002,12 +3275,12 @@ msgstr "" "๋งˆ์ง€๋ง‰ ์ธ๋ฑ์Šค๋„ ์ƒ๋žต ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ `&a[2..a.len()]` ์™€ `&a[2..]`๋Š” ๋™์ผ" "ํ•ฉ๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:26 +#: src/basic-syntax/slices.md:27 msgid "" "To easily create a slice of the full array, we can therefore use `&a[..]`." msgstr "๋”ฐ๋ผ์„œ ์ „์ฒด ๋ฐฐ์—ด์— ๋Œ€ํ•œ ์Šฌ๋ผ์ด์Šค๋Š” `&a[..]`๊ฐ€ ๋ฉ๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:28 +#: src/basic-syntax/slices.md:29 msgid "" "`s` is a reference to a slice of `i32`s. Notice that the type of `s` " "(`&[i32]`) no longer mentions the array length. This allows us to perform " @@ -3017,25 +3290,28 @@ msgstr "" "๋ฐฐ์—ด์˜ ํฌ๊ธฐ๊ฐ€ ๋น ์ ธ์žˆ์Œ์— ์ฃผ๋ชฉํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ์ฆ‰, ์Šฌ๋ผ์ด์Šค๋ฅผ ์ด์šฉํ•˜๋ฉด ๋‹ค์–‘ํ•œ " "๊ธธ์ด์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/basic-syntax/slices.md:30 +#: src/basic-syntax/slices.md:31 msgid "" "Slices always borrow from another object. In this example, `a` has to remain " "'alive' (in scope) for at least as long as our slice. " msgstr "" "์Šฌ๋ผ์ด์Šค๋Š” ํ•ญ์ƒ ๋‹ค๋ฅธ ๊ฐ์ฒด๋กœ๋ถ€ํ„ฐ '๋นŒ๋ ค' ์˜ต๋‹ˆ๋‹ค. ์ด ์˜ˆ์‹œ์—์„œ ๊ฐ์ฒด `a`๋Š” ์Šฌ๋ผ์ด" -"์Šค `s`๋ณด๋‹ค ๋” ์˜ค๋ž˜ ์‚ด์•„ ์žˆ์–ด์•ผ๋งŒ ํ•ฉ๋‹ˆ๋‹ค." +"์Šค `s`๋ณด๋‹ค ๋” ์˜ค๋ž˜ ์‚ด์•„ ์žˆ์–ด์•ผ๋งŒ ํ•ฉ๋‹ˆ๋‹ค. " -#: src/basic-syntax/slices.md:32 +#: src/basic-syntax/slices.md:33 msgid "" "The question about modifying `a[3]` can spark an interesting discussion, but " -"the answer is that for memory safety reasons you cannot do it through `a` " -"after you created a slice, but you can read the data from both `a` and `s` " -"safely. More details will be explained in the borrow checker section." +"the answer is that for memory safety reasons you cannot do it through `a` at " +"this point in the execution, but you can read the data from both `a` and `s` " +"safely. It works before you created the slice, and again after the " +"`println`, when the slice is no longer used. More details will be explained " +"in the borrow checker section." msgstr "" "`a[3]`์˜ ๊ฐ’์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋ƒ๋Š” ์งˆ๋ฌธ์€ ์ข‹์€ ์งˆ๋ฌธ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์— ๋Œ€ํ•œ ๋‹ต์€ `a`์™€ " "`s`๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์„ ์ˆ˜๋Š” ์žˆ์ง€๋งŒ ์ˆ˜์ •ํ•  ์ˆ˜๋Š” ์—†์œผ๋ฉฐ, ์ด๋Š” ๋ฉ”๋ชจ๋ฆฌ ์•ˆ์ „์„ " -"์œ„ํ•ด์„œ๋ผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์™œ ๊ทธ๋Ÿฐ์ง€์— ๋Œ€ํ•œ ์ข€๋” ๊ตฌ์ฒด์ ์ธ ๋‹ต์€ ๋นŒ๋ฆผ ๊ฒ€์‚ฌ ๋ถ€๋ถ„์—์„œ " -"์ž์„ธํžˆ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค." +"์œ„ํ•ด์„œ๋ผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์Šฌ๋ผ์ด์Šค๊ฐ€ ์‚ฌ์šฉ๋˜์ง€ ์•Š์„ ๋•Œ, ์ฆ‰ ์Šฌ๋ผ์ด์Šค๋ฅผ ๋งŒ๋“ค" +"๊ธฐ ์ „์ด๋‚˜, ํ˜น์€ `println`์ดํ›„์—๋Š” `a[3]`์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์™œ ๊ทธ๋Ÿฐ์ง€์— ๋Œ€" +"ํ•œ ์ข€๋” ๊ตฌ์ฒด์ ์ธ ๋‹ต์€ ๋นŒ๋ฆผ ๊ฒ€์‚ฌ ๋ถ€๋ถ„์—์„œ ์ž์„ธํžˆ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค." #: src/basic-syntax/string-slices.md:1 msgid "`String` vs `str`" @@ -3095,9 +3371,9 @@ msgid "" "encoded string data stored in a block of memory. String literals " "(`โ€Helloโ€`), are stored in the programโ€™s binary." msgstr "" -"`&str`์€ ๋ฌธ์ž์—ด ์Šฌ๋ผ์ด์Šค์˜ ๋ถˆ๋ณ€ ์ฐธ์กฐ์ž…๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ์—์„œ ๋ฌธ์ž์—ด์€ UTF-8๋กœ ์ธ์ฝ”" -"๋”ฉ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ๋ฆฌํ„ฐ๋Ÿด(`\"Hello\"`)์€ ํ”„๋กœ๊ทธ๋žจ ๋ฐ”์ด๋„ˆ๋ฆฌ์— ์ €" -"์žฅ๋ฉ๋‹ˆ๋‹ค." +"`&str`์€ ๋ฌธ์ž์—ด ์Šฌ๋ผ์ด์Šค์ž…๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ์Šฌ๋ผ์ด์Šค๋Š” UTF-8๋กœ ์ธ์ฝ”๋”ฉ๋œ ๋ฌธ์ž์—ด ๋ฐ" +"์ดํ„ฐ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ๋ฆฌํ„ฐ๋Ÿด(`\"Hello\"`)์€ ํ”„๋กœ๊ทธ๋žจ ๋ฐ”์ด๋„ˆ๋ฆฌ์— ์ €์žฅ๋ฉ๋‹ˆ" +"๋‹ค." #: src/basic-syntax/string-slices.md:30 msgid "" @@ -3145,7 +3421,7 @@ msgstr "" "ํšจํ•œ ๋ฌธ์ž์—ด์„ ๊ฐ€๋ฆฌํ‚จ๋‹ค๋Š” ์ ์ด ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ์˜ `String`์€ C++์˜ `std::" "string` ๊ณผ ๋Œ€๋žต ๊ฑฐ์˜ ๋™์ผํ•ฉ๋‹ˆ๋‹ค. (์ฃผ์š” ์ฐจ์ด์ : ๋Ÿฌ์ŠคํŠธ์˜ `String`์€ UTF-8 ์ธ์ฝ”" "๋”ฉ ๋ฐ”์ดํŠธ๋งŒ ํฌํ•จํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์ž‘์€ ๋ฌธ์ž์—ด ์ตœ์ ํ™”(small-string optimization)๋Š” " -"์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +"๊ตฌํ˜„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." #: src/basic-syntax/functions.md:3 msgid "" @@ -3158,59 +3434,56 @@ msgstr "" msgid "" "```rust,editable\n" "fn main() {\n" -" fizzbuzz_to(20); // Defined below, no forward declaration needed\n" +" print_fizzbuzz_to(20);\n" "}\n" "\n" -"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" -" if rhs == 0 {\n" -" return false; // Corner case, early return\n" +"fn is_divisible(n: u32, divisor: u32) -> bool {\n" +" if divisor == 0 {\n" +" return false;\n" " }\n" -" lhs % rhs == 0 // The last expression in a block is the return " -"value\n" +" n % divisor == 0\n" "}\n" "\n" -"fn fizzbuzz(n: u32) -> () { // No return value means returning the unit " -"type `()`\n" -" match (is_divisible_by(n, 3), is_divisible_by(n, 5)) {\n" -" (true, true) => println!(\"fizzbuzz\"),\n" -" (true, false) => println!(\"fizz\"),\n" -" (false, true) => println!(\"buzz\"),\n" -" (false, false) => println!(\"{n}\"),\n" +"fn fizzbuzz(n: u32) -> String {\n" +" let fizz = if is_divisible(n, 3) { \"fizz\" } else { \"\" };\n" +" let buzz = if is_divisible(n, 5) { \"buzz\" } else { \"\" };\n" +" if fizz.is_empty() && buzz.is_empty() {\n" +" return format!(\"{n}\");\n" " }\n" +" format!(\"{fizz}{buzz}\")\n" "}\n" "\n" -"fn fizzbuzz_to(n: u32) { // `-> ()` is normally omitted\n" +"fn print_fizzbuzz_to(n: u32) {\n" " for i in 1..=n {\n" -" fizzbuzz(i);\n" +" println!(\"{}\", fizzbuzz(i));\n" " }\n" "}\n" "```" msgstr "" "```rust,editable\n" "fn main() {\n" -" fizzbuzz_to(20); // C/C++ ์™€ ๋‹ฌ๋ฆฌ ํ˜ธ์ถœ๋ถ€ ํ•˜๋‹จ์— ์ •์˜ํ•ด๋„ ๋ฌธ์ œ ์—†์Šต๋‹ˆ" -"๋‹ค.\n" +" print_fizzbuzz_to(20);\n" "}\n" "\n" -"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" -" if rhs == 0 {\n" -" return false; // Corner case์ด๋ฏ€๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.\n" +"fn is_divisible(n: u32, divisor: u32) -> bool {\n" +" if divisor == 0 {\n" +" return false;\n" " }\n" -" lhs % rhs == 0 // ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์€ ๋ฐ˜ํ™˜ ๊ฐ’์ž…๋‹ˆ๋‹ค.(;์—†์Œ์— ์ฃผ๋ชฉ)\n" +" n % divisor == 0\n" "}\n" "\n" -"fn fizzbuzz(n: u32) -> () { // `()`๋Š” ๋ฐ˜ํ™˜๊ฐ’์ด ์—†๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.\n" -" match (is_divisible_by(n, 3), is_divisible_by(n, 5)) {\n" -" (true, true) => println!(\"fizzbuzz\"),\n" -" (true, false) => println!(\"fizz\"),\n" -" (false, true) => println!(\"buzz\"),\n" -" (false, false) => println!(\"{n}\"),\n" +"fn fizzbuzz(n: u32) -> String {\n" +" let fizz = if is_divisible(n, 3) { \"fizz\" } else { \"\" };\n" +" let buzz = if is_divisible(n, 5) { \"buzz\" } else { \"\" };\n" +" if fizz.is_empty() && buzz.is_empty() {\n" +" return format!(\"{n}\");\n" " }\n" +" format!(\"{fizz}{buzz}\")\n" "}\n" "\n" -"fn fizzbuzz_to(n: u32) { // `-> ()` ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค.\n" +"fn print_fizzbuzz_to(n: u32) {\n" " for i in 1..=n {\n" -" fizzbuzz(i);\n" +" println!(\"{}\", fizzbuzz(i));\n" " }\n" "}\n" "```" @@ -3220,8 +3493,8 @@ msgid "" "We refer in `main` to a function written below. Neither forward declarations " "nor headers are necessary. " msgstr "" -"`main` ํ•จ์ˆ˜์—์„œ ๊ทธ ๋‹ค์Œ์— ์˜ค๋Š” ํ•จ์ˆ˜๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒ๋‹จ์— ์„ ์–ธ์ด๋‚˜ " -"ํ—ค๋” ๊ฐ™์€๊ฑด ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค." +"`main` ํ•จ์ˆ˜์—์„œ ๊ทธ ๋‹ค์Œ์— ์˜ค๋Š” ํ•จ์ˆ˜๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฏธ๋ฆฌ ์„ ์–ธํ•˜๊ธฐ" +"(forward declaration)๋‚˜ ํ—ค๋” ๊ฐ™์€๊ฑด ํ•„์š” ์—†์Šต๋‹ˆ๋‹ค. " #: src/basic-syntax/functions.md:36 msgid "" @@ -3250,50 +3523,97 @@ msgstr "" #: src/basic-syntax/functions.md:39 msgid "" -"The range expression in the `for` loop in `fizzbuzz_to()` contains `=n`, " -"which causes it to include the upper bound." +"The range expression in the `for` loop in `print_fizzbuzz_to()` contains " +"`=n`, which causes it to include the upper bound." msgstr "" "`fizzbuzz_to()`ํ•จ์ˆ˜ ๋‚ด `for` ๋ฐ˜๋ชฉ๋ฌธ์˜ ๋ฒ”์œ„ ํ‘œํ˜„์‹ ์ค‘ `=n`์€ n๊นŒ์ง€ ํฌํ•จํ•œ๋‹ค๋Š” " "์˜๋ฏธ์ž…๋‹ˆ๋‹ค." -#: src/basic-syntax/functions.md:40 +#: src/basic-syntax/rustdoc.md:3 msgid "" -"The `match` expression in `fizzbuzz()` is doing a lot of work. It is " -"expanded below to show what is happening." -msgstr "" -"`fizzbuzz()`ํ•จ์ˆ˜์˜ `match` ํ‘œํ˜„์‹์€ ๋งŽ์€ ์ผ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ์กฐ" -"๊ธˆ ๋” ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋„๋ก ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." +"All language items in Rust can be documented using special `///` syntax." +msgstr "Rust์˜ ์•„์ดํ…œ(item)์€ `///` ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/basic-syntax/functions.md:42 -msgid "(Type annotations added for clarity, but they can be elided.)" -msgstr "(๋ช…ํ™•ํ•œ ์„ค๋ช…์„ ์œ„ํ•ด ํƒ€์ž…์ด ๋ช…์‹œ์ ์œผ๋กœ ์„ ์–ธ ๋˜์—ˆ์ง€๋งŒ ์ƒ๋žต ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.)" - -#: src/basic-syntax/functions.md:44 +#: src/basic-syntax/rustdoc.md:5 msgid "" -"```rust,ignore\n" -"let by_3: bool = is_divisible_by(n, 3);\n" -"let by_5: bool = is_divisible_by(n, 5);\n" -"let by_35: (bool, bool) = (by_3, by_5);\n" -"match by_35 {\n" -" // ...\n" +"```rust,editable\n" +"/// Determine whether the first argument is divisible by the second " +"argument.\n" +"///\n" +"/// If the second argument is zero, the result is false.\n" +"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" +" if rhs == 0 {\n" +" return false; // Corner case, early return\n" +" }\n" +" lhs % rhs == 0 // The last expression in a block is the return " +"value\n" +"}\n" "```" msgstr "" -"```rust,ignore\n" -"let by_3: bool = is_divisible_by(n, 3);\n" -"let by_5: bool = is_divisible_by(n, 5);\n" -"let by_35: (bool, bool) = (by_3, by_5);\n" -"match by_35 {\n" -" // ...\n" +"```rust,editable\n" +"/// ์ฒซ ๋ฒˆ์งธ ์ธ์ˆ˜๊ฐ€ ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๋กœ ๋‚˜๋ˆ ์งˆ ์ˆ˜ ์žˆ๋Š”์ง€ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.\n" +"///\n" +"/// ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๊ฐ€ 0์ด๋ฉด ๊ฒฐ๊ณผ๋Š” false์ž…๋‹ˆ๋‹ค.\n" +"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" +" if rhs == 0 {\n" +" return false; // Corner case, early return\n" +" }\n" +" lhs % rhs == 0 // ๋ธ”๋ก ์•ˆ์˜ ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์€ ๋ฐ˜ํ™˜๊ฐ’์ž…๋‹ˆ๋‹ค\n" +"}\n" "```" +#: src/basic-syntax/rustdoc.md:17 +msgid "" +"The contents are treated as Markdown. All published Rust library crates are " +"automatically documented at [`docs.rs`](https://docs.rs) using the [rustdoc]" +"(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It is " +"idiomatic to document all public items in an API using this pattern." +msgstr "" +"์ฝ˜ํ…์ธ ๋Š” ๋งˆํฌ๋‹ค์šด์œผ๋กœ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค. ๊ฒŒ์‹œ๋œ ๋ชจ๋“  Rust ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํฌ๋ ˆ์ดํŠธ๋Š” " +"[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉ" +"ํ•˜์—ฌ [`docs.rs`](https://docs.rs)์— ์ž๋™์œผ๋กœ ๋ฌธ์„œํ™”๋ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ API์˜ " +"๋ชจ๋“  ๊ณต๊ฐœ ํ•ญ๋ชฉ์€ ์ด ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œํ™”๋ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/rustdoc.md:24 +msgid "" +"Show students the generated docs for the `rand` crate at [`docs.rs/rand`]" +"(https://docs.rs/rand)." +msgstr "" +"[`docs.rs/rand`](https://docs.rs/rand)์—์„œ `rand` ํฌ๋ ˆ์ดํŠธ์šฉ์œผ๋กœ ์ƒ์„ฑ๋œ ๋ฌธ์„œ" +"๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." + +#: src/basic-syntax/rustdoc.md:27 +msgid "" +"This course does not include rustdoc on slides, just to save space, but in " +"real code they should be present." +msgstr "" +"์ด ์Šฌ๋ผ์ด๋“œ์˜ ์˜ˆ์ œ ์ฝ”๋“œ๋Š” ๋ฌธ์„œํ™” ์ฃผ์„์ด ์ƒ๋žต๋˜์–ด ์žˆ์ง€๋งŒ, ์‹ค์ œ ์ฝ”๋“œ๋ผ๋ฉด ๋ฌธ์„œ" +"ํ™” ์ฃผ์„์„ ๋ฐ˜๋“œ์‹œ ์จ์•ผ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/rustdoc.md:30 +msgid "" +"Inner doc comments are discussed later (in the page on modules) and need not " +"be addressed here." +msgstr "" +"๋ฌธ์„œ ๋‚ด๋ถ€ ์ฃผ์„ ๋ชจ๋“ˆ ํŽ˜์ด์ง€ ๋’ท๋ถ€๋ถ„์—์„œ ๋‹ค๋ฃจ๋ฉฐ ์—ฌ๊ธฐ์„œ ๋‹ค๋ฃจ์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/rustdoc.md:33 +msgid "" +"Rustdoc comments can contain code snippets that we can run and test using " +"`cargo test`. We will discuss these tests in the [Testing section](../" +"testing/doc-tests.html)." +msgstr "" +"๋ฌธ์„œํ™” ์ฃผ์„์€ ์ฝ”๋“œ๋ฅผ ํฌํ•จํ•  ์ˆ˜๋„ ์žˆ์œผ๋ฉฐ, ์ด ์ฝ”๋“œ๋Š” `cargo test`๋ฅผ ํ†ตํ•ด ํ…Œ์ŠคํŠธ" +"๋กœ ๋™์ž‘ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. [ํ…Œ์ŠคํŠธ](../testing/doc-tests.html)์—์„œ ๋” ์ž์„ธํžˆ ๋‹ค" +"๋ฃจ๊ฒ ์Šต๋‹ˆ๋‹ค." + #: src/basic-syntax/methods.md:3 msgid "" -"Rust has methods, they are simply functions that are associated with a " -"particular type. The first argument of a method is an instance of the type " -"it is associated with:" +"Methods are functions associated with a type. The `self` argument of a " +"method is an instance of the type it is associated with:" msgstr "" -"๋Ÿฌ์ŠคํŠธ์˜ ๋ฉ”์„œ๋“œ๋Š” ํŠน์ • ํƒ€์ž…๊ณผ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ๋ฉ”์„œ๋“œ์˜ ์ฒซ๋ฒˆ์งธ ์ธ์ž์˜ ํƒ€์ž…" -"์ด ๋ฐ”๋กœ ๊ทธ ๋ฉ”์„œ๋“œ๊ฐ€ ์—ฐ๊ฒฐ๋œ ํƒ€์ž…์ž…๋‹ˆ๋‹ค:" +"๋ฉ”์„œ๋“œ๋Š” ํŠน์ • ํƒ€์ž…๊ณผ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ๋ฉ”์„œ๋“œ์˜ `self` ์ธ์ž๊ฐ€ ๊ทธ ๋ฉ”์„œ๋“œ๊ฐ€ ์—ฐ" +"๊ฒฐ๋œ ์ธ์Šคํ„ด์Šค์˜ ํƒ€์ž…์ž…๋‹ˆ๋‹ค:" #: src/basic-syntax/methods.md:6 msgid "" @@ -3351,6 +3671,45 @@ msgid "" "class." msgstr "์˜ค๋Š˜๊ณผ ๋‚ด์ผ ๊ฐ•์˜์—์„œ ๋” ๋งŽ์€ ๋ฉ”์„œ๋“œ ์‚ฌ์šฉ๋ฒ•์„ ๋‹ค๋ฃฐ ๊ฒƒ์ž…๋‹ˆ๋‹ค." +#: src/basic-syntax/methods.md:34 +msgid "Add a static method called `Rectangle::new` and call this from `main`:" +msgstr "`Rectangle::new` ์ƒ์„ฑ์ž๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์ด๋ฅผ `main`์—์„œ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค:" + +#: src/basic-syntax/methods.md:36 +msgid "" +"```rust,editable,compile_fail\n" +"fn new(width: u32, height: u32) -> Rectangle {\n" +" Rectangle { width, height }\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"fn new(width: u32, height: u32) -> Rectangle {\n" +" Rectangle { width, height }\n" +"}\n" +"```" + +#: src/basic-syntax/methods.md:42 +msgid "" +"While _technically_, Rust does not have custom constructors, static methods " +"are commonly used to initialize structs (but don't have to). The actual " +"constructor, `Rectangle { width, height }`, could be called directly. See " +"the [Rustnomicon](https://doc.rust-lang.org/nomicon/constructors.html)." +msgstr "" +"\\_๊ธฐ์ˆ ์ _์œผ๋กœ ์ด์•ผ๊ธฐ ํ•˜์ž๋ฉด, ๋Ÿฌ์ŠคํŠธ๋Š” ์ปค์Šคํ…€ ์ƒ์„ฑ์ž๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ •" +"์  ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ตฌ์กฐ์ฒด๋ฅผ ์ดˆ๊ธฐํ™” ํ•˜๋Š” ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค (๋ฌผ๋ก  ์ด๊ฒƒ" +"์ด ๊ฐ•์ œ๋˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค). ์ง„์งœ ์ƒ์„ฑ์ž์ธ `Rectangle { width, height }`๋ฅผ ์ง์ ‘ " +"ํ˜ธ์ถœํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ [Rustnomicon](https://doc.rust-lang.org/" +"nomicon/constructors.html)์„ ์ฐธ์กฐํ•˜์„ธ์š”." + +#: src/basic-syntax/methods.md:45 +msgid "" +"Add a `Rectangle::square(width: u32)` constructor to illustrate that such " +"static methods can take arbitrary parameters." +msgstr "" +"`Rectangle::square(width: u32)` ์ƒ์„ฑ์ž๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ƒ์„ฑ์ž๊ฐ€ ์ž„์˜์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ " +"์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ์„ ๋ณด์ž…์‹œ๋‹ค." + #: src/basic-syntax/functions-interlude.md:1 msgid "Function Overloading" msgstr "(ํ•จ์ˆ˜) ์˜ค๋ฒ„๋กœ๋”ฉ" @@ -3361,7 +3720,7 @@ msgstr "์˜ค๋ฒ„๋กœ๋”ฉ์€ ์ง€์›๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" #: src/basic-syntax/functions-interlude.md:5 msgid "Each function has a single implementation:" -msgstr "๊ฐœ๋ณ„ํ•จ์ˆ˜๋Š” ๋‹จ์ผ ๊ตฌํ˜„๋งŒ ๊ฐ–์Šต๋‹ˆ๋‹ค." +msgstr "๊ฐœ๋ณ„ํ•จ์ˆ˜๋Š” ๋‹จ์ผ ๊ตฌํ˜„๋งŒ ๊ฐ–์Šต๋‹ˆ๋‹ค:" #: src/basic-syntax/functions-interlude.md:6 msgid "Always takes a fixed number of parameters." @@ -3373,11 +3732,11 @@ msgstr "ํŒŒ๋ผ๋งคํ„ฐ๋“ค์˜ ํƒ€์ž…์€ ํ•ญ์ƒ ๊ณ ์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค." #: src/basic-syntax/functions-interlude.md:8 msgid "Default values are not supported:" -msgstr "ํŒŒ๋ผ๋งคํ„ฐ์˜ ๊ธฐ๋ณธ ๊ฐ’์€ ์ง€์›๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +msgstr "ํŒŒ๋ผ๋งคํ„ฐ์˜ ๊ธฐ๋ณธ ๊ฐ’์€ ์ง€์›๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" #: src/basic-syntax/functions-interlude.md:9 msgid "All call sites have the same number of arguments." -msgstr "๋ชจ๋“  ํ˜ธ์ถœ๋ถ€์—์„œ๋Š” ๋™์ผํ•œ ์ˆ˜์˜ ์ธ์ž๋ฅผ ์„ค์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. " +msgstr "๋ชจ๋“  ํ˜ธ์ถœ๋ถ€์—์„œ๋Š” ๋™์ผํ•œ ์ˆ˜์˜ ์ธ์ž๋ฅผ ์„ค์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค." #: src/basic-syntax/functions-interlude.md:10 msgid "Macros are sometimes used as an alternative." @@ -3464,7 +3823,10 @@ msgstr "" #: src/exercises/day-1/morning.md:22 src/exercises/day-1/afternoon.md:11 #: src/exercises/day-2/morning.md:11 src/exercises/day-2/afternoon.md:7 -#: src/exercises/day-3/morning.md:7 src/exercises/day-4/morning.md:12 +#: src/exercises/day-3/morning.md:7 src/exercises/bare-metal/morning.md:7 +#: src/exercises/bare-metal/afternoon.md:7 +#: src/exercises/concurrency/morning.md:12 +#: src/exercises/concurrency/afternoon.md:13 msgid "" "After looking at the exercises, you can look at the \\[solutions\\] provided." msgstr "" @@ -3495,6 +3857,18 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable,compile_fail\n" +"fn multiply(x: i16, y: i16) -> i16 {\n" +" x * y\n" +"}\n" +"\n" +"fn main() {\n" +" let x: i8 = 15;\n" +" let y: i16 = 1000;\n" +"\n" +" println!(\"{x} * {y} = {}\", multiply(x, y));\n" +"}\n" +"```" #: src/exercises/day-1/implicit-conversions.md:19 msgid "" @@ -3571,6 +3945,9 @@ msgid "" "let array = [10, 20, 30];\n" "```" msgstr "" +"```rust\n" +"let array = [10, 20, 30];\n" +"```" #: src/exercises/day-1/for-loops.md:9 msgid "" @@ -3587,6 +3964,12 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let array = [10, 20, 30];\n" +" println!(\"array: {array:?}\");\n" +"}\n" +"```" #: src/exercises/day-1/for-loops.md:18 msgid "" @@ -3613,6 +3996,22 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let array = [10, 20, 30];\n" +" print!(\"Iterating over array:\");\n" +" for n in array {\n" +" print!(\" {n}\");\n" +" }\n" +" println!();\n" +"\n" +" print!(\"Iterating over range:\");\n" +" for i in 0..3 {\n" +" print!(\" {}\", array[i]);\n" +" }\n" +" println!();\n" +"}\n" +"```" #: src/exercises/day-1/for-loops.md:38 msgid "" @@ -3631,6 +4030,11 @@ msgid "" " โŽโŽฃ7 8 9โŽฆโŽ  โŽฃ3 6 9โŽฆ\n" "```" msgstr "" +"```bob\n" +" โŽ›โŽก1 2 3โŽคโŽž โŽก1 4 7โŽค\n" +"\"transpose\"โŽœโŽข4 5 6โŽฅโŽŸ \"==\"โŽข2 5 8โŽฅ\n" +" โŽโŽฃ7 8 9โŽฆโŽ  โŽฃ3 6 9โŽฆ\n" +"```" #: src/exercises/day-1/for-loops.md:47 msgid "Hard-code both functions to operate on 3 ร— 3 matrices." @@ -3767,14 +4171,6 @@ msgstr "" "ํƒ€์ž… ์ถ”๋ก ์— ๋•๋ถ„์— `i32`๋Š” ์ƒ๋žต ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๊ฐ•์˜๊ฐ€ ์ง„ํ–‰๋  ์ˆ˜๋ก ์ƒ๋žต ๊ฐ€๋Šฅํ•œ ๋ถ€" "๋ถ„์€ ์ ์  ์ƒ๋žตํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค." -#: src/basic-syntax/variables.md:18 -msgid "" -"Note that since `println!` is a macro, `x` is not moved, even using the " -"function like syntax of `println!(\"x: {}\", x)`" -msgstr "" -"`println!(\"x: {}\", x)`๋Š” ํ•จ์ˆ˜ ํ˜ธ์ถœ ์ฒ˜๋Ÿผ ๋ณด์ด์ง€๋งŒ ์‹ค์€ ๋งคํฌ๋กœ ํ˜ธ์ถœ์ด๋ฉฐ `x`" -"๋Š” ์ด๋™๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - #: src/basic-syntax/type-inference.md:3 msgid "Rust will look at how the variable is _used_ to determine the type:" msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ๋ณ€์ˆ˜๊ฐ€ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉ๋˜๋Š”์ง€๋ฅผ ๋ณด๊ณ  ๊ทธ ๋ณ€์ˆ˜์˜ ํƒ€์ž…์„ ์ถ”๋ก ํ•ฉ๋‹ˆ๋‹ค:" @@ -3879,30 +4275,44 @@ msgstr "" #: src/basic-syntax/type-inference.md:46 msgid "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." -"html#method.collect) relies on `FromIterator`, which [`HashSet`](https://doc." -"rust-lang.org/std/iter/trait.FromIterator.html) implements." +"html#method.collect) relies on [`FromIterator`](https://doc.rust-lang.org/" +"std/iter/trait.FromIterator.html), which [`HashSet`](https://doc.rust-lang." +"org/std/collections/struct.HashSet.html#impl-FromIterator%3CT%3E-for-" +"HashSet%3CT,+S%3E) implements." msgstr "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." -"html#method.collect)๋Š” [`HashSet`](https://doc.rust-lang.org/std/iter/trait." -"FromIterator.html)์„ ๊ตฌํ˜„ํ•œ `FromIterator`์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค." +"html#method.collect)๋Š” [`HashSet`](https://doc.rust-lang.org/std/collections/" +"struct.HashSet.html#impl-FromIterator%3CT%3E-for-HashSet%3CT,+S%3E)์„ ๊ตฌํ˜„ํ•œ " +"[`FromIterator`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html)" +"์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค." #: src/basic-syntax/static-and-const.md:1 msgid "Static and Constant Variables" msgstr "์ •์ ๋ณ€์ˆ˜(static)๊ณผ ์ƒ์ˆ˜(const)" #: src/basic-syntax/static-and-const.md:3 -msgid "Global state is managed with static and constant variables." -msgstr "ํ”„๋กœ๊ทธ๋žจ์˜ ๊ธ€๋กœ๋ฒŒ ์ƒํƒœ๋Š” ๊ฒฐ๊ตญ ์ •์  ๋ณ€์ˆ˜์™€ ์ƒ์ˆ˜๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค." +msgid "" +"Static and constant variables are two different ways to create globally-" +"scoped values that cannot be moved or reallocated during the execution of " +"the program. " +msgstr "" +"์ •์  ๋ณ€์ˆ˜์™€ ์ƒ์ˆ˜๋Š” ์ „์—ญ ์Šค์ฝ”ํ”„์—์„œ ๊ฐ’์„ ์ƒ์„ฑํ•˜๋Š” ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ์ „์—ญ ์Šค" +"์ฝ”ํ”„์— ์ƒ์„ฑ๋œ ๊ฐ’์€ ํ”„๋กœ๊ทธ๋žจ ์ˆ˜ํ–‰ ๋„์ค‘์— ๋‹ค๋ฅธ ๊ฐ’์œผ๋กœ ์ด๋™๋˜์ง€ ์•Š์œผ๋ฉฐ, ๋ฉ”๋ชจ๋ฆฌ " +"์ƒ์—์„œ ๊ทธ ์œ„์น˜๊ฐ€ ๋ณ€ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. " -#: src/basic-syntax/static-and-const.md:5 +#: src/basic-syntax/static-and-const.md:6 msgid "`const`" msgstr "์ƒ์ˆ˜(`const`)" -#: src/basic-syntax/static-and-const.md:7 -msgid "You can declare compile-time constants:" -msgstr "์ปดํŒŒ์ผ ์‹œ ๊ฐ’์ด ์ •ํ•ด์ง€๋Š” ์ƒ์ˆ˜๋ฅผ ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +#: src/basic-syntax/static-and-const.md:8 +msgid "" +"Constant variables are evaluated at compile time and their values are " +"inlined wherever they are used:" +msgstr "" +"์ƒ์ˆ˜๋Š” ์ปดํŒŒ์ผ ํ•  ๋•Œ ๊ทธ ๊ฐ’์ด ์ •ํ•ด์ง‘๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ๊ฐ’์€ ๊ทธ ์ƒ์ˆ˜๊ฐ€ ์‚ฌ์šฉ๋˜๋Š” ๋ชจ" +"๋“  ๋ถ€๋ถ„์—์„œ ์ธ๋ผ์ธ ๋ฉ๋‹ˆ๋‹ค:" -#: src/basic-syntax/static-and-const.md:9 +#: src/basic-syntax/static-and-const.md:11 msgid "" "```rust,editable\n" "const DIGEST_SIZE: usize = 3;\n" @@ -3942,23 +4352,36 @@ msgstr "" "}\n" "```" -#: src/basic-syntax/static-and-const.md:27 +#: src/basic-syntax/static-and-const.md:29 msgid "" -"According the the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-" -"const-vs-static.html) these are inlined upon use." +"According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" +"vs-static.html) these are inlined upon use." msgstr "" "[Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-vs-static.html)" "์— ๋”ฐ๋ฅด๋ฉด ์ƒ์ˆ˜๋Š”, ๊ทธ ์ƒ์ˆ˜๊ฐ€ ์‚ฌ์šฉ๋˜๋Š” ๊ณณ์— ์ธ๋ผ์ธ ๋ฉ๋‹ˆ๋‹ค." -#: src/basic-syntax/static-and-const.md:29 +#: src/basic-syntax/static-and-const.md:31 +msgid "" +"Only functions marked `const` can be called at compile time to generate " +"`const` values. `const` functions can however be called at runtime." +msgstr "" +"`const` ๊ฐ’์„ ์ƒ์„ฑํ•  ๋•Œ์—๋Š” `const`๋กœ ๋งˆํ‚น๋œ ํ•จ์ˆ˜๋งŒ์ด ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ์ด ํ•จ์ˆ˜๋“ค" +"์€ ์ปดํŒŒ์ผ ์‹œ์— ํ˜ธ์ถœ์ด ๋ฉ๋‹ˆ๋‹ค. ๋ฌผ๋ก  `const`ํ•จ์ˆ˜๋“ค์„ ๋Ÿฐํƒ€์ž„์— ํ˜ธ์ถœํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€" +"๋Šฅํ•ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/static-and-const.md:33 msgid "`static`" msgstr "์ •์ ๋ณ€์ˆ˜(`static`)" -#: src/basic-syntax/static-and-const.md:31 -msgid "You can also declare static variables:" -msgstr "๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์ •์  ๋ณ€์ˆ˜๋„ ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +#: src/basic-syntax/static-and-const.md:35 +msgid "" +"Static variables will live during the whole execution of the program, and " +"therefore will not move:" +msgstr "" +"์ •์  ๋ณ€์ˆ˜๋Š” ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰๋˜๋Š” ๋™์•ˆ ์œ ์ง€๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ ๋‹ค๋ฅธ ๋ณ€์ˆ˜๋กœ ์ด๋™" +"(move)๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" -#: src/basic-syntax/static-and-const.md:33 +#: src/basic-syntax/static-and-const.md:37 msgid "" "```rust,editable\n" "static BANNER: &str = \"Welcome to RustOS 3.14\";\n" @@ -3976,37 +4399,60 @@ msgstr "" "}\n" "```" -#: src/basic-syntax/static-and-const.md:41 +#: src/basic-syntax/static-and-const.md:45 msgid "" "As noted in the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" "vs-static.html), these are not inlined upon use and have an actual " -"associated memory location. This is useful for unsafe and embedded code, " -"and the variable lives through the entirety of the program execution." +"associated memory location. This is useful for unsafe and embedded code, " +"and the variable lives through the entirety of the program execution. When a " +"globally-scoped value does not have a reason to need object identity, " +"`const` is generally preferred." msgstr "" "[Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-vs-static.html)์—" "์„œ ์–ธ๊ธ‰ํ•œ ๋ฐ”์™€ ๊ฐ™์ด, ์ •์  ๋ณ€์ˆ˜๋Š” ๋ณ„๋„์˜ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์„ ๊ฐ€์ง€๋ฉฐ, ์ธ๋ผ์ธ ๋˜์ง€ ์•Š" "์Šต๋‹ˆ๋‹ค. ์ •์  ๋ณ€์ˆ˜๋Š” ์•ˆ์ „ํ•˜์ง€ ์•Š์€(unsafe) ๋Ÿฌ์ŠคํŠธ์™€ ์ž„๋ฒ ๋””๋“œ ์‹œ์Šคํ…œ์šฉ ์ฝ”๋“œ์—" -"์„œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด๋“ค์˜ ์ˆ˜๋ช…์€ ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰๋˜๋Š” ์ „์ฒด ์‹œ๊ฐ„๊ณผ ๋™์ผํ•ฉ๋‹ˆ๋‹ค." - -#: src/basic-syntax/static-and-const.md:44 -msgid "" -"We will look at mutating static data in the [chapter on Unsafe Rust](../" -"unsafe.md)." -msgstr "" -"๊ฐ€๋ณ€ ์ •์  ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•ด์„œ๋Š” [์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๋Ÿฌ์ŠคํŠธ](../unsafe.md)์—์„œ ์‚ดํŽด๋ด…๋‹ˆ" -"๋‹ค." - -#: src/basic-syntax/static-and-const.md:48 -msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`." -msgstr "`const`๋Š” C++์˜ `constexpr`๊ณผ ๋งค์šฐ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค." +"์„œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด๋“ค์˜ ์ˆ˜๋ช…์€ ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰๋˜๋Š” ์ „์ฒด ์‹œ๊ฐ„๊ณผ ๋™์ผํ•ฉ๋‹ˆ๋‹ค. ์ „" +"์—ญ ์Šค์ฝ”ํ”„๋ฅผ ๊ฐ€์ง„ ์–ด๋–ค ๊ฐ’์ด, ๋ฉ”๋ชจ๋ฆฌ ์ƒ์— ๋‹จ ํ•˜๋‚˜๋งŒ ์กด์žฌํ•ด์•ผ ํ•œ๋‹ค๋Š” ์š”๊ตฌ์กฐ๊ฑด์ด " +"์—†๋‹ค๋ฉด, ์ •์  ๋ณ€์ˆ˜ ๋Œ€์‹  `const`๋ฅผ ์“ฐ๋Š” ๊ฒƒ์ด ์˜ณ์Šต๋‹ˆ๋‹ค." #: src/basic-syntax/static-and-const.md:49 msgid "" +"Because `static` variables are accessible from any thread, they must be " +"`Sync`. Interior mutability is possible through a [`Mutex`](https://doc.rust-" +"lang.org/std/sync/struct.Mutex.html), atomic or similar. It is also possible " +"to have mutable statics, but they require manual synchronisation so any " +"access to them requires `unsafe` code. We will look at [mutable statics](../" +"unsafe/mutable-static-variables.md) in the chapter on Unsafe Rust." +msgstr "" +"`static`๋ณ€์ˆ˜๋“ค์€ ์–ด๋–ค ์Šค๋ ˆ๋“œ์—์„œ๋„ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•˜๊ธฐ ๋•Œ๋ฌธ์—, `Sync`ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„" +"ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ณ€์ˆ˜๋ฅผ ์ฝ๊ณ  ์“ฐ๋ ค๋ฉด [`Mutex`](https://doc.rust-lang.org/std/" +"sync/struct.Mutex.html)๋กœ ๊ฐ์‹ธ๊ฑฐ๋‚˜, atomic ์—ฐ์‚ฐ์„ ์จ์•ผ ํ•ฉ๋‹ˆ๋‹ค. `static` ๋ณ€์ˆ˜" +"๋ฅผ mutableํ•˜๊ฒŒ ์„ ์–ธํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ, ์ด ๊ฒฝ์šฐ ๋™๊ธฐํ™” ์ž‘์—…์„ ์ˆ˜๋™์œผ๋กœ ํ•ด ์ฃผ์–ด์•ผ " +"ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ทธ๋Ÿฌํ•œ ๋ณ€์ˆ˜๋ฅผ ์ ‘๊ทผํ•˜๋Š” ์ฝ”๋“œ๋Š”`unsafe`๋กœ ๋ช…์‹œ์ ์œผ๋กœ ํ‘œ์‹œ๊ฐ€ ๋˜์–ด" +"์•ผ ํ•ฉ๋‹ˆ๋‹ค. \"์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๋Ÿฌ์ŠคํŠธ\"๋ฅผ ๋ฐฐ์šธ ๋•Œ [mutable statics](../unsafe/" +"mutable-static-variables.md) ๋ถ€๋ถ„์—์„œ ์ข€ ๋” ์ž์„ธํžˆ ๋‹ค๋ฃจ๊ฒ ์Šต๋‹ˆ๋‹ค." + +#: src/basic-syntax/static-and-const.md:57 +msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`." +msgstr "๋Ÿฌ์ŠคํŠธ์˜ `const`๋Š” C++์˜ `constexpr`๊ณผ ๋งค์šฐ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/static-and-const.md:58 +msgid "" "`static`, on the other hand, is much more similar to a `const` or mutable " "global variable in C++." -msgstr "๋ฐ˜๋ฉด์— `static`์€ C++์˜ `const`๋‚˜ ๊ฐ€๋ณ€ ์ •์  ๋ณ€์ˆ˜์™€ ํ›จ์”ฌ ๋” ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." +msgstr "" +"๋ฐ˜๋ฉด์— ๋Ÿฌ์ŠคํŠธ์˜ `static`์€ C++์˜ `const`๋‚˜ ๊ฐ€๋ณ€ ์ •์  ๋ณ€์ˆ˜(mutable global " +"variable)์™€ ํ›จ์”ฌ ๋” ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." -#: src/basic-syntax/static-and-const.md:50 +#: src/basic-syntax/static-and-const.md:59 +msgid "" +"`static` provides object identity: an address in memory and state as " +"required by types with interior mutability such as `Mutex`." +msgstr "" +"`static`์€ ๊ฐ์ฒด์— ์ •์ฒด์„ฑ์„ ๋ถ€์—ฌํ•ฉ๋‹ˆ๋‹ค. ์ •์ฒด์ •์ด๋ž€ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์—์„œ์˜ ์ฃผ์†Œ, ๊ทธ๋ฆฌ" +"๊ณ  ๋‚ด๋ถ€ ์ƒํƒœ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." + +#: src/basic-syntax/static-and-const.md:60 msgid "" "It isn't super common that one would need a runtime evaluated constant, but " "it is helpful and safer than using a static." @@ -4014,6 +4460,73 @@ msgstr "" "ํ”„๋กœ๊ทธ๋žจ ์ˆ˜ํ–‰์‹œ ๊ทธ ๊ฐ’์ด ์ •ํ•ด์ง€๋Š” ์ƒ์ˆ˜๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ๋Š” ๋“œ๋ญ…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ทธ๋ ‡๋‹ค" "๊ณ  ํ•ด๋„, ์ •์  ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ๋ณด๋‹ค๋Š” ๋” ์œ ์šฉํ•˜๊ณ  ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค." +#: src/basic-syntax/static-and-const.md:61 +msgid "`thread_local` data can be created with the macro `std::thread_local`." +msgstr "" +"`thread_local` ๋ฐ์ดํ„ฐ๋Š” `std::thread_local` ๋งคํฌ๋กœ๋ฅผ ์ด์šฉํ•˜์—ฌ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต" +"๋‹ˆ๋‹ค." + +#: src/basic-syntax/static-and-const.md:63 +msgid "Properties table:" +msgstr "์†์„ฑ ๋น„๊ต ํ…Œ์ด๋ธ”:" + +#: src/basic-syntax/static-and-const.md:65 +msgid "Property" +msgstr "์†์„ฑ" + +#: src/basic-syntax/static-and-const.md:65 +msgid "Static" +msgstr "์ •์ (static) ๋ณ€์ˆ˜" + +#: src/basic-syntax/static-and-const.md:65 +msgid "Constant" +msgstr "์ƒ์ˆ˜(constant)" + +#: src/basic-syntax/static-and-const.md:67 +msgid "Has an address in memory" +msgstr "๋ฉ”๋ชจ๋ฆฌ ์ƒ์— ์ฃผ์†Œ๊ฐ€ ์žˆ๋Š”๊ฐ€" + +#: src/basic-syntax/static-and-const.md:67 +#: src/basic-syntax/static-and-const.md:68 +#: src/basic-syntax/static-and-const.md:70 +#: src/basic-syntax/static-and-const.md:71 +msgid "Yes" +msgstr "์˜ˆ" + +#: src/basic-syntax/static-and-const.md:67 +msgid "No (inlined)" +msgstr "์•„๋‹ˆ์˜ค(์ธ๋ผ์ธ ๋จ)" + +#: src/basic-syntax/static-and-const.md:68 +msgid "Lives for the entire duration of the program" +msgstr "ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰๋˜๋Š” ๋™์•ˆ ๊ณ„์† ์‚ด์•„ ์žˆ๋Š”๊ฐ€" + +#: src/basic-syntax/static-and-const.md:68 +#: src/basic-syntax/static-and-const.md:69 +#: src/basic-syntax/static-and-const.md:71 +msgid "No" +msgstr "์•„๋‹ˆ์˜ค" + +#: src/basic-syntax/static-and-const.md:69 +msgid "Can be mutable" +msgstr "๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•œ๊ฐ€" + +#: src/basic-syntax/static-and-const.md:69 +msgid "Yes (unsafe)" +msgstr "์˜ˆ (๊ทธ๋Ÿฌ๋‚˜ ์•ˆ์ „ํ•˜์ง€ ์•Š์Œ)" + +#: src/basic-syntax/static-and-const.md:70 +msgid "Evaluated at compile time" +msgstr "์ปดํŒŒ์ผ์‹œ ๊ทธ ๊ฐ’์ด ๊ฒฐ์ •๋˜๋Š”๊ฐ€" + +#: src/basic-syntax/static-and-const.md:70 +msgid "Yes (initialised at compile time)" +msgstr "์˜ˆ (์ปดํŒŒ์ผ์‹œ ์ดˆ๊ธฐํ™” ๋จ)" + +#: src/basic-syntax/static-and-const.md:71 +msgid "Inlined wherever it is used" +msgstr "์‚ฌ์šฉ๋˜๋Š” ๊ณณ์— ์ธ๋ผ์ธ ๋˜๋Š”๊ฐ€" + #: src/basic-syntax/scopes-shadowing.md:3 msgid "" "You can shadow variables, both those from outer scopes and variables from " @@ -4066,11 +4579,11 @@ msgstr "" "์‰๋„์ž‰์€ ๊ธฐ์กด ๋ณ€์ˆ˜์— ์ƒˆ๋กœ์šด ๊ฐ’์„ ํ• ๋‹นํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ์‰๋„์ž‰์„ ํ•˜๋ฉด ์ƒˆ๋กœ" "์šด ๋ณ€์ˆ˜๊ฐ€ ์ƒ๊ธฐ๋ฉฐ, ์ด์ „ ๋ณ€์ˆ˜์™€ ์ƒˆ ๋ณ€์ˆ˜๋Š” ๋ฉ”๋ชจ๋ฆฌ์˜ ์„œ๋กœ ๋‹ค๋ฅธ ์œ„์น˜์— ์กด์žฌํ•ฉ๋‹ˆ" "๋‹ค. ๊ทธ ๋‘ ๋ณ€์ˆ˜๋Š” ๋‹จ์ง€ ์ด๋ฆ„์ด ๊ฐ™์€ ๋ฟ์ด๋ฉฐ, ์ฝ”๋“œ ์ค‘ ์–ด๋””์—์„œ ๊ทธ ์ด๋ฆ„์ด ์‚ฌ์šฉ๋˜์—ˆ" -"๋А๋ƒ์— ๋”ฐ๋ผ ์–ด๋–ค ๋ณ€์ˆ˜๋ฅผ ์ง€์นญํ•˜๋Š” ์ง€๊ฐ€ ๊ฒฐ์ •๋ฉ๋‹ˆ๋‹ค." +"๋А๋ƒ์— ๋”ฐ๋ผ ์–ด๋–ค ๋ณ€์ˆ˜๋ฅผ ์ง€์นญํ•˜๋Š” ์ง€๊ฐ€ ๊ฒฐ์ •๋ฉ๋‹ˆ๋‹ค. " #: src/basic-syntax/scopes-shadowing.md:26 msgid "A shadowing variable can have a different type. " -msgstr "์‰๋„์ž‰ ์‹œ ํƒ€์ž…์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr "์‰๋„์ž‰ ์‹œ ํƒ€์ž…์„ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " #: src/basic-syntax/scopes-shadowing.md:27 msgid "" @@ -4138,7 +4651,7 @@ msgid "" "Full control _and_ safety via compile time enforcement of correct memory " "management." msgstr "" -"์ปดํŒŒ์ผ ์‹œ ์˜ฌ๋ฐ”๋ฅธ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ๋ฅผ ๊ฐ•์ œํ•จ์œผ๋กœ์จ ์™„์ „ํ•œ ํ†ต์ œ์™€ ์•ˆ์ „์„ฑ ๋ชจ๋‘ ์ œ๊ณต" +"์ปดํŒŒ์ผ ์‹œ ์˜ฌ๋ฐ”๋ฅธ ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ๋ฅผ ๊ฐ•์ œํ•จ์œผ๋กœ์จ ์™„์ „ํ•œ ํ†ต์ œ์™€ ์•ˆ์ „์„ฑ _๋ชจ๋‘_ ์ œ๊ณต." #: src/memory-management.md:13 msgid "It does this with an explicit ownership concept." @@ -4154,11 +4667,11 @@ msgstr "์Šคํƒ(Stack)๊ณผ ํž™(Heap)" #: src/memory-management/stack-vs-heap.md:3 msgid "Stack: Continuous area of memory for local variables." -msgstr "์Šคํƒ: ์ง€์—ญ ๋ณ€์ˆ˜๋ฅผ ์œ„ํ•œ ์—ฐ์†์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ" +msgstr "์Šคํƒ: ๋กœ์ปฌ ๋ณ€์ˆ˜๋ฅผ ์œ„ํ•œ ์—ฐ์†์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ." #: src/memory-management/stack-vs-heap.md:4 msgid "Values have fixed sizes known at compile time." -msgstr "์—ฌ๊ธฐ ์ €์žฅ๋˜๋Š” ๊ฐ’์€ ์ปดํŒŒ์ผ ์‹œ ๊ฒฐ์ •๋˜๋Š” ๊ณ ์ • ํฌ๊ธฐ๋ฅผ ๊ฐ–์Šต๋‹ˆ๋‹ค. " +msgstr "์—ฌ๊ธฐ ์ €์žฅ๋˜๋Š” ๊ฐ’์€ ์ปดํŒŒ์ผ ์‹œ ๊ฒฐ์ •๋˜๋Š” ๊ณ ์ • ํฌ๊ธฐ๋ฅผ ๊ฐ–์Šต๋‹ˆ๋‹ค." #: src/memory-management/stack-vs-heap.md:5 msgid "Extremely fast: just move a stack pointer." @@ -4171,13 +4684,11 @@ msgstr "๊ด€๋ฆฌ๊ฐ€ ์‰ฌ์›€: ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด ํ• ๋‹น๋˜๊ณ , ๋ฆฌํ„ดํ•˜๋ฉด ๋ฐ˜ #: src/memory-management/stack-vs-heap.md:7 msgid "Great memory locality." -msgstr "" -"์Šคํƒ์— ์žˆ๋Š” ๊ฐ’๋“ค์€ ๋งค์šฐ ๋†’์€ ๋ฉ”๋ชจ๋ฆฌ ์ธ์ ‘์„ฑ์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค(_์—ญ์ฃผ_: ๊ทธ๋ž˜์„œ ์บ์‹œ๋ฅผ " -"ํšจ๊ณผ์ ์œผ๋กœ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค)" +msgstr "์Šคํƒ์— ์žˆ๋Š” ๊ฐ’๋“ค์€ ๋งค์šฐ ๋†’์€ ๋ฉ”๋ชจ๋ฆฌ ์ธ์ ‘์„ฑ์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค." #: src/memory-management/stack-vs-heap.md:9 msgid "Heap: Storage of values outside of function calls." -msgstr "ํž™: ํ•จ์ˆ˜ ํ˜ธ์ถœ/๋ฆฌํ„ด๊ณผ ์ƒ๊ด€ ์—†์ด ์œ ์ง€๋˜๋Š” ๊ฐ’์ด ์ €์žฅ๋˜๋Š” ๊ณณ" +msgstr "ํž™: ํ•จ์ˆ˜ ํ˜ธ์ถœ/๋ฆฌํ„ด๊ณผ ์ƒ๊ด€ ์—†์ด ์œ ์ง€๋˜๋Š” ๊ฐ’์ด ์ €์žฅ๋˜๋Š” ๊ณณ." #: src/memory-management/stack-vs-heap.md:10 msgid "Values have dynamic sizes determined at runtime." @@ -4191,14 +4702,17 @@ msgstr "์Šคํƒ ๋ณด๋‹ค๋Š” ๋А๋ฆผ: ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น/๋ฐ˜ํ™˜์‹œ ํ•ด์•ผ ํ•  ์ผ์ด msgid "No guarantee of memory locality." msgstr "๋ฉ”๋ชจ๋ฆฌ ์ธ์ ‘์„ฑ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +#: src/memory-management/stack.md:1 +msgid "Stack and Heap Example" +msgstr "์Šคํƒ๊ณผ ํž™์— ๊ด€ํ•œ ์˜ˆ์ œ" + #: src/memory-management/stack.md:3 msgid "" -"Creating a `String` puts fixed-sized data on the stack and dynamically sized " -"data on the heap:" +"Creating a `String` puts fixed-sized metadata on the stack and dynamically " +"sized data, the actual string, on the heap:" msgstr "" -"`String` ํƒ€์ž…์€ ๊ณ ์ • ํฌ๊ธฐ ๋ฐ์ดํ„ฐ(_์—ญ์ฃผ_: ๋ฌธ์ž์—ด์˜ ๊ธธ์ด, ๋ฌธ์ž์—ด์ด ์ €์žฅ๋œ ๋ฒ„ํผ" -"์˜ ์ฃผ์†Œ ๋“ฑ)๋Š” ์Šคํƒ์— ์ €์žฅํ•˜๊ณ , ๊ฐ€๋ณ€ ํฌ๊ธฐ ๋ฐ์ดํ„ฐ(_์—ญ์ฃผ_: ๋ฌธ์ž์—ด ๋ฒ„ํผ)๋Š” ํž™์— " -"์ €์žฅํ•ฉ๋‹ˆ๋‹ค:" +"`String`์„ ํ•˜๋‚˜ ๋งŒ๋“ค๊ฒŒ ๋˜๋ฉด, ์Šคํƒ์—๋Š” ๊ณ ์ •๋œ ํฌ๊ธฐ์˜ ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ƒ์„ฑ๋˜๊ณ , " +"ํž™์—๋Š” ๊ฐ€๋ณ€ ํฌ๊ธฐ์˜ ๋ฐ์ดํ„ฐ, ์ฆ‰, ์‹ค์ œ ๋ฌธ์ž์—ด, ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค:" #: src/memory-management/stack.md:6 msgid "" @@ -4269,8 +4783,8 @@ msgid "" "We can inspect the memory layout with `unsafe` code. However, you should " "point out that this is rightfully unsafe!" msgstr "" -"`unsafe` ์ฝ”๋“œ๋กœ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ์ด์•„์›ƒ์„ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌผ๋ก  ์ด ์ฝ”๋“œ๊ฐ€ ์•ˆ์ „ํ•˜" -"์ง€ ์•Š๋‹ค๋Š” ์ ์„ ์•Œ๋ ค์ฃผ์„ธ์š”!" +"์•„๋ž˜์™€ ๊ฐ™์€ `unsafe` ์ฝ”๋“œ๋กœ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ์ด์•„์›ƒ์„ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌผ๋ก  ์ด ์ฝ”" +"๋“œ๊ฐ€ ์•ˆ์ „ํ•˜์ง€ ์•Š๋‹ค๋Š” ์ ์„ ์•Œ๋ ค์ฃผ์„ธ์š”!" #: src/memory-management/stack.md:34 msgid "" @@ -4284,7 +4798,7 @@ msgid "" "to\n" " // undefined behavior.\n" " unsafe {\n" -" let (capacity, ptr, len): (usize, usize, usize) = std::mem::" +" let (ptr, capacity, len): (usize, usize, usize) = std::mem::" "transmute(s1);\n" " println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" " }\n" @@ -4301,11 +4815,12 @@ msgstr "" "to\n" " // undefined behavior.\n" " unsafe {\n" -" let (capacity, ptr, len): (usize, usize, usize) = std::mem::" +" let (ptr, capacity, len): (usize, usize, usize) = std::mem::" "transmute(s1);\n" " println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" " }\n" "}\n" +"\n" "```" #: src/memory-management/manual.md:3 @@ -4332,7 +4847,7 @@ msgstr "`malloc`์œผ๋กœ ํ• ๋‹นํ•˜๋Š” ํฌ์ธํ„ฐ๋งˆ๋‹ค `free`๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ํ•ฉ msgid "" "```c\n" "void foo(size_t n) {\n" -" int* int_array = (int*)malloc(n * sizeof(int));\n" +" int* int_array = malloc(n * sizeof(int));\n" " //\n" " // ... lots of code\n" " //\n" @@ -4342,7 +4857,7 @@ msgid "" msgstr "" "```c\n" "void foo(size_t n) {\n" -" int* int_array = (int*)malloc(n * sizeof(int));\n" +" int* int_array = malloc(n * sizeof(int));\n" " //\n" " // ... lots of code\n" " //\n" @@ -4353,10 +4868,14 @@ msgstr "" #: src/memory-management/manual.md:21 msgid "" "Memory is leaked if the function returns early between `malloc` and `free`: " -"the pointer is lost and we cannot deallocate the memory." +"the pointer is lost and we cannot deallocate the memory. Worse, freeing the " +"pointer twice, or accessing a freed pointer can lead to exploitable security " +"vulnerabilities." msgstr "" "๋งŒ์•ฝ `malloc` ๊ณผ `free` ์‚ฌ์ด์—์„œ ํ•จ์ˆ˜๊ฐ€ ์ผ์ฐ ๋ฐ˜ํ™˜๋˜๋ฉด ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ถœ์ด ์ผ์–ด๋‚ฉ๋‹ˆ" -"๋‹ค: ํฌ์ธํ„ฐ๋ฅผ ์žƒ์–ด๋ฒ„๋ฆฌ๊ฒŒ ๋˜์–ด ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์—†๊ฒŒ ๋ฉ๋‹ˆ๋‹ค." +"๋‹ค: ํฌ์ธํ„ฐ๋ฅผ ์žƒ์–ด๋ฒ„๋ฆฌ๊ฒŒ ๋˜์–ด ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์—†๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ฐ™์€ ํฌ์ธํ„ฐ๋ฅผ " +"๋‘ ๋ฒˆ ๋ฐ˜ํ™˜ํ•˜๊ฑฐ๋‚˜, ์ด๋ฏธ ๋ฐ˜ํ™˜๋œ ํฌ์ธํ„ฐ๋ฅผ ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์€ ์‹ฌ๊ฐํ•œ ๋ณด์•ˆ ๋ฌธ์ œ๋ฅผ ์ผ์œผ" +"ํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/memory-management/scope-based.md:3 msgid "" @@ -4514,9 +5033,9 @@ msgstr "" "๋Ÿผ ๋Ÿฐํƒ€์ž„ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์—†๋Š” ๊ฒƒ๋„ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/memory-management/rust.md:10 -msgid "It achieves this by modeling _ownership_ explicitly." +msgid "Rust achieves this by modeling _ownership_ explicitly." msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” _์†Œ์œ ๊ถŒ_์„ ์–ธ์–ด ์ฐจ์›์—์„œ ๋ช…์‹œ์ ์œผ๋กœ ๋ชจ๋ธ๋ง ํ•จ์œผ๋กœ์จ ์ด๋ฅผ ์ด๋ฃน๋‹ˆ๋‹ค." +"๋Ÿฌ์ŠคํŠธ๋Š” \\_์†Œ์œ ๊ถŒ_์„ ์–ธ์–ด ์ฐจ์›์—์„œ ๋ช…์‹œ์ ์œผ๋กœ ๋ชจ๋ธ๋ง ํ•จ์œผ๋กœ์จ ์ด๋ฅผ ์ด๋ฃน๋‹ˆ๋‹ค." #: src/memory-management/rust.md:14 msgid "" @@ -4554,16 +5073,16 @@ msgstr "๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ ๋ฐฉ๋ฒ• ๋ณ„ ์žฅ์ " #: src/memory-management/comparison.md:7 src/memory-management/comparison.md:22 msgid "Manual like C:" -msgstr "C์™€ ๊ฐ™์€ ์ˆ˜๋™ ๊ด€๋ฆฌ: " +msgstr "C์™€ ๊ฐ™์€ ์ˆ˜๋™ ๊ด€๋ฆฌ:" #: src/memory-management/comparison.md:8 src/memory-management/comparison.md:14 #: src/memory-management/comparison.md:17 msgid "No runtime overhead." -msgstr "๋Ÿฐํƒ€์ž„ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์—†์Œ. " +msgstr "๋Ÿฐํƒ€์ž„ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์—†์Œ." #: src/memory-management/comparison.md:9 src/memory-management/comparison.md:26 msgid "Automatic like Java:" -msgstr "JAVA์™€ ๊ฐ™์€ ์ž๋™ํ™” ๊ด€๋ฆฌ: " +msgstr "JAVA์™€ ๊ฐ™์€ ์ž๋™ํ™” ๊ด€๋ฆฌ:" #: src/memory-management/comparison.md:10 msgid "Fully automatic." @@ -4577,15 +5096,15 @@ msgstr "์•ˆ์ „ํ•˜๊ณ  ์ •ํ™•ํ•จ." #: src/memory-management/comparison.md:12 #: src/memory-management/comparison.md:29 msgid "Scope-based like C++:" -msgstr "C++ ์™€ ๊ฐ™์€ ๋ฒ”์œ„ ๊ธฐ๋ฐ˜ ๊ด€๋ฆฌ: " +msgstr "C++ ์™€ ๊ฐ™์€ ๋ฒ”์œ„ ๊ธฐ๋ฐ˜ ๊ด€๋ฆฌ:" #: src/memory-management/comparison.md:13 msgid "Partially automatic." -msgstr "๋ถ€๋ถ„ ์ž๋™ํ™”" +msgstr "๋ถ€๋ถ„ ์ž๋™ํ™”." #: src/memory-management/comparison.md:15 msgid "Compiler-enforced scope-based like Rust:" -msgstr "๋Ÿฌ์ŠคํŠธ์™€ ๊ฐ™์€ ์ปดํŒŒ์ผ๋Ÿฌ ์ˆ˜ํ–‰ ๋ฒ”์œ„ ๊ธฐ๋ฐ˜ ๊ด€๋ฆฌ: " +msgstr "๋Ÿฌ์ŠคํŠธ์™€ ๊ฐ™์€ ์ปดํŒŒ์ผ๋Ÿฌ ์ˆ˜ํ–‰ ๋ฒ”์œ„ ๊ธฐ๋ฐ˜ ๊ด€๋ฆฌ:" #: src/memory-management/comparison.md:16 msgid "Enforced by compiler." @@ -4618,24 +5137,28 @@ msgstr "" "์•Š๊ณ  GC๊ฐ€ ๋™์ž‘ํ•  ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ค์•ผ ํ•œ๋‹ค๋Š” ์ )" #: src/memory-management/comparison.md:30 -msgid "Complex, opt-in by programmer." +msgid "Complex, opt-in by programmer (on C++)." msgstr "๋ณต์žกํ•˜๋ฉฐ, ๊ฐœ๋ฐœ์ž์˜ ์„ ํƒ์‚ฌํ•ญ์ž„." #: src/memory-management/comparison.md:31 -msgid "Potential for use-after-free." -msgstr "์‚ฌ์šฉ ํ›„ ํ•ด์ œ ๋ฌธ์ œ ๊ฐ€๋Šฅ์„ฑ ์žˆ์Œ." +msgid "Circular references can lead to memory leaks" +msgstr "์ˆœํ™˜ ์ฐธ์กฐ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๊ฐ€ ๋ฐœ์ƒํ•จ" #: src/memory-management/comparison.md:32 +msgid "Potential runtime overhead" +msgstr "๋Ÿฐํƒ€์ž„ ์˜ค๋ฒ„ํ—ค๋“œ ์žˆ์„ ์ˆ˜ ์žˆ์Œ" + +#: src/memory-management/comparison.md:33 msgid "Compiler-enforced and scope-based like Rust:" msgstr "๋Ÿฌ์ŠคํŠธ์™€ ๊ฐ™์€ ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๊ฐ•์ œํ•˜๋Š” ์ˆ˜ํ–‰ ๋ฒ”์œ„ ๊ธฐ๋ฐ˜ ๊ด€๋ฆฌ:" -#: src/memory-management/comparison.md:33 -msgid "Some upfront complexity." -msgstr "์•ฝ๊ฐ„์˜ ์ดˆ๊ธฐ ๋ณต์žก์„ฑ." - #: src/memory-management/comparison.md:34 +msgid "Some upfront complexity." +msgstr "์ฒ˜์Œ์— ๋ฐฐ์šธ ๋•Œ ์–ด๋ ค์›€." + +#: src/memory-management/comparison.md:35 msgid "Can reject valid programs." -msgstr "์˜ฌ๋ฐ”๋ฅธ ํ”„๋กœ๊ทธ๋žจ์ด์ง€๋งŒ ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๊ฑฐ๋ถ€ํ•  ์ˆ˜ ์žˆ์Œ." +msgstr "์˜ฌ๋ฐ”๋ฅธ ํ”„๋กœ๊ทธ๋žจ์ด๋”๋ผ๋„ ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๊ฑฐ๋ถ€ํ•  ์ˆ˜ ์žˆ์Œ." #: src/ownership.md:3 msgid "" @@ -4689,8 +5212,8 @@ msgid "We say that the variable _owns_ the value." msgstr "์ด๊ฒƒ์„ ๋‘๊ณ  ๋ณ€์ˆ˜๊ฐ€ ๊ฐ’์„ \"์†Œ์œ \"ํ•œ๋‹ค๊ณ  ํ‘œํ˜„ํ•ฉ๋‹ˆ๋‹ค." #: src/ownership/move-semantics.md:3 -msgid "An assignment will transfer ownership between variables:" -msgstr "(๋ณ€์ˆ˜์˜) ํ• ๋‹น์€ ์†Œ์œ ๊ถŒ์„ ๋ณ€์ˆ˜ ๊ฐ„์— ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค:" +msgid "An assignment will transfer _ownership_ between variables:" +msgstr "(๋ณ€์ˆ˜์˜) ํ• ๋‹น์€ \\_์†Œ์œ ๊ถŒ_์„ ๋ณ€์ˆ˜ ๊ฐ„์— ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค:" #: src/ownership/move-semantics.md:5 msgid "" @@ -4717,26 +5240,20 @@ msgid "The assignment of `s1` to `s2` transfers ownership." msgstr "`s1`์„ `s2`์— ํ• ๋‹นํ•˜์—ฌ ์†Œ์œ ๊ถŒ์„ ์ด์ „์‹œํ‚ต๋‹ˆ๋‹ค." #: src/ownership/move-semantics.md:15 -msgid "The data was _moved_ from `s1` and `s1` is no longer accessible." -msgstr "" -"๋ฐ์ดํ„ฐ๋Š” `s1`์—์„œ \\_์ด๋™_๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ํ”„๋กœ๊ทธ๋ž˜๋จธ๋Š” `s1`์€ ๋” ์ด์ƒ ์ ‘๊ทผ ํ•  " -"์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค." - -#: src/ownership/move-semantics.md:16 -msgid "When `s1` goes out of scope, nothing happens: it has no ownership." +msgid "When `s1` goes out of scope, nothing happens: it does not own anything." msgstr "" "`s1`์˜ ์Šค์ฝ”ํ”„๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ์•„๋ฌด ์ผ๋„ ์—†์Šต๋‹ˆ๋‹ค: ์™œ๋ƒํ•˜๋ฉด `s1`์€ ์•„๋ฌด๋Ÿฐ ์†Œ์œ ๊ถŒ์ด " "์—†๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." -#: src/ownership/move-semantics.md:17 +#: src/ownership/move-semantics.md:16 msgid "When `s2` goes out of scope, the string data is freed." msgstr "`s2`์˜ ์Šค์ฝ”ํ”„๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ๋ฌธ์ž์—ด ๋ฐ์ดํ„ฐ๋Š” ํ•ด์ œ๋ฉ๋‹ˆ๋‹ค." -#: src/ownership/move-semantics.md:18 +#: src/ownership/move-semantics.md:17 msgid "There is always _exactly_ one variable binding which owns a value." msgstr "๊ฐ’(๋ฐ์ดํ„ฐ)์˜ ์†Œ์œ ๊ถŒ์„ ๊ฐ–๋Š” ๋ณ€์ˆ˜๋Š” ํ•ญ์ƒ _๋‹จ_ ํ•˜๋‚˜ ์ž…๋‹ˆ๋‹ค." -#: src/ownership/move-semantics.md:22 +#: src/ownership/move-semantics.md:21 msgid "" "Mention that this is the opposite of the defaults in C++, which copies by " "value unless you use `std::move` (and the move constructor is defined!)." @@ -4744,7 +5261,23 @@ msgstr "" "์ด๋Š” C++๊ณผ ์ •๋ฐ˜๋Œ€ ์ž„์„ ์„ค๋ช…ํ•˜์„ธ์š”. C++์—์„œ๋Š” ๋ณต์‚ฌ๊ฐ€ ๊ธฐ๋ณธ์ด๊ณ , `std::move` ๋ฅผ " "์ด์šฉํ•ด์•ผ๋งŒ (๊ทธ๋ฆฌ๊ณ  ์ด๋™ ์ƒ์„ฑ์ž๊ฐ€ ์ •์˜๋˜์–ด ์žˆ์–ด์•ผ๋งŒ!) ์†Œ์œ ๊ถŒ ์ด์ „์ด ๋ฉ๋‹ˆ๋‹ค." -#: src/ownership/move-semantics.md:24 +#: src/ownership/move-semantics.md:23 +msgid "" +"It is only the ownership that moves. Whether any machine code is generated " +"to manipulate the data itself is a matter of optimization, and such copies " +"are aggressively optimized away." +msgstr "" +"์‹ค์ œ๋กœ ์ด๋™๋˜๋Š” ๊ฒƒ์€ ์†Œ์œ ๊ถŒ์ผ ๋ฟ์ž…๋‹ˆ๋‹ค. ๋จธ์‹  ์ฝ”๋“œ ๋ ˆ๋ฒจ์—์„œ ๋ฐ์ดํ„ฐ ๋ณต์‚ฌ๊ฐ€ ์ผ์–ด" +"๋‚  ์ง€ ๋ง ์ง€์— ๋Œ€ํ•œ ๊ฒƒ์€ ์ปดํŒŒ์ผ๋Ÿฌ ๋‚ด๋ถ€์—์„œ ์ผ์–ด๋‚˜๋Š” ์ตœ์ ํ™” ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฐ ๋ณต" +"์‚ฌ๋Š” ์ตœ์ ํ™” ๊ณผ์ •์—์„œ ์ œ๊ฑฐ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค." + +#: src/ownership/move-semantics.md:25 +msgid "" +"Simple values (such as integers) can be marked `Copy` (see later slides)." +msgstr "" +"์ •์ˆ˜์™€ ๊ฐ™์€ ๊ฐ„๋‹จํ•œ ๊ฐ’๋“ค์€ `Copy` (๋’ค์— ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค)๋กœ ๋งˆํ‚น๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/ownership/move-semantics.md:27 msgid "In Rust, clones are explicit (by using `clone`)." msgstr "๋Ÿฌ์ŠคํŠธ์—์„œ๋Š” ๋ณต์‚ฌํ• ๋•Œ์—๋Š” ๋ช…์‹œ์ ์œผ๋กœ `clone`์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." @@ -4857,6 +5390,10 @@ msgstr "" "`- - - - - - - - - - - - - -'\n" "```" +#: src/ownership/double-free-modern-cpp.md:1 +msgid "Extra Work in Modern C++" +msgstr "Modern C++์—์„œ ์ด์ค‘ํ•ด์ œ ๋ฌธ์ œ" + #: src/ownership/double-free-modern-cpp.md:3 msgid "Modern C++ solves this differently:" msgstr "Modern C++์€ ์ด ๋ฌธ์ œ๋ฅผ ๋‹ค๋ฅด๊ฒŒ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค:" @@ -5228,15 +5765,17 @@ msgstr "์Šคํƒ์— ํ• ๋‹น๋œ ๊ฐ’์„ ๋ฆฌํ„ดํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•œ ์ฐธ๊ณ :" msgid "" "Demonstrate that the return from `add` is cheap because the compiler can " "eliminate the copy operation. Change the above code to print stack addresses " -"and run it on the [Playground](https://play.rust-lang.org/). In the " -"\"DEBUG\" optimization level, the addresses should change, while they stay " -"the same when changing to the \"RELEASE\" setting:" +"and run it on the [Playground](https://play.rust-lang.org/) or look at the " +"assembly in [Godbolt](https://rust.godbolt.org/). In the \"DEBUG\" " +"optimization level, the addresses should change, while they stay the same " +"when changing to the \"RELEASE\" setting:" msgstr "" "`add`์—์„œ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์€ ๋งค์šฐ ๊ฐ’์ด ์‹ธ๋‹ค๋Š” ๊ฒƒ์„ ์„ค๋ช…ํ•˜์„ธ์š”. ์™œ๋ƒํ•˜๋ฉด, ์ปดํŒŒ" "์ผ๋Ÿฌ๊ฐ€ ๋ณต์‚ฌ ๊ณผ์ •์„ ์ƒ๋žตํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์œ„ ์ฝ”๋“œ๋ฅผ ์Šคํƒ ์ฃผ์†Œ๋ฅผ ์ถœ๋ ฅํ•˜๋„" -"๋ก ์ˆ˜์ •ํ•˜๊ณ  [Playground](https://play.rust-lang.org/)์—์„œ ์ˆ˜ํ–‰ํ•ด ๋ณด์„ธ์š”. \"๋””" -"๋ฒ„๊ทธ\" ์ตœ์ ํ™” ๋ ˆ๋ฒจ์—์„œ๋Š” ์ฃผ์†Œ๊ฐ€ ๋ฐ”๋€Œ์ง€๋งŒ, \"๋ฆด๋ฆฌ์ฆˆ\" ๋ ˆ๋ฒจ์—์„œ๋Š” ๋ฐ”๋€Œ์ง€ ์•Š์Šต๋‹ˆ" -"๋‹ค:" +"๋ก ์ˆ˜์ •ํ•˜๊ณ  [Playground](https://play.rust-lang.org/)์—์„œ ์ˆ˜ํ–‰ํ•ด ๋ณด์„ธ์š”. ๋˜" +"๋Š” [Godbolt](https://rust.godbolt.org/)์—์„œ ์–ด์…ˆ๋ธ”๋ฆฌ๋ฅผ ํ™•์ธํ•ด ๋ณด์„ธ์š”. ์ตœ์ ํ™” " +"๋ ˆ๋ฒจ์ด \"DEBUG\" ์ผ ๋•Œ์—๋Š” ์ฃผ์†Œ๊ฐ€ ๋ฐ”๋€Œ์ง€๋งŒ, \"RELEASE\" ๋ ˆ๋ฒจ์—์„œ๋Š” ๋ฐ”๋€Œ์ง€ ์•Š" +"์Šต๋‹ˆ๋‹ค:" #: src/ownership/borrowing.md:30 msgid "" @@ -5250,7 +5789,7 @@ msgid "" " p\n" "}\n" "\n" -"fn main() {\n" +"pub fn main() {\n" " let p1 = Point(3, 4);\n" " let p2 = Point(10, 20);\n" " let p3 = add(&p1, &p2);\n" @@ -5269,7 +5808,7 @@ msgstr "" " p\n" "}\n" "\n" -"fn main() {\n" +"pub fn main() {\n" " let p1 = Point(3, 4);\n" " let p2 = Point(10, 20);\n" " let p3 = add(&p1, &p2);\n" @@ -5286,8 +5825,8 @@ msgstr "๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ๋ฐ˜ํ™˜๊ฐ’ ์ตœ์ ํ™”(RVO)๋ฅผ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ msgid "" "In C++, copy elision has to be defined in the language specification because " "constructors can have side effects. In Rust, this is not an issue at all. If " -"RVO did not happen, Rust will always performs a simple and efficient " -"`memcpy` copy." +"RVO did not happen, Rust will always perform a simple and efficient `memcpy` " +"copy." msgstr "" "C++์—์„œ copy elision์€ ์ƒ์„ฑ์ž์˜ ๋ถ€์ˆ˜ํšจ๊ณผ ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์–ด ์–ธ์–ด๋ ˆ๋ฒจ์˜ ์ •์˜๊ฐ€ ํ•„์š”" "ํ•˜์ง€๋งŒ ๋Ÿฌ์ŠคํŠธ์—์„œ๋Š” ๋ฌธ์ œ๊ฐ€ ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ RVO๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์œผ๋ฉด ๋Ÿฌ์ŠคํŠธ" @@ -5338,7 +5877,6 @@ msgstr "" "```" #: src/ownership/shared-unique-borrows.md:25 -#, fuzzy msgid "" "The above code does not compile because `a` is borrowed as mutable (through " "`c`) and as immutable (through `b`) at the same time." @@ -5347,7 +5885,6 @@ msgstr "" "๋™์‹œ์— `b`๋Š” `a`๋ฅผ ๋ถˆ๋ณ€ ๋ณ€์ˆ˜๋กœ ๋นŒ๋ ธ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." #: src/ownership/shared-unique-borrows.md:26 -#, fuzzy msgid "" "Move the `println!` statement for `b` before the scope that introduces `c` " "to make the code compile." @@ -5356,7 +5893,6 @@ msgstr "" "๋‹ค." #: src/ownership/shared-unique-borrows.md:27 -#, fuzzy msgid "" "After that change, the compiler realizes that `b` is only ever used before " "the new mutable borrow of `a` through `c`. This is a feature of the borrow " @@ -5364,21 +5900,14 @@ msgid "" msgstr "" "์ด๋ ‡๊ฒŒ ๋ฐ”๊พธ๋ฉด, ์ปดํŒŒ์ผ๋Ÿฌ๋Š” `c`๊ฐ€ `a`๋ฅผ ๊ฐ€๋ณ€ ๋ณ€์ˆ˜๋กœ ๋นŒ๋ฆฌ๊ธฐ ์ „์—๋งŒ `b`๊ฐ€ ์‚ฌ์šฉ๋œ" "๋‹ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋นŒ๋ฆผ ๊ฒ€์‚ฌ๊ธฐ์˜ ์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ์„ \"non-lexical " -"lifetime\" ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.\n" -"\n" -"๋‹จ์ˆœํžˆ ์Šค์ฝ”ํ”„๋งŒ ๋ณด๋ฉด `b`์˜ ์ˆ˜๋ช…์€ `main`ํ•จ์ˆ˜์˜ ์ „์ฒด๋ผ๊ณ  ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " -"๋•Œ๋ฌธ์— `c`์˜ ๋ธ”๋ก ์•ˆ์—์„œ๋Š” `a`์— ๋Œ€ํ•œ ๊ฐ€๋ณ€ ๋นŒ๋ฆผ๊ณผ ๋ถˆ๋ณ€ ๋นŒ๋ฆผ์ด ๋™์‹œ์— ์กด์žฌํ•˜" -"๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ ๋ณด์ด๋ฉฐ, ์ด๋Š” ์œ„ ์ œ์•ฝ ์กฐ๊ฑด์„ ์œ„๋ฐ˜ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ" -"๋Ÿฌ๋‚˜ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” `b`๊ฐ€ `c`๋ธ”๋ก์ด ์‹œ์ž‘๋˜๊ธฐ ์ „์—๋งŒ ์‚ฌ์šฉ๋œ๋‹ค๋Š” ์ ์„ ์ ๊ทน ํ™œ์šฉํ•ด" -"์„œ `b`์˜ ์ˆ˜๋ช…์„ `c`๋ธ”๋ก์˜ ์‹œ์ž‘ ์ „ ๊นŒ์ง€๋กœ ์ค„์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด `b`์™€ `c`์˜ ์ˆ˜๋ช…์€ " -"๊ฒน์น˜์ง€ ์•Š๊ณ , ๋”ฐ๋ผ์„œ ์ œ์•ฝ ์กฐ๊ฑด์„ ์œ„๋ฐ˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +"lifetime\" ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค." #: src/ownership/lifetimes.md:3 msgid "A borrowed value has a _lifetime_:" msgstr "๋นŒ๋ ค์˜จ ๊ฐ’์€ _์ˆ˜๋ช…_์„ ๊ฐ–์Šต๋‹ˆ๋‹ค:" #: src/ownership/lifetimes.md:5 -msgid "The lifetime can be elided: `add(p1: &Point, p2: &Point) -> Point`." +msgid "The lifetime can be implicit: `add(p1: &Point, p2: &Point) -> Point`." msgstr "์ˆ˜๋ช…์€ ์ƒ๋žตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: `add(p1: &Point, p2: &Point) -> Point`." #: src/ownership/lifetimes.md:6 @@ -5408,6 +5937,16 @@ msgstr "" "์ˆ˜๋ช… ํ‘œ๊ธฐ(`'`)์€ ์ˆ˜๋ช… ์ถ”๋ก ์‹œ ์ œ์•ฝ์กฐ๊ฑด์ด ๋ฉ๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ์ด ์ œ์•ฝ์กฐ๊ฑด์„ ๋งŒ์กฑ" "์‹œํ‚ค๋Š” ์œ ์š”ํ•œ ์ˆ˜๋ช…์„ ์ถ”๋ก ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ๊ฒ€์‚ฌ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค." +#: src/ownership/lifetimes.md:13 +msgid "" +"Lifetimes for function arguments and return values must be fully specified, " +"but Rust allows lifetimes to be elided in most cases with [a few simple " +"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html)." +msgstr "" +"์›๋ž˜, ํ•จ์ˆ˜์˜ ์ธ์ž์™€ ๋ฆฌํ„ด๊ฐ’์—๋Š” ์ˆ˜๋ช…์„ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ [๋ช‡ ๊ฐ€์ง€ ์กฐ๊ฑด]" +"(https://doc.rust-lang.org/nomicon/lifetime-elision.html)์„ ๋งŒ์กฑํ•˜๋Š” ๋Œ€๋ถ€๋ถ„" +"์˜ ๊ฒฝ์šฐ์—๋Š” ์ƒ๋žตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + #: src/ownership/lifetimes-function-calls.md:3 msgid "" "In addition to borrowing its arguments, a function can return a borrowed " @@ -5464,7 +6003,7 @@ msgstr "" #: src/ownership/lifetimes-function-calls.md:31 msgid "" -"Move the declaration of `p2` and `p3` into a a new scope (`{ ... }`), " +"Move the declaration of `p2` and `p3` into a new scope (`{ ... }`), " "resulting in the following code:" msgstr "`p2`์™€ `p3`๋ฅผ ์ƒˆ๋กœ์šด ๋ฒ”์œ„(`{...}`)๋กœ ์•„๋ž˜ ์ฝ”๋“œ์™€ ๊ฐ™์ด ์ด๋™ํ•ด ๋ด…๋‹ˆ๋‹ค:" @@ -5543,7 +6082,7 @@ msgstr "" #: src/ownership/lifetimes-function-calls.md:57 msgid "" -"Which one is it? The compiler needs to to know, so at the call site the " +"Which one is it? The compiler needs to know, so at the call site the " "returned reference is not used for longer than a variable from where the " "reference came from." msgstr "" @@ -5652,7 +6191,7 @@ msgstr "์ด๋ฒˆ ์—ฐ์Šต๋ฌธ์ œ๋Š” ์•„๋ž˜ ๋‘๊ฐ€์ง€์ž…๋‹ˆ๋‹ค:" #: src/exercises/day-1/afternoon.md:5 msgid "A small book library," -msgstr "์ž‘์€ ๋„์„œ๊ด€" +msgstr "์ž‘์€ ๋„์„œ๊ด€," #: src/exercises/day-1/afternoon.md:7 msgid "Iterators and ownership (hard)." @@ -5672,26 +6211,37 @@ msgid "" "fn main() {\n" " let mut vec = vec![10, 20];\n" " vec.push(30);\n" -" println!(\"middle value: {}\", vec[vec.len() / 2]);\n" -" for item in vec.iter() {\n" +" let midpoint = vec.len() / 2;\n" +" println!(\"middle value: {}\", vec[midpoint]);\n" +" for item in &vec {\n" " println!(\"item: {item}\");\n" " }\n" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut vec = vec![10, 20];\n" +" vec.push(30);\n" +" let midpoint = vec.len() / 2;\n" +" println!(\"middle value: {}\", vec[midpoint]);\n" +" for item in &vec {\n" +" println!(\"item: {item}\");\n" +" }\n" +"}\n" +"```" -#: src/exercises/day-1/book-library.md:17 +#: src/exercises/day-1/book-library.md:18 msgid "" -"Use this to create a library application. Copy the code below to and update the types to make it compile:" +"Use this to model a library's book collection. Copy the code below to " +" and update the types to make it compile:" msgstr "" -"๋„์„œ๊ด€ ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์— ๋ณต" -"์‚ฌํ•ด์„œ ๊ตฌํ˜„ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค:" +"์•„๋ž˜ ์ฝ”๋“œ๋Š” ๋„์„œ๊ด€์— ์žˆ๋Š” ๋„์„œ ์ปฌ๋ž™์…˜์„ ๋ชจ๋ธ๋ง ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์— ๋ณต์‚ฌํ•œ ํ›„, ์ปดํŒŒ์ผ ๋˜๋„๋ก ์ˆ˜์ •ํ•ด ๋ด…์‹œ๋‹ค:" -#: src/exercises/day-1/book-library.md:20 +#: src/exercises/day-1/book-library.md:21 msgid "" "```rust,should_panic\n" -"\n" "struct Library {\n" " books: Vec,\n" "}\n" @@ -5711,36 +6261,36 @@ msgid "" " }\n" "}\n" "\n" -"// This makes it possible to print Book values with {}.\n" -"impl std::fmt::Display for Book {\n" -" fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n" -" write!(f, \"{} ({})\", self.title, self.year)\n" -" }\n" -"}\n" -"\n" +"// Implement the methods below. Update the `self` parameter to\n" +"// indicate the method's required level of ownership over the object:\n" +"//\n" +"// - `&self` for shared read-only access,\n" +"// - `&mut self` for unique and mutable access,\n" +"// - `self` for unique access by value.\n" "impl Library {\n" " fn new() -> Library {\n" -" unimplemented!()\n" +" todo!(\"Initialize and return a `Library` value\")\n" " }\n" "\n" " //fn len(self) -> usize {\n" -" // unimplemented!()\n" +" // todo!(\"Return the length of `self.books`\")\n" " //}\n" "\n" " //fn is_empty(self) -> bool {\n" -" // unimplemented!()\n" +" // todo!(\"Return `true` if `self.books` is empty\")\n" " //}\n" "\n" " //fn add_book(self, book: Book) {\n" -" // unimplemented!()\n" +" // todo!(\"Add a new book to `self.books`\")\n" " //}\n" "\n" " //fn print_books(self) {\n" -" // unimplemented!()\n" +" // todo!(\"Iterate over `self.books` and each book's title and " +"year\")\n" " //}\n" "\n" " //fn oldest_book(self) -> Option<&Book> {\n" -" // unimplemented!()\n" +" // todo!(\"Return a reference to the oldest book (if any)\")\n" " //}\n" "}\n" "\n" @@ -5751,31 +6301,113 @@ msgid "" "fn main() {\n" " let library = Library::new();\n" "\n" -" //println!(\"Our library is empty: {}\", library.is_empty());\n" -"\n" -" let favorite_book = Book::new(\"Lord of the Rings\", 1954);\n" -" println!(\"Our favorite book {favorite_book} should go in the " -"library\");\n" -" //library.add_book(favorite_book);\n" +" //println!(\"The library is empty: library.is_empty() -> {}\", library." +"is_empty());\n" +" //\n" +" //library.add_book(Book::new(\"Lord of the Rings\", 1954));\n" " //library.add_book(Book::new(\"Alice's Adventures in Wonderland\", " "1865));\n" " //\n" +" //println!(\"The library is no longer empty: library.is_empty() -> {}\", " +"library.is_empty());\n" +" //\n" +" //\n" " //library.print_books();\n" " //\n" " //match library.oldest_book() {\n" -" // Some(book) => println!(\"My oldest book is {book}\"),\n" -" // None => println!(\"My library is empty!\"),\n" +" // Some(book) => println!(\"The oldest book is {}\", book.title),\n" +" // None => println!(\"The library is empty!\"),\n" " //}\n" " //\n" -" //println!(\"Our library has {} books\", library.len());\n" -" for book in library.books {\n" -" println!(\"{book}\");\n" -" }\n" +" //println!(\"The library has {} books\", library.len());\n" +" //library.print_books();\n" "}\n" "```" msgstr "" +"```rust,should_panic\n" +"struct Library {\n" +" books: Vec,\n" +"}\n" +"\n" +"struct Book {\n" +" title: String,\n" +" year: u16,\n" +"}\n" +"\n" +"impl Book {\n" +" // This is a constructor, used below.\n" +" fn new(title: &str, year: u16) -> Book {\n" +" Book {\n" +" title: String::from(title),\n" +" year,\n" +" }\n" +" }\n" +"}\n" +"\n" +"// Implement the methods below. Update the `self` parameter to\n" +"// indicate the method's required level of ownership over the object:\n" +"//\n" +"// - `&self` for shared read-only access,\n" +"// - `&mut self` for unique and mutable access,\n" +"// - `self` for unique access by value.\n" +"impl Library {\n" +" fn new() -> Library {\n" +" todo!(\"Initialize and return a `Library` value\")\n" +" }\n" +"\n" +" //fn len(self) -> usize {\n" +" // todo!(\"Return the length of `self.books`\")\n" +" //}\n" +"\n" +" //fn is_empty(self) -> bool {\n" +" // todo!(\"Return `true` if `self.books` is empty\")\n" +" //}\n" +"\n" +" //fn add_book(self, book: Book) {\n" +" // todo!(\"Add a new book to `self.books`\")\n" +" //}\n" +"\n" +" //fn print_books(self) {\n" +" // todo!(\"Iterate over `self.books` and each book's title and " +"year\")\n" +" //}\n" +"\n" +" //fn oldest_book(self) -> Option<&Book> {\n" +" // todo!(\"Return a reference to the oldest book (if any)\")\n" +" //}\n" +"}\n" +"\n" +"// This shows the desired behavior. Uncomment the code below and\n" +"// implement the missing methods. You will need to update the\n" +"// method signatures, including the \"self\" parameter! You may\n" +"// also need to update the variable bindings within main.\n" +"fn main() {\n" +" let library = Library::new();\n" +"\n" +" //println!(\"The library is empty: library.is_empty() -> {}\", library." +"is_empty());\n" +" //\n" +" //library.add_book(Book::new(\"Lord of the Rings\", 1954));\n" +" //library.add_book(Book::new(\"Alice's Adventures in Wonderland\", " +"1865));\n" +" //\n" +" //println!(\"The library is no longer empty: library.is_empty() -> {}\", " +"library.is_empty());\n" +" //\n" +" //\n" +" //library.print_books();\n" +" //\n" +" //match library.oldest_book() {\n" +" // Some(book) => println!(\"The oldest book is {}\", book.title),\n" +" // None => println!(\"The library is empty!\"),\n" +" //}\n" +" //\n" +" //println!(\"The library has {} books\", library.len());\n" +" //library.print_books();\n" +"}\n" +"```" -#: src/exercises/day-1/book-library.md:104 +#: src/exercises/day-1/book-library.md:102 msgid "[Solution](solutions-afternoon.md#designing-a-library)" msgstr "[ํ•ด๋‹ต](solutions-afternoon.md#designing-a-library)" @@ -5814,6 +6446,12 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"pub trait Iterator {\n" +" type Item;\n" +" fn next(&mut self) -> Option;\n" +"}\n" +"```" #: src/exercises/day-1/iterators-and-ownership.md:20 msgid "You use this trait like this:" @@ -5833,6 +6471,17 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let v: Vec = vec![10, 20, 30];\n" +" let mut iter = v.iter();\n" +"\n" +" println!(\"v[0]: {:?}\", iter.next());\n" +" println!(\"v[1]: {:?}\", iter.next());\n" +" println!(\"v[2]: {:?}\", iter.next());\n" +" println!(\"No more items: {:?}\", iter.next());\n" +"}\n" +"```" #: src/exercises/day-1/iterators-and-ownership.md:34 msgid "What is the type returned by the iterator? Test your answer here:" @@ -5888,6 +6537,14 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"pub trait IntoIterator {\n" +" type Item;\n" +" type IntoIter: Iterator;\n" +"\n" +" fn into_iter(self) -> Self::IntoIter;\n" +"}\n" +"```" #: src/exercises/day-1/iterators-and-ownership.md:62 msgid "" @@ -5897,7 +6554,7 @@ msgstr "`IntoIterator`์˜ ๋ชจ๋“  ๊ตฌํ˜„์€ ๋ฐ˜๋“œ์‹œ ๋‹ค์Œ์˜ ๋‘ ํƒ€์ž…์„ ์„  #: src/exercises/day-1/iterators-and-ownership.md:65 msgid "`Item`: the type we iterate over, such as `i8`," -msgstr "`Item`: `i8`๊ณผ ๊ฐ™์ด ๋ฐ˜๋ณต๋˜๋Š” ๊ฐ’์˜ ํƒ€์ž…" +msgstr "`Item`: `i8`๊ณผ ๊ฐ™์ด ๋ฐ˜๋ณต๋˜๋Š” ๊ฐ’์˜ ํƒ€์ž…," #: src/exercises/day-1/iterators-and-ownership.md:66 msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." @@ -5910,7 +6567,7 @@ msgid "" msgstr "" "`IntoIter`์—๋Š” `Item`์ด ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์Œ์„ ์ฃผ๋ชฉํ•˜์„ธ์š”. `IntoIter` ๋ฐ˜๋ณต์ž๋Š” " "`Item` ํƒ€์ž…์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€๋ฆฌ์ผœ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, ๋ฐ˜๋ณต์ž๋Š” `Option`์„ ๋ฆฌํ„ดํ•ฉ" -"๋‹ˆ๋‹ค." +"๋‹ˆ๋‹ค" #: src/exercises/day-1/iterators-and-ownership.md:71 msgid "Like before, what is the type returned by the iterator?" @@ -5929,6 +6586,16 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable,compile_fail\n" +"fn main() {\n" +" let v: Vec = vec![String::from(\"foo\"), String::" +"from(\"bar\")];\n" +" let mut iter = v.into_iter();\n" +"\n" +" let v0: Option<..> = iter.next();\n" +" println!(\"v0: {v0:?}\");\n" +"}\n" +"```" #: src/exercises/day-1/iterators-and-ownership.md:83 msgid "`for` Loops" @@ -5961,6 +6628,20 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let v: Vec = vec![String::from(\"foo\"), String::" +"from(\"bar\")];\n" +"\n" +" for word in &v {\n" +" println!(\"word: {word}\");\n" +" }\n" +"\n" +" for word in v {\n" +" println!(\"word: {word}\");\n" +" }\n" +"}\n" +"```" #: src/exercises/day-1/iterators-and-ownership.md:103 msgid "What is the type of `word` in each loop?" @@ -5970,15 +6651,15 @@ msgstr "๋งค ๋ฃจํ”„์—์„œ `word`์˜ ํƒ€์ž…์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?" msgid "" "Experiment with the code above and then consult the documentation for [`impl " "IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-%26%27a%20Vec%3CT%2C%20A%3E) and [`impl " -"IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-Vec%3CT%2C%20A%3E) to check your answers." +"html#impl-IntoIterator-for-%26'a+Vec%3CT,+A%3E) and [`impl IntoIterator for " +"Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-" +"for-Vec%3CT,+A%3E) to check your answers." msgstr "" -"์œ„ ์ฝ”๋“œ์—์„œ ์‹คํ—˜ ํ•ด ๋ณธ ํ›„ ๋‹ค์Œ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด์„œ ๋‹ต๋ณ€์„ ํ™•์ธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค: " +"์œ„ ์ฝ”๋“œ์—์„œ ์‹คํ—˜ ํ•ด ๋ณธ ํ›„, ๋‹ค์Œ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด์„œ ๋‹ต๋ณ€์„ ํ™•์ธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค:" "[`impl IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/struct." -"Vec.html#impl-IntoIterator-for-%26%27a%20Vec%3CT%2C%20A%3E), [`impl " -"IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -"html#impl-IntoIterator-for-Vec%3CT%2C%20A%3E)" +"Vec.html#impl-IntoIterator-for-%26'a+Vec%3CT,+A%3E), [`impl IntoIterator for " +"Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-" +"for-Vec%3CT%2C%20A%3E)" #: src/welcome-day-2.md:1 msgid "Welcome to Day 2" @@ -6069,43 +6750,49 @@ msgstr "" "}\n" "```" -#: src/structs.md:32 +#: src/structs.md:31 src/enums.md:34 src/enums/sizes.md:28 src/methods.md:30 +#: src/methods/example.md:46 src/pattern-matching.md:25 +#: src/pattern-matching/match-guards.md:22 src/control-flow/blocks.md:43 +msgid "Key Points:" +msgstr "ํ‚ค ํฌ์ธํŠธ:" + +#: src/structs.md:33 msgid "Structs work like in C or C++." msgstr "๊ตฌ์กฐ์ฒด๋Š” C/C++ ์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." -#: src/structs.md:33 +#: src/structs.md:34 msgid "Like in C++, and unlike in C, no typedef is needed to define a type." msgstr "" "C++ ์™€ ๊ฐ™์ง€๋งŒ C์™€๋Š” ๋‹ฌ๋ฆฌ ํƒ€์ž…์„ ์ •์˜ํ•˜๊ธฐ ์œ„ํ•ด 'typedef'๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." -#: src/structs.md:34 +#: src/structs.md:35 msgid "Unlike in C++, there is no inheritance between structs." msgstr "C++ ์™€ ๋‹ฌ๋ฆฌ ๊ตฌ์กฐ์ฒด ๊ฐ„ ์ƒ์†์€ ์—†์Šต๋‹ˆ๋‹ค." -#: src/structs.md:35 +#: src/structs.md:36 msgid "" "Methods are defined in an `impl` block, which we will see in following " "slides." msgstr "" "๋ฉ”์„œ๋“œ๋Š” `impl`๋ธ”๋ก์— ์ •์˜ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์Šฌ๋ผ์ด๋“œ์—์„œ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/structs.md:36 +#: src/structs.md:37 msgid "" "This may be a good time to let people know there are different types of " "structs. " msgstr "" -"์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ ๊ตฌ์กฐ์ฒด๊ฐ€ ์žˆ์Œ์„ ์•Œ๊ฒŒ ํ•˜๊ธฐ์— ์ข‹์€ ์‹œ๊ฐ„์ผ ๊ฒƒ์ž…๋‹ˆ๋‹ค." +"์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ ๊ตฌ์กฐ์ฒด๊ฐ€ ์žˆ์Œ์„ ์•Œ๊ฒŒ ํ•˜๊ธฐ์— ์ข‹์€ ์‹œ๊ฐ„์ผ ๊ฒƒ์ž…๋‹ˆ๋‹ค. " -#: src/structs.md:37 +#: src/structs.md:38 msgid "" "Zero-sized structs `e.g., struct Foo;` might be used when implementing a " "trait on some type but donโ€™t have any data that you want to store in the " "value itself. " msgstr "" "0 ํฌ๊ธฐ ๊ตฌ์กฐ์ฒด(์˜ˆ: `struct Foo;`)๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์ง€ ์•Š์ง€๋งŒ ํŠน์ • ํƒ€์ž…์˜ ํŠธ" -"๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•  ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." +"๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•  ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. " -#: src/structs.md:38 +#: src/structs.md:39 msgid "" "The next slide will introduce Tuple structs, used when the field names are " "not important." @@ -6113,7 +6800,7 @@ msgstr "" "๋‹ค์Œ ์Šฌ๋ผ์ด๋“œ์—์„œ๋Š” ํ•„๋“œ ์ด๋ฆ„์ด ๋œ ์ค‘์š”ํ•  ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํŠœํ”Œ ๊ตฌ์กฐ์ฒด๋ฅผ ์†Œ" "๊ฐœํ•ฉ๋‹ˆ๋‹ค." -#: src/structs.md:39 +#: src/structs.md:40 msgid "" "The syntax `..peter` allows us to copy the majority of the fields from the " "old struct without having to explicitly type it all out. It must always be " @@ -6197,19 +6884,19 @@ msgid "" "Newtypes are a great way to encode additional information about the value in " "a primitive type, for example:" msgstr "" -"๋‰ดํƒ€์ž…์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์›์‹œํƒ€์ž… ๊ฐ’์— ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋ฅผ ๋ถ€์—ฌํ•˜๋Š” ๋ฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." +"๋‰ดํƒ€์ž…์€ ๊ธฐ๋ณธ ํƒ€์ž…์— ๋ถ€๊ฐ€์ ์ธ ์˜๋ฏธ๋ฅผ ๋”ํ•˜๋Š” ์ข‹์€ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด:" #: src/structs/tuple-structs.md:38 msgid "The number is measured in some units: `Newtons` in the example above." -msgstr "๋‹จ์œ„ ํ‘œ์‹œ๋ฅผ ์œ„ํ•œ ์ˆซ์ž: ์œ„ ์˜ˆ์ œ์—์„œ๋Š” ๋‰ดํ„ด ๋‹จ์œ„ ํ‘œ๊ธฐ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." +msgstr "์ˆซ์ž๊ฐ’์— ๋‹จ์œ„๋ฅผ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Œ: ์œ„์—์„œ `Newtons`์ด ๊ทธ ์˜ˆ์ž…๋‹ˆ๋‹ค." #: src/structs/tuple-structs.md:39 msgid "" "The value passed some validation when it was created, so you no longer have " "to validate it again at every use: 'PhoneNumber(String)`or`OddNumber(u32)\\`." msgstr "" -"๊ฐ’์ด ์ƒ์„ฑ๋  ๋•Œ ์ด๋ฏธ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ํ†ต๊ณผ ํ–ˆ์œผ๋ฏ€๋กœ ์ถ”๊ฐ€์ ์ธ ๊ฒ€์‚ฌ๊ฐ€ ํ•„์š”์—†๋Š” ๊ฒฝ" -"์šฐ: `PhoneNumber(String)`๋˜๋Š” `OddNumber(u32)`" +"๊ฐ’์ด ์ƒ์„ฑ๋  ๋•Œ ์ด๋ฏธ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ํ†ต๊ณผ ํ–ˆ์œผ๋ฏ€๋กœ ์ถ”๊ฐ€์ ์ธ ๊ฒ€์‚ฌ๊ฐ€ ํ•„์š”์—†์Šต๋‹ˆ" +"๋‹ค: `PhoneNumber(String)`๋˜๋Š” `OddNumber(u32)`." #: src/structs/tuple-structs.md:40 msgid "" @@ -6222,13 +6909,21 @@ msgid "" "Rust generally doesnโ€™t like inexplicit things, like automatic unwrapping or " "for instance using booleans as integers." msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ๋Œ€์ฒด๋กœ ๋ถ„๋ช…ํ•˜์ง€ ์•Š์€ ๊ฒƒ์„ ์‹ซ์–ดํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ์ž๋™์œผ๋กœ unwrapํ•˜๊ฑฐ" -"๋‚˜ ๋ถˆ๋ฆฌ์–ธ ๊ฐ’์„ ์ •์ˆ˜ ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋“ค์ด ๊ทธ๋ ‡์Šต๋‹ˆ๋‹ค." +"๋Ÿฌ์ŠคํŠธ๋Š” ๋ถ„๋ช…ํ•˜์ง€ ์•Š์€ ๊ฒƒ์„ ์‹ซ์–ดํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ์ž๋™์œผ๋กœ unwrapํ•˜๊ฑฐ๋‚˜ ๋ถˆ๋ฆฌ" +"์–ธ ๊ฐ’์„ ์ •์ˆ˜ ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋“ค์ด ๊ทธ๋ ‡์Šต๋‹ˆ๋‹ค." #: src/structs/tuple-structs.md:42 -msgid "Operator overloading is discussed on Day 3 (generics). " +msgid "Operator overloading is discussed on Day 3 (generics)." msgstr "์—ฐ์‚ฐ์ž ์žฌ์ •์˜๋Š” 3์ผ์ฐจ ์ œ๋„ค๋ฆญ ๋ถ€๋ถ„์—์„œ ๋‹ค๋ฃน๋‹ˆ๋‹ค." +#: src/structs/tuple-structs.md:43 +msgid "" +"The example is a subtle reference to the [Mars Climate Orbiter](https://en." +"wikipedia.org/wiki/Mars_Climate_Orbiter) failure." +msgstr "" +"์ด๋Š” [ํ™”์„ฑ ๊ธฐํ›„ ๊ถค๋„์„  (Mars Climate Orbiter)](https://en.wikipedia.org/wiki/" +"Mars_Climate_Orbiter)์˜ ์‹คํŒจ ์›์ธ์œผ๋กœ ์ง€๋ชฉ๋œ ๋„๋Ÿ‰ํ˜• ์ž…๋ ฅ ์˜ค๋ฅ˜๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." + #: src/structs/field-shorthand.md:3 msgid "" "If you already have variables with the right names, then you can create the " @@ -6282,7 +6977,7 @@ msgid "" "The `new` function could be written using `Self` as a type, as it is " "interchangeable with the struct type name" msgstr "" -"`new`ํ•จ์ˆ˜๋ฅผ ๋‹ค์Œ์ฒ˜๋Ÿผ ๊ตฌ์กฐ์ฒด ์ด๋ฆ„ ๋Œ€์‹  `Self`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์„ฑํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค." +"`new`ํ•จ์ˆ˜๋ฅผ ๋‹ค์Œ์ฒ˜๋Ÿผ ๊ตฌ์กฐ์ฒด ์ด๋ฆ„ ๋Œ€์‹  `Self`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์„ฑํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค" #: src/structs/field-shorthand.md:29 msgid "" @@ -6338,11 +7033,11 @@ msgid "" "}\n" "fn create_default() {\n" " let tmp = Person {\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" " let tmp = Person {\n" " name: \"Sam\".to_string(),\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" "}\n" "```" @@ -6363,11 +7058,11 @@ msgstr "" "}\n" "fn create_default() {\n" " let tmp = Person {\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" " let tmp = Person {\n" " name: \"Sam\".to_string(),\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" "}\n" "```" @@ -6399,6 +7094,7 @@ msgstr "`enum` ํ‚ค์›Œ๋“œ๋Š” ๋ช‡๊ฐ€์ง€ ์œ ํ˜•(variant)์œผ๋กœ ํ‘œํ˜„๋˜๋Š” ํƒ€์ž… msgid "" "```rust,editable\n" "fn generate_random_number() -> i32 {\n" +" // Implementation based on https://xkcd.com/221/\n" " 4 // Chosen by fair dice roll. Guaranteed to be random.\n" "}\n" "\n" @@ -6422,49 +7118,68 @@ msgid "" "}\n" "```" msgstr "" - -#: src/enums.md:33 src/enums/sizes.md:29 src/methods.md:30 -#: src/methods/example.md:46 src/pattern-matching.md:25 -#: src/pattern-matching/match-guards.md:22 src/control-flow/blocks.md:42 -msgid "Key Points:" -msgstr "ํ‚ค ํฌ์ธํŠธ:" - -#: src/enums.md:35 -msgid "Enumerations allow you to collect a set of values under one type" -msgstr "์—ด๊ฑฐํ˜•์€ ๊ฐ’๋“ค์˜ ์ง‘ํ•ฉ์„ ํ•˜๋‚˜์˜ ํƒ€์ž…์œผ๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค." +"```rust,editable\n" +"fn generate_random_number() -> i32 {\n" +" // Implementation based on https://xkcd.com/221/\n" +" 4 // Chosen by fair dice roll. Guaranteed to be random.\n" +"}\n" +"\n" +"#[derive(Debug)]\n" +"enum CoinFlip {\n" +" Heads,\n" +" Tails,\n" +"}\n" +"\n" +"fn flip_coin() -> CoinFlip {\n" +" let random_number = generate_random_number();\n" +" if random_number % 2 == 0 {\n" +" return CoinFlip::Heads;\n" +" } else {\n" +" return CoinFlip::Tails;\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" println!(\"You got: {:?}\", flip_coin());\n" +"}\n" +"```" #: src/enums.md:36 -msgid "" -"This page offers an enum type `CoinFlip` with two variants `Heads` and " -"`Tail`. You might note the namespace when using variants." -msgstr "" -"์œ„์˜ `CoinFlip` ์—ด๊ฑฐํ˜• ํƒ€์ž…์€ `Heads`์™€ `Tail` ๋‘๊ฐ€์ง€ variant๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค. ์—ด" -"๊ฑฐํ˜• ํƒ€์ž…์˜ variant๋Š” ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ๋ถ™์—ฌ์„œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." +msgid "Enumerations allow you to collect a set of values under one type" +msgstr "์—ด๊ฑฐํ˜•์€ ๊ฐ’๋“ค์˜ ์ง‘ํ•ฉ์„ ํ•˜๋‚˜์˜ ํƒ€์ž…์œผ๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค" #: src/enums.md:37 -msgid "This might be a good time to compare Structs and Enums:" -msgstr "๊ตฌ์กฐ์ฒด์™€ ์—ด๊ฑฐํ˜•์„ ๋น„๊ตํ•ด ๋ณผ๊นŒ์š”?" +msgid "" +"This page offers an enum type `CoinFlip` with two variants `Heads` and " +"`Tails`. You might note the namespace when using variants." +msgstr "" +"์œ„์˜ `CoinFlip` ์—ด๊ฑฐํ˜• ํƒ€์ž…์€ `Heads`์™€ `Tail` ๋‘ ๊ฐ€์ง€ variant๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค. ์—ด" +"๊ฑฐํ˜• ํƒ€์ž…์˜ variant๋Š” ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ๋ถ™์—ฌ์„œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." #: src/enums.md:38 +msgid "This might be a good time to compare Structs and Enums:" +msgstr "๊ตฌ์กฐ์ฒด์™€ ์—ด๊ฑฐํ˜•์„ ๋น„๊ตํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค:" + +#: src/enums.md:39 msgid "" "In both, you can have a simple version without fields (unit struct) or one " "with different types of fields (variant payloads). " msgstr "" "๊ตฌ์กฐ์ฒด๋‚˜ ์—ด๊ฑฐํ˜• ๋ชจ๋‘, ํ•„๋“œ๊ฐ€ ํ•˜๋‚˜๋„ ์—†๋Š” ๋‹จ์ˆœํ•œ ํ˜•ํƒœ๋„ ๊ฐ€๋Šฅ ํ•˜๊ณ , ์—ฌ๋Ÿฌ ํƒ€์ž…" -"์˜ ํ•„๋“œ๋ฅผ ๊ฐ€์งˆ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค." +"์˜ ํ•„๋“œ๋ฅผ ๊ฐ€์งˆ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. " -#: src/enums.md:39 +#: src/enums.md:40 msgid "In both, associated functions are defined within an `impl` block." msgstr "๋‘˜ ๋‹ค ์—ฐ๊ด€ํ•จ์ˆ˜๋ฅผ `impl`๋ธ”๋ก์œผ๋กœ ์ •์˜ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/enums.md:40 +#: src/enums.md:41 msgid "" "You could even implement the different variants of an enum with separate " "structs but then they wouldnโ€™t be the same type as they would if they were " "all defined in an enum. " msgstr "" "์—ด๊ฑฐํ˜• ํƒ€์ž…์˜ ๊ฐ variant๋ฅผ ๋ณ„๋„์˜ ๊ตฌ์กฐ์ฒด๋กœ ์ •์˜ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ, ๊ทธ๋Ÿฌ๋ฉด ์—ด๊ฑฐํ˜•" -"์„ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ์ฒ˜๋Ÿผ ํ•˜๋‚˜์˜ ํƒ€์ž…์œผ๋กœ ์ทจ๊ธ‰ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค." +"์„ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ์ฒ˜๋Ÿผ ํ•˜๋‚˜์˜ ํƒ€์ž…์œผ๋กœ ์ทจ๊ธ‰ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. " #: src/enums/variant-payloads.md:3 msgid "" @@ -6562,7 +7277,7 @@ msgid "" msgstr "" "๊ฐ€์žฅ ์œ„์—์„œ ๋ถ€ํ„ฐ ์–ด๋–ค ํŒจํ„ด์ด ์ฃผ์–ด์ง„ ๊ฐ’๊ณผ ๋งค์นญํ•˜๋Š”์ง€ ๊ฒ€์‚ฌํ•œ ๋‹ค์Œ, ๋งค์นญ๋œ ๊ฒƒ์ด " "๋ฐœ๊ฒฌ๋˜๋ฉด ํ™”์‚ดํ‘œ๋ฅผ ๋”ฐ๋ผ ์ฝ”๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ํ•œ ๋ฒˆ ๋งค์นญ์ด ๋˜๊ณ  ์ฝ”๋“œ๊ฐ€ ์ˆ˜ํ–‰์ด ๋˜" -"๋ฉด, ๋”์ด์ƒ์˜ ๋งค์นญ์€ ์—†์Šต๋‹ˆ๋‹ค." +"๋ฉด, ๋”์ด์ƒ์˜ ๋งค์นญ์€ ์—†์Šต๋‹ˆ๋‹ค. " #: src/enums/variant-payloads.md:39 msgid "" @@ -6570,7 +7285,7 @@ msgid "" "the Rust compiler provides by confirming when all cases are handled. " msgstr "" "๋งค์นญ ํŒจํ„ด๋“ค์ด ๋ถˆ์ถฉ๋ถ„ ํ•˜๋‹ค๋ฉด ์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ์„ค๋ช…ํ•˜์„ธ์š”. ๋Ÿฌ์ŠคํŠธ ์ปดํŒŒ์ผ๋Ÿฌ" -"๋Š” ๋ชจ๋“  ๊ฐ€๋Šฅํ•œ ์ผ€์ด์Šค๋“ค์ด ํ•ธ๋“ค๋ง ๋˜๋Š”์ง€ ์ฒดํฌํ•œ๋‹ค๋Š” ์ ์„ ์ƒ๊ธฐ์‹œํ‚ค์„ธ์š”." +"๋Š” ๋ชจ๋“  ๊ฐ€๋Šฅํ•œ ์ผ€์ด์Šค๋“ค์ด ํ•ธ๋“ค๋ง ๋˜๋Š”์ง€ ์ฒดํฌํ•œ๋‹ค๋Š” ์ ์„ ์ƒ๊ธฐ์‹œํ‚ค์„ธ์š”. " #: src/enums/variant-payloads.md:40 msgid "`match` inspects a hidden discriminant field in the `enum`." @@ -6582,7 +7297,7 @@ msgstr "" msgid "" "It is possible to retrieve the discriminant by calling `std::mem::" "discriminant()`" -msgstr "`std::mem::discriminant()`๋ฅผ ์ด์šฉํ•˜์—ฌ ์‹๋ณ„์ž๋ฅผ ์–ป์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr "`std::mem::discriminant()`๋ฅผ ์ด์šฉํ•˜์—ฌ ์‹๋ณ„์ž๋ฅผ ์–ป์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค" #: src/enums/variant-payloads.md:42 msgid "" @@ -6614,13 +7329,12 @@ msgstr "" #: src/enums/sizes.md:5 msgid "" "```rust,editable\n" +"use std::any::type_name;\n" "use std::mem::{align_of, size_of};\n" "\n" -"macro_rules! dbg_size {\n" -" ($t:ty) => {\n" -" println!(\"{}: size {} bytes, align: {} bytes\",\n" -" stringify!($t), size_of::<$t>(), align_of::<$t>());\n" -" };\n" +"fn dbg_size() {\n" +" println!(\"{}: size {} bytes, align: {} bytes\",\n" +" type_name::(), size_of::(), align_of::());\n" "}\n" "\n" "enum Foo {\n" @@ -6629,18 +7343,17 @@ msgid "" "}\n" "\n" "fn main() {\n" -" dbg_size!(Foo);\n" +" dbg_size::();\n" "}\n" "```" msgstr "" "```rust,editable\n" +"use std::any::type_name;\n" "use std::mem::{align_of, size_of};\n" "\n" -"macro_rules! dbg_size {\n" -" ($t:ty) => {\n" -" println!(\"{}: size {} bytes, align: {} bytes\",\n" -" stringify!($t), size_of::<$t>(), align_of::<$t>());\n" -" };\n" +"fn dbg_size() {\n" +" println!(\"{}: size {} bytes, align: {} bytes\",\n" +" type_name::(), size_of::(), align_of::());\n" "}\n" "\n" "enum Foo {\n" @@ -6649,11 +7362,11 @@ msgstr "" "}\n" "\n" "fn main() {\n" -" dbg_size!(Foo);\n" +" dbg_size::();\n" "}\n" "```" -#: src/enums/sizes.md:25 +#: src/enums/sizes.md:24 msgid "" "See the [Rust Reference](https://doc.rust-lang.org/reference/type-layout." "html)." @@ -6661,8 +7374,7 @@ msgstr "" "์ž์„ธํ•œ ์‚ฌํ•ญ์€ [๊ณต์‹๋ฌธ์„œ](https://doc.rust-lang.org/reference/type-layout." "html)๋ฅผ ํ™•์ธํ•˜์„ธ์š”." -#: src/enums/sizes.md:31 -#, fuzzy +#: src/enums/sizes.md:30 msgid "" "Internally Rust is using a field (discriminant) to keep track of the enum " "variant." @@ -6670,14 +7382,12 @@ msgstr "" "๋Ÿฌ์ŠคํŠธ๋Š” ์—ด๊ฑฐํ˜• variant๋ฅผ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ๋‚ด๋ถ€์ ์œผ๋กœ ์‹๋ณ„์ž(discriminant) ํ•„๋“œ" "๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." -#: src/enums/sizes.md:33 -#, fuzzy +#: src/enums/sizes.md:32 msgid "" "You can control the discriminant if needed (e.g., for compatibility with C):" -msgstr "C์™€์˜ ์—ฐ๋™๊ณผ ๊ฐ™์€ ์ด์œ ๋กœ ์‹๋ณ„์ž๋ฅผ ์ง์ ‘ ์ง€์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค:" +msgstr "C์™€์˜ ์—ฐ๋™์„ ์œ„ํ•ด ์‹๋ณ„์ž ๊ฐ’์„ ์ง์ ‘ ์ง€์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/enums/sizes.md:35 -#, fuzzy +#: src/enums/sizes.md:34 msgid "" "```rust,editable\n" "#[repr(u32)]\n" @@ -6709,8 +7419,7 @@ msgstr "" "}\n" "```" -#: src/enums/sizes.md:50 -#, fuzzy +#: src/enums/sizes.md:49 msgid "" "Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " "bytes." @@ -6718,62 +7427,62 @@ msgstr "" "`repr` ์†์„ฑ์ด ์—†๋‹ค๋ฉด 10001์ด 2 ๋ฐ”์ดํŠธ๋กœ ํ‘œํ˜„๊ฐ€๋Šฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์‹๋ณ„์ž์˜ ํƒ€์ž… ํฌ" "๊ธฐ๋Š” 2 ๋ฐ”์ดํŠธ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค." -#: src/enums/sizes.md:54 -#, fuzzy +#: src/enums/sizes.md:53 msgid "Try out other types such as" -msgstr "๋‹ค๋ฅธ ํƒ€์ž…๋“ค๋„ ํ™•์ธํ•ด๋ณด์„ธ์š”." +msgstr "๋‹ค๋ฅธ ํƒ€์ž…๋“ค๋„ ํ™•์ธํ•ด๋ณด์„ธ์š”" + +#: src/enums/sizes.md:55 +msgid "`dbg_size!(bool)`: size 1 bytes, align: 1 bytes," +msgstr "`dbg_size!(bool)`: ํฌ๊ธฐ 1 ๋ฐ”์ดํŠธ, ์ •๋ ฌ: 1 ๋ฐ”์ดํŠธ," #: src/enums/sizes.md:56 -#, fuzzy -msgid "`dbg_size!(bool)`: size 1 bytes, align: 1 bytes," -msgstr "`dbg_size!(bool)`: size 1 bytes, align: 1 bytes" - -#: src/enums/sizes.md:57 -#, fuzzy msgid "" "`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (niche optimization, " "see below)," msgstr "" -"`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (๋‹ˆ์น˜ ์ตœ์ ํ™”, ์•„๋ž˜ ์„ค" -"๋ช… ์ฐธ์กฐ)" +"`dbg_size!(Option)`: ํฌ๊ธฐ 1 ๋ฐ”์ดํŠธ, ์ •๋ ฌ: 1 ๋ฐ”์ดํŠธ (๋‹ˆ์น˜ ์ตœ์ ํ™”, ์•„๋ž˜ " +"์„ค๋ช… ์ฐธ์กฐ)" + +#: src/enums/sizes.md:57 +msgid "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," +msgstr "`dbg_size!(&i32)`: ํฌ๊ธฐ 8 ๋ฐ”์ดํŠธ, ์ •๋ ฌ: 8 ๋ฐ”์ดํŠธ (64๋น„ํŠธ ๋จธ์‹ ์ธ ๊ฒฝ์šฐ)" #: src/enums/sizes.md:58 -#, fuzzy -msgid "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," -msgstr "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (64๋น„ํŠธ ๋จธ์‹ ์ธ ๊ฒฝ์šฐ)" - -#: src/enums/sizes.md:59 -#, fuzzy msgid "" "`dbg_size!(Option<&i32>)`: size 8 bytes, align: 8 bytes (null pointer " "optimization, see below)." msgstr "" -"`dbg_size!(Option<&i32>)`: size 8 bytes, align: 8 bytes (๋„ํฌ์ธํ„ฐ ์ตœ์ ํ™”, ์•„" +"`dbg_size!(Option<&i32>)`: ํฌ๊ธฐ 8 ๋ฐ”์ดํŠธ, ์ •๋ ฌ: 8 ๋ฐ”์ดํŠธ (๋„ํฌ์ธํ„ฐ ์ตœ์ ํ™”, ์•„" "๋ž˜ ์„ค๋ช… ์ฐธ์กฐ)" -#: src/enums/sizes.md:61 -#, fuzzy +#: src/enums/sizes.md:60 msgid "" -"Niche optimization: Rust will merge use unused bit patterns for the enum " +"Niche optimization: Rust will merge unused bit patterns for the enum " "discriminant." msgstr "" "๋‹ˆ์น˜ ์ตœ์ ํ™”: ๋Ÿฌ์ŠคํŠธ๋Š” ์—ด๊ฑฐํ˜• ์‹๋ณ„์ž๋ฅผ ์‚ฌ์šฉ๋˜์ง€ ์•Š์€ ๋น„ํŠธ ํŒจํ„ด๊ณผ ๋ณ‘ํ•ฉํ•ฉ๋‹ˆ๋‹ค." -#: src/enums/sizes.md:64 +#: src/enums/sizes.md:63 msgid "" "Null pointer optimization: For [some types](https://doc.rust-lang.org/std/" "option/#representation), Rust guarantees that `size_of::()` equals " "`size_of::>()`." msgstr "" +"๋„ํฌ์ธํ„ฐ ์ตœ์ ํ™”: [์–ด๋–ค ํƒ€์ž…๋“ค](https://doc.rust-lang.org/std/option/" +"#representation)์— ๋Œ€ํ•ด์„œ ๋Ÿฌ์ŠคํŠธ๋Š” `size_of::()`๊ฐ€ `size_of::" +">()`์™€ ๊ฐ™์€ ๊ฒƒ์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." -#: src/enums/sizes.md:68 +#: src/enums/sizes.md:67 msgid "" "Example code if you want to show how the bitwise representation _may_ look " "like in practice. It's important to note that the compiler provides no " "guarantees regarding this representation, therefore this is totally unsafe." msgstr "" +"์‹ค์ œ๋กœ ๋„ํฌ์ธํ„ฐ ์ตœ์ ํ™”๊ฐ€ ์ ์šฉ๋œ ๊ฒƒ์„ ํ™•์ธํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์•„๋ž˜์˜ ์˜ˆ์ œ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜" +"์„ธ์š”. ์ฃผ์˜ํ•  ์ ์€, ์—ฌ๊ธฐ์—์„œ ๋ณด์—ฌ์ฃผ๋Š” ๋น„ํŠธ ํŒจํ„ด์ด ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๋ณด์žฅํ•ด ์ฃผ๋Š” ๊ฒƒ์€ " +"์•„๋‹ˆ๋ผ๋Š” ์ ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์— ์˜์กดํ•˜๋Š” ๊ฒƒ์€ ์™„์ „ํžˆ unsafeํ•ฉ๋‹ˆ๋‹ค." -#: src/enums/sizes.md:71 +#: src/enums/sizes.md:70 msgid "" "```rust,editable\n" "use std::mem::transmute;\n" @@ -6811,14 +7520,51 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"use std::mem::transmute;\n" +"\n" +"macro_rules! dbg_bits {\n" +" ($e:expr, $bit_type:ty) => {\n" +" println!(\"- {}: {:#x}\", stringify!($e), transmute::<_, " +"$bit_type>($e));\n" +" };\n" +"}\n" +"\n" +"fn main() {\n" +" // TOTALLY UNSAFE. Rust provides no guarantees about the bitwise\n" +" // representation of types.\n" +" unsafe {\n" +" println!(\"Bitwise representation of bool\");\n" +" dbg_bits!(false, u8);\n" +" dbg_bits!(true, u8);\n" +"\n" +" println!(\"Bitwise representation of Option\");\n" +" dbg_bits!(None::, u8);\n" +" dbg_bits!(Some(false), u8);\n" +" dbg_bits!(Some(true), u8);\n" +"\n" +" println!(\"Bitwise representation of Option>\");\n" +" dbg_bits!(Some(Some(false)), u8);\n" +" dbg_bits!(Some(Some(true)), u8);\n" +" dbg_bits!(Some(None::), u8);\n" +" dbg_bits!(None::>, u8);\n" +"\n" +" println!(\"Bitwise representation of Option<&i32>\");\n" +" dbg_bits!(None::<&i32>, usize);\n" +" dbg_bits!(Some(&0i32), usize);\n" +" }\n" +"}\n" +"```" -#: src/enums/sizes.md:106 +#: src/enums/sizes.md:105 msgid "" "More complex example if you want to discuss what happens when we chain more " "than 256 `Option`s together." msgstr "" +"์•„๋ž˜๋Š” ์ข€ ๋” ๋ณต์žกํ•œ ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค. 256๊ฐœ ์ด์ƒ์˜ `Option`์ด ์ค‘์ฒฉ๋˜์–ด ์—ฐ๊ฒฐ๋˜์–ด ์žˆ" +"์„ ๊ฒฝ์šฐ ์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." -#: src/enums/sizes.md:108 +#: src/enums/sizes.md:107 msgid "" "```rust,editable\n" "#![recursion_limit = \"1000\"]\n" @@ -6870,6 +7616,55 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"#![recursion_limit = \"1000\"]\n" +"\n" +"use std::mem::transmute;\n" +"\n" +"macro_rules! dbg_bits {\n" +" ($e:expr, $bit_type:ty) => {\n" +" println!(\"- {}: {:#x}\", stringify!($e), transmute::<_, " +"$bit_type>($e));\n" +" };\n" +"}\n" +"\n" +"// Macro to wrap a value in 2^n Some() where n is the number of \"@\" " +"signs.\n" +"// Increasing the recursion limit is required to evaluate this macro.\n" +"macro_rules! many_options {\n" +" ($value:expr) => { Some($value) };\n" +" ($value:expr, @) => {\n" +" Some(Some($value))\n" +" };\n" +" ($value:expr, @ $($more:tt)+) => {\n" +" many_options!(many_options!($value, $($more)+), $($more)+)\n" +" };\n" +"}\n" +"\n" +"fn main() {\n" +" // TOTALLY UNSAFE. Rust provides no guarantees about the bitwise\n" +" // representation of types.\n" +" unsafe {\n" +" assert_eq!(many_options!(false), Some(false));\n" +" assert_eq!(many_options!(false, @), Some(Some(false)));\n" +" assert_eq!(many_options!(false, @@), " +"Some(Some(Some(Some(false)))));\n" +"\n" +" println!(\"Bitwise representation of a chain of 128 Option's.\");\n" +" dbg_bits!(many_options!(false, @@@@@@@), u8);\n" +" dbg_bits!(many_options!(true, @@@@@@@), u8);\n" +"\n" +" println!(\"Bitwise representation of a chain of 256 Option's.\");\n" +" dbg_bits!(many_options!(false, @@@@@@@@), u16);\n" +" dbg_bits!(many_options!(true, @@@@@@@@), u16);\n" +"\n" +" println!(\"Bitwise representation of a chain of 257 Option's.\");\n" +" dbg_bits!(many_options!(Some(false), @@@@@@@@), u16);\n" +" dbg_bits!(many_options!(Some(true), @@@@@@@@), u16);\n" +" dbg_bits!(many_options!(None::, @@@@@@@@), u16);\n" +" }\n" +"}\n" +"```" #: src/methods.md:3 msgid "" @@ -6947,13 +7742,13 @@ msgstr "" "ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฉ”์„œ๋“œ๋“ค์ด ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ์œ„์น˜์— ๋ชจ์—ฌ ์žˆ์œผ๋‹ˆ ์ฐพ๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค." #: src/methods.md:34 -msgid "Point out the use of the keyword `self`, a method receiver. " +msgid "Point out the use of the keyword `self`, a method receiver." msgstr "๋ฉ”์„œ๋“œ receiver์ธ `self` ํ‚ค์›Œ๋“œ ์‚ฌ์šฉ์„ ์–ธ๊ธ‰ํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." #: src/methods.md:35 msgid "" -"Show that it is an abbreviated term for `self:&Self` and perhaps show how " -"the struct name could also be used. " +"Show that it is an abbreviated term for `self: Self` and perhaps show how " +"the struct name could also be used." msgstr "" "์˜ˆ์ œ์˜ ๊ฒฝ์šฐ `self: &Self`์˜ ์ค„์ธ ๋ฒ„์ „์ž„์„ ์•Œ๋ ค์ฃผ๊ณ , ๊ตฌ์กฐ์ฒด์˜ ์ด๋ฆ„์„ ์ง์ ‘ ์‚ฌ์šฉ" "ํ•˜๋ฉด ์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€ ๋ณด์—ฌ์ฃผ๋Š” ๊ฒƒ๋„ ์ข‹์Šต๋‹ˆ๋‹ค." @@ -7015,22 +7810,20 @@ msgid "" "`self`: takes ownership of the object and moves it away from the caller. The " "method becomes the owner of the object. The object will be dropped " "(deallocated) when the method returns, unless its ownership is explicitly " -"transmitted." +"transmitted. Complete ownership does not automatically mean mutability." msgstr "" "`self`: ํ˜ธ์ถœ์ž๋กœ๋ถ€ํ„ฐ ๊ฐ์ฒด์˜ ์†Œ์œ ๊ถŒ์„ ๊ฐ€์ ธ์˜ค๊ณ  ๊ฐ์ฒด๋Š” ํ˜ธ์ถœ์ž๋กœ๋ถ€ํ„ฐ ๋ฉ”์†Œ๋“œ๋กœ ์ด" "๋™๋ฉ๋‹ˆ๋‹ค. ๋ฉ”์†Œ๋“œ๊ฐ€ ๊ฐ์ฒด๋ฅผ ์†Œ์œ ํ•˜๊ฒŒ ๋˜๋ฉฐ ๋”ฐ๋ผ์„œ ๋ช…์‹œ์ ์œผ๋กœ ์†Œ์œ ๊ถŒ์„ ๋‹ค๋ฅธ ๊ณณ์œผ" "๋กœ ์ „๋‹ฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋ฉ”์„œ๋“œ ์ข…๋ฃŒ์™€ ํ•จ๊ป˜ ๊ฐ์ฒด๋Š” drop(ํ•ด์ œ)๋ฉ๋‹ˆ๋‹ค." #: src/methods/receiver.md:14 -msgid "" -"`mut self`: same as above, but while the method owns the object, it can " -"mutate it too. Complete ownership does not automatically mean mutability." +msgid "`mut self`: same as above, but the method can mutate the object. " msgstr "" "`mut self`: ์œ„์™€ ๋™์ผํ•˜์ง€๋งŒ ๋ฉ”์„œ๋“œ๊ฐ€ ๊ฐ์ฒด์˜ ์†Œ์œ ๊ถŒ์„ ๊ฐ€์ง€๋ฉด์„œ ๋™์‹œ์— ๊ฐ์ฒด๋ฅผ " "์ˆ˜์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์†Œ์œ ๊ถŒ์„ ๊ฐ€์ง€๋Š” ๊ฒƒ์ด ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•˜๋Š” ๊ฒƒ์€ ์•„" -"๋‹™๋‹ˆ๋‹ค." +"๋‹™๋‹ˆ๋‹ค. " -#: src/methods/receiver.md:16 +#: src/methods/receiver.md:15 msgid "" "No receiver: this becomes a static method on the struct. Typically used to " "create constructors which are called `new` by convention." @@ -7038,7 +7831,7 @@ msgstr "" "๋ฆฌ์‹œ๋ฒ„ ์—†์Œ: ๊ตฌ์กฐ์ฒด์˜ ์ •์  ๋ฉ”์„œ๋“œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์ฃผ๋กœ ์ƒ์„ฑ์ž๋ฅผ ๋งŒ๋“ค๋•Œ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜" "๋ฉฐ, ์ƒ์„ฑ์ž๋Š” ํ”ํžˆ `new`๋ผ๊ณ  ์ด๋ฆ„๋ถ™์ž…๋‹ˆ๋‹ค." -#: src/methods/receiver.md:19 +#: src/methods/receiver.md:18 msgid "" "Beyond variants on `self`, there are also [special wrapper types](https://" "doc.rust-lang.org/reference/special-types-and-traits.html) allowed to be " @@ -7048,7 +7841,7 @@ msgstr "" "์šฉ๋˜๋Š” [ํŠน๋ณ„ํ•œ ๋ž˜ํผ ํƒ€์ž…](https://doc.rust-lang.org/reference/special-types-" "and-traits.html)์ด ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/methods/receiver.md:25 +#: src/methods/receiver.md:24 msgid "" "Consider emphasizing \"shared and immutable\" and \"unique and mutable\". " "These constraints always come together in Rust due to borrow checker rules, " @@ -7150,14 +7943,14 @@ msgstr "" #: src/methods/example.md:47 msgid "All four methods here use a different method receiver." -msgstr "4๊ฐ€์ง€ ์œ ํ˜•์˜ ๋ฉ”์„œ๋“œ receiver์— ๋Œ€ํ•ด ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค." +msgstr "์ด ๋„ค ๊ฐœ์˜ ๋ฉ”์„œ๋“œ๋Š” ์„œ๋กœ ๋‹ค๋ฅธ ์œ ํ˜•์˜ ๋ฆฌ์‹œ๋ฒ„๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." #: src/methods/example.md:48 msgid "" "You can point out how that changes what the function can do with the " "variable values and if/how it can be used again in `main`." msgstr "" -"receiver ์œ ํ˜•์— ๋”ฐ๋ผ ํ•จ์ˆ˜๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋Š” ์ผ์ด ๋‹ฌ๋ผ์ง€๊ณ , ๋˜ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ ๋’ค " +"๋ฆฌ์‹œ๋ฒ„์˜ ์œ ํ˜•์— ๋”ฐ๋ผ ํ•จ์ˆ˜๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋Š” ์ผ์ด ๋‹ฌ๋ผ์ง€๊ณ , ๋˜ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•œ ๋’ค " "`main`์—์„œ ํ•ด๋‹น ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋„ ๋‹ฌ๋ผ์ง„๋‹ค๋Š” ์ ์„ ๊ฐ•์กฐํ•˜์„ธ์š”." #: src/methods/example.md:49 @@ -7233,23 +8026,23 @@ msgstr "`_`ํŒจํ„ด์€ ์–ด๋–ค ๊ฐ’๊ณผ๋„ ๋งค์นญ๋˜๋Š” ์™€์ผ๋“œ์นด๋“œ์ž…๋‹ˆ๋‹ค." msgid "" "You might point out how some specific characters are being used when in a " "pattern" -msgstr "ํŒจํ„ด์—์„œ ์‚ฌ์šฉ๋˜๋Š” ํŠน์ˆ˜ ๋ฌธ์ž๋“ค์„ ์•Œ๋ ค์ฃผ์„ธ์š”." +msgstr "ํŒจํ„ด์—์„œ ์‚ฌ์šฉ๋˜๋Š” ํŠน์ˆ˜ ๋ฌธ์ž๋“ค์„ ์•Œ๋ ค์ฃผ์„ธ์š”" #: src/pattern-matching.md:27 msgid "`|` as an `or`" -msgstr "`|`: or ๊ธฐํ˜ธ์ž…๋‹ˆ๋‹ค." +msgstr "`|`: or ๊ธฐํ˜ธ์ž…๋‹ˆ๋‹ค" #: src/pattern-matching.md:28 msgid "`..` can expand as much as it needs to be" -msgstr "`..`: ํ•„์š”ํ•œ ๋งŒํผ ํ™•์žฅํ•ฉ๋‹ˆ๋‹ค." +msgstr "`..`: ํ•„์š”ํ•œ ๋งŒํผ ํ™•์žฅํ•ฉ๋‹ˆ๋‹ค" #: src/pattern-matching.md:29 msgid "`1..=5` represents an inclusive range" -msgstr "`1..=5`: ๋ ๊ฐ’(์—ฌ๊ธฐ์„œ๋Š” 5)์„ ํฌํ•จํ•˜๋Š” ๋ฒ”์œ„๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค." +msgstr "`1..=5`: ๋ ๊ฐ’(์—ฌ๊ธฐ์„œ๋Š” 5)์„ ํฌํ•จํ•˜๋Š” ๋ฒ”์œ„๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค" #: src/pattern-matching.md:30 msgid "`_` is a wild card" -msgstr "`_`: ์™€์ผ๋“œ์นด๋“œ์ž…๋‹ˆ๋‹ค." +msgstr "`_`: ์™€์ผ๋“œ์นด๋“œ์ž…๋‹ˆ๋‹ค" #: src/pattern-matching.md:31 msgid "" @@ -7400,13 +8193,11 @@ msgstr "" #: src/pattern-matching/destructuring-structs.md:23 msgid "Change the literal values in `foo` to match with the other patterns." -msgstr "" -"`foo` ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ์— ์‚ฌ์šฉ๋œ ๋ฆฌํ„ฐ๋Ÿด ๊ฐ’์„ ๋ณ€๊ฒฝํ•ด์„œ ๋‹ค๋ฅธ ํŒจํ„ด์— ๋งค์น˜๋˜๋„๋ก ํ•ด๋ณด" -"์„ธ์š”." +msgstr "`foo`์˜ ๋ฆฌํ„ฐ๋Ÿด ๊ฐ’์„ ๋‹ค๋ฅธ ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋„๋ก ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค." #: src/pattern-matching/destructuring-structs.md:24 msgid "Add a new field to `Foo` and make changes to the pattern as needed." -msgstr "`Foo` ๊ตฌ์กฐ์ฒด์— ์ƒˆ ํ•„๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ํŒจํ„ด๋„ ๋ฐ”๊ฟ”๋ณด์„ธ์š”." +msgstr "`Foo`์— ์ƒˆ ํ•„๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ํ•„์š”์— ๋”ฐ๋ผ ํŒจํ„ด์„ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค." #: src/pattern-matching/destructuring-structs.md:25 msgid "" @@ -7497,7 +8288,7 @@ msgstr "" #: src/pattern-matching/destructuring-arrays.md:41 msgid "Create a new pattern using `_` to represent an element. " -msgstr "`_`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์š”์†Œ๋ฅผ ๋งค์นญํ•˜๋Š” ํŒจํ„ด์„ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”." +msgstr "`_`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์š”์†Œ๋ฅผ ๋งค์นญํ•˜๋Š” ํŒจํ„ด์„ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”. " #: src/pattern-matching/destructuring-arrays.md:42 msgid "Add more values to the array." @@ -7512,7 +8303,7 @@ msgstr "`..`๊ฐ€ ์š”์†Œ ๊ฐœ์ˆ˜์— ์ƒ๊ด€์—†์ด ๋งค์น˜๋  ์ˆ˜ ์žˆ์Œ์„ ์•Œ๋ ค์ฃผ #: src/pattern-matching/destructuring-arrays.md:44 msgid "Show matching against the tail with patterns `[.., b]` and `[a@..,b]`" msgstr "" -"`[.., b]`๋‚˜ `[a@.., b]`์™€ ๊ฐ™์€ ํŒจํ„ด์œผ๋กœ ๊ผฌ๋ฆฌ ๋ถ€๋ถ„์„ ๋งค์นญํ•˜๋Š” ๊ฒƒ์„ ๋ณด์—ฌ์ฃผ์„ธ์š”." +"`[.., b]`๋‚˜ `[a@.., b]`์™€ ๊ฐ™์€ ํŒจํ„ด์œผ๋กœ ๊ผฌ๋ฆฌ ๋ถ€๋ถ„์„ ๋งค์นญํ•˜๋Š” ๊ฒƒ์„ ๋ณด์—ฌ์ฃผ์„ธ์š”" #: src/pattern-matching/match-guards.md:3 msgid "" @@ -7628,14 +8419,28 @@ msgid "" "// TODO: remove this when you're done with your implementation.\n" "#![allow(unused_variables, dead_code)]\n" "\n" -"struct User {\n" +"pub struct User {\n" " name: String,\n" " age: u32,\n" -" weight: f32,\n" +" height: f32,\n" +" visit_count: usize,\n" +" last_blood_pressure: Option<(u32, u32)>,\n" +"}\n" +"\n" +"pub struct Measurements {\n" +" height: f32,\n" +" blood_pressure: (u32, u32),\n" +"}\n" +"\n" +"pub struct HealthReport<'a> {\n" +" patient_name: &'a str,\n" +" visit_count: u32,\n" +" height_change: f32,\n" +" blood_pressure_change: Option<(i32, i32)>,\n" "}\n" "\n" "impl User {\n" -" pub fn new(name: String, age: u32, weight: f32) -> Self {\n" +" pub fn new(name: String, age: u32, height: f32) -> Self {\n" " unimplemented!()\n" " }\n" "\n" @@ -7647,7 +8452,11 @@ msgid "" " unimplemented!()\n" " }\n" "\n" -" pub fn weight(&self) -> f32 {\n" +" pub fn height(&self) -> f32 {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn doctor_visits(&self) -> u32 {\n" " unimplemented!()\n" " }\n" "\n" @@ -7655,7 +8464,12 @@ msgid "" " unimplemented!()\n" " }\n" "\n" -" pub fn set_weight(&mut self, new_weight: f32) {\n" +" pub fn set_height(&mut self, new_height: f32) {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn visit_doctor(&mut self, measurements: Measurements) -> " +"HealthReport {\n" " unimplemented!()\n" " }\n" "}\n" @@ -7666,9 +8480,9 @@ msgid "" "}\n" "\n" "#[test]\n" -"fn test_weight() {\n" +"fn test_height() {\n" " let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" -" assert_eq!(bob.weight(), 155.2);\n" +" assert_eq!(bob.height(), 155.2);\n" "}\n" "\n" "#[test]\n" @@ -7678,8 +8492,128 @@ msgid "" " bob.set_age(33);\n" " assert_eq!(bob.age(), 33);\n" "}\n" +"\n" +"#[test]\n" +"fn test_visit() {\n" +" let mut bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.doctor_visits(), 0);\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (120, 80),\n" +" });\n" +" assert_eq!(report.patient_name, \"Bob\");\n" +" assert_eq!(report.visit_count, 1);\n" +" assert_eq!(report.blood_pressure_change, None);\n" +"\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (115, 76),\n" +" });\n" +"\n" +" assert_eq!(report.visit_count, 2);\n" +" assert_eq!(report.blood_pressure_change, Some((-5, -4)));\n" +"}\n" "```" msgstr "" +"```rust,should_panic\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub struct User {\n" +" name: String,\n" +" age: u32,\n" +" height: f32,\n" +" visit_count: usize,\n" +" last_blood_pressure: Option<(u32, u32)>,\n" +"}\n" +"\n" +"pub struct Measurements {\n" +" height: f32,\n" +" blood_pressure: (u32, u32),\n" +"}\n" +"\n" +"pub struct HealthReport<'a> {\n" +" patient_name: &'a str,\n" +" visit_count: u32,\n" +" height_change: f32,\n" +" blood_pressure_change: Option<(i32, i32)>,\n" +"}\n" +"\n" +"impl User {\n" +" pub fn new(name: String, age: u32, height: f32) -> Self {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn name(&self) -> &str {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn age(&self) -> u32 {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn height(&self) -> f32 {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn doctor_visits(&self) -> u32 {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn set_age(&mut self, new_age: u32) {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn set_height(&mut self, new_height: f32) {\n" +" unimplemented!()\n" +" }\n" +"\n" +" pub fn visit_doctor(&mut self, measurements: Measurements) -> " +"HealthReport {\n" +" unimplemented!()\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" println!(\"I'm {} and my age is {}\", bob.name(), bob.age());\n" +"}\n" +"\n" +"#[test]\n" +"fn test_height() {\n" +" let bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.height(), 155.2);\n" +"}\n" +"\n" +"#[test]\n" +"fn test_set_age() {\n" +" let mut bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.age(), 32);\n" +" bob.set_age(33);\n" +" assert_eq!(bob.age(), 33);\n" +"}\n" +"\n" +"#[test]\n" +"fn test_visit() {\n" +" let mut bob = User::new(String::from(\"Bob\"), 32, 155.2);\n" +" assert_eq!(bob.doctor_visits(), 0);\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (120, 80),\n" +" });\n" +" assert_eq!(report.patient_name, \"Bob\");\n" +" assert_eq!(report.visit_count, 1);\n" +" assert_eq!(report.blood_pressure_change, None);\n" +"\n" +" let report = bob.visit_doctor(Measurements {\n" +" height: 156.1,\n" +" blood_pressure: (115, 76),\n" +" });\n" +"\n" +" assert_eq!(report.visit_count, 2);\n" +" assert_eq!(report.blood_pressure_change, Some((-5, -4)));\n" +"}\n" +"```" #: src/exercises/day-2/points-polygons.md:1 msgid "Polygon Struct" @@ -7805,6 +8739,113 @@ msgid "" "fn main() {}\n" "```" msgstr "" +"```rust\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub struct Point {\n" +" // add fields\n" +"}\n" +"\n" +"impl Point {\n" +" // add methods\n" +"}\n" +"\n" +"pub struct Polygon {\n" +" // add fields\n" +"}\n" +"\n" +"impl Polygon {\n" +" // add methods\n" +"}\n" +"\n" +"pub struct Circle {\n" +" // add fields\n" +"}\n" +"\n" +"impl Circle {\n" +" // add methods\n" +"}\n" +"\n" +"pub enum Shape {\n" +" Polygon(Polygon),\n" +" Circle(Circle),\n" +"}\n" +"\n" +"#[cfg(test)]\n" +"mod tests {\n" +" use super::*;\n" +"\n" +" fn round_two_digits(x: f64) -> f64 {\n" +" (x * 100.0).round() / 100.0\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_magnitude() {\n" +" let p1 = Point::new(12, 13);\n" +" assert_eq!(round_two_digits(p1.magnitude()), 17.69);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_dist() {\n" +" let p1 = Point::new(10, 10);\n" +" let p2 = Point::new(14, 13);\n" +" assert_eq!(round_two_digits(p1.dist(p2)), 5.00);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_point_add() {\n" +" let p1 = Point::new(16, 16);\n" +" let p2 = p1 + Point::new(-4, 3);\n" +" assert_eq!(p2, Point::new(12, 19));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_left_most_point() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +" assert_eq!(poly.left_most_point(), Some(p1));\n" +" }\n" +"\n" +" #[test]\n" +" fn test_polygon_iter() {\n" +" let p1 = Point::new(12, 13);\n" +" let p2 = Point::new(16, 16);\n" +"\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(p1);\n" +" poly.add_point(p2);\n" +"\n" +" let points = poly.iter().cloned().collect::>();\n" +" assert_eq!(points, vec![Point::new(12, 13), Point::new(16, 16)]);\n" +" }\n" +"\n" +" #[test]\n" +" fn test_shape_perimeters() {\n" +" let mut poly = Polygon::new();\n" +" poly.add_point(Point::new(12, 13));\n" +" poly.add_point(Point::new(17, 11));\n" +" poly.add_point(Point::new(16, 16));\n" +" let shapes = vec![\n" +" Shape::from(poly),\n" +" Shape::from(Circle::new(Point::new(10, 20), 5)),\n" +" ];\n" +" let perimeters = shapes\n" +" .iter()\n" +" .map(Shape::perimeter)\n" +" .map(round_two_digits)\n" +" .collect::>();\n" +" assert_eq!(perimeters, vec![15.48, 31.42]);\n" +" }\n" +"}\n" +"\n" +"#[allow(dead_code)]\n" +"fn main() {}\n" +"```" #: src/exercises/day-2/points-polygons.md:117 msgid "" @@ -7848,13 +8889,13 @@ msgstr "" #: src/control-flow/blocks.md:3 msgid "" -"A block in Rust has a value and a type: the value is the last expression of " -"the block:" +"A block in Rust contains a sequence of expressions. Each block has a value " +"and a type, which are those of the last expression of the block:" msgstr "" "๋Ÿฌ์ŠคํŠธ์—์„œ ๋ธ”๋ก์€ ๊ฐ’๊ณผ ํƒ€์ž…์„ ๊ฐ–์Šต๋‹ˆ๋‹ค. ๋ธ”๋ก์˜ ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์ด ๋ธ”๋ก์˜ ๊ฐ’์ด ๋ฉ" "๋‹ˆ๋‹ค:" -#: src/control-flow/blocks.md:6 +#: src/control-flow/blocks.md:7 msgid "" "```rust,editable\n" "fn main() {\n" @@ -7894,7 +8935,15 @@ msgstr "" "}\n" "```" -#: src/control-flow/blocks.md:25 +#: src/control-flow/blocks.md:26 +msgid "" +"If the last expression ends with `;`, then the resulting value and type is " +"`()`." +msgstr "" +"์œ„์˜ `main` ํ•จ์ˆ˜๋Š” ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์ด `;`๋กœ ๋๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ˜ํ™˜๋˜๋Š” ๊ฐ’๊ณผ ํƒ€์ž…์ด " +"`()`์ž…๋‹ˆ๋‹ค." + +#: src/control-flow/blocks.md:28 msgid "" "The same rule is used for functions: the value of the function body is the " "return value:" @@ -7902,7 +8951,7 @@ msgstr "" "ํ•จ์ˆ˜์—๋„ ๋™์ผํ•œ ๊ทœ์น™์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. ํ•จ์ˆ˜ ๋ฐ”๋””๋ฅผ ์ด๋ฃจ๋Š” ๋ธ”๋ก์˜ ๊ฐ’์ด ๋ฐ˜ํ™˜๊ฐ’์ด ๋ฉ" "๋‹ˆ๋‹ค:" -#: src/control-flow/blocks.md:28 +#: src/control-flow/blocks.md:31 msgid "" "```rust,editable\n" "fn double(x: i32) -> i32 {\n" @@ -7924,22 +8973,14 @@ msgstr "" "}\n" "```" -#: src/control-flow/blocks.md:38 -msgid "" -"However if the last expression ends with `;`, then the resulting value and " -"type is `()`." -msgstr "" -"์œ„์˜ `main` ํ•จ์ˆ˜๋Š” ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์ด `;`๋กœ ๋๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ˜ํ™˜๋˜๋Š” ๊ฐ’๊ณผ ํƒ€์ž…์ด " -"`()`์ž…๋‹ˆ๋‹ค." - -#: src/control-flow/blocks.md:43 +#: src/control-flow/blocks.md:44 msgid "" "The point of this slide is to show that blocks have a type and value in " "Rust. " msgstr "" -"๋Ÿฌ์ŠคํŠธ์—์„œ๋Š” ๋ธ”๋ก์ด ํƒ€์ž…๊ณผ ๊ฐ’์„ ๊ฐ€์ง„๋‹ค๋Š” ์ ์ด ์ด ์Šฌ๋ผ์ด๋“œ์˜ ํ•ต์‹ฌ์ž…๋‹ˆ๋‹ค." +"๋Ÿฌ์ŠคํŠธ์—์„œ๋Š” ๋ธ”๋ก์ด ํƒ€์ž…๊ณผ ๊ฐ’์„ ๊ฐ€์ง„๋‹ค๋Š” ์ ์ด ์ด ์Šฌ๋ผ์ด๋“œ์˜ ํ•ต์‹ฌ์ž…๋‹ˆ๋‹ค. " -#: src/control-flow/blocks.md:44 +#: src/control-flow/blocks.md:45 msgid "" "You can show how the value of the block changes by changing the last line in " "the block. For instance, adding/removing a semicolon or using a `return`." @@ -7952,8 +8993,12 @@ msgid "`if` expressions" msgstr "`if` ํ‘œํ˜„์‹" #: src/control-flow/if-expressions.md:3 -msgid "You use `if` very similarly to how you would in other languages:" -msgstr "`if`๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค:" +msgid "" +"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/" +"if-expr.html#if-expressions) exactly like `if` statements in other languages:" +msgstr "" +"๋‹ค๋ฅธ ์–ธ์–ด์˜ `if` ๋ฌธ๊ณผ ๋˜‘๊ฐ™์ด [`if` ํ‘œํ˜„์‹](https://doc.rust-lang.org/" +"reference/expressions/if-expr.html#if-expressions)์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค:" #: src/control-flow/if-expressions.md:7 msgid "" @@ -7979,9 +9024,10 @@ msgstr "" "}\n" "```" -#: src/control-flow/if-expressions.md:16 +#: src/control-flow/if-expressions.md:18 msgid "" -"In addition, you can use it as an expression. This does the same as above:" +"In addition, you can use `if` as an expression. The last expression of each " +"block becomes the value of the `if` expression:" msgstr "" "๊ฒŒ๋‹ค๊ฐ€ `if`๋Š” ํ‘œํ˜„์‹์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋Š” ์œ„์™€ ๋™์ผํ•ฉ๋‹ˆ๋‹ค:" @@ -8009,7 +9055,7 @@ msgstr "" "}\n" "```" -#: src/control-flow/if-expressions.md:31 +#: src/control-flow/if-expressions.md:35 msgid "" "Because `if` is an expression and must have a particular type, both of its " "branch blocks must have the same type. Consider showing what happens if you " @@ -8024,9 +9070,14 @@ msgid "`if let` expressions" msgstr "`if let` ํ‘œํ˜„์‹" #: src/control-flow/if-let-expressions.md:3 -msgid "If you want to match a value against a pattern, you can use `if let`:" +msgid "" +"The [`if let` expression](https://doc.rust-lang.org/reference/expressions/if-" +"expr.html#if-let-expressions) lets you execute different code depending on " +"whether a value matches a pattern:" msgstr "" -"์–ด๋–ค ๊ฐ’์ด ํŒจํ„ด์— ๋งค์น˜๋˜๋Š”์ง€ ๊ฒ€์‚ฌํ•˜๋ ค๋ฉด `if let` ํ‘œํ˜„์‹์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค:" +"[`if let` ํ‘œํ˜„์‹](https://doc.rust-lang.org/reference/expressions/if-expr." +"html#if-let-expressions)์„ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ’์ด ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š”์ง€์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์ฝ”๋“œ" +"๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" #: src/control-flow/if-let-expressions.md:7 msgid "" @@ -8052,50 +9103,85 @@ msgstr "" "}\n" "```" -#: src/control-flow/if-let-expressions.md:16 +#: src/control-flow/if-let-expressions.md:18 #: src/control-flow/while-let-expressions.md:21 -#: src/control-flow/match-expressions.md:22 +#: src/control-flow/match-expressions.md:23 msgid "" "See [pattern matching](../pattern-matching.md) for more details on patterns " "in Rust." msgstr "ํŒจํ„ด์— ๊ด€ํ•œ ์„ค๋ช…์€ [ํŒจํ„ด ๋งค์นญ](../pattern-matching.md)์„ ์ฐธ์กฐํ•˜์„ธ์š”." -#: src/control-flow/if-let-expressions.md:21 #: src/control-flow/if-let-expressions.md:23 msgid "" -"`if let` can be more concise than `match`, e.g., when only one case is " -"interesting. In contrast, `match` requires all branches to be covered." +"Unlike `match`, `if let` does not have to cover all branches. This can make " +"it more concise than `match`." msgstr "" -"`if let`์€ `match`๋ณด๋‹ค ๋” ๊ฐ„๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํŠน์ •ํ•œ ๊ฒฝ์šฐ๋งŒ ๊ณ ๋ คํ•˜" -"๊ณ  ์‹ถ๋”๋ผ๋„ `match`๋Š” ๋ชจ๋“  ๋ถ„๊ธฐ๋ฅผ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." +"`if let`์ด `match`๋ณด๋‹ค ๋” ๊ฐ„๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(์˜ˆ: ํ•œ๊ฐ€์ง€ ๋ธŒ๋žœ์น˜๋งŒ ํฅ๋ฏธ๋กœ์šด ๊ฒฝ" +"์šฐ). ์ด์™€ ๋‹ฌ๋ฆฌ `match`์—์„œ๋Š” ๋ชจ๋“  ๋ธŒ๋žœ์น˜๊ฐ€ ์ฒ˜๋ฆฌ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." -#: src/control-flow/if-let-expressions.md:22 -msgid "" -"For the similar use case consider demonstrating a newly stabilized [`let " -"else`](https://github.com/rust-lang/rust/pull/93628) feature." -msgstr "" -"๋น„์Šทํ•œ ์‚ฌ์šฉ๋ก€๋กœ ์ƒˆ๋กญ๊ฒŒ \"stable\" ๋ฆด๋ฆฌ์ฆˆ ๋œ [`let else`](https://github.com/" -"rust-lang/rust/pull/93628) ๊ธฐ๋Šฅ์„ ์‹œ์—ฐํ•˜๋Š” ๊ฒƒ๋„ ๊ณ ๋ คํ•ด ๋ณด์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." - -#: src/control-flow/if-let-expressions.md:23 #: src/control-flow/if-let-expressions.md:24 msgid "A common usage is handling `Some` values when working with `Option`." -msgstr "" -"์ผ๋ฐ˜์ ์œผ๋กœ `Option`์œผ๋กœ ์ž‘์—…ํ•  ๋•Œ `Some` ๊ฐ’์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์‹์œผ๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค." +msgstr "์ผ๋ฐ˜์  ์‚ฌ์šฉ๋ฒ•์€ `Option`์„ ์‚ฌ์šฉํ•  ๋•Œ `Some` ๊ฐ’์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." -#: src/control-flow/if-let-expressions.md:24 #: src/control-flow/if-let-expressions.md:25 msgid "" "Unlike `match`, `if let` does not support guard clauses for pattern matching." -msgstr "`match`์™€ ๋‹ค๋ฅด๊ฒŒ `if let` ํŒจํ„ด ๋งค์นญ์—์„œ๋Š” ๊ฐ€๋“œ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +msgstr "" +"`match`์™€ ๋‹ฌ๋ฆฌ `if let`์€ ํŒจํ„ด ์ผ์น˜๋ฅผ ์œ„ํ•œ ๋ณดํ˜ธ ์ ˆ์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/control-flow/if-let-expressions.md:26 +msgid "" +"Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" +"flow_control/let_else.html) construct allows to do a destructuring " +"assignment, or if it fails, execute a block which is required to abort " +"normal control flow (with `panic`/`return`/`break`/`continue`):" +msgstr "" +"1.65๋ถ€ํ„ฐ ์œ ์‚ฌํ•œ [let-else](https://doc.rust-lang.org/rust-by-example/" +"flow_control/let_else.html) ๊ตฌ์„ฑ์€ ๋””์ŠคํŠธ๋Ÿญ์ฒ˜๋ง ํ• ๋‹น์„ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ ์‹คํŒจํ•  ๊ฒฝ" +"์šฐ ๋ฐ˜ํ™˜๋˜์ง€ ์•Š๋Š” ๋ธ”๋ก ๋ธŒ๋žœ์น˜(panic/return/break/continue)๋ฅผ ๋ณด์œ ํ•˜๋„๋ก ํ—ˆ์šฉํ•ฉ" +"๋‹ˆ๋‹ค:" + +#: src/control-flow/if-let-expressions.md:28 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" +"}\n" +" \n" +"fn second_word_to_upper(s: &str) -> Option {\n" +" let mut it = s.split(' ');\n" +" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" +" return None;\n" +" };\n" +" Some(item.to_uppercase())\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"fn main() {\n" +" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" +"}\n" +" \n" +"fn second_word_to_upper(s: &str) -> Option {\n" +" let mut it = s.split(' ');\n" +" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" +" return None;\n" +" };\n" +" Some(item.to_uppercase())\n" +"}\n" +"```" #: src/control-flow/while-expressions.md:1 -msgid "`while` expressions" -msgstr "`while` ํ‘œํ˜„์‹" +msgid "`while` loops" +msgstr "`while` ๋ฐ˜๋ณต๋ฌธ" #: src/control-flow/while-expressions.md:3 -msgid "The `while` keyword works very similar to other languages:" -msgstr "`while` ์—ญ์‹œ ๋‹ค๋ฅธ ์–ธ์–ด๊ณผ ๋งค์šฐ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค:" +msgid "" +"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#predicate-loops) works very similar to other languages:" +msgstr "" +"[`while` ํ‚ค์›Œ๋“œ](https://doc.rust-lang.org/reference/expressions/loop-expr." +"html#predicate-loops)๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งค์šฐ ๋น„์Šทํ•˜๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค:" #: src/control-flow/while-expressions.md:6 msgid "" @@ -8128,14 +9214,17 @@ msgstr "" "```" #: src/control-flow/while-let-expressions.md:1 -msgid "`while let` expressions" -msgstr "`while let` ํ‘œํ˜„์‹" +msgid "`while let` loops" +msgstr "`while let` ๋ฐ˜๋ณต๋ฌธ" #: src/control-flow/while-let-expressions.md:3 msgid "" -"Like with `if`, there is a `while let` variant which repeatedly tests a " -"value against a pattern:" -msgstr "`if`์™€ ๋™์ผํ•˜๊ฒŒ `while let`๊ตฌ๋ฌธ ์—ญ์‹œ ํŒจํ„ด๋งค์นญ์— ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +"Like with `if let`, there is a [`while let`](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which " +"repeatedly tests a value against a pattern:" +msgstr "" +"๋งˆ์ง€๋ง‰์œผ๋กœ, ๋ฌดํ•œ ๋ฃจํ”„๋ฅผ ๋งŒ๋“œ๋Š” [`loop` ํ‚ค์›Œ๋“œ](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#infinite-loops)๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค:" #: src/control-flow/while-let-expressions.md:6 msgid "" @@ -8163,7 +9252,7 @@ msgstr "" #: src/control-flow/while-let-expressions.md:17 msgid "" -"Here the iterator returned by `v.iter()` will return a `Option` on " +"Here the iterator returned by `v.into_iter()` will return a `Option` on " "every call to `next()`. It returns `Some(x)` until it is done, after which " "it will return `None`. The `while let` lets us keep iterating through all " "items." @@ -8172,13 +9261,13 @@ msgstr "" "ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ณต์ž๊ฐ€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€๋Š” `Some(x)`๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  ๋งˆ์ง€๋ง‰์—” `None`์„ ๋ฐ˜" "ํ™˜ํ•ฉ๋‹ˆ๋‹ค. `while let`์„ ํ†ตํ•ด ๋ฐ˜๋ณต์ž์˜ ๋ชจ๋“  ์•„์ดํ…œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/control-flow/while-let-expressions.md:27 +#: src/control-flow/while-let-expressions.md:26 msgid "" "Point out that the `while let` loop will keep going as long as the value " "matches the pattern." msgstr "`while let`์€ ๊ฐ’์ด ํŒจํ„ด์— ๋งค์น˜๋˜๋Š” ๋™์•ˆ ๊ณ„์†๋ฉ๋‹ˆ๋‹ค." -#: src/control-flow/while-let-expressions.md:28 +#: src/control-flow/while-let-expressions.md:27 msgid "" "You could rewrite the `while let` loop as an infinite loop with an if " "statement that breaks when there is no value to unwrap for `iter.next()`. " @@ -8189,19 +9278,19 @@ msgstr "" "๋ฒ•์  ํŽธ์˜๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." #: src/control-flow/for-expressions.md:1 -msgid "`for` expressions" -msgstr "`for` ํ‘œํ˜„์‹" +msgid "`for` loops" +msgstr "`for` ๋ฐ˜๋ณต๋ฌธ" #: src/control-flow/for-expressions.md:3 msgid "" -"The `for` expression is closely related to the `while let` expression. It " -"will automatically call `into_iter()` on the expression and then iterate " -"over it:" +"The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) is closely " +"related to the [`while let` loop](while-let-expressions.md). It will " +"automatically call `into_iter()` on the expression and then iterate over it:" msgstr "" -"`for`ํ‘œํ˜„์‹์€ `while let` ํ‘œํ˜„์‹๊ณผ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. `for`ํ‘œํ˜„์‹์€ ์ž๋™์œผ๋กœ " +"`for` ๋ฐ˜๋ณต๋ฌธ์€ `while let` ๋ฐ˜๋ณต๋ฌธ๊ณผ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. `for` ๋ฐ˜๋ณต๋ฌธ์€ ์ž๋™์œผ๋กœ " "`into_iter()`๋ฅผ ํ˜ธ์ถœํ•œ ๋‹ค์Œ ์ด๋ฅผ ๋ฐ˜๋ณตํ•ฉ๋‹ˆ๋‹ค:" -#: src/control-flow/for-expressions.md:6 +#: src/control-flow/for-expressions.md:7 msgid "" "```rust,editable\n" "fn main() {\n" @@ -8231,27 +9320,27 @@ msgstr "" "}\n" "```" -#: src/control-flow/for-expressions.md:20 +#: src/control-flow/for-expressions.md:21 msgid "You can use `break` and `continue` here as usual." msgstr "๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ `break` ์™€ `continue`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/control-flow/for-expressions.md:24 -msgid "Index iteration is not a special syntax in Rust for just that case." -msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ์ธ๋ฑ์Šค ๋ฐ˜๋ณต์„ ์œ„ํ•ด ๋ณ„๋„์˜ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. " - #: src/control-flow/for-expressions.md:25 +msgid "Index iteration is not a special syntax in Rust for just that case." +msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ์ธ๋ฑ์Šค ๊ธฐ๋ฐ˜์˜ ๋ฐ˜๋ณต์„ ์œ„ํ•œ ๋ณ„๋„์˜ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/control-flow/for-expressions.md:26 msgid "`(0..10)` is a range that implements an `Iterator` trait. " msgstr "`(0..10)`์€ `Iterator` ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฒ”์œ„(range) ๊ฐ’์ž…๋‹ˆ๋‹ค. " -#: src/control-flow/for-expressions.md:26 +#: src/control-flow/for-expressions.md:27 msgid "" "`step_by` is a method that returns another `Iterator` that skips every other " "element. " msgstr "" "`step_by`๋Š” ๋ฐ˜๋ณต์ž์˜ ์š”์†Œ๋“ค์„ ๊ฑด๋„ˆ๋›ฐ๋Š” ๋˜๋‹ค๋ฅธ `Iterator`๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋ฉ”์„œ๋“œ์ž…" -"๋‹ˆ๋‹ค." +"๋‹ˆ๋‹ค. " -#: src/control-flow/for-expressions.md:27 +#: src/control-flow/for-expressions.md:28 msgid "" "Modify the elements in the vector and explain the compiler errors. Change " "vector `v` to be mutable and the for loop to `for x in v.iter_mut()`." @@ -8265,11 +9354,15 @@ msgstr "`loop` ํ‘œํ˜„์‹" #: src/control-flow/loop-expressions.md:3 msgid "" -"Finally, there is a `loop` keyword which creates an endless loop. Here you " -"must either `break` or `return` to stop the loop:" +"Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#infinite-loops) which creates an endless loop." msgstr "" -"๋งˆ์ง€๋ง‰์œผ๋กœ `loop`ํ‚ค์›Œ๋“œ๋Š” ๋ฌดํ•œ ๋ฃจํ”„๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ฐ˜๋“œ์‹œ `break` ๋˜๋Š” " -"`return`์„ ์‚ฌ์šฉํ•ด์„œ ๋ฃจํ”„๋ฅผ ์ •์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:" +"๋งˆ์ง€๋ง‰์œผ๋กœ, ๋ฌดํ•œ ๋ฃจํ”„๋ฅผ ๋งŒ๋“œ๋Š” [`loop` ํ‚ค์›Œ๋“œ](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#infinite-loops)๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/control-flow/loop-expressions.md:6 +msgid "Here you must either `break` or `return` to stop the loop:" +msgstr "๋”ฐ๋ผ์„œ ๋ฐ˜๋“œ์‹œ `break` ๋˜๋Š” `return`์„ ์‚ฌ์šฉํ•ด์„œ ๋ฃจํ”„๋ฅผ ์ •์ง€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:" #: src/control-flow/loop-expressions.md:8 msgid "" @@ -8307,11 +9400,19 @@ msgstr "" "}\n" "```" -#: src/control-flow/loop-expressions.md:25 #: src/control-flow/loop-expressions.md:27 msgid "Break the `loop` with a value (e.g. `break 8`) and print it out." +msgstr "`loop`๋ฅผ ๊ฐ’(์˜ˆ: `break 8`)์œผ๋กœ ๋‚˜๋ˆ„๊ณ  ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค." + +#: src/control-flow/loop-expressions.md:28 +msgid "" +"Note that `loop` is the only looping construct which returns a non-trivial " +"value. This is because it's guaranteed to be entered at least once (unlike " +"`while` and `for` loops)." msgstr "" -"`loop` ๋ธ”๋ก์„ ๋น ์ ธ๋‚˜์˜ฌ ๋•Œ `break 8`์ฒ˜๋Ÿผ ๊ฐ’์„ ์ง€์ •ํ•˜๊ณ  ๊ทธ๊ฑธ ์ถœ๋ ฅํ•ด๋ณด์„ธ์š”." +"`loop`๋Š” non-trivial ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ์œ ์ผํ•œ ๋ฐ˜๋ณต๋ฌธ์ž…๋‹ˆ๋‹ค. ์ด๋Š” `while` ๋ฐ " +"`for` ๋ฐ˜๋ณต๋ฌธ๊ณผ ๋‹ฌ๋ฆฌ ์ตœ์†Œํ•œ ํ•œ ๋ฒˆ์€ ๋ฃจํ”„๋ฌธ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ" +"๋‹ค." #: src/control-flow/match-expressions.md:1 msgid "`match` expressions" @@ -8319,13 +9420,14 @@ msgstr "`match` ํ‘œํ˜„์‹" #: src/control-flow/match-expressions.md:3 msgid "" -"The `match` keyword is used to match a value against one or more patterns. " -"In that sense, it works like a series of `if let` expressions:" +"The [`match` keyword](https://doc.rust-lang.org/reference/expressions/match-" +"expr.html) is used to match a value against one or more patterns. In that " +"sense, it works like a series of `if let` expressions:" msgstr "" "`match`ํ‚ค์›Œ๋“œ๋Š” ์–ด๋–ค ๊ฐ’์„ ํ•˜๋‚˜ ์ด์ƒ์˜ ํŒจํ„ด์— ๋Œ€ํ•ด ๋งค์น˜ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ทธ" "๋Ÿฐ ๋ฉด์—์„œ `if let` ํ‘œํ˜„์‹์„ ์—ฌ๋Ÿฌ๊ฐœ ์ด์–ด ๋†“์€ ๊ฒƒ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" -#: src/control-flow/match-expressions.md:6 +#: src/control-flow/match-expressions.md:7 msgid "" "```rust,editable\n" "fn main() {\n" @@ -8353,7 +9455,7 @@ msgstr "" "}\n" "```" -#: src/control-flow/match-expressions.md:19 +#: src/control-flow/match-expressions.md:20 msgid "" "Like `if let`, each match arm must have the same type. The type is the last " "expression of the block, if any. In the example above, the type is `()`." @@ -8362,15 +9464,15 @@ msgstr "" "์ด๋ผ๋ฉด ๋ธ”๋ก์˜ ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์ด ๊ทธ ํƒ€์ž…์ด ๋ฉ๋‹ˆ๋‹ค. ์œ„์˜ ์˜ˆ์ œ์—์„œ ๋งค์น˜ ํ‘œํ˜„์‹์˜ " "ํƒ€์ž…์€ `()`์ž…๋‹ˆ๋‹ค." -#: src/control-flow/match-expressions.md:27 +#: src/control-flow/match-expressions.md:28 msgid "Save the match expression to a variable and print it out." msgstr "`match` ํ‘œํ˜„์‹์„ ๋ณ€์ˆ˜์— ํ• ๋‹นํ•˜๊ณ  ๊ทธ ๊ฐ’์„ ์ถœ๋ ฅํ•ด๋ณด์„ธ์š”." -#: src/control-flow/match-expressions.md:28 +#: src/control-flow/match-expressions.md:29 msgid "Remove `.as_deref()` and explain the error." msgstr "`.as_deref()`๋ฅผ ์ง€์›Œ๋ณด๊ณ , ์ด ๋•Œ ๋‚˜์˜ค๋Š” ์—๋Ÿฌ๋ฅผ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”." -#: src/control-flow/match-expressions.md:29 +#: src/control-flow/match-expressions.md:30 msgid "" "`std::env::args().next()` returns an `Option`, but we cannot match " "against `String`." @@ -8378,7 +9480,7 @@ msgstr "" "`std::env::args().next()`๋Š” `Option` ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š”๋ฐ, `String`์€ ์ง" "์ ‘ ๋งค์น˜ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค." -#: src/control-flow/match-expressions.md:30 +#: src/control-flow/match-expressions.md:31 msgid "" "`as_deref()` transforms an `Option` to `Option<&T::Target>`. In our case, " "this turns `Option` into `Option<&str>`." @@ -8386,7 +9488,7 @@ msgstr "" "`as_deref()`๋Š” `Option`๋ฅผ `Option<&T::Target>`์œผ๋กœ ๋ฐ”๊ฟ”์ค๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ๋Š” " "`Option`์—์„œ `Option<&str>`๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค." -#: src/control-flow/match-expressions.md:31 +#: src/control-flow/match-expressions.md:32 msgid "" "We can now use pattern matching to match against the `&str` inside `Option`." msgstr "์ด์ œ๋Š” ํŒจํ„ด ๋งค์นญ์œผ๋กœ `Option` ์•ˆ์˜ `&str`์„ ๋งค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." @@ -8397,14 +9499,29 @@ msgstr "`break`์™€ `continue`" #: src/control-flow/break-continue.md:3 msgid "" -"If you want to exit a loop early, use `break`, if you want to immediately " -"start the next iteration use `continue`. Both `continue` and `break` can " -"optionally take a label argument which is used to break out of nested loops:" +"If you want to exit a loop early, use [`break`](https://doc.rust-lang.org/" +"reference/expressions/loop-expr.html#break-expressions)," +msgstr "" +"๋ฃจํ”„๋ฅผ ์กฐ๊ธฐ์— ์ข…๋ฃŒํ•˜๋ ค๋ฉด [`break`](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#break-expressions)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค," + +#: src/control-flow/break-continue.md:4 +msgid "" +"If you want to immediately start the next iteration use [`continue`](https://" +"doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)." +msgstr "" +"๋‹ค์Œ ๋ฐ˜๋ณต์„ ์ฆ‰์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด [`continue`](https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#continue-expressions)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." + +#: src/control-flow/break-continue.md:7 +msgid "" +"Both `continue` and `break` can optionally take a label argument which is " +"used to break out of nested loops:" msgstr "" "๋ฃจํ”„๋ฅผ ๋น ์ ธ๋‚˜๊ฐ€๋ ค๋ฉด `break`๋ฅผ, ๋‹ค์Œ ๋ฐ˜๋ณต์œผ๋กœ ๋„˜์–ด๊ฐ€๊ธฐ ์œ„ํ•ด์„œ๋Š” `continue`๋ฅผ " "์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ค‘์ฒฉ ๋ฃจํ”„์—์„œ๋Š” ๋ ˆ์ด๋ธ”๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/control-flow/break-continue.md:7 +#: src/control-flow/break-continue.md:10 msgid "" "```rust,editable\n" "fn main() {\n" @@ -8442,7 +9559,7 @@ msgstr "" "}\n" "```" -#: src/control-flow/break-continue.md:25 +#: src/control-flow/break-continue.md:28 msgid "" "In this case we break the outer loop after 3 iterations of the inner loop." msgstr "" @@ -8506,7 +9623,7 @@ msgid "" "`alloc` and `std`. " msgstr "" "์‚ฌ์‹ค, ๋Ÿฌ์ŠคํŠธ์˜ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” `core`, `alloc`, `std`์™€ ๊ฐ™์ด ๊ณ„์ธต(layer)์œผ" -"๋กœ ๋‚˜๋ˆ ์ง‘๋‹ˆ๋‹ค." +"๋กœ ๋‚˜๋ˆ ์ง‘๋‹ˆ๋‹ค. " #: src/std.md:26 msgid "" @@ -8514,7 +9631,7 @@ msgid "" "`libc`, allocator or even the presence of an operating system. " msgstr "" "`core`๋Š” `libc`๋‚˜ ํ• ๋‹น์ž(allocator), ์‹ฌ์ง€์–ด OS์—๋„ ์˜์กดํ•˜์ง€ ์•Š๋Š” ๊ฐ€์žฅ ๊ธฐ๋ณธ์ " -"์ธ ํ•จ์ˆ˜์™€ ํƒ€์ž…์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค." +"์ธ ํ•จ์ˆ˜์™€ ํƒ€์ž…์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. " #: src/std.md:28 msgid "" @@ -8681,7 +9798,7 @@ msgstr "" msgid "" "When people refer to strings they could either be talking about `&str` or " "`String`." -msgstr "๋ฌธ์ž์—ด์ด๋ผ๊ณ  ์–ธ๊ธ‰ํ•˜๋Š” ๊ฒฝ์šฐ๋Š” `&str`์ด๊ฑฐ๋‚˜ `String`์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr "์‚ฌ๋žŒ๋“ค์ด ๋ฌธ์ž์—ด์ด๋ผ๊ณ  ๋งํ•  ๋•Œ์—๋Š” `&str`์ด๊ฑฐ๋‚˜ `String`์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/std/string.md:34 msgid "" @@ -8714,14 +9831,24 @@ msgstr "" "๋‹ค." #: src/std/string.md:38 +msgid "Compare the different ways to index a `String`:" +msgstr "`String`์„ ์ธ๋ฑ์Šค๋กœ ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•๋“ค์„ ๋น„๊ตํ•ด๋ณด์„ธ์š”:" + +#: src/std/string.md:39 msgid "" -"Compare the different ways to index a `String` by using `s3[i]` and `s3." -"chars().nth(i).unwrap()` where `i` is in-bound, out-of-bounds, and \"on\" " -"the flag Unicode character." +"To a character by using `s3.chars().nth(i).unwrap()` where `i` is in-bound, " +"out-of-bounds." msgstr "" -"`String`์„ ์ธ๋ฑ์Šค๋กœ ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•๋“ค์„ ๋น„๊ตํ•ด๋ณด์„ธ์š”. `s3[i]`์™€ `s3.chars()." -"nth(i).unwrap()` ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด `i`๊ฐ’์ด ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚  ๋•Œ, ๋ฒ—์–ด๋‚˜์ง€ ์•Š์„ ๋•Œ, ํ˜น" -"์€ ํ”Œ๋ž˜๊ทธ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์— ๋”ฑ ๊ฑธ๋ฆฐ ๊ฒฝ์šฐ ๋“ฑ์„ ๋น„๊ต ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”." +"`s3.chars().nth(i).unwrap()`๋ฅผ ์ด์šฉํ•˜์—ฌ ํ•œ ๋ฌธ์ž๋ฅผ ์„ ํƒํ•˜๋Š” ๊ฒฝ์šฐ, `i`๊ฐ’์ด ๋ฒ”์œ„" +"๋ฅผ ๋ฒ—์–ด๋‚  ๋•Œ, ๋ฒ—์–ด๋‚˜์ง€ ์•Š์„ ๋•Œ ๋™์ž‘์„ ์„ค๋ช…ํ•˜์„ธ์š”." + +#: src/std/string.md:40 +msgid "" +"To a substring by using `s3[0..4]`, where that slice is on character " +"boundaries or not." +msgstr "" +"`s3[0..4]`๋ฅผ ์ด์šฉํ•ด์„œ ๋ฌธ์ž์—ด์˜ ์ผ๋ถ€๋ฅผ ์„ ํƒํ•˜๋Š”๋ฐ, ์Šฌ๋ผ์ด์Šค๊ฐ€ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž์—ด " +"๊ฒฝ๊ณ„์— ๋”ฑ ๋งž์ง€ ์•Š์„ ๊ฒฝ์šฐ ์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€ ์„ค๋ช…ํ•˜์„ธ์š”." #: src/std/vec.md:1 msgid "`Vec`" @@ -9014,6 +10141,18 @@ msgstr "" "์˜ˆ์ œ ์ฝ”๋“œ์—์„œ `to_string()`์„ ์—†์• ๋„ ์ปดํŒŒ์ผ์— ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธํ•ด๋ณด์„ธ์š”. ์–ด" "๋–ค ๋ฌธ์ œ์— ๋ถ€๋”ชํž๊นŒ์š”?" +#: src/std/hashmap.md:64 +msgid "" +"This type has several \"method-specific\" return types, such as `std::" +"collections::hash_map::Keys`. These types often appear in searches of the " +"Rust docs. Show students the docs for this type, and the helpful link back " +"to the `keys` method." +msgstr "" +"ํ•ด์‹œ๋งต์˜ ๋ช‡ ๋ช‡ ๋ฉ”์„œ๋“œ๋Š” ํ•ด์‹œ๋งต ๋‚ด๋ถ€์˜ ํŠน๋ณ„ํ•œ ํƒ€์ž…(์˜ˆ๋ฅผ ๋“ค์–ด `std::" +"collections::hash_map::Keys`)๋“ค์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํƒ€์ž…๋“ค์€ Rust ๋ฌธ์„œ์—์„œ" +"๋„ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ฐ•์ƒ๋“ค์—๊ฒŒ ์ด ํƒ€์ž…๋“ค์— ๋Œ€ํ•œ ๋ฌธ์„œ๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ , ์ด ๋ฌธ์„œ" +"์— `keys` ๋ฉ”์„œ๋“œ๋กœ์˜ ์—ญ ๋งํฌ๊ฐ€ ์žˆ์Œ์„ ์•Œ๋ ค์ฃผ์„ธ์š”." + #: src/std/box.md:1 msgid "`Box`" msgstr "`Box`" @@ -9087,14 +10226,14 @@ msgid "" "not null. " msgstr "" "`Box`๋Š” C++์˜ `std::unique_ptr`๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ์ฐจ์ด๋ผ๋ฉด `Box`๋Š” ๋„์ด ์•„๋‹˜์„ ๋ณด" -"์žฅํ•œ๋‹ค๋Š” ์ ์ž…๋‹ˆ๋‹ค." +"์žฅํ•œ๋‹ค๋Š” ์ ์ž…๋‹ˆ๋‹ค. " #: src/std/box.md:35 msgid "" "In the above example, you can even leave out the `*` in the `println!` " "statement thanks to `Deref`. " msgstr "" -"`Deref` ๋•๋ถ„์— ์œ„ ์˜ˆ์ œ์˜ `println!`๋ฌธ์— ์‚ฌ์šฉ๋œ `*`๋ฅผ ๋นผ๋„ ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." +"`Deref` ๋•๋ถ„์— ์œ„ ์˜ˆ์ œ์˜ `println!`๋ฌธ์— ์‚ฌ์šฉ๋œ `*`๋ฅผ ๋นผ๋„ ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. " #: src/std/box.md:36 msgid "A `Box` can be useful when you:" @@ -9196,9 +10335,9 @@ msgstr "" #: src/std/box-recursive.md:33 msgid "" -"If the `Box` was not used here and we attempted to embed a `List` directly " -"into the `List`, the compiler would not compute a fixed size of the struct " -"in memory, it would look infinite." +"If `Box` was not used and we attempted to embed a `List` directly into the " +"`List`, the compiler would not compute a fixed size of the struct in memory " +"(`List` would be of infinite size)." msgstr "" "๋งŒ์ผ `Box`๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  `List`์— ์ง์ ‘ `List`๋ฅผ ํฌํ•จํ•˜๋ ค๊ณ  ์‹œ๋„ํ•œ๋‹ค๋ฉด, ์ปดํŒŒ" "์ผ๋Ÿฌ๋Š” ๊ตฌ์กฐ์ฒด์˜ ๊ณ ์ • ํฌ๊ธฐ๋ฅผ ๊ณ„์‚ฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๋ณด๊ธฐ์— ๋ฌดํ•œ๋Œ€์˜ ํฌ" @@ -9290,7 +10429,7 @@ msgid "" "\n" "fn main() {\n" " let mut a = Rc::new(10);\n" -" let mut b = a.clone();\n" +" let mut b = Rc::clone(&a);\n" "\n" " println!(\"a: {a}\");\n" " println!(\"b: {b}\");\n" @@ -9302,7 +10441,7 @@ msgstr "" "\n" "fn main() {\n" " let mut a = Rc::new(10);\n" -" let mut b = a.clone();\n" +" let mut b = Rc::clone(&a);\n" "\n" " println!(\"a: {a}\");\n" " println!(\"b: {b}\");\n" @@ -9311,53 +10450,46 @@ msgstr "" #: src/std/rc.md:18 msgid "" -"If you need to mutate the data inside an `Rc`, you will need to wrap the " -"data in a type such as [`Cell` or `RefCell`](../concurrency/shared_state/arc." -"md)." +"See [`Arc`](../concurrency/shared_state/arc.md) and [`Mutex`](https://doc." +"rust-lang.org/std/sync/struct.Mutex.html) if you are in a multi-threaded " +"context." msgstr "" -"`Rc`๋‚ด๋ถ€์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ, ๋ฐ์ดํ„ฐ๋ฅผ [`Cell` ๋˜๋Š” `RefCell`](../" -"concurrency/shared_state/arc.md)๋กœ ๋ž˜ํ•‘ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค." +"๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ํ™˜๊ฒฝ์—์„œ ์ž‘์—…ํ•˜๋Š” ๊ฒฝ์šฐ [`Arc`](../concurrency/shared_state/arc.md)" +"์™€ [`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)๋ฅผ ์ฐธ์กฐํ•˜์„ธ" +"์š”." -#: src/std/rc.md:20 -msgid "" -"See [`Arc`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) if you are " -"in a multi-threaded context." -msgstr "" -"๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ์ธ ๊ฒฝ์šฐ [`Arc`](https://doc.rust-lang.org/std/sync/struct.Mutex." -"html)๋ฅผ ์ฐธ์กฐํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." - -#: src/std/rc.md:21 +#: src/std/rc.md:19 msgid "" "You can _downgrade_ a shared pointer into a [`Weak`](https://doc.rust-lang." "org/std/rc/struct.Weak.html) pointer to create cycles that will get dropped." msgstr "" "drop ๊ฐ€๋Šฅํ•œ ์ˆœํ™˜ ๊ตฌ์กฐ๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ๊ณต์œ  ํฌ์ธํ„ฐ๋ฅผ [`Weak`](https://doc.rust-" -"lang.org/std/rc/struct.Weak.html) ํฌ์ธํ„ฐ๋กœ **๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ**ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค." +"lang.org/std/rc/struct.Weak.html) ํฌ์ธํ„ฐ๋กœ _๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ_ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/std/rc.md:31 +#: src/std/rc.md:29 msgid "" -"`Rc`'s Count ensures that its contained value is valid for as long as there " +"`Rc`'s count ensures that its contained value is valid for as long as there " "are references." msgstr "" "`Rc`๋Š” ์ฐธ์กฐ ์นด์šดํŠธ๋ฅผ ํ†ตํ•ด ์ฐธ์กฐ๊ฐ€ ์žˆ๋Š” ๋™์•ˆ์€ `Rc`๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ๋Š” ๊ฐ’์ด ๋ฉ”๋ชจ๋ฆฌ" "์—์„œ ํ•ด์ œ๋˜์ง€ ์•Š์Œ์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." -#: src/std/rc.md:32 -msgid "Like C++'s `std::shared_ptr`." +#: src/std/rc.md:30 +msgid "`Rc` in Rust is like `std::shared_ptr` in C++." msgstr "C++์˜ `std::shared_ptr`์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." -#: src/std/rc.md:33 +#: src/std/rc.md:31 msgid "" -"`clone` is cheap: it creates a pointer to the same allocation and increases " -"the reference count. Does not make a deep clone and can generally be ignored " -"when looking for performance issues in code." +"`Rc::clone` is cheap: it creates a pointer to the same allocation and " +"increases the reference count. Does not make a deep clone and can generally " +"be ignored when looking for performance issues in code." msgstr "" -"`clone`์€ ์ €๋ ดํ•ฉ๋‹ˆ๋‹ค. ๊ฐ™์€ ๊ณณ์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ํฌ์ธํ„ฐ๋ฅผ ํ•˜๋‚˜ ๋” ๋งŒ๋“ค๊ณ , ์ฐธ์กฐ ์นด์šดํŠธ" -"๋ฅผ ๋Š˜๋ฆฝ๋‹ˆ๋‹ค. ํฌ์ธํ„ฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ’ ์ž์ฒด๊ฐ€ ๋ณต์ œ(๊นŠ์€ ๋ณต์ œ)๋˜์ง€๋Š” ์•Š์œผ๋ฉฐ, ๊ทธ๋ž˜" -"์„œ ์ฝ”๋“œ์—์„œ ์„ฑ๋Šฅ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”์ง€ ๊ฒ€ํ† ํ•  ๋•Œ ์ผ๋ฐ˜์ ์œผ๋กœ `Rc`๋ฅผ `clone`ํ•˜๋Š” ๊ฒƒ์€ " -"๋ฌด์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"`clone`์€ ๋น„์šฉ์ด ๊ฑฐ์˜ ๋“ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ฐ™์€ ๊ณณ์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ํฌ์ธํ„ฐ๋ฅผ ํ•˜๋‚˜ ๋” ๋งŒ๋“ค" +"๊ณ , ์ฐธ์กฐ ์นด์šดํŠธ๋ฅผ ๋Š˜๋ฆฝ๋‹ˆ๋‹ค. ํฌ์ธํ„ฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ’ ์ž์ฒด๊ฐ€ ๋ณต์ œ(๊นŠ์€ ๋ณต์ œ)๋˜์ง€" +"๋Š” ์•Š์œผ๋ฉฐ, ๊ทธ๋ž˜์„œ ์ฝ”๋“œ์—์„œ ์„ฑ๋Šฅ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”์ง€ ๊ฒ€ํ† ํ•  ๋•Œ ์ผ๋ฐ˜์ ์œผ๋กœ `Rc`๋ฅผ " +"`clone`ํ•˜๋Š” ๊ฒƒ์€ ๋ฌด์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/std/rc.md:34 +#: src/std/rc.md:32 msgid "" "`make_mut` actually clones the inner value if necessary (\"clone-on-write\") " "and returns a mutable reference." @@ -9365,88 +10497,158 @@ msgstr "" "`make_mut`๋Š” ์‹ค์ œ๋กœ ํ•„์š”ํ•œ ๊ฒฝ์šฐ์— ๋‚ด๋ถ€ ๊ฐ’์„ ๋ณต์ œํ•˜๊ณ (\"clone-on-write\") ๊ฐ€" "๋ณ€ ์ฐธ์กฐ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค." -#: src/std/rc.md:35 +#: src/std/rc.md:33 msgid "Use `Rc::strong_count` to check the reference count." msgstr "์ฐธ์กฐ ์นด์šดํŠธ๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด `Rc::strong_count`๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”." -#: src/std/rc.md:36 +#: src/std/rc.md:34 msgid "" -"Compare the different datatypes mentioned. `Box` enables (im)mutable borrows " -"that are enforced at compile time. `RefCell` enables (im)mutable borrows " -"that are enforced at run time and will panic if it fails at runtime." +"`Rc::downgrade` gives you a _weakly reference-counted_ object to create " +"cycles that will be dropped properly (likely in combination with `RefCell`, " +"on the next slide)." msgstr "" -"์—ฌ๊ธฐ ์–ธ๊ธ‰๋œ ๋ช‡๊ฐ€์ง€ ๋ฐ์ดํ„ฐ ํƒ€์ž…์„ ๋น„๊ตํ•ด๋ณด์„ธ์š”. `Box`๋Š” ๋ถˆ๋ณ€/๊ฐ€๋ณ€ ๋นŒ๋ฆผ(borrow)" -"์„ ์ปดํŒŒ์ผ ์‹œ์ ์— ๊ฐ•์ œํ•ฉ๋‹ˆ๋‹ค. `RefCell`์€ ์‹คํ–‰ ์‹œ์ ์— ๋ถˆ๋ณ€/๊ฐ€๋ณ€ ๋นŒ๋ฆผ์„ ๊ฐ•์ œํ•˜" -"๋ฉฐ, ๋งŒ์•ฝ ๋Ÿฐํƒ€์ž„ ์‹œ์— ๋นŒ๋ฆผ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ํŒจ๋‹‰์„ ์ผ์œผํ‚ต๋‹ˆ๋‹ค." +"`Rc`๋Š” `downgrade()`๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œํ•˜์—ฌ _์•ฝํ•˜๊ฒŒ ์ฐธ์กฐ ์นด์šดํŠธ๋˜๋Š”(weekly " +"reference-counted)_ ๊ฐ์ฒด๊ฐ€ ๋  ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ์ˆœํ™˜๊ตฌ์กฐ๋ผ ํ•˜๋”๋ผ๋„ drop์ด ๊ฐ€" +"๋Šฅํ•ฉ๋‹ˆ๋‹ค. (์•„๋งˆ๋„ `RefCell` ์„ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ด์•ผ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.)" -#: src/std/rc.md:37 +#: src/std/cell.md:1 +msgid "`Cell` and `RefCell`" +msgstr "`Cell`๊ณผ `RefCell`" + +#: src/std/cell.md:3 msgid "" -"You can `downgrade()` a `Rc` into a _weakly reference-counted_ object to " -"create cycles that will be dropped properly (likely in combination with " -"`RefCell`)." +"\\[`Cell`\\]\\[https://doc.rust-lang.org/std/cell/struct.Cell.html\\] and " +"[`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html) " +"implement what Rust calls _interior mutability:_ mutation of values in an " +"immutable context." msgstr "" -"`Rc`๋Š” `downgrade()`๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œํ•˜์—ฌ **weak ์ฐธ์กฐ ์นด์šดํŠธ**๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต" -"๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ์ˆœํ™˜๊ตฌ์กฐ๋ผ ํ•˜๋”๋ผ๋„ drop์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. (์•„๋งˆ๋„ `RefCell` ์„ ํ•จ" -"๊ป˜ ์‚ฌ์šฉํ•ด์•ผ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.)" +"[`Cell`](https://doc.rust-lang.org/std/cell/struct.Cell.html ๊ณผ [`RefCell`]" +"(https://doc.rust-lang.org/std/cell/struct.RefCell.html)์€ ๋Ÿฌ์ŠคํŠธ์—์„œ _๋‚ด์  " +"๊ฐ€๋ณ€์„ฑ(interior mutability)_์ด๋ผ๊ณ  ๋ถ€๋ฅด๋Š” ๊ฒƒ์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ๋ถˆ๋ณ€" +"์ธ ๊ฐ์ฒด์˜ ๊ฐ’์„ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/std/rc.md:41 +#: src/std/cell.md:8 +msgid "" +"`Cell` is typically used for simple types, as it requires copying or moving " +"values. More complex interior types typically use `RefCell`, which tracks " +"shared and exclusive references at runtime and panics if they are misused." +msgstr "" +"`Cell`์€ ๊ฐ„๋‹จํ•œ ํƒ€์ž…์— ๋Œ€ํ•ด์„œ ์ฃผ๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด `Cell`์— ์žˆ๋Š” ๊ฐ’์„ ์ฝ" +"๊ฑฐ๋‚˜ ์“ธ๋•Œ์—๋Š” ๋ณต์‚ฌ ํ˜น์€ ์ด๋™์„ ํ•ด์•ผ๋งŒ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋ณต์žกํ•œ ํƒ€์ž…์ด๋ผ๋ฉด " +"`RefCell`์ด ๋” ๋ณดํŽธ์ ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ์ฐธ์กฐ๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ์ฝ๊ฑฐ๋‚˜ ์“ฐ๊ฒŒ ํ•ด ์ฃผ" +"๋Š” ๋Œ€์‹ , ๊ทธ ์ฐธ์กฐ๋“ค์ด ์˜ฌ๋ฐ”๋ฅธ์ง€๋ฅผ ๋Ÿฐํƒ€์ž„์— ์ฒดํฌํ•˜๊ณ , ์ œ๋Œ€๋กœ ์‚ฌ์šฉ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ " +"ํŒจ๋‹‰์„ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค." + +#: src/std/cell.md:12 msgid "" "```rust,editable\n" -"use std::rc::{Rc, Weak};\n" "use std::cell::RefCell;\n" +"use std::rc::Rc;\n" "\n" -"#[derive(Debug)]\n" +"#[derive(Debug, Default)]\n" "struct Node {\n" " value: i64,\n" -" parent: Option>>,\n" " children: Vec>>,\n" "}\n" "\n" +"impl Node {\n" +" fn new(value: i64) -> Rc> {\n" +" Rc::new(RefCell::new(Node { value, ..Node::default() }))\n" +" }\n" +"\n" +" fn sum(&self) -> i64 {\n" +" self.value + self.children.iter().map(|c| c.borrow().sum()).sum::" +"()\n" +" }\n" +"}\n" +"\n" "fn main() {\n" -" let mut root = Rc::new(RefCell::new(Node {\n" -" value: 42,\n" -" parent: None,\n" -" children: vec![],\n" -" }));\n" -" let child = Rc::new(RefCell::new(Node {\n" -" value: 43,\n" -" children: vec![],\n" -" parent: Some(Rc::downgrade(&root))\n" -" }));\n" -" root.borrow_mut().children.push(child);\n" +" let root = Node::new(1);\n" +" root.borrow_mut().children.push(Node::new(5));\n" +" let subtree = Node::new(10);\n" +" subtree.borrow_mut().children.push(Node::new(11));\n" +" subtree.borrow_mut().children.push(Node::new(12));\n" +" root.borrow_mut().children.push(subtree);\n" "\n" " println!(\"graph: {root:#?}\");\n" +" println!(\"graph sum: {}\", root.borrow().sum());\n" "}\n" "```" msgstr "" "```rust,editable\n" -"use std::rc::{Rc, Weak};\n" "use std::cell::RefCell;\n" +"use std::rc::Rc;\n" "\n" -"#[derive(Debug)]\n" +"#[derive(Debug, Default)]\n" "struct Node {\n" " value: i64,\n" -" parent: Option>>,\n" " children: Vec>>,\n" "}\n" "\n" +"impl Node {\n" +" fn new(value: i64) -> Rc> {\n" +" Rc::new(RefCell::new(Node { value, ..Node::default() }))\n" +" }\n" +"\n" +" fn sum(&self) -> i64 {\n" +" self.value + self.children.iter().map(|c| c.borrow().sum()).sum::" +"()\n" +" }\n" +"}\n" +"\n" "fn main() {\n" -" let mut root = Rc::new(RefCell::new(Node {\n" -" value: 42,\n" -" parent: None,\n" -" children: vec![],\n" -" }));\n" -" let child = Rc::new(RefCell::new(Node {\n" -" value: 43,\n" -" children: vec![],\n" -" parent: Some(Rc::downgrade(&root))\n" -" }));\n" -" root.borrow_mut().children.push(child);\n" +" let root = Node::new(1);\n" +" root.borrow_mut().children.push(Node::new(5));\n" +" let subtree = Node::new(10);\n" +" subtree.borrow_mut().children.push(Node::new(11));\n" +" subtree.borrow_mut().children.push(Node::new(12));\n" +" root.borrow_mut().children.push(subtree);\n" "\n" " println!(\"graph: {root:#?}\");\n" +" println!(\"graph sum: {}\", root.borrow().sum());\n" "}\n" "```" +#: src/std/cell.md:47 +msgid "" +"If we were using `Cell` instead of `RefCell` in this example, we would have " +"to move the `Node` out of the `Rc` to push children, then move it back in. " +"This is safe because there's always one, un-referenced value in the cell, " +"but it's not ergonomic." +msgstr "" +"์ด ์˜ˆ์ œ์—์„œ `RefCell`๋Œ€์‹  `Cell`์„ ์ผ์—ˆ๋‹ค๋ฉด, `Node`์— ์ž์‹ ๋…ธ๋А๋ฅผ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„" +"ํ•ด์„œ, `Node`๋ฅผ `Rc`๋ฐ–์œผ๋กœ ์ด๋™์‹œํ‚จ ๋‹ค์Œ, ์ž์‹ ๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ , ๋‹ค์‹œ `Rc`์•ˆ์œผ" +"๋กœ ์ด๋™์‹œ์ผœ์•ผ ํ–ˆ์„ ๊ฒ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•ด์•ผ๋งŒ ํ•˜๋Š” ์ด์œ ๋Š” ์•ˆ์ „ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. Cell ๋‚ด" +"๋ถ€์˜ ๊ทธ ๊ฐ’์ด ์˜ค์ง ํ•˜๋‚˜ ์กด์žฌํ•˜๋ฉฐ, ๊ทธ ๊ฐ’์— ๋Œ€ํ•œ ์ฐธ์กฐ๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜๊ธฐ ๋•Œ" +"๋ฌธ์ž…๋‹ˆ๋‹ค. ๋ฌผ๋ก  ํŽธ๋ฆฌํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/std/cell.md:48 +msgid "" +"To do anything with a Node, you must call a `RefCell` method, usually " +"`borrow` or `borrow_mut`." +msgstr "" +"๋…ธ๋“œ๋ฅผ ์ด๋™ํ•˜๊ฑฐ๋‚˜ ๋ณต์‚ฌํ•˜์ง€ ์•Š๊ณ  ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” `RefCell`๋กœ ๊ฐ์‹ผ๋‹ค" +"์Œ `borrow`๋‚˜ `borrow_mut`๋ฉ”์„œ๋“œ๋ฅผ ์ด์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/std/cell.md:49 +msgid "" +"Demonstrate that reference loops can be created by adding `root` to `subtree." +"children` (don't try to print it!)." +msgstr "" +"`root`๋ฅผ `subtree.children`์— ์ถ”๊ฐ€ํ•ด์„œ ์ˆœํ™˜ ์ฐธ์กฐ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ์Œ์„ ๋ณด์—ฌ์ฃผ์„ธ์š” " +"(๊ทธ๋ž˜ํ”„๋ฅผ ์ถœ๋ ฅํ•˜์ง€๋Š” ๋งˆ์„ธ์š”!)." + +#: src/std/cell.md:50 +msgid "" +"To demonstrate a runtime panic, add a `fn inc(&mut self)` that increments " +"`self.value` and calls the same method on its children. This will panic in " +"the presence of the reference loop, with `thread 'main' panicked at 'already " +"borrowed: BorrowMutError'`." +msgstr "" +"`self.value`๋ฅผ ์ฆ๊ฐ€์‹œํ‚ค๋Š” ๋ฉ”์„œ๋“œ์ธ`fn inc(&mut self)`๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ๊ทธ ๋ฉ”์„œ๋“œ๋ฅผ " +"์ž์‹๋…ธ๋“œ์—์„œ ํ˜ธ์ถœํ•˜์„ธ์š”. ๊ทธ๋Ÿฌ๋ฉด `thread 'main' panicked at 'already " +"borrowed: BorrowMutError'` ๋Ÿฐํƒ€์ž„ ํŒจ๋‹‰์ด ๋ฐœ์ƒํ•จ์„ ๋ณด์ด์„ธ์š”." + #: src/modules.md:3 msgid "We have seen how `impl` blocks let us namespace functions to a type." msgstr "`impl`๋ธ”๋ก์€ ํ•ด๋‹น ํƒ€์ž…์˜ ํ•จ์ˆ˜๋“ค์— ๋Œ€ํ•œ ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." @@ -9633,11 +10835,11 @@ msgstr "๊ฒฝ๋กœ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๊ตฌ๋ถ„ํ•ฉ๋‹ˆ๋‹ค:" #: src/modules/paths.md:5 msgid "As a relative path:" -msgstr "์ƒ๋Œ€ ๊ฒฝ๋กœ" +msgstr "์ƒ๋Œ€ ๊ฒฝ๋กœ:" #: src/modules/paths.md:6 msgid "`foo` or `self::foo` refers to `foo` in the current module," -msgstr "`foo` ๋˜๋Š” `self::foo`๋Š” ํ˜„์žฌ ๋ชจ๋“ˆ ๋‚ด๋ถ€์˜ `foo`๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค." +msgstr "`foo` ๋˜๋Š” `self::foo`๋Š” ํ˜„์žฌ ๋ชจ๋“ˆ ๋‚ด๋ถ€์˜ `foo`๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค," #: src/modules/paths.md:7 msgid "`super::foo` refers to `foo` in the parent module." @@ -9645,11 +10847,11 @@ msgstr "`super::foo`๋Š” ๋ถ€๋ชจ ๋ชจ๋“ˆ์˜ `foo`๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค." #: src/modules/paths.md:9 msgid "As an absolute path:" -msgstr "์ ˆ๋Œ€ ๊ฒฝ๋กœ" +msgstr "์ ˆ๋Œ€ ๊ฒฝ๋กœ:" #: src/modules/paths.md:10 msgid "`crate::foo` refers to `foo` in the root of the current crate," -msgstr "`crate::foo`๋Š” ํ˜„์žฌ ํฌ๋ ˆ์ดํŠธ ๋ฃจํŠธ์˜ `foo`๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค." +msgstr "`crate::foo`๋Š” ํ˜„์žฌ ํฌ๋ ˆ์ดํŠธ ๋ฃจํŠธ์˜ `foo`๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค," #: src/modules/paths.md:11 msgid "`bar::foo` refers to `foo` in the `bar` crate." @@ -9661,7 +10863,7 @@ msgid "" "will typically see something like this at the top of each module:" msgstr "" "๋ชจ๋“ˆ์€ `use`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค๋ฅธ ๋ชจ๋“ˆ์˜ ์‹ฌ๋ณผ์„ ๋‚ด ์Šค์ฝ”ํ”„๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ผ" -"๋ฐ˜์ ์œผ๋กœ ๊ฐ ๋ชจ๋“ˆ์˜ ์ƒ๋‹จ์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์ด ์˜ต๋‹ˆ๋‹ค." +"๋ฐ˜์ ์œผ๋กœ ๊ฐ ๋ชจ๋“ˆ์˜ ์ƒ๋‹จ์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์ด ์˜ต๋‹ˆ๋‹ค:" #: src/modules/paths.md:16 msgid "" @@ -9676,8 +10878,10 @@ msgstr "" "```" #: src/modules/filesystem.md:3 -msgid "The module content can be omitted:" -msgstr "๋ชจ๋“ˆ์˜ ๋‚ด์šฉ์€ ์ƒ๋žต๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +msgid "" +"Omitting the module content will tell Rust to look for it in another file:" +msgstr "" +"๋ชจ๋“ˆ์˜ ๋‚ด์šฉ์„ ๊ธฐ์ˆ ํ•˜์ง€ ์•Š์œผ๋ฉด, ๋Ÿฌ์ŠคํŠธ๋Š” ๋‹ค๋ฅธ ํŒŒ์ผ์—์„œ ๊ทธ ๋‚ด์šฉ์„ ์ฝ์Šต๋‹ˆ๋‹ค:" #: src/modules/filesystem.md:5 msgid "" @@ -9690,42 +10894,28 @@ msgstr "" "```" #: src/modules/filesystem.md:9 -msgid "The `garden` module content is found at:" -msgstr "`garden` ๋ชจ๋“ˆ์˜ ๋‚ด์šฉ์€ ์•„๋ž˜ ์œ„์น˜์—์„œ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" - -#: src/modules/filesystem.md:11 -msgid "`src/garden.rs` (modern Rust 2018 style)" -msgstr "`src/garden.rs`(์ตœ์‹  Rust 2018 ์Šคํƒ€์ผ)" +msgid "" +"This tells rust that the `garden` module content is found at `src/garden." +"rs`. Similarly, a `garden::vegetables` module can be found at `src/garden/" +"vegetables.rs`." +msgstr "" +"์œ„ ์ฝ”๋“œ๋Š” ๋Ÿฌ์ŠคํŠธ๋กœ ํ•˜์—ฌ๊ธˆ `garden`๋ชจ๋“ˆ์˜ ๋‚ด์šฉ์„ `src/garden.rs`์—์„œ ์ฐพ๋„๋ก ํ•ฉ" +"๋‹ˆ๋‹ค. ๋น„์Šทํ•˜๊ฒŒ, `garden::vegetables` ๋ชจ๋“ˆ์€ `src/garden/vegetables.rs`์—์„œ ์ฐพ" +"์Šต๋‹ˆ๋‹ค." #: src/modules/filesystem.md:12 -msgid "`src/garden/mod.rs` (older Rust 2015 style)" -msgstr "`src/garden/mod.rs`(์ด์ „ Rust 2015 ์Šคํƒ€์ผ)" - -#: src/modules/filesystem.md:14 -msgid "Similarly, a `garden::vegetables` module can be found at:" -msgstr "์œ ์‚ฌํ•˜๊ฒŒ `garden::vegetables` ๋ชจ๋“ˆ์€ ์•„๋ž˜ ์œ„์น˜์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" - -#: src/modules/filesystem.md:16 -msgid "`src/garden/vegetables.rs` (modern Rust 2018 style)" -msgstr "`src/garden/vegetables.rs`(์ตœ์‹  Rust 2018 ์Šคํƒ€์ผ)" - -#: src/modules/filesystem.md:17 -msgid "`src/garden/vegetables/mod.rs` (older Rust 2015 style)" -msgstr "`src/garden/vegetables/mod.rs`(์ด์ „ Rust 2015 ์Šคํƒ€์ผ)" - -#: src/modules/filesystem.md:19 msgid "The `crate` root is in:" msgstr "`crate(ํฌ๋ ˆ์ดํŠธ)`์˜ ๋ฃจํŠธ๋Š” ์•„๋ž˜ ๊ฒฝ๋กœ ์ž…๋‹ˆ๋‹ค:" -#: src/modules/filesystem.md:21 +#: src/modules/filesystem.md:14 msgid "`src/lib.rs` (for a library crate)" msgstr "`src/lib.rs` (๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํฌ๋ ˆ์ดํŠธ)" -#: src/modules/filesystem.md:22 +#: src/modules/filesystem.md:15 msgid "`src/main.rs` (for a binary crate)" msgstr "`src/main.rs` (๋ฐ”์ด๋„ˆ๋ฆฌ ํฌ๋ ˆ์ดํŠธ)" -#: src/modules/filesystem.md:24 +#: src/modules/filesystem.md:17 msgid "" "Modules defined in files can be documented, too, using \"inner doc " "comments\". These document the item that contains them -- in this case, a " @@ -9734,74 +10924,7 @@ msgstr "" "๋ชจ๋“ˆ๋„ \"๋‚ด๋ถ€ ๋ฌธ์„œ ์ฃผ์„\"์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋ชจ๋“ˆ์€ ๋ชจ๋“ˆ" "์ด ํฌํ•จ๋œ ํ•ญ๋ชฉ(์ด ๊ฒฝ์šฐ์—๋Š” ๋ชจ๋“ˆ)์„ ๋ฌธ์„œํ™”ํ•ฉ๋‹ˆ๋‹ค." -#: src/modules/filesystem.md:26 -msgid "" -"The change from `module/mod.rs` to `module.rs` doesn't preclude the use of " -"submodules in Rust 2018. (It was mandatory in Rust 2015.)" -msgstr "" -"`module/mod.rs`๋ฅผ `module.rs`๋กœ ๋ฐ”๊พผ๋‹ค ํ•˜๋”๋ผ๋„ Rust 2018์—์„œ๋Š” ํ•˜์œ„ ๋ชจ๋“ˆ์„ " -"์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (Rust 2015์—์„œ๋Š” ํ•˜์œ„ ๋ชจ๋“ˆ์ด ์žˆ๋Š” ๋ชจ๋“ˆ์€ `module/mod.rs` " -"ํ˜•ํƒœ์—ฌ์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.)" - -#: src/modules/filesystem.md:29 -msgid "The following is valid:" -msgstr "์•„๋ž˜์ฒ˜๋Ÿผ ๊ตฌ์„ฑํ•˜๋Š”๋ฐ ์•„๋ฌด๋Ÿฐ ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค:" - -#: src/modules/filesystem.md:31 -msgid "" -"```ignore\n" -"src/\n" -"โ”œโ”€โ”€ main.rs\n" -"โ”œโ”€โ”€ top_module.rs\n" -"โ””โ”€โ”€ top_module/\n" -" โ””โ”€โ”€ sub_module.rs\n" -"```" -msgstr "" -"```ignore\n" -"src/\n" -"โ”œโ”€โ”€ main.rs\n" -"โ”œโ”€โ”€ top_module.rs\n" -"โ””โ”€โ”€ top_module/\n" -" โ””โ”€โ”€ sub_module.rs\n" -"```" - -#: src/modules/filesystem.md:39 -msgid "" -"The main reason for the change is to prevent many files named `mod.rs`, " -"which can be hard to distinguish in IDEs." -msgstr "" -"์ด๋ ‡๊ฒŒ ๋ณ€๊ฒฝ๋œ ์ฃผ๋œ ์ด์œ ๋Š” ๋ชจ๋‘ ๋˜‘๊ฐ™์€ ์ด๋ฆ„์˜ `mod.rs` ํŒŒ์ผ์ด ์ž”๋œฉ ์ƒ๊ธฐ๋Š” ๊ฒƒ" -"์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด์„œ ์ž…๋‹ˆ๋‹ค. IDE์—์„œ๋Š” ์ด๋“ค์„ ๊ตฌ๋ถ„ํ•˜๊ธฐ๊ฐ€ ๊นŒ๋‹ค๋กœ์› ์Šต๋‹ˆ๋‹ค." - -#: src/modules/filesystem.md:42 -msgid "" -"Rust will look for modules in `modulename/mod.rs` and `modulename.rs`, but " -"this can be changed with a compiler directive:" -msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ๋ชจ๋“ˆ์„ ์ฐพ์„ ๋•Œ `modulename/mod.rs`์™€ `modulename.rs` ํŒŒ์ผ์„ ๊ฒ€์‚ฌํ•˜๋Š”" -"๋ฐ, ์ปดํŒŒ์ผ๋Ÿฌ ๋””๋ ‰ํ‹ฐ๋ธŒ๋กœ ์ด๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/modules/filesystem.md:45 -msgid "" -"```rust,ignore\n" -"#[path = \"some/path.rs\"]\n" -"mod some_module { }\n" -"```" -msgstr "" -"```rust,ignore\n" -"#[path = \"some/path.rs\"]\n" -"mod some_module { }\n" -"```" - -#: src/modules/filesystem.md:50 -msgid "" -"This is useful, for example, if you would like to place tests for a module " -"in a file named `some_module_test.rs`, similar to the convention in Go." -msgstr "" -"Go์–ธ์–ด ์—์„œ์ฒ˜๋Ÿผ ์–ด๋–ค ๋ชจ๋“ˆ์˜ ํ…Œ์ŠคํŠธ๋ฅผ `some_module_test.rs` ๊ฐ™์€ ํŒŒ์ผ์— ๋‘๊ณ  " -"์‹ถ์€ ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/modules/filesystem.md:27 +#: src/modules/filesystem.md:20 msgid "" "```rust,editable,compile_fail\n" "//! This module implements the garden, including a highly performant " @@ -9834,6 +10957,73 @@ msgstr "" "pub fn harvest(garden: &mut Garden) { todo!() }\n" "```" +#: src/modules/filesystem.md:37 +msgid "" +"Before Rust 2018, modules needed to be located at `module/mod.rs` instead of " +"`module.rs`, and this is still a working alternative for editions after 2018." +msgstr "" +"`module/mod.rs`๋ฅผ `module.rs`๋กœ ๋ฐ”๊พผ๋‹ค ํ•˜๋”๋ผ๋„ Rust 2018์—์„œ๋Š” ํ•˜์œ„ ๋ชจ๋“ˆ์„ " +"์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/modules/filesystem.md:39 +msgid "" +"The main reason to introduce `filename.rs` as alternative to `filename/mod." +"rs` was because many files named `mod.rs` can be hard to distinguish in IDEs." +msgstr "" +"`filename.rs`๋ฅผ `filename/mod.rs`๋Œ€์‹  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์ฃผ๋œ ์ด์œ ๋Š”, " +"`mod.rs`๋ผ๋Š” ์ด๋ฆ„์„ ๊ฐ€์ง„ ํŒŒ์ผ์ด ๋งŽ์„ ๊ฒฝ์šฐ IDE์—์„œ ์ด๋“ค์„ ์„œ๋กœ ๊ตฌ๋ณ„ํ•˜๋Š”๊ฒŒ ํž˜๋“ค" +"๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/modules/filesystem.md:42 +msgid "Deeper nesting can use folders, even if the main module is a file:" +msgstr "" +"ํด๋”๋ฅผ ์ด์šฉํ•ด์„œ ๋” ๊นŠ์€ ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‹ฌ์ง€์–ด๋Š” ๋ฉ”์ธ ๋ชจ๋“ˆ์ด " +"ํŒŒ์ผ์ด๋”๋ผ๋„์š”:" + +#: src/modules/filesystem.md:44 +msgid "" +"```ignore\n" +"src/\n" +"โ”œโ”€โ”€ main.rs\n" +"โ”œโ”€โ”€ top_module.rs\n" +"โ””โ”€โ”€ top_module/\n" +" โ””โ”€โ”€ sub_module.rs\n" +"```" +msgstr "" +"```ignore\n" +"src/\n" +"โ”œโ”€โ”€ main.rs\n" +"โ”œโ”€โ”€ top_module.rs\n" +"โ””โ”€โ”€ top_module/\n" +" โ””โ”€โ”€ sub_module.rs\n" +"```" + +#: src/modules/filesystem.md:52 +msgid "" +"The place rust will look for modules can be changed with a compiler " +"directive:" +msgstr "๋Ÿฌ์ŠคํŠธ๊ฐ€ ์–ด๋””์„œ ๋ชจ๋“ˆ๋“ค์„ ์ฐพ์„์ง€๋Š” ์ปดํŒŒ์ผ๋Ÿฌ ๋””๋ ‰ํ‹ฐ๋ธŒ๋กœ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค:" + +#: src/modules/filesystem.md:54 +msgid "" +"```rust,ignore\n" +"#[path = \"some/path.rs\"]\n" +"mod some_module;\n" +"```" +msgstr "" +"```rust,ignore\n" +"#[path = \"some/path.rs\"]\n" +"mod some_module;\n" +"```" + +#: src/modules/filesystem.md:59 +msgid "" +"This is useful, for example, if you would like to place tests for a module " +"in a file named `some_module_test.rs`, similar to the convention in Go." +msgstr "" +"์ด๋Š” Go์–ธ์–ด ์—์„œ์ฒ˜๋Ÿผ ์–ด๋–ค ๋ชจ๋“ˆ์˜ ํ…Œ์ŠคํŠธ๋ฅผ `some_module_test.rs` ๊ฐ™์€ ํŒŒ์ผ์— " +"๋‘๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." + #: src/exercises/day-2/afternoon.md:1 msgid "Day 2: Afternoon Exercises" msgstr "2์ผ์ฐจ ์˜คํ›„ ์—ฐ์Šต๋ฌธ์ œ" @@ -9859,11 +11049,11 @@ msgstr "๋ชจ๋“  ๊ณต๋ฐฑ์„ ๋ฌด์‹œํ•ฉ๋‹ˆ๋‹ค. 2์ž๋ฆฌ ๋ฏธ๋งŒ ์ˆซ์ž๋Š” ๋ฌด์‹œํ•ฉ๋‹ˆ #: src/exercises/day-2/luhn.md:9 msgid "" -"Moving from right to left, double every second digit: for the number `1234`, " -"we double `3` and `1`." +"Moving from **right to left**, double every second digit: for the number " +"`1234`, we double `3` and `1`. For the number `98765`, we double `6` and `8`." msgstr "" -"์˜ค๋ฅธ์ชฝ์—์„œ ์™ผ์ชฝ์œผ๋กœ ์ด๋™ํ•˜๋ฉฐ 2๋ฒˆ์งธ ์ž๋ฆฌ๋งˆ๋‹ค ์ˆซ์ž๋ฅผ 2๋ฐฐ ์ฆ๊ฐ€์‹œํ‚ต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค" -"์–ด `1234`์—์„œ `3`๊ณผ `1`์— ๊ฐ๊ฐ 2๋ฅผ ๊ณฑํ•ฉ๋‹ˆ๋‹ค." +"**์˜ค๋ฅธ์ชฝ์—์„œ ์™ผ์ชฝ์œผ๋กœ** ์ด๋™ํ•˜๋ฉฐ 2๋ฒˆ์งธ ์ž๋ฆฌ๋งˆ๋‹ค ์ˆซ์ž๋ฅผ 2๋ฐฐ ์ฆ๊ฐ€์‹œํ‚ต๋‹ˆ๋‹ค. ์˜ˆ" +"๋ฅผ ๋“ค์–ด `1234`์—์„œ `3`๊ณผ `1`์— ๊ฐ๊ฐ 2๋ฅผ ๊ณฑํ•ฉ๋‹ˆ๋‹ค." #: src/exercises/day-2/luhn.md:12 msgid "" @@ -9883,13 +11073,20 @@ msgstr "ํ•ฉ๊ณ„์˜ ๋์ž๋ฆฌ๊ฐ€ `0`์ธ ๊ฒฝ์šฐ ์œ ํšจํ•œ ์‹ ์šฉ์นด๋“œ ๋ฒˆํ˜ธ์ž…๋‹ˆ #: src/exercises/day-2/luhn.md:19 msgid "" -"Copy the following code to and implement the " -"function:" +"Copy the code below to and implement the " +"function." msgstr "" -"์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์— ๋ณต์‚ฌํ•˜๊ณ  ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ•ด ๋ณด์‹œ๊ธฐ ๋ฐ”" -"๋ž๋‹ˆ๋‹ค:" +"์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์— ๋ณต์‚ฌํ•ด์„œ ๊ตฌํ˜„ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค." -#: src/exercises/day-2/luhn.md:23 +#: src/exercises/day-2/luhn.md:21 +msgid "" +"Try to solve the problem the \"simple\" way first, using `for` loops and " +"integers. Then, revisit the solution and try to implement it with iterators." +msgstr "" +"`for`๋ฐ˜๋ณต๋ฌธ๊ณผ ์ธ๋ฑ์Šค๋ฅผ ์ด์šฉํ•˜๋Š” \"์‰ฌ์šด\"๋ฐฉ๋ฒ•์œผ๋กœ ๋จผ์ € ํ’€์–ด ๋ณด์„ธ์š”. ๊ทธ๋Ÿฐ ๋‹ค์Œ " +"๋ฐ˜๋ณต์ž๋ฅผ ์ด์šฉํ•ด์„œ ๋‹ค์‹œ ํ’€์–ด ๋ณด์„ธ์š”." + +#: src/exercises/day-2/luhn.md:25 msgid "" "```rust\n" "// TODO: remove this when you're done with your implementation.\n" @@ -9940,6 +11137,54 @@ msgid "" "fn main() {}\n" "```" msgstr "" +"```rust\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub fn luhn(cc_number: &str) -> bool {\n" +" unimplemented!()\n" +"}\n" +"\n" +"#[test]\n" +"fn test_non_digit_cc_number() {\n" +" assert!(!luhn(\"foo\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_empty_cc_number() {\n" +" assert!(!luhn(\"\"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +" assert!(!luhn(\" \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_single_digit_cc_number() {\n" +" assert!(!luhn(\"0\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_two_digit_cc_number() {\n" +" assert!(luhn(\" 0 0 \"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_valid_cc_number() {\n" +" assert!(luhn(\"4263 9826 4026 9299\"));\n" +" assert!(luhn(\"4539 3195 0343 6467\"));\n" +" assert!(luhn(\"7992 7398 713\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_invalid_cc_number() {\n" +" assert!(!luhn(\"4223 9826 4026 9299\"));\n" +" assert!(!luhn(\"4539 3195 0343 6476\"));\n" +" assert!(!luhn(\"8273 1232 7352 0569\"));\n" +"}\n" +"\n" +"#[allow(dead_code)]\n" +"fn main() {}\n" +"```" #: src/exercises/day-2/strings-iterators.md:3 msgid "" @@ -10009,6 +11254,51 @@ msgid "" "}\n" "```" msgstr "" +"```rust\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_variables, dead_code)]\n" +"\n" +"pub fn prefix_matches(prefix: &str, request_path: &str) -> bool {\n" +" unimplemented!()\n" +"}\n" +"\n" +"#[test]\n" +"fn test_matches_without_wildcard() {\n" +" assert!(prefix_matches(\"/v1/publishers\", \"/v1/publishers\"));\n" +" assert!(prefix_matches(\"/v1/publishers\", \"/v1/publishers/" +"abc-123\"));\n" +" assert!(prefix_matches(\"/v1/publishers\", \"/v1/publishers/abc/" +"books\"));\n" +"\n" +" assert!(!prefix_matches(\"/v1/publishers\", \"/v1\"));\n" +" assert!(!prefix_matches(\"/v1/publishers\", \"/v1/publishersBooks\"));\n" +" assert!(!prefix_matches(\"/v1/publishers\", \"/v1/parent/" +"publishers\"));\n" +"}\n" +"\n" +"#[test]\n" +"fn test_matches_with_wildcard() {\n" +" assert!(prefix_matches(\n" +" \"/v1/publishers/*/books\",\n" +" \"/v1/publishers/foo/books\"\n" +" ));\n" +" assert!(prefix_matches(\n" +" \"/v1/publishers/*/books\",\n" +" \"/v1/publishers/bar/books\"\n" +" ));\n" +" assert!(prefix_matches(\n" +" \"/v1/publishers/*/books\",\n" +" \"/v1/publishers/foo/books/book1\"\n" +" ));\n" +"\n" +" assert!(!prefix_matches(\"/v1/publishers/*/books\", \"/v1/" +"publishers\"));\n" +" assert!(!prefix_matches(\n" +" \"/v1/publishers/*/books\",\n" +" \"/v1/publishers/foo/booksByAuthor\"\n" +" ));\n" +"}\n" +"```" #: src/welcome-day-3.md:1 msgid "Welcome to Day 3" @@ -10050,6 +11340,201 @@ msgstr "" "์•ˆ์ „ํ•˜์ง€ ์•Š์€ ๋Ÿฌ์ŠคํŠธ: ์›์‹œ(raw) ํฌ์ธํ„ฐ, ์ •์  ๋ณ€์ˆ˜, ์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํ•จ์ˆ˜, ์™ธ๋ถ€ " "ํ•จ์ˆ˜." +#: src/generics.md:3 +msgid "" +"Rust support generics, which lets you abstract algorithms or data structures " +"(such as sorting or a binary tree) over the types used or stored." +msgstr "" +"๋Ÿฌ์ŠคํŠธ๋Š” ์ œ๋„ค๋ฆญ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ์•Œ๊ณ ๋ฆฌ์ฆ˜(์ •๋ ฌ๊ณผ ๊ฐ™์€)์ด๋‚˜ ๋ฐ์ดํ„ฐ " +"๊ตฌ์กฐ(์ด์ง„ ํŠธ๋ฆฌ ๊ฐ™์€)๋ฅผ ์ถ”์ƒํ™” ํ•˜์—ฌ ํŠน์ • ํƒ€์ž…์— ์˜์กดํ•˜์ง€ ์•Š๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ" +"๋‹ค." + +#: src/generics/data-types.md:3 +msgid "You can use generics to abstract over the concrete field type:" +msgstr "์ œ๋„ค๋ฆญ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•„๋“œ์˜ ํƒ€์ž…์„ ์ถ”์ƒํ™” ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/generics/data-types.md:5 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point {\n" +" x: T,\n" +" y: T,\n" +"}\n" +"\n" +"fn main() {\n" +" let integer = Point { x: 5, y: 10 };\n" +" let float = Point { x: 1.0, y: 4.0 };\n" +" println!(\"{integer:?} and {float:?}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point {\n" +" x: T,\n" +" y: T,\n" +"}\n" +"\n" +"fn main() {\n" +" let integer = Point { x: 5, y: 10 };\n" +" let float = Point { x: 1.0, y: 4.0 };\n" +" println!(\"{integer:?} and {float:?}\");\n" +"}\n" +"```" + +#: src/generics/data-types.md:21 +msgid "Try declaring a new variable `let p = Point { x: 5, y: 10.0 };`." +msgstr "์ƒˆ ๋ณ€์ˆ˜ `let p = Point { x: 5, y: 10.0 };`๋ฅผ ์„ ์–ธํ•ด ๋ณด์„ธ์š”." + +#: src/generics/data-types.md:23 +msgid "Fix the code to allow points that have elements of different types." +msgstr "" +"`Point`๊ฐ€ ์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…์˜ ๊ฐ’๋“ค์œผ๋กœ ์ด๋ฃจ์–ด์ ธ๋„ ์ปดํŒŒ์ผ ๋˜๋„๋ก ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•ด ๋ณด" +"์„ธ์š”." + +#: src/generics/methods.md:3 +msgid "You can declare a generic type on your `impl` block:" +msgstr "`impl` ๋ธ”๋ก์—์„œ๋„ ์ œ๋„ค๋ฆญ ํƒ€์ž…์„ ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/generics/methods.md:5 +msgid "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point(T, T);\n" +"\n" +"impl Point {\n" +" fn x(&self) -> &T {\n" +" &self.0 // + 10\n" +" }\n" +"\n" +" // fn set_x(&mut self, x: T)\n" +"}\n" +"\n" +"fn main() {\n" +" let p = Point(5, 10);\n" +" println!(\"p.x = {}\", p.x());\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"#[derive(Debug)]\n" +"struct Point(T, T);\n" +"\n" +"impl Point {\n" +" fn x(&self) -> &T {\n" +" &self.0 // + 10\n" +" }\n" +"\n" +" // fn set_x(&mut self, x: T)\n" +"}\n" +"\n" +"fn main() {\n" +" let p = Point(5, 10);\n" +" println!(\"p.x = {}\", p.x());\n" +"}\n" +"```" + +#: src/generics/methods.md:25 +msgid "" +"_Q:_ Why `T` is specified twice in `impl Point {}`? Isn't that " +"redundant?" +msgstr "_์งˆ๋ฌธ:_ `impl Point {}`์—์„œ `T`๊ฐ€ ์™œ ๋‘ ๋ฒˆ ์‚ฌ์šฉ๋ฉ๋‹ˆ๊นŒ?" + +#: src/generics/methods.md:26 +msgid "" +"This is because it is a generic implementation section for generic type. " +"They are independently generic." +msgstr "" +"์ œ๋„ค๋ฆญ ํƒ€์ž…์— ๋Œ€ํ•œ ์ œ๋„ค๋ฆญ ๊ตฌํ˜„ ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์ด ๋‘ ์ œ๋„ค๋ฆญ์€ ์„œ๋กœ ๋…๋ฆฝ์ ์ž…" +"๋‹ˆ๋‹ค." + +#: src/generics/methods.md:27 +msgid "It means these methods are defined for any `T`." +msgstr "" +"์ด๋Š” ์ž„์˜์˜ ๋ชจ๋“  `T`์— ๋Œ€ํ•ด์„œ ์ด ๋ฉ”์†Œ๋“œ๋“ค์ด ์ •์˜๋œ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." + +#: src/generics/methods.md:28 +msgid "It is possible to write `impl Point { .. }`. " +msgstr "`impl Point { .. }`์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. " + +#: src/generics/methods.md:29 +msgid "" +"`Point` is still generic and you can use `Point`, but methods in this " +"block will only be available for `Point`." +msgstr "" +"`Point`๋Š” ์—ฌ์ „ํžˆ ์ œ๋„ค๋ฆญ์ด๋ฉฐ `Point`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์ด ๋ธ”๋ก์˜ ๋ฉ”์„œ" +"๋“œ๋Š” `Point`๋งŒ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/generics/monomorphization.md:3 +msgid "Generic code is turned into non-generic code based on the call sites:" +msgstr "์ œ๋„ค๋ฆญ ์ฝ”๋“œ๋Š” ํ˜ธ์ถœ๋ถ€์—์„œ ๋น„ ์ œ๋„ค๋ฆญ ์ฝ”๋“œ๋กœ ์ „ํ™˜๋ฉ๋‹ˆ๋‹ค:" + +#: src/generics/monomorphization.md:5 +msgid "" +"```rust,editable\n" +"fn main() {\n" +" let integer = Some(5);\n" +" let float = Some(5.0);\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let integer = Some(5);\n" +" let float = Some(5.0);\n" +"}\n" +"```" + +#: src/generics/monomorphization.md:12 +msgid "behaves as if you wrote" +msgstr "์œ„ ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค" + +#: src/generics/monomorphization.md:14 +msgid "" +"```rust,editable\n" +"enum Option_i32 {\n" +" Some(i32),\n" +" None,\n" +"}\n" +"\n" +"enum Option_f64 {\n" +" Some(f64),\n" +" None,\n" +"}\n" +"\n" +"fn main() {\n" +" let integer = Option_i32::Some(5);\n" +" let float = Option_f64::Some(5.0);\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"enum Option_i32 {\n" +" Some(i32),\n" +" None,\n" +"}\n" +"\n" +"enum Option_f64 {\n" +" Some(f64),\n" +" None,\n" +"}\n" +"\n" +"fn main() {\n" +" let integer = Option_i32::Some(5);\n" +" let float = Option_f64::Some(5.0);\n" +"}\n" +"```" + +#: src/generics/monomorphization.md:31 +msgid "" +"This is a zero-cost abstraction: you get exactly the same result as if you " +"had hand-coded the data structures without the abstraction." +msgstr "" +"์ด๊ฒƒ์ด ๋ฐ”๋กœ ๋น„์šฉ์ด ๋“ค์ง€ ์•Š๋Š” (zero-cost) ์ถ”์ƒํ™” ์ž…๋‹ˆ๋‹ค: ๋Ÿฌ์ŠคํŠธ์˜ ์ œ๋„ค๋ฆญ์€ ์ถ”" +"์ƒํ™”๋ฅผ ๊ฑฐ์น˜์ง€ ์•Š๊ณ  ์ง์ ‘ ๊ตฌ์ฒด์ ์ธ ํƒ€์ž…์„ ์จ์„œ ์ฝ”๋”ฉํ•œ ๊ฒƒ๊ณผ ์ •ํ™•ํžˆ ๋™์ผํ•œ ๊ฒฐ๊ณผ" +"๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." + #: src/traits.md:3 msgid "" "Rust lets you abstract over types with traits. They're similar to interfaces:" @@ -10131,120 +11616,230 @@ msgstr "" "}\n" "```" -#: src/traits/default-methods.md:32 src/traits.md:41 +#: src/traits/trait-objects.md:3 msgid "" -"Traits may specify pre-implemented (default) methods and methods that users " -"are required to implement themselves. Methods with default implementations " -"can rely on required methods." +"Trait objects allow for values of different types, for instance in a " +"collection:" msgstr "" -"ํŠธ๋ ˆ์ž‡์€ ์‚ฌ์ „ ๊ตฌํ˜„๋œ (๊ธฐ๋ณธ๊ฐ’) ๋ฉ”์„œ๋“œ์™€ ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ " -"์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๊ตฌํ˜„์ด ์žˆ๋Š” ๋ฉ”์„œ๋“œ๋Š” ํ•„์ˆ˜ ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ" -"๋‹ค." +"ํŠธ๋ ˆ์ž‡ ๊ฐ์ฒด๋Š” ํƒ€์ž…์ด ๋‹ค๋ฅธ ๊ฐ’(์˜ˆ๋ฅผ ๋“ค์–ด ์ปฌ๋ ‰์…˜์— ์†ํ•œ ๊ฐ ๊ฐ’)๋“ค์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต" +"๋‹ˆ๋‹ค:" -#: src/traits/default-methods.md:35 -msgid "Move method `not_equal` to a new trait `NotEqual`." -msgstr "`not_equal` ๋ฉ”์„œ๋“œ๋ฅผ ์ƒˆ๋กœ์šด ํŠธ๋ ˆ์ž‡์ธ `NotEqual`๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค." - -#: src/traits/default-methods.md:37 -msgid "Make `NotEqual` a super trait for `Equal`." -msgstr "`NotEqual`์„ `Equal`์˜ ์Šˆํผ ํŠธ๋ ˆ์ž‡์œผ๋กœ ๋งŒ๋“ญ๋‹ˆ๋‹ค." - -#: src/traits/default-methods.md:38 +#: src/traits/trait-objects.md:5 msgid "" -"```rust,editable,compile_fail\n" -"trait NotEqual: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"trait NotEqual: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" -" }\n" -"}\n" -"```" - -#: src/traits/default-methods.md:46 -msgid "Provide a blanket implementation of `NotEqual` for `Equal`." -msgstr "`Equal`์— `NotEqual`์˜ ํฌ๊ด„์  ๊ตฌํ˜„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." - -#: src/traits/default-methods.md:47 -msgid "" -"```rust,editable,compile_fail\n" -"trait NotEqual {\n" -" fn not_equal(&self, other: &Self) -> bool;\n" +"```rust,editable\n" +"trait Pet {\n" +" fn name(&self) -> String;\n" "}\n" "\n" -"impl NotEqual for T where T: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"trait NotEqual {\n" -" fn not_equal(&self, other: &Self) -> bool;\n" +"struct Dog {\n" +" name: String,\n" "}\n" "\n" -"impl NotEqual for T where T: Equals {\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +"struct Cat;\n" +"\n" +"impl Pet for Dog {\n" +" fn name(&self) -> String {\n" +" self.name.clone()\n" +" }\n" +"}\n" +"\n" +"impl Pet for Cat {\n" +" fn name(&self) -> String {\n" +" String::from(\"The cat\") // No name, cats won't respond to it " +"anyway.\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let pets: Vec> = vec![\n" +" Box::new(Cat),\n" +" Box::new(Dog { name: String::from(\"Fido\") }),\n" +" ];\n" +" for pet in pets {\n" +" println!(\"Hello {}!\", pet.name());\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"trait Pet {\n" +" fn name(&self) -> String;\n" +"}\n" +"\n" +"struct Dog {\n" +" name: String,\n" +"}\n" +"\n" +"struct Cat;\n" +"\n" +"impl Pet for Dog {\n" +" fn name(&self) -> String {\n" +" self.name.clone()\n" +" }\n" +"}\n" +"\n" +"impl Pet for Cat {\n" +" fn name(&self) -> String {\n" +" String::from(\"The cat\") // No name, cats won't respond to it " +"anyway.\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let pets: Vec> = vec![\n" +" Box::new(Cat),\n" +" Box::new(Dog { name: String::from(\"Fido\") }),\n" +" ];\n" +" for pet in pets {\n" +" println!(\"Hello {}!\", pet.name());\n" " }\n" "}\n" "```" -#: src/traits/default-methods.md:58 -msgid "" -"With the blanket implementation, you no longer need `NotEqual` as a super " -"trait for `Equal`." -msgstr "" -"ํฌ๊ด„์  ๊ตฌํ˜„์„ ์‚ฌ์šฉํ•˜๋ฉด ๋” ์ด์ƒ `NotEqual`์ด `Equal`์˜ ์Šˆํผ ํŠธ๋ ˆ์ž‡์œผ๋กœ ํ•„์š”ํ•˜" -"์ง€ ์•Š์Šต๋‹ˆ๋‹ค." +#: src/traits/trait-objects.md:40 +msgid "Memory layout after allocating `pets`:" +msgstr "`pets`๋ฅผ ํ• ๋‹นํ•œ ์ดํ›„์˜ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ์ด์•„์›ƒ:" -#: src/traits.md:42 +#: src/traits/trait-objects.md:42 +msgid "" +"```bob\n" +" Stack Heap\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " +"- -.\n" +": : : :\n" +": " +"pets : : :\n" +": +-----------+-------+ : : +-----+-----" +"+ :\n" +": | ptr | o---+---+-----+-->| o o | o o " +"| :\n" +": | len | 2 | : : +-|-|-+-|-|-" +"+ :\n" +": | capacity | 2 | : : | | | | +---------------" +"+ :\n" +": +-----------+-------+ : : | | | '-->| name: \"Fido\" " +"| :\n" +": : : | | | +---------------" +"+ :\n" +"`- - - - - - - - - - - - - -' : | | " +"| :\n" +" : | | | +----------------------" +"+ : \n" +" : | | '---->| \"::name\" " +"| :\n" +" : | | +----------------------" +"+ : \n" +" : | " +"| : \n" +" : | | +-" +"+ : \n" +" : | '-->|" +"\\| : \n" +" : | +-" +"+ : \n" +" : " +"| : \n" +" : | +----------------------" +"+ : \n" +" : '---->| \"::name\" " +"| : \n" +" : +----------------------" +"+ :\n" +" : :\n" +" '- - - - - - - - - - - - - - - - - - - - - " +"- -'\n" +"\n" +"```" +msgstr "" +"```bob\n" +" ์Šคํƒ ํž™\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " +"- -.\n" +": : : :\n" +": " +"pets : : :\n" +": +-----------+-------+ : : +-----+-----" +"+ :\n" +": | ptr | o---+---+-----+-->| o o | o o " +"| :\n" +": | len | 2 | : : +-|-|-+-|-|-" +"+ :\n" +": | capacity | 2 | : : | | | | +---------------" +"+ :\n" +": +-----------+-------+ : : | | | '-->| name: \"Fido\" " +"| :\n" +": : : | | | +---------------" +"+ :\n" +"`- - - - - - - - - - - - - -' : | | " +"| :\n" +" : | | | +----------------------" +"+ : \n" +" : | | '---->| \"::name\" " +"| :\n" +" : | | +----------------------" +"+ : \n" +" : | " +"| : \n" +" : | | +-" +"+ : \n" +" : | '-->|" +"\\| : \n" +" : | +-" +"+ : \n" +" : " +"| : \n" +" : | +----------------------" +"+ : \n" +" : '---->| \"::name\" " +"| : \n" +" : +----------------------" +"+ :\n" +" : :\n" +" '- - - - - - - - - - - - - - - - - - - - - " +"- -'\n" +"\n" +"```" + +#: src/traits/trait-objects.md:72 msgid "" "Types that implement a given trait may be of different sizes. This makes it " -"impossible to have things like `Vec` in the example above." +"impossible to have things like `Vec` in the example above." msgstr "" "์—ฌ๋Ÿฌ ํƒ€์ž…์ด ๊ฐ™์€ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋”๋ผ๋„ ๊ทธ ํฌ๊ธฐ๋Š” ์„œ๋กœ ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜" -"์„œ `Vec`๊ฐ™์€ ๊ฒƒ์€ ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด `Greet`ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ํƒ€" -"์ž…๋“ค ์ค‘ ์–ด๋–ค ํฌ๊ธฐ์˜ ํƒ€์ž…์ด ์‹ค์ œ๋กœ ์‚ฌ์šฉ๋  ์ง€, ์ปดํŒŒ์ผ ์‹œ์— ์•Œ ๋ฐฉ๋ฒ•์ด ์—†๋Š” ๋ฐ˜" -"๋ฉด, `Vec<>`๋Š” ํƒ€์ž…์˜ ํฌ๊ธฐ๋ฅผ ์ปดํŒŒ์ผ ์‹œ์— ์•Œ๊ณ ์ž ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." +"์„œ `Vec`๊ฐ™์€ ๊ฒƒ์€ ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." -#: src/traits.md:43 +#: src/traits/trait-objects.md:73 msgid "" -"`dyn Greet` is a way to tell the compiler about a dynamically sized type " -"that implements `Greet`." -msgstr "`dyn Greet`๋Š” `Greet`์„ ๊ตฌํ˜„ํ•˜๋Š”, ๊ฐ€๋ณ€ ํฌ๊ธฐ์˜ ํƒ€์ž…์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." +"`dyn Pet` is a way to tell the compiler about a dynamically sized type that " +"implements `Pet`." +msgstr "" +"`dyn Pet`์ด๋ผ๊ณ  ํ•˜๋ฉด์ด ํƒ€์ž…์˜ ํฌ๊ธฐ๋Š” ๋™์ ์ด๋ฉฐ `Pet`์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ์ปดํŒŒ์ผ" +"๋Ÿฌ์—๊ฒŒ ์•Œ๋ ค์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." -#: src/traits.md:44 +#: src/traits/trait-objects.md:74 msgid "" -"In the example, `pets` holds Fat Pointers to objects that implement `Greet`. " -"The Fat Pointer consists of two components, a pointer to the actual object " -"and a pointer to the virtual method table for the `Greet` implementation of " +"In the example, `pets` holds _fat pointers_ to objects that implement `Pet`. " +"The fat pointer consists of two components, a pointer to the actual object " +"and a pointer to the virtual method table for the `Pet` implementation of " "that particular object." msgstr "" -"์˜ˆ์ œ์—์„œ `pets`๋Š” `Greet`์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฐ์ฒด๋“ค์˜ Fat pointer๋ฅผ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. " -"Fat pointer๋Š” ์‹ค์ œ ๊ฐ์ฒด์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ์™€ ๊ทธ ๊ฐ์ฒด๊ฐ€ `Greet`์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋Š” ๊ฐ€" -"์ƒ ํ•จ์ˆ˜ ํ…Œ์ด๋ธ”์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค." +"์˜ˆ์ œ์—์„œ `pets`๋Š” `Pet`์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฐ์ฒด๋“ค์˜ _Fat ํฌ์ธํ„ฐ_๋ฅผ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. " +"Fat ํฌ์ธํ„ฐ๋Š” ์‹ค์ œ ๊ฐ์ฒด์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ์™€ ๊ทธ ๊ฐ์ฒด๊ฐ€ `Pet`์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋Š” ๊ฐ€์ƒ " +"ํ•จ์ˆ˜ ํ…Œ์ด๋ธ”์— ๋Œ€ํ•œ ํฌ์ธํ„ฐ๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค." -#: src/traits.md:45 +#: src/traits/trait-objects.md:75 msgid "Compare these outputs in the above example:" msgstr "์•„๋ž˜ ์ฝ”๋“œ์˜ ๊ฒฐ๊ณผ์™€ ๋น„๊ตํ•ด๋ณด์„ธ์š”:" -#: src/traits.md:46 +#: src/traits/trait-objects.md:76 msgid "" "```rust,ignore\n" " println!(\"{} {}\", std::mem::size_of::(), std::mem::size_of::" "());\n" " println!(\"{} {}\", std::mem::size_of::<&Dog>(), std::mem::size_of::" "<&Cat>());\n" -" println!(\"{}\", std::mem::size_of::<&dyn Greet>());\n" -" println!(\"{}\", std::mem::size_of::>());\n" +" println!(\"{}\", std::mem::size_of::<&dyn Pet>());\n" +" println!(\"{}\", std::mem::size_of::>());\n" "```" msgstr "" "```rust,ignore\n" @@ -10252,17 +11847,25 @@ msgstr "" "());\n" " println!(\"{} {}\", std::mem::size_of::<&Dog>(), std::mem::size_of::" "<&Cat>());\n" -" println!(\"{}\", std::mem::size_of::<&dyn Greet>());\n" -" println!(\"{}\", std::mem::size_of::>());\n" +" println!(\"{}\", std::mem::size_of::<&dyn Pet>());\n" +" println!(\"{}\", std::mem::size_of::>());\n" "```" #: src/traits/deriving-traits.md:3 -msgid "You can let the compiler derive a number of traits:" +msgid "" +"Rust derive macros work by automatically generating code that implements the " +"specified traits for a data structure." +msgstr "" +"๋Ÿฌ์ŠคํŠธ์˜ derive ๋งคํฌ๋กœ๋Š” ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ์ฒด๊ฐ€ ํŠน์ • ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž๋™์œผ" +"๋กœ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค." + +#: src/traits/deriving-traits.md:5 +msgid "You can let the compiler derive a number of traits as follows:" msgstr "" "์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํŠธ๋ ˆ์ž‡์„ ์ƒ์†(derive)ํ•˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ ์ปดํŒŒ" "์ผ๋Ÿฌ๊ฐ€ ํŠธ๋ ˆ์ž‡์„ ์ž๋™์œผ๋กœ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค:" -#: src/traits/deriving-traits.md:5 +#: src/traits/deriving-traits.md:7 msgid "" "```rust,editable\n" "#[derive(Debug, Clone, PartialEq, Eq, Default)]\n" @@ -10305,9 +11908,9 @@ msgstr "" msgid "" "```rust,editable\n" "trait Equals {\n" -" fn equal(&self, other: &Self) -> bool;\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +" fn equals(&self, other: &Self) -> bool;\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" " }\n" "}\n" "\n" @@ -10315,7 +11918,7 @@ msgid "" "struct Centimeter(i16);\n" "\n" "impl Equals for Centimeter {\n" -" fn equal(&self, other: &Centimeter) -> bool {\n" +" fn equals(&self, other: &Centimeter) -> bool {\n" " self.0 == other.0\n" " }\n" "}\n" @@ -10323,16 +11926,16 @@ msgid "" "fn main() {\n" " let a = Centimeter(10);\n" " let b = Centimeter(20);\n" -" println!(\"{a:?} equals {b:?}: {}\", a.equal(&b));\n" -" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equal(&b));\n" +" println!(\"{a:?} equals {b:?}: {}\", a.equals(&b));\n" +" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equals(&b));\n" "}\n" "```" msgstr "" "```rust,editable\n" "trait Equals {\n" -" fn equal(&self, other: &Self) -> bool;\n" -" fn not_equal(&self, other: &Self) -> bool {\n" -" !self.equal(other)\n" +" fn equals(&self, other: &Self) -> bool;\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" " }\n" "}\n" "\n" @@ -10340,7 +11943,7 @@ msgstr "" "struct Centimeter(i16);\n" "\n" "impl Equals for Centimeter {\n" -" fn equal(&self, other: &Centimeter) -> bool {\n" +" fn equals(&self, other: &Centimeter) -> bool {\n" " self.0 == other.0\n" " }\n" "}\n" @@ -10348,11 +11951,294 @@ msgstr "" "fn main() {\n" " let a = Centimeter(10);\n" " let b = Centimeter(20);\n" -" println!(\"{a:?} equals {b:?}: {}\", a.equal(&b));\n" -" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equal(&b));\n" +" println!(\"{a:?} equals {b:?}: {}\", a.equals(&b));\n" +" println!(\"{a:?} not_equals {b:?}: {}\", a.not_equals(&b));\n" "}\n" "```" +#: src/traits/default-methods.md:32 +msgid "" +"Traits may specify pre-implemented (default) methods and methods that users " +"are required to implement themselves. Methods with default implementations " +"can rely on required methods." +msgstr "" +"ํŠธ๋ ˆ์ž‡์€, ๊ทธ ํŠธ๋ ˆ์ž‡์ด ์ •์˜๋œ ์œ„์น˜์—์„œ ์ง์ ‘ ๊ตฌํ˜„๋˜๋Š” ๋””ํดํŠธ ๋ฉ”์„œ๋“œ์™€, ๊ฑฐ๊ธฐ์—์„œ" +"๋Š” ์„ ์–ธ๋งŒ ์กด์žฌํ•˜๊ณ  ๊ทธ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ํƒ€์ž…์—์„œ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š”, ๋‘ ์ข…๋ฅ˜์˜ ๋ฉ”" +"์„œ๋“œ๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋””ํดํŠธ ๋ฉ”์„œ๋“œ๋ฅผ ๊ตฌํ˜„ํ•  ๋•Œ์—๋Š”, ๋‘ ์ข…๋ฅ˜์˜ ๋ฉ”์„œ๋“œ ๋ชจ" +"๋‘ ์‚ฌ์šฉ(ํ˜ธ์ถœ)ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/traits/default-methods.md:35 +msgid "Move method `not_equals` to a new trait `NotEquals`." +msgstr "`not_equal` ๋ฉ”์„œ๋“œ๋ฅผ ์ƒˆ๋กœ์šด ํŠธ๋ ˆ์ž‡์ธ `NotEqual`๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/default-methods.md:37 +msgid "Make `Equals` a super trait for `NotEquals`." +msgstr "`NotEqual`์„ `Equal`์˜ ์Šˆํผ ํŠธ๋ ˆ์ž‡์œผ๋กœ ๋งŒ๋“ญ๋‹ˆ๋‹ค." + +#: src/traits/default-methods.md:38 +msgid "" +"```rust,editable,compile_fail\n" +"trait NotEquals: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"trait NotEquals: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" +" }\n" +"}\n" +"```" + +#: src/traits/default-methods.md:46 +msgid "Provide a blanket implementation of `NotEquals` for `Equals`." +msgstr "`Equal`์— `NotEqual`์˜ ํฌ๊ด„์  ๊ตฌํ˜„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/default-methods.md:47 +msgid "" +"```rust,editable,compile_fail\n" +"trait NotEquals {\n" +" fn not_equals(&self, other: &Self) -> bool;\n" +"}\n" +"\n" +"impl NotEquals for T where T: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"trait NotEquals {\n" +" fn not_equals(&self, other: &Self) -> bool;\n" +"}\n" +"\n" +"impl NotEquals for T where T: Equals {\n" +" fn not_equals(&self, other: &Self) -> bool {\n" +" !self.equals(other)\n" +" }\n" +"}\n" +"```" + +#: src/traits/default-methods.md:58 +msgid "" +"With the blanket implementation, you no longer need `Equals` as a super " +"trait for `NotEqual`." +msgstr "" +"ํฌ๊ด„์  ๊ตฌํ˜„์„ ์‚ฌ์šฉํ•˜๋ฉด ๋” ์ด์ƒ `NotEqual`์ด `Equal`์˜ ์Šˆํผ ํŠธ๋ ˆ์ž‡์œผ๋กœ ํ•„์š”ํ•˜" +"์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/traits/trait-bounds.md:3 +msgid "" +"When working with generics, you often want to require the types to implement " +"some trait, so that you can call this trait's methods." +msgstr "" +"์ œ๋„ค๋ฆญ์„ ์ด์šฉํ•˜๋‹ค ๋ณด๋ฉด ํƒ€์ž…์ด ์–ด๋–ค ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต" +"๋‹ˆ๋‹ค. ๊ทธ๋ž˜์•ผ ๊ทธ ํŠธ๋ ˆ์ž‡์˜ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/traits/trait-bounds.md:6 +msgid "You can do this with `T: Trait` or `impl Trait`:" +msgstr "`T: Trait` ํ˜น์€ `impl Trait`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค:" + +#: src/traits/trait-bounds.md:8 +msgid "" +"```rust,editable\n" +"fn duplicate(a: T) -> (T, T) {\n" +" (a.clone(), a.clone())\n" +"}\n" +"\n" +"// Syntactic sugar for:\n" +"// fn add_42_millions>(x: T) -> i32 {\n" +"fn add_42_millions(x: impl Into) -> i32 {\n" +" x.into() + 42_000_000\n" +"}\n" +"\n" +"// struct NotClonable;\n" +"\n" +"fn main() {\n" +" let foo = String::from(\"foo\");\n" +" let pair = duplicate(foo);\n" +" println!(\"{pair:?}\");\n" +"\n" +" let many = add_42_millions(42_i8);\n" +" println!(\"{many}\");\n" +" let many_more = add_42_millions(10_000_000);\n" +" println!(\"{many_more}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"fn duplicate(a: T) -> (T, T) {\n" +" (a.clone(), a.clone())\n" +"}\n" +"\n" +"// ๋‹ค์Œ์— ๋Œ€ํ•œ ๋ฌธ๋ฒ• ์Šˆ๊ฐ€:\n" +"// fn add_42_millions>(x: T) -> i32 {\n" +"fn add_42_millions(x: impl Into) -> i32 {\n" +" x.into() + 42_000_000\n" +"}\n" +"\n" +"// struct NotClonable;\n" +"\n" +"fn main() {\n" +" let foo = String::from(\"foo\");\n" +" let pair = duplicate(foo);\n" +" println!(\"{pair:?}\");\n" +"\n" +" let many = add_42_millions(42_i8);\n" +" println!(\"{many}\");\n" +" let many_more = add_42_millions(10_000_000);\n" +" println!(\"{many_more}\");\n" +"}\n" +"```" + +#: src/traits/trait-bounds.md:35 +msgid "Show a `where` clause, students will encounter it when reading code." +msgstr "" +"`where` ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ฐ•์ƒ๋“ค๋„ ์ฝ”๋“œ๋ฅผ ์ฝ๋‹ค๊ฐ€ ๊ทธ ๋ฌธ๋ฒ•์„ ๋งˆ์ฃผ" +"ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/traits/trait-bounds.md:37 +msgid "" +"```rust,ignore\n" +"fn duplicate(a: T) -> (T, T)\n" +"where\n" +" T: Clone,\n" +"{\n" +" (a.clone(), a.clone())\n" +"}\n" +"```" +msgstr "" +"```rust,ignore\n" +"fn duplicate(a: T) -> (T, T)\n" +"where\n" +" T: Clone,\n" +"{\n" +" (a.clone(), a.clone())\n" +"}\n" +"```" + +#: src/traits/trait-bounds.md:46 +msgid "It declutters the function signature if you have many parameters." +msgstr "" +"์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๊ฐ€ ๋งŽ์€ ๊ฒฝ์šฐ ํ•จ์ˆ˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋Š” ๋ฐ " +"๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค." + +#: src/traits/trait-bounds.md:47 +msgid "It has additional features making it more powerful." +msgstr "์ข€ ๋” ๊ฐ•๋ ฅํ•œ ์ถ”๊ฐ€ ๊ธฐ๋Šฅ๋„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/trait-bounds.md:48 +msgid "" +"If someone asks, the extra feature is that the type on the left of \":\" can " +"be arbitrary, like `Option`." +msgstr "`:` ์™ผ์ชฝ์— ์ž„์˜์˜ ํƒ€์ž…(์˜ˆ๋ฅผ ๋“ค์–ด `Option`)์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/traits/impl-trait.md:1 +msgid "`impl Trait`" +msgstr "ํŠธ๋ ˆ์ž‡ ๊ตฌํ˜„ํ•˜๊ธฐ(`impl Trait`)" + +#: src/traits/impl-trait.md:3 +msgid "" +"Similar to trait bounds, an `impl Trait` syntax can be used in function " +"arguments and return values:" +msgstr "" +"ํŠธ๋ ˆ์ž‡ ๋ฐ”์šด๋“œ์™€ ์œ ์‚ฌํ•˜๊ฒŒ `impl Trait` ๋ฌธ๋ฒ•์€ ํ•จ์ˆ˜์˜ ์ธ์ž์™€ ๋ฐ˜ํ™˜๊ฐ’์—๋„ ์ ์šฉ ๊ฐ€" +"๋Šฅํ•ฉ๋‹ˆ๋‹ค:" + +#: src/traits/impl-trait.md:6 +msgid "" +"```rust,editable\n" +"use std::fmt::Display;\n" +"\n" +"fn get_x(name: impl Display) -> impl Display {\n" +" format!(\"Hello {name}\")\n" +"}\n" +"\n" +"fn main() {\n" +" let x = get_x(\"foo\");\n" +" println!(\"{x}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::fmt::Display;\n" +"\n" +"fn get_x(name: impl Display) -> impl Display {\n" +" format!(\"Hello {name}\")\n" +"}\n" +"\n" +"fn main() {\n" +" let x = get_x(\"foo\");\n" +" println!(\"{x}\");\n" +"}\n" +"```" + +#: src/traits/impl-trait.md:19 +msgid "`impl Trait` allows you to work with types which you cannot name." +msgstr "`impl Trait`๋ฅผ ์ด์šฉํ•˜๋ฉด ์ด๋ฆ„์ด ์—†๋Š” ํƒ€์ž…์„ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/traits/impl-trait.md:23 +msgid "" +"The meaning of `impl Trait` is a bit different in the different positions." +msgstr "`impl Trait`๋Š” ์–ด๋””์— ์‚ฌ์šฉ๋˜์—ˆ๋А๋ƒ์— ๋”ฐ๋ผ ์˜๋ฏธ๊ฐ€ ์กฐ๊ธˆ์”ฉ ๋‹ค๋ฆ…๋‹ˆ๋‹ค." + +#: src/traits/impl-trait.md:25 +msgid "" +"For a parameter, `impl Trait` is like an anonymous generic parameter with a " +"trait bound." +msgstr "" +"ํ•จ์ˆ˜ ์ธ์ž์˜ ํƒ€์ž…์œผ๋กœ ์‚ฌ์šฉ๋˜์—ˆ์„ ๊ฒฝ์šฐ์—๋Š” `impl Trait`๋Š” ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„๊ฐ€ ์žˆ๋Š” ์ต" +"๋ช…์˜ ์ œ๋„ค๋ฆญ ํƒ€์ž…์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/impl-trait.md:27 +msgid "" +"For a return type, it means that the return type is some concrete type that " +"implements the trait, without naming the type. This can be useful when you " +"don't want to expose the concrete type in a public API." +msgstr "" +"๋ฆฌํ„ด ํƒ€์ž…์œผ๋กœ ์‚ฌ์šฉ๋˜์—ˆ์„ ๊ฒฝ์šฐ์—๋Š”, ๊ทธ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ตฌ์ฒด์ ์ธ ํƒ€์ž…์ธ๋ฐ, ํƒ€" +"์ž… ์ด๋ฆ„์„ ํ”„๋กœ๊ทธ๋ž˜๋จธ๊ฐ€ ์ง“์ง€ ์•Š์•˜๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๊ทธ ๊ตฌ์ฒด์ ์ธ ํƒ€์ž… " +"์ด๋ฆ„์„ API๋กœ ๊ณต๊ฐœํ•˜๊ณ  ์‹ถ์ง€ ์•Š์€ ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/impl-trait.md:31 +msgid "" +"Inference is hard in return position. A function returning `impl Foo` picks " +"the concrete type it returns, without writing it out in the source. A " +"function returning a generic type like `collect() -> B` can return any " +"type satisfying `B`, and the caller may need to choose one, such as with " +"`let x: Vec<_> = foo.collect()` or with the turbofish, `foo.collect::" +">()`." +msgstr "" +"ํ•จ์ˆ˜๊ฐ€ ๋ฆฌํ„ด๋˜๋Š” ๊ณณ์—์„œ์˜ ํƒ€์ž… ์ถ”๋ก ์€ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ์–ด๋–ค ํ•จ์ˆ˜์˜ ๋ฆฌํ„ด ํƒ€์ž…์ด " +"`impl Foo`๋กœ ์„ ์–ธ๋˜์–ด ์žˆ์„ ๊ฒฝ์šฐ, ๊ทธ ํ•จ์ˆ˜๊ฐ€ ์‹ค์ œ๋กœ ๋ฆฌํ„ดํ•˜๋Š” ํƒ€์ž…์€ ์†Œ์Šค ์ฝ”๋“œ " +"์ƒ ์–ด๋””์—๋„ ๋‚˜ํƒ€๋‚˜ ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. `collect B`์™€ ๊ฐ™์ด ์ œ๋„ˆ๋ฆญ ํƒ€์ž…์„ ๋ฆฌ" +"ํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋Š” `B`๋ฅผ ๋งŒ์กฑํ•˜๋Š” ์–ด๋–ค ํƒ€์ž…๋„ ๋ฆฌํ„ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ, ํ˜ธ์ถœํ•˜" +"๋Š” ์ธก์—์„œ๋Š” `let x: Vec<_> = foo.collect()`๋‚˜ ํ„ฐ๋ณดํ”ผ์‹œ ๋ฌธ๋ฒ•์„ ์จ์„œ `foo." +"collect::>()`์™€ ๊ฐ™์ด ๋ฆฌํ„ด ํƒ€์ž…์„ ๋ช…์‹œ์ ์œผ๋กœ ์จ ์ฃผ์–ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ" +"๋‹ค." + +#: src/traits/impl-trait.md:37 +msgid "" +"This example is great, because it uses `impl Display` twice. It helps to " +"explain that nothing here enforces that it is _the same_ `impl Display` " +"type. If we used a single `T: Display`, it would enforce the constraint " +"that input `T` and return `T` type are the same type. It would not work for " +"this particular function, as the type we expect as input is likely not what " +"`format!` returns. If we wanted to do the same via `: Display` syntax, we'd " +"need two independent generic parameters." +msgstr "" +"์ด ์˜ˆ์‹œ๋Š” `impl Display`๊ฐ€ ๋‘๋ฒˆ ์‚ฌ์šฉ ๋˜์—ˆ๋‹ค๋Š” ์ ์—์„œ ํ›Œ๋ฅญํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ์ค‘์š”" +"ํ•œ ๊ฒƒ์€ ์ด ๋‘ `impl Display`๊ฐ€ ์‹ค์ œ๋กœ ๊ฐ™์€ ํƒ€์ž…์ผ ํ•„์š”๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋งŒ" +"์•ฝ `T: Display`๋กœ ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„๋ฅผ ์ •ํ•˜๊ณ  ์ž…๋ ฅ ํŒŒ๋ผ๋ฉ”ํ„ฐ์™€ ๋ฆฌํ„ด ๊ฐ’์˜ ํƒ€์ž…์„ ๋ชจ๋‘ " +"`T`๋กœ ํ–ˆ๋‹ค๋ฉด, ์ด๋Š” ์ž…๋ ฅ๊ณผ ๋ฆฌํ„ด๊ฐ’์ด ๊ฐ™์€ ํƒ€์ž…์ž„์„ ๊ฐ•์ œํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ–ˆ๋‹ค๋ฉด ์œ„" +"์˜ ์˜ˆ์ œ๋Š” ๋™์ž‘ํ•˜์ง€ ์•Š์•˜์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด, ์ž…๋ ฅ ๊ฐ’์˜ ํƒ€์ž…์ด `format!`์ด ๋ฆฌ" +"ํ„ดํ•˜๋Š” ํƒ€์ž…๊ณผ ๊ฐ™์ง€ ์•Š์„ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ `: Display` ๋ฌธ๋ฒ•์„ ์‚ฌ" +"์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ๋…๋ฆฝ์ ์ธ ์ œ๋„ค๋ฆญ ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ๋‘ ๊ฐœ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค." + #: src/traits/important-traits.md:3 msgid "" "We will now look at some of the most common traits of the Rust standard " @@ -10368,7 +12254,7 @@ msgid "" msgstr "" "[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html)์™€ " "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " -"ํŠธ๋ ˆ์ž‡์€ `for` ๋ฃจํ”„์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค." +"ํŠธ๋ ˆ์ž‡์€ `for` ๋ฐ˜๋ณต๋ฌธ์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค," #: src/traits/important-traits.md:6 msgid "" @@ -10378,7 +12264,7 @@ msgid "" msgstr "" "[`From`](https://doc.rust-lang.org/std/convert/trait.From.html)๊ณผ [`Into`]" "(https://doc.rust-lang.org/std/convert/trait.Into.html) ํŠธ๋ ˆ์ž‡์€ ๊ฐ’์„ ๋ณ€ํ™˜ํ•  " -"๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค." +"๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค," #: src/traits/important-traits.md:7 msgid "" @@ -10387,7 +12273,7 @@ msgid "" msgstr "" "[`Read`](https://doc.rust-lang.org/std/io/trait.Read.html)์™€ [`Write`]" "(https://doc.rust-lang.org/std/io/trait.Write.html) ํŠธ๋ ˆ์ž‡์€ I/O์— ์‚ฌ์šฉ๋ฉ๋‹ˆ" -"๋‹ค." +"๋‹ค," #: src/traits/important-traits.md:8 msgid "" @@ -10479,26 +12365,16 @@ msgstr "" #: src/traits/iterator.md:32 msgid "" -"`IntoIterator` is the trait that makes for loops work. It is implemented by " -"collection types such as `Vec` and references to them such as `&Vec` " -"and `&[T]`. Ranges also implement it." -msgstr "" -"`IntoIterator`๋Š” ๋ฃจํ”„๊ฐ€ ์ž‘๋™ํ•˜๋„๋ก ๋งŒ๋“œ๋Š” ํŠธ๋ ˆ์ž‡์ž…๋‹ˆ๋‹ค. `Vec`์™€ ๊ฐ™์€ ์ปฌ๋ ‰" -"์…˜ ํƒ€์ž…๊ณผ ๊ทธ์— ๋Œ€ํ•œ ์ฐธ์กฐ ํƒ€์ž…(`&Vec`, `&[T]`)๋“ค ๋ชจ๋‘ ์ด ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ" -"๋‹ค. Range ์—ญ์‹œ ์ด๋ฅผ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค." - -#: src/traits/iterator.md:34 src/traits/iterator.md:32 -msgid "" "The `Iterator` trait implements many common functional programming " "operations over collections (e.g. `map`, `filter`, `reduce`, etc). This is " "the trait where you can find all the documentation about them. In Rust these " "functions should produce the code as efficient as equivalent imperative " "implementations." msgstr "" -"`Iterator` ํŠธ๋ ˆ์ž‡์€ ์ปฌ๋ ‰์…˜์— ๋Œ€ํ•ด ๋‹ค์–‘ํ•œ ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ฐ์‚ฐ (`map`, " -"`filter`, `reduce` ๋“ฑ)์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์ด ์—ฐ์‚ฐ๋“ค์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์„ค๋ช…์€ " -"`Iterator` ํŠธ๋ ˆ์ž‡์˜ API ๋ ˆํผ๋Ÿฐ์Šค์—์„œ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ์—์„œ ์ด๋Ÿฌํ•œ ํ•จ์ˆ˜" -"ํ˜• ์—ฐ์‚ฐ๋“ค์€ ์ ˆ์ฐจํ˜•์œผ๋กœ ๊ตฌํ˜„๋œ ์ฝ”๋“œ์™€ ๋™์ผํ•œ ์„ฑ๋Šฅ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." +"`Iterator` ํŠธ๋ ˆ์ž‡์€ ์ปฌ๋ ‰์…˜์— ๋Œ€ํ•œ ์—ฌ๋Ÿฌ ์ผ๋ฐ˜์ ์ธ ํ•จ์ˆ˜ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ž‘์—…(์˜ˆ: " +"`map`, `filter`, `reduce` ๋“ฑ)์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๊ด€๋ จ ๋ฌธ์„œ๋ฅผ ๋ชจ๋‘ ์ฐพ์„ ์ˆ˜ ์žˆ" +"๋Š” ํŠธ๋ ˆ์ž‡์ž…๋‹ˆ๋‹ค. Rust์—์„œ๋Š” ์ด๋Ÿฌํ•œ ํ•จ์ˆ˜๊ฐ€, ์ด์™€ ๋™์ผํ•œ ์ผ์„ ํ•˜๋Š” ๋ช…๋ นํ˜• ๊ตฌํ˜„" +"๋งŒํผ ํšจ์œจ์ ์ธ ์ฝ”๋“œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค." #: src/traits/iterator.md:37 msgid "" @@ -10741,88 +12617,6 @@ msgstr "" "}\n" "```" -#: src/traits/operators.md:1 -msgid "`Add`, `Mul`, ..." -msgstr "`Add`, `Mul`, ..." - -#: src/traits/operators.md:3 -msgid "" -"Operator overloading is implemented via traits in [`std::ops`](https://doc." -"rust-lang.org/std/ops/index.html):" -msgstr "์—ฐ์‚ฐ์ž ์˜ค๋ฒ„๋กœ๋“œ๋Š” `std::ops`์— ์žˆ๋Š” ๋‹ค์–‘ํ•œ ํŠธ๋ ˆ์ž‡๋“ค์„ ํ†ตํ•ด ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค:" - -#: src/traits/operators.md:5 -msgid "" -"```rust,editable\n" -"#[derive(Debug, Copy, Clone)]\n" -"struct Point { x: i32, y: i32 }\n" -"\n" -"impl std::ops::Add for Point {\n" -" type Output = Self;\n" -"\n" -" fn add(self, other: Self) -> Self {\n" -" Self {x: self.x + other.x, y: self.y + other.y}\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" let p1 = Point { x: 10, y: 20 };\n" -" let p2 = Point { x: 100, y: 200 };\n" -" println!(\"{:?} + {:?} = {:?}\", p1, p2, p1 + p2);\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"#[derive(Debug, Copy, Clone)]\n" -"struct Point { x: i32, y: i32 }\n" -"\n" -"impl std::ops::Add for Point {\n" -" type Output = Self;\n" -"\n" -" fn add(self, other: Self) -> Self {\n" -" Self {x: self.x + other.x, y: self.y + other.y}\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" let p1 = Point { x: 10, y: 20 };\n" -" let p2 = Point { x: 100, y: 200 };\n" -" println!(\"{:?} + {:?} = {:?}\", p1, p2, p1 + p2);\n" -"}\n" -"```" - -#: src/traits/operators.md:26 src/traits/drop.md:34 -msgid "Discussion points:" -msgstr "๋…ผ์˜์ :" - -#: src/traits/operators.md:28 -msgid "" -"You could implement `Add` for `&Point`. In which situations is that useful? " -msgstr "" -"`&Point`๊ฐ€ `Add`๋ฅผ ๊ตฌํ˜„ํ•˜๋„๋ก ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒŒ ์–ด๋–ค ๊ฒฝ์šฐ์— ์œ ์šฉํ• ๊นŒ์š”?" - -#: src/traits/operators.md:29 -msgid "" -"Answer: `Add:add` consumes `self`. If type `T` for which you are overloading " -"the operator is not `Copy`, you should consider overloading the operator for " -"`&T` as well. This avoids unnecessary cloning on the call site." -msgstr "" -"๋‹ต: `Add:add`๋Š” `self`๋ฅผ ์†Œ๋ชจํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ํƒ€์ž… `T`๊ฐ€ `Copy`ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๊ณ  " -"์žˆ์ง€ ์•Š๋‹ค๋ฉด `&T`์— ๋Œ€ํ•ด์„œ๋„ ์—ฐ์‚ฐ์ž ์˜ค๋ฒ„๋กœ๋”ฉ์„ ๊ณ ๋ คํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ˜ธ" -"์ถœ๋ถ€์—์„œ ๋ถˆํ•„์š”ํ•œ ๋ณต์‚ฌ๋ฅผ ํ”ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/traits/operators.md:33 -msgid "Why is `Output` an associated type? Could it be made a type parameter?" -msgstr "์™œ `Output`์ด ์—ฐ๊ด€๋œ ํƒ€์ž…์ธ๊ฐ€์š”? ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์„๊นŒ์š”?" - -#: src/traits/operators.md:34 -msgid "" -"Short answer: Type parameters are controlled by the caller, but associated " -"types (like `Output`) are controlled by the implementor of a trait." -msgstr "" -"๋‹ต: ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ์ชฝ์—์„œ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ฉด ์—ฐ๊ด€๋œ ํƒ€์ž…(`Output`๊ฐ™" -"์€) ์€ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ์ชฝ์—์„œ ์ œ์–ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." - #: src/traits/drop.md:1 msgid "The `Drop` Trait" msgstr "`Drop` ํŠธ๋ ˆ์ž‡" @@ -10891,6 +12685,10 @@ msgstr "" "}\n" "```" +#: src/traits/drop.md:34 src/traits/operators.md:26 +msgid "Discussion points:" +msgstr "๋…ผ์˜์ :" + #: src/traits/drop.md:36 msgid "Why doesn't `Drop::drop` take `self`?" msgstr "`Drop::drop`์€ ์™œ `self`๋ฅผ ์ธ์ž๋กœ ๋ฐ›์ง€ ์•Š์Šต๋‹ˆ๊นŒ?" @@ -10901,7 +12699,7 @@ msgid "" "block, resulting in another call to `Drop::drop`, and a stack overflow!" msgstr "" "์งง์€ ๋Œ€๋‹ต: ๋งŒ์•ฝ ๊ทธ๋ ‡๊ฒŒ ๋œ๋‹ค๋ฉด `std::mem::drop`์ด ๋ธ”๋ก์˜ ๋์—์„œ ํ˜ธ์ถœ๋˜๊ณ , ๋‹ค" -"์‹œ `Drop::drop`์„ ํ˜ธ์ถœํ•˜๊ฒŒ๋˜ ์Šคํƒ ์˜ค๋ฒ„ํ”Œ๋กœ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค." +"์‹œ `Drop::drop`์„ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜์–ด, ์Šคํƒ ์˜ค๋ฒ„ํ”Œ๋กœ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค!" #: src/traits/drop.md:40 msgid "Try replacing `drop(a)` with `a.drop()`." @@ -10914,10 +12712,10 @@ msgstr "`Default` ํŠธ๋ ˆ์ž‡" #: src/traits/default.md:3 msgid "" "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait " -"provides a default implementation of a trait." +"produces a default value for a type." msgstr "" "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) ํŠธ๋ ˆ์ž‡" -"์€ ๊ธฐ๋ณธ ๊ตฌํ˜„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." +"์€ ์–ด๋–ค ํƒ€์ž…์— ๋Œ€ํ•œ ๊ธฐ๋ณธ๊ฐ’์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." #: src/traits/default.md:5 msgid "" @@ -10939,12 +12737,12 @@ msgid "" "}\n" "\n" "fn main() {\n" -" let default_struct: Derived = Default::default();\n" +" let default_struct = Derived::default();\n" " println!(\"{default_struct:#?}\");\n" "\n" " let almost_default_struct = Derived {\n" " y: \"Y is set!\".into(),\n" -" ..Default::default()\n" +" ..Derived::default()\n" " };\n" " println!(\"{almost_default_struct:#?}\");\n" "\n" @@ -10972,12 +12770,12 @@ msgstr "" "}\n" "\n" "fn main() {\n" -" let default_struct: Derived = Default::default();\n" +" let default_struct = Derived::default();\n" " println!(\"{default_struct:#?}\");\n" "\n" " let almost_default_struct = Derived {\n" " y: \"Y is set!\".into(),\n" -" ..Default::default()\n" +" ..Derived::default()\n" " };\n" " println!(\"{almost_default_struct:#?}\");\n" "\n" @@ -10996,7 +12794,7 @@ msgstr "" #: src/traits/default.md:41 msgid "" -"Derived implementation will produce an instance where all fields are set to " +"A derived implementation will produce a value where all fields are set to " "their default values." msgstr "" "์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ์ œ๊ณตํ•˜๋Š” ์ž๋™ ๊ตฌํ˜„์˜ ๊ฒฝ์šฐ ๋ชจ๋“  ํ•„๋“œ์— ๋Œ€ํ•ด ๊ธฐ๋ณธ ๊ฐ’์„ ์„ค์ •ํ•œ ์ƒˆ ์ธ" @@ -11004,7 +12802,9 @@ msgstr "" #: src/traits/default.md:42 msgid "This means all types in the struct must implement `Default` too." -msgstr "๊ตฌ์กฐ์ฒด์˜ ๊ฐ ํ•„๋“œ ํƒ€์ž…๋“ค์ด ๋ชจ๋‘ `Default`๋ฅผ ๊ตฌํ˜„ํ•ด์•ผ ํ•จ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." +msgstr "" +"์ด๋Š” ๊ตฌ์กฐ์ฒด์˜ ๊ฐ ํ•„๋“œ ํƒ€์ž…๋“ค์ด ๋ชจ๋‘ `Default` ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•ด์•ผ ํ•จ์„ ์˜๋ฏธํ•ฉ๋‹ˆ" +"๋‹ค." #: src/traits/default.md:43 msgid "" @@ -11016,7 +12816,8 @@ msgstr "" #: src/traits/default.md:44 msgid "The partial struct copy works nicely with default." -msgstr "๊ตฌ์กฐ์ฒด ๋ถ€๋ถ„ ๋ณต์‚ฌ๋ฅผ ํ• ๋•Œ `default`๋ฅผ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr "" +"๊ตฌ์กฐ์ฒด์˜ ์ผ๋ถ€๋ถ„๋งŒ ๋ณต์‚ฌํ•˜๊ณ  ์‹ถ์„ ๋•Œ `default`๋ฅผ ํŽธ๋ฆฌํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." #: src/traits/default.md:45 msgid "" @@ -11026,327 +12827,110 @@ msgstr "" "๋Ÿฌ์ŠคํŠธ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” `Default` ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•œ ํƒ€์ž…์„ ์œ„ํ•œ ํŽธ์˜ ๋ฉ”์„œ๋“œ๋ฅผ " "์ œ๊ณตํ•˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค." -#: src/generics.md:3 +#: src/traits/default.md:46 msgid "" -"Rust support generics, which lets you abstract an algorithm (such as " -"sorting) over the types used in the algorithm." +"the `..` syntax is called [struct update syntax](https://doc.rust-lang.org/" +"book/ch05-01-defining-structs.html#creating-instances-from-other-instances-" +"with-struct-update-syntax)" msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ์ œ๋„ค๋ฆญ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ์•Œ๊ณ ๋ฆฌ์ฆ˜(์ •๋ ฌ๊ณผ ๊ฐ™์€)์„ ์ถ”์ƒํ™” ํ•˜" -"์—ฌ ํŠน์ • ํƒ€์ž…์— ์˜์กดํ•˜์ง€ ์•Š๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"์ด `..` ๋ฌธ๋ฒ•์€ [๊ตฌ์กฐ์ฒด ์—…๋ฐ์ดํŠธ ๋ฌธ๋ฒ•(struct update syntax)](https://doc.rust-" +"lang.org/book/ch05-01-defining-structs.html#creating-instances-from-other-" +"instances-with-struct-update-syntax)๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค" -#: src/generics/data-types.md:3 -msgid "You can use generics to abstract over the concrete field type:" -msgstr "์ œ๋„ค๋ฆญ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•„๋“œ์˜ ํƒ€์ž…์„ ์ถ”์ƒํ™” ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" +#: src/traits/operators.md:1 +msgid "`Add`, `Mul`, ..." +msgstr "`Add`, `Mul`, ..." -#: src/generics/data-types.md:5 +#: src/traits/operators.md:3 +msgid "" +"Operator overloading is implemented via traits in [`std::ops`](https://doc." +"rust-lang.org/std/ops/index.html):" +msgstr "์—ฐ์‚ฐ์ž ์˜ค๋ฒ„๋กœ๋“œ๋Š” `std::ops`์— ์žˆ๋Š” ๋‹ค์–‘ํ•œ ํŠธ๋ ˆ์ž‡๋“ค์„ ํ†ตํ•ด ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค:" + +#: src/traits/operators.md:5 msgid "" "```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point {\n" -" x: T,\n" -" y: T,\n" -"}\n" +"#[derive(Debug, Copy, Clone)]\n" +"struct Point { x: i32, y: i32 }\n" "\n" -"fn main() {\n" -" let integer = Point { x: 5, y: 10 };\n" -" let float = Point { x: 1.0, y: 4.0 };\n" -" println!(\"{integer:?} and {float:?}\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point {\n" -" x: T,\n" -" y: T,\n" -"}\n" +"impl std::ops::Add for Point {\n" +" type Output = Self;\n" "\n" -"fn main() {\n" -" let integer = Point { x: 5, y: 10 };\n" -" let float = Point { x: 1.0, y: 4.0 };\n" -" println!(\"{integer:?} and {float:?}\");\n" -"}\n" -"```" - -#: src/generics/data-types.md:21 -msgid "Try declaring a new variable `let p = Point { x: 5, y: 10.0 };`." -msgstr "์ƒˆ ๋ณ€์ˆ˜ `let p = Point { x: 5, y: 10.0 };`๋ฅผ ์„ ์–ธํ•ด ๋ณด์„ธ์š”." - -#: src/generics/data-types.md:23 -msgid "Fix the code to allow points that have elements of different types." -msgstr "" -"`Point`๊ฐ€ ์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…์˜ ๊ฐ’๋“ค์œผ๋กœ ์ด๋ฃจ์–ด์ ธ๋„ ์ปดํŒŒ์ผ ๋˜๋„๋ก ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•ด ๋ณด" -"์„ธ์š”." - -#: src/generics/methods.md:3 -msgid "You can declare a generic type on your `impl` block:" -msgstr "`impl` ๋ธ”๋ก์—์„œ๋„ ์ œ๋„ค๋ฆญ ํƒ€์ž…์„ ์„ ์–ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" - -#: src/generics/methods.md:5 -msgid "" -"```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point(T, T);\n" -"\n" -"impl Point {\n" -" fn x(&self) -> &T {\n" -" &self.0 // + 10\n" +" fn add(self, other: Self) -> Self {\n" +" Self {x: self.x + other.x, y: self.y + other.y}\n" " }\n" -"\n" -" // fn set_x(&mut self, x: T)\n" "}\n" "\n" "fn main() {\n" -" let p = Point(5, 10);\n" -" println!(\"p.x = {}\", p.x());\n" +" let p1 = Point { x: 10, y: 20 };\n" +" let p2 = Point { x: 100, y: 200 };\n" +" println!(\"{:?} + {:?} = {:?}\", p1, p2, p1 + p2);\n" "}\n" "```" msgstr "" "```rust,editable\n" -"#[derive(Debug)]\n" -"struct Point(T, T);\n" +"#[derive(Debug, Copy, Clone)]\n" +"struct Point { x: i32, y: i32 }\n" "\n" -"impl Point {\n" -" fn x(&self) -> &T {\n" -" &self.0 // + 10\n" +"impl std::ops::Add for Point {\n" +" type Output = Self;\n" +"\n" +" fn add(self, other: Self) -> Self {\n" +" Self {x: self.x + other.x, y: self.y + other.y}\n" " }\n" -"\n" -" // fn set_x(&mut self, x: T)\n" "}\n" "\n" "fn main() {\n" -" let p = Point(5, 10);\n" -" println!(\"p.x = {}\", p.x());\n" +" let p1 = Point { x: 10, y: 20 };\n" +" let p2 = Point { x: 100, y: 200 };\n" +" println!(\"{:?} + {:?} = {:?}\", p1, p2, p1 + p2);\n" "}\n" "```" -#: src/generics/methods.md:25 +#: src/traits/operators.md:28 msgid "" -"_Q:_ Why `T` is specified twice in `impl Point {}`? Isn't that " -"redundant?" -msgstr "_์งˆ๋ฌธ:_ `impl Point {}`์—์„œ `T`๊ฐ€ ์™œ ๋‘ ๋ฒˆ ์‚ฌ์šฉ๋ฉ๋‹ˆ๊นŒ?" +"You could implement `Add` for `&Point`. In which situations is that useful? " +msgstr "" +"`&Point`๊ฐ€ `Add`๋ฅผ ๊ตฌํ˜„ํ•˜๋„๋ก ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒŒ ์–ด๋–ค ๊ฒฝ์šฐ์— ์œ ์šฉํ• ๊นŒ์š”? " -#: src/generics/methods.md:26 +#: src/traits/operators.md:29 msgid "" -"This is because it is a generic implementation section for generic type. " -"They are independently generic." +"Answer: `Add:add` consumes `self`. If type `T` for which you are overloading " +"the operator is not `Copy`, you should consider overloading the operator for " +"`&T` as well. This avoids unnecessary cloning on the call site." msgstr "" -"์ œ๋„ค๋ฆญ ํƒ€์ž…์— ๋Œ€ํ•œ ์ œ๋„ค๋ฆญ ๊ตฌํ˜„ ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์ด ๋‘ ์ œ๋„ค๋ฆญ์€ ์„œ๋กœ ๋…๋ฆฝ์ ์ž…" -"๋‹ˆ๋‹ค." +"๋‹ต: `Add:add`๋Š” `self`๋ฅผ ์†Œ๋ชจํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ํƒ€์ž… `T`๊ฐ€ `Copy`ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๊ณ  " +"์žˆ์ง€ ์•Š๋‹ค๋ฉด `&T`์— ๋Œ€ํ•ด์„œ๋„ ์—ฐ์‚ฐ์ž ์˜ค๋ฒ„๋กœ๋”ฉ์„ ๊ณ ๋ คํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ˜ธ" +"์ถœ๋ถ€์—์„œ ๋ถˆํ•„์š”ํ•œ ๋ณต์‚ฌ๋ฅผ ํ”ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/generics/methods.md:27 -msgid "It means these methods are defined for any `T`." -msgstr "" -"์ด๋Š” ์ž„์˜์˜ ๋ชจ๋“  `T`์— ๋Œ€ํ•ด์„œ ์ด ๋ฉ”์†Œ๋“œ๋“ค์ด ์ •์˜๋œ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/methods.md:28 -msgid "It is possible to write `impl Point { .. }`. " -msgstr "`impl Point { .. }`์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/methods.md:29 +#: src/traits/operators.md:33 msgid "" -"`Point` is still generic and you can use `Point`, but methods in this " -"block will only be available for `Point`." -msgstr "" -"`Point`๋Š” ์—ฌ์ „ํžˆ ์ œ๋„ค๋ฆญ์ด๋ฉฐ `Point`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์ด ๋ธ”๋ก์˜ ๋ฉ”์„œ" -"๋“œ๋Š” `Point`๋งŒ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"Why is `Output` an associated type? Could it be made a type parameter of the " +"method?" +msgstr "์™œ `Output`์ด ์—ฐ๊ด€๋œ ํƒ€์ž…์ธ๊ฐ€์š”? ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์„๊นŒ์š”?" -#: src/generics/trait-bounds.md:3 +#: src/traits/operators.md:34 msgid "" -"When working with generics, you often want to require the types to implement " -"some trait, so that you can call this trait's methods." +"Short answer: Function type parameters are controlled by the caller, but " +"associated types (like `Output`) are controlled by the implementor of a " +"trait." msgstr "" -"์ œ๋„ค๋ฆญ์„ ์ด์šฉํ•˜๋‹ค ๋ณด๋ฉด ํƒ€์ž…์ด ์–ด๋–ค ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต" -"๋‹ˆ๋‹ค. ๊ทธ๋ž˜์•ผ ๊ทธ ํŠธ๋ ˆ์ž‡์˜ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." +"๋‹ต: ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ์ชฝ์—์„œ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ฉด ์—ฐ๊ด€๋œ ํƒ€์ž…(`Output`๊ฐ™" +"์€) ์€ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ์ชฝ์—์„œ ์ œ์–ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." -#: src/generics/trait-bounds.md:6 -msgid "You can do this with `T: Trait` or `impl Trait`:" -msgstr "`T: Trait` ํ˜น์€ `impl Trait`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค:" - -#: src/traits/trait-bounds.md:8 +#: src/traits/operators.md:37 msgid "" -"```rust,editable\n" -"fn duplicate(a: T) -> (T, T) {\n" -" (a.clone(), a.clone())\n" -"}\n" -"\n" -"// Syntactic sugar for:\n" -"// fn add_42_millions>(x: T) -> i32 {\n" -"fn add_42_millions(x: impl Into) -> i32 {\n" -" x.into() + 42_000_000\n" -"}\n" -"\n" -"// struct NotClonable;\n" -"\n" -"fn main() {\n" -" let foo = String::from(\"foo\");\n" -" let pair = duplicate(foo);\n" -" println!(\"{pair:?}\");\n" -"\n" -" let many = add_42_millions(42_i8);\n" -" println!(\"{many}\");\n" -" let many_more = add_42_millions(10_000_000);\n" -" println!(\"{many_more}\");\n" -"}\n" -"```" +"You could implement `Add` for two different types, e.g. `impl Add<(i32, " +"i32)> for Point` would add a tuple to a `Point`." msgstr "" -"```rust,editable\n" -"fn duplicate(a: T) -> (T, T) {\n" -" (a.clone(), a.clone())\n" -"}\n" -"\n" -"// ๋‹ค์Œ์— ๋Œ€ํ•œ ๋ฌธ๋ฒ• ์Šˆ๊ฐ€:\n" -"// fn add_42_millions>(x: T) -> i32 {\n" -"fn add_42_millions(x: impl Into) -> i32 {\n" -" x.into() + 42_000_000\n" -"}\n" -"\n" -"// struct NotClonable;\n" -"\n" -"fn main() {\n" -" let foo = String::from(\"foo\");\n" -" let pair = duplicate(foo);\n" -" println!(\"{pair:?}\");\n" -"\n" -" let many = add_42_millions(42_i8);\n" -" println!(\"{many}\");\n" -" let many_more = add_42_millions(10_000_000);\n" -" println!(\"{many_more}\");\n" -"}\n" -"```" +"`Add`๋ฅผ ์ด์šฉํ•ด์„œ ์„œ๋กœ ๋‹ค๋ฅธ ๋‘ ๊ฐœ์˜ ํƒ€์ž…์„ ๋”ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด " +"`impl Add<(i32, i32)> for Point`๋Š” ํŠœํ”Œ์„ `Point`์— ๋”ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ค๋‹ˆ๋‹ค." -#: src/generics/trait-bounds.md:35 -msgid "Show a `where` clause, students will encounter it when reading code." -msgstr "" -"`where` ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ฐ•์ƒ๋“ค๋„ ์ฝ”๋“œ๋ฅผ ์ฝ๋‹ค๊ฐ€ ๊ทธ ๋ฌธ๋ฒ•์„ ๋งˆ์ฃผ" -"ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +#: src/traits/closures.md:1 +msgid "Closures" +msgstr "ํด๋กœ์ €(Closure)" -#: src/generics/trait-bounds.md:37 -msgid "" -"```rust,ignore\n" -"fn duplicate(a: T) -> (T, T)\n" -"where\n" -" T: Clone,\n" -"{\n" -" (a.clone(), a.clone())\n" -"}\n" -"```" -msgstr "" -"```rust,ignore\n" -"fn duplicate(a: T) -> (T, T)\n" -"where\n" -" T: Clone,\n" -"{\n" -" (a.clone(), a.clone())\n" -"}\n" -"```" - -#: src/generics/trait-bounds.md:46 -msgid "It declutters the function signature if you have many parameters." -msgstr "" -"์ด๋ฅผ ์ด์šฉํ•˜๋ฉด ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๊ฐ€ ๋งŽ์€ ๊ฒฝ์šฐ ํ•จ์ˆ˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋Š” ๋ฐ " -"๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค." - -#: src/generics/trait-bounds.md:47 -msgid "It has additional features making it more powerful." -msgstr "์ข€ ๋” ๊ฐ•๋ ฅํ•œ ์ถ”๊ฐ€ ๊ธฐ๋Šฅ๋„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/trait-bounds.md:48 -msgid "" -"If someone asks, the extra feature is that the type on the left of \":\" can " -"be arbitrary, like `Option`." -msgstr "`:` ์™ผ์ชฝ์— ์ž„์˜์˜ ํƒ€์ž…(์˜ˆ๋ฅผ ๋“ค์–ด `Option`)์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:1 -msgid "`impl Trait`" -msgstr "ํŠธ๋ ˆ์ž‡ ๊ตฌํ˜„ํ•˜๊ธฐ(`impl Trait`)" - -#: src/generics/impl-trait.md:3 -msgid "" -"Similar to trait bounds, an `impl Trait` syntax can be used in function " -"arguments and return values:" -msgstr "" -"ํŠธ๋ ˆ์ž‡ ๋ฐ”์šด๋“œ์™€ ์œ ์‚ฌํ•˜๊ฒŒ `impl Trait` ๋ฌธ๋ฒ•์€ ํ•จ์ˆ˜์˜ ์ธ์ž์™€ ๋ฐ˜ํ™˜๊ฐ’์—๋„ ์ ์šฉ ๊ฐ€" -"๋Šฅํ•ฉ๋‹ˆ๋‹ค:" - -#: src/traits/impl-trait.md:6 -msgid "" -"```rust,editable\n" -"use std::fmt::Display;\n" -"\n" -"fn get_x(name: impl Display) -> impl Display {\n" -" format!(\"Hello {name}\")\n" -"}\n" -"\n" -"fn main() {\n" -" let x = get_x(\"foo\");\n" -" println!(\"{x}\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::fmt::Display;\n" -"\n" -"fn get_x(name: impl Display) -> impl Display {\n" -" format!(\"Hello {name}\")\n" -"}\n" -"\n" -"fn main() {\n" -" let x = get_x(\"foo\");\n" -" println!(\"{x}\");\n" -"}\n" -"```" - -#: src/generics/impl-trait.md:19 -msgid "`impl Trait` cannot be used with the `::<>` turbo fish syntax." -msgstr "`impl Trait`๋ฅผ ํ„ฐ๋ณดํ”ผ์‰ฌ๋ฌธ๋ฒ•(`::<>`)๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:20 -msgid "`impl Trait` allows you to work with types which you cannot name." -msgstr "`impl Trait`๋ฅผ ์ด์šฉํ•˜๋ฉด ์ด๋ฆ„์ด ์—†๋Š” ํƒ€์ž…์„ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:24 -msgid "" -"The meaning of `impl Trait` is a bit different in the different positions." -msgstr "`impl Trait`๋Š” ์–ด๋””์— ์‚ฌ์šฉ๋˜์—ˆ๋А๋ƒ์— ๋”ฐ๋ผ ์˜๋ฏธ๊ฐ€ ์กฐ๊ธˆ์”ฉ ๋‹ค๋ฆ…๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:26 -msgid "" -"For a parameter, `impl Trait` is like an anonymous generic parameter with a " -"trait bound." -msgstr "" -"ํ•จ์ˆ˜ ์ธ์ž์˜ ํƒ€์ž…์œผ๋กœ ์‚ฌ์šฉ๋˜์—ˆ์„ ๊ฒฝ์šฐ์—๋Š” `impl Trait`๋Š” ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„๊ฐ€ ์žˆ๋Š” ์ต" -"๋ช…์˜ ์ œ๋„ค๋ฆญ ํƒ€์ž…์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:27 -msgid "" -"For a return type, it means that the return type is some concrete type that " -"implements the trait, without naming the type. This can be useful when you " -"don't want to expose the concrete type in a public API." -msgstr "" -"๋ฆฌํ„ด ํƒ€์ž…์œผ๋กœ ์‚ฌ์šฉ๋˜์—ˆ์„ ๊ฒฝ์šฐ์—๋Š”, ๊ทธ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ตฌ์ฒด์ ์ธ ํƒ€์ž…์ธ๋ฐ, ํƒ€" -"์ž… ์ด๋ฆ„์„ ํ”„๋กœ๊ทธ๋ž˜๋จธ๊ฐ€ ์ง“์ง€ ์•Š์•˜๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๊ทธ ๊ตฌ์ฒด์ ์ธ ํƒ€์ž… " -"์ด๋ฆ„์„ API๋กœ ๊ณต๊ฐœํ•˜๊ณ  ์‹ถ์ง€ ์•Š์€ ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/impl-trait.md:31 -msgid "" -"This example is great, because it uses `impl Display` twice. It helps to " -"explain that nothing here enforces that it is _the same_ `impl Display` " -"type. If we used a single `T: Display`, it would enforce the constraint " -"that input `T` and return `T` type are the same type. It would not work for " -"this particular function, as the type we expect as input is likely not what " -"`format!` returns. If we wanted to do the same via `: Display` syntax, we'd " -"need two independent generic parameters." -msgstr "" -"์ด ์˜ˆ์‹œ๋Š” `impl Display`๊ฐ€ ๋‘๋ฒˆ ์‚ฌ์šฉ ๋˜์—ˆ๋‹ค๋Š” ์ ์—์„œ ํ›Œ๋ฅญํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ์ค‘์š”" -"ํ•œ ๊ฒƒ์€ ์ด ๋‘ `impl Display`๊ฐ€ ์‹ค์ œ๋กœ ๊ฐ™์€ ํƒ€์ž…์ผ ํ•„์š”๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋งŒ" -"์•ฝ `T: Display`๋กœ ํŠธ๋ ˆ์ž‡ ๊ฒฝ๊ณ„๋ฅผ ์ •ํ•˜๊ณ  ์ž…๋ ฅ ํŒŒ๋ผ๋ฉ”ํ„ฐ์™€ ๋ฆฌํ„ด ๊ฐ’์˜ ํƒ€์ž…์„ ๋ชจ๋‘ " -"`T`๋กœ ํ–ˆ๋‹ค๋ฉด, ์ด๋Š” ์ž…๋ ฅ๊ณผ ๋ฆฌํ„ด๊ฐ’์ด ๊ฐ™์€ ํƒ€์ž…์ž„์„ ๊ฐ•์ œํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ–ˆ๋‹ค๋ฉด ์œ„" -"์˜ ์˜ˆ์ œ๋Š” ๋™์ž‘ํ•˜์ง€ ์•Š์•˜์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด, ์ž…๋ ฅ ๊ฐ’์˜ ํƒ€์ž…์ด `format!`์ด ๋ฆฌ" -"ํ„ดํ•˜๋Š” ํƒ€์ž…๊ณผ ๊ฐ™์ง€ ์•Š์„ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ `: Display` ๋ฌธ๋ฒ•์„ ์‚ฌ" -"์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ๋…๋ฆฝ์ ์ธ ์ œ๋„ค๋ฆญ ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ๋‘ ๊ฐœ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/closures.md:3 +#: src/traits/closures.md:3 msgid "" "Closures or lambda expressions have types which cannot be named. However, " "they implement special [`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn." @@ -11368,10 +12952,19 @@ msgid "" "\n" "fn main() {\n" " let add_3 = |x| x + 3;\n" -" let mul_5 = |x| x * 5;\n" -"\n" " println!(\"add_3: {}\", apply_with_log(add_3, 10));\n" -" println!(\"mul_5: {}\", apply_with_log(mul_5, 20));\n" +" println!(\"add_3: {}\", apply_with_log(add_3, 20));\n" +"\n" +" let mut v = Vec::new();\n" +" let mut accumulate = |x: i32| {\n" +" v.push(x);\n" +" v.iter().sum::()\n" +" };\n" +" println!(\"accumulate: {}\", apply_with_log(&mut accumulate, 4));\n" +" println!(\"accumulate: {}\", apply_with_log(&mut accumulate, 5));\n" +"\n" +" let multiply_sum = |x| x * v.into_iter().sum::();\n" +" println!(\"multiply_sum: {}\", apply_with_log(multiply_sum, 3));\n" "}\n" "```" msgstr "" @@ -11383,36 +12976,47 @@ msgstr "" "\n" "fn main() {\n" " let add_3 = |x| x + 3;\n" -" let mul_5 = |x| x * 5;\n" -"\n" " println!(\"add_3: {}\", apply_with_log(add_3, 10));\n" -" println!(\"mul_5: {}\", apply_with_log(mul_5, 20));\n" +" println!(\"add_3: {}\", apply_with_log(add_3, 20));\n" +"\n" +" let mut v = Vec::new();\n" +" let mut accumulate = |x: i32| {\n" +" v.push(x);\n" +" v.iter().sum::()\n" +" };\n" +" println!(\"accumulate: {}\", apply_with_log(&mut accumulate, 4));\n" +" println!(\"accumulate: {}\", apply_with_log(&mut accumulate, 5));\n" +"\n" +" let multiply_sum = |x| x * v.into_iter().sum::();\n" +" println!(\"multiply_sum: {}\", apply_with_log(multiply_sum, 3));\n" "}\n" "```" -#: src/generics/closures.md:25 +#: src/traits/closures.md:34 msgid "" -"If you have an `FnOnce`, you may only call it once. It might consume " -"captured values." -msgstr "`FnOnce`๋Š” ํ•œ๋ฒˆ๋งŒ ํ˜ธ์ถœ๋˜๋ฉฐ ์บก์ฒ˜๋œ ๊ฐ’์„ ์†Œ๋ชจํ•ฉ๋‹ˆ๋‹ค." - -#: src/generics/closures.md:27 -msgid "" -"An `FnMut` might mutate captured values, so you can call it multiple times " -"but not concurrently." +"An `Fn` (e.g. `add_3`) neither consumes nor mutates captured values, or " +"perhaps captures nothing at all. It can be called multiple times " +"concurrently." msgstr "" -"`FnMut`๋Š” ์บก์ฒ˜๋œ ๊ฐ’์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์—ฌ๋Ÿฌ๋ฒˆ ํ˜ธ์ถœ์€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ๋™์‹œ์— ํ˜ธ" -"์ถœ ํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค." +"`Fn`(์˜ˆ๋ฅผ ๋“ค์–ด `add_3`)์€ ์บก์ฒ˜๋œ ๊ฐ’์„ ์†Œ๋ชจ๋„ ๋ณ€๊ฒฝ๋„ ํ•˜์ง€ ์•Š๊ณ , ํ˜น์€ ์–ด๋–ค ๊ฒƒ" +"๋„ ์บก์ณํ•˜์ง€ ์•Š์•˜์„ ์ˆ˜๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋™์‹œ์— ์—ฌ๋Ÿฌ๋ฒˆ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/generics/closures.md:29 +#: src/traits/closures.md:37 msgid "" -"An `Fn` neither consumes nor mutates captured values, or perhaps captures " -"nothing at all, so it can be called multiple times concurrently." +"An `FnMut` (e.g. `accumulate`) might mutate captured values. You can call it " +"multiple times, but not concurrently." msgstr "" -"`Fn`์€ ์บก์ฒ˜๋œ ๊ฐ’์„ ์†Œ๋ชจ๋„ ๋ณ€๊ฒฝ๋„ ํ•˜์ง€ ์•Š๊ณ , ํ˜น์€ ์–ด๋–ค ๊ฒƒ๋„ ์บก์ณํ•˜์ง€ ์•Š์•˜์„ ์ˆ˜" -"๋„ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋™์‹œ์— ์—ฌ๋Ÿฌ๋ฒˆ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"`FnMut`(์˜ˆ๋ฅผ ๋“ค์–ด `accumulate`)๋Š” ์บก์ฒ˜๋œ ๊ฐ’์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์—ฌ๋Ÿฌ ๋ฒˆ ํ˜ธ์ถœ" +"์€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ๋™์‹œ์— ํ˜ธ์ถœ ํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค." -#: src/generics/closures.md:32 +#: src/traits/closures.md:40 +msgid "" +"If you have an `FnOnce` (e.g. `multiply_sum`), you may only call it once. It " +"might consume captured values." +msgstr "" +"`FnOnce` (์˜ˆ๋ฅผ ๋“ค์–ด `multiply_sum`)๋Š” ํ•œ๋ฒˆ๋งŒ ํ˜ธ์ถœ๋˜๋ฉฐ ์บก์ฒ˜๋œ ๊ฐ’์„ ์†Œ๋ชจํ•ฉ๋‹ˆ๋‹ค." + +#: src/traits/closures.md:43 msgid "" "`FnMut` is a subtype of `FnOnce`. `Fn` is a subtype of `FnMut` and `FnOnce`. " "I.e. you can use an `FnMut` wherever an `FnOnce` is called for, and you can " @@ -11422,332 +13026,45 @@ msgstr "" "๋‹ˆ๋‹ค. ์ฆ‰, `FnMut`๋Š” `FnOnce`๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ๊ณณ์ด๋ฉด ์–ด๋””์„œ๋‚˜ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๊ณ  `Fn`" "์€ `FnMut`์™€ `FnOnce`๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ๊ณณ์ด๋ฉด ์–ด๋””๋“  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/generics/closures.md:36 -msgid "`move` closures only implement `FnOnce`." +#: src/traits/closures.md:47 +msgid "" +"The compiler also infers `Copy` (e.g. for `add_3`) and `Clone` (e.g. " +"`multiply_sum`), depending on what the closure captures." msgstr "" -"ํด๋กœ์ €๊ฐ€ `move`์™€ ํ•จ๊ป˜ ์„ ์–ธ๋˜์—ˆ๋‹ค๋ฉด ๊ทธ ํด๋กœ์ €๋Š” ์˜ค์ง `FnOnce`๋งŒ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค." +"์ปดํŒŒ์ผ๋Ÿฌ๋Š” ํด๋กœ์ €๊ฐ€ ๋ฌด์—‡์„ ์บก์ณํ•˜๋Š”์ง€์— ๋”ฐ๋ผ `Copy`(์˜ˆ๋ฅผ ๋“ค์–ด `add_3`)๊ณผ " +"`Clone`(์˜ˆ๋ฅผ ๋“ค์–ด `multiply_sum`)์„ ์•Œ์•„์„œ ์ถ”๋ก ํ•ฉ๋‹ˆ๋‹ค." -#: src/generics/monomorphization.md:3 -msgid "Generic code is turned into non-generic code based on the call sites:" -msgstr "์ œ๋„ค๋ฆญ ์ฝ”๋“œ๋Š” ํ˜ธ์ถœ๋ถ€์—์„œ ๋น„ ์ œ๋„ค๋ฆญ ์ฝ”๋“œ๋กœ ์ „ํ™˜๋ฉ๋‹ˆ๋‹ค:" +#: src/traits/closures.md:50 +msgid "" +"By default, closures will capture by reference if they can. The `move` " +"keyword makes them capture by value." +msgstr "" +"๊ธฐ๋ณธ์ ์œผ๋กœ ํด๋กœ์ ธ๋Š”, ๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด, ์ฐธ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์บก์ณ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค. `move` ํ‚ค์›Œ๋“œ" +"๋ฅผ ์“ฐ๋ฉด ๊ฐ’์œผ๋กœ ์บก์ณ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค." -#: src/generics/monomorphization.md:5 +#: src/traits/closures.md:52 msgid "" "```rust,editable\n" +"fn make_greeter(prefix: String) -> impl Fn(&str) {\n" +" return move |name| println!(\"{} {}\", prefix, name)\n" +"}\n" +"\n" "fn main() {\n" -" let integer = Some(5);\n" -" let float = Some(5.0);\n" +" let hi = make_greeter(\"Hi\".to_string());\n" +" hi(\"there\");\n" "}\n" "```" msgstr "" "```rust,editable\n" -"fn main() {\n" -" let integer = Some(5);\n" -" let float = Some(5.0);\n" -"}\n" -"```" - -#: src/generics/monomorphization.md:12 -msgid "behaves as if you wrote" -msgstr "์œ„ ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค" - -#: src/generics/monomorphization.md:14 -msgid "" -"```rust,editable\n" -"enum Option_i32 {\n" -" Some(i32),\n" -" None,\n" -"}\n" -"\n" -"enum Option_f64 {\n" -" Some(f64),\n" -" None,\n" +"fn make_greeter(prefix: String) -> impl Fn(&str) {\n" +" return move |name| println!(\"{} {}\", prefix, name)\n" "}\n" "\n" "fn main() {\n" -" let integer = Option_i32::Some(5);\n" -" let float = Option_f64::Some(5.0);\n" +" let hi = make_greeter(\"Hi\".to_string());\n" +" hi(\"there\");\n" "}\n" "```" -msgstr "" -"```rust,editable\n" -"enum Option_i32 {\n" -" Some(i32),\n" -" None,\n" -"}\n" -"\n" -"enum Option_f64 {\n" -" Some(f64),\n" -" None,\n" -"}\n" -"\n" -"fn main() {\n" -" let integer = Option_i32::Some(5);\n" -" let float = Option_f64::Some(5.0);\n" -"}\n" -"```" - -#: src/generics/monomorphization.md:31 -msgid "" -"This is a zero-cost abstraction: you get exactly the same result as if you " -"had hand-coded the data structures without the abstraction." -msgstr "" -"์ด๊ฒƒ์ด ๋ฐ”๋กœ ๋น„์šฉ์ด ๋“ค์ง€ ์•Š๋Š” (zero-cost) ์ถ”์ƒํ™” ์ž…๋‹ˆ๋‹ค: ๋Ÿฌ์ŠคํŠธ์˜ ์ œ๋„ค๋ฆญ์€ ์ถ”" -"์ƒํ™”๋ฅผ ๊ฑฐ์น˜์ง€ ์•Š๊ณ  ์ง์ ‘ ๊ตฌ์ฒด์ ์ธ ํƒ€์ž…์„ ์จ์„œ ์ฝ”๋”ฉํ•œ ๊ฒƒ๊ณผ ์ •ํ™•ํžˆ ๋™์ผํ•œ ๊ฒฐ๊ณผ" -"๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." - -#: src/generics/trait-objects.md:3 -msgid "We've seen how a function can take arguments which implement a trait:" -msgstr "" -"ํ•จ์ˆ˜๊ฐ€ ํŠน์ • ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ์ธ์ž๋ฅผ ์ž…๋ ฅ์œผ๋กœ ๋ฐ›๋„๋ก ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์„ค๋ช…ํ–ˆ" -"์—ˆ์Šต๋‹ˆ๋‹ค:" - -#: src/traits/trait-objects.md:3 -msgid "" -"Trait objects allow for values of different types, for instance in a " -"collection:" -msgstr "" -"ํŠธ๋ ˆ์ž‡ ๊ฐ์ฒด๋Š” ํƒ€์ž…์ด ๋‹ค๋ฅธ ๊ฐ’(์˜ˆ๋ฅผ ๋“ค์–ด ์ปฌ๋ ‰์…˜์— ์†ํ•œ ๊ฐ ๊ฐ’)๋“ค์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต" -"๋‹ˆ๋‹ค." - -#: src/traits/trait-objects.md:5 -msgid "" -"```rust,editable\n" -"trait Pet {\n" -" fn name(&self) -> String;\n" -"}\n" -"\n" -"struct Dog {\n" -" name: String,\n" -"}\n" -"\n" -"struct Cat;\n" -"\n" -"impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" -"}\n" -"\n" -"impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(\"The cat\") // No name, cats won't respond to it " -"anyway.\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" let pets: Vec> = vec![\n" -" Box::new(Cat),\n" -" Box::new(Dog { name: String::from(\"Fido\") }),\n" -" ];\n" -" for pet in pets {\n" -" println!(\"Hello {}!\", pet.name());\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"trait Pet {\n" -" fn name(&self) -> String;\n" -"}\n" -"\n" -"struct Dog {\n" -" name: String,\n" -"}\n" -"\n" -"struct Cat;\n" -"\n" -"impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" -"}\n" -"\n" -"impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(\"The cat\") // No name, cats won't respond to it " -"anyway.\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" let pets: Vec> = vec![\n" -" Box::new(Cat),\n" -" Box::new(Dog { name: String::from(\"Fido\") }),\n" -" ];\n" -" for pet in pets {\n" -" println!(\"Hello {}!\", pet.name());\n" -" }\n" -"}\n" -"```" - -#: src/generics/trait-objects.md:18 -msgid "" -"However, how can we store a collection of mixed types which implement " -"`Display`?" -msgstr "" -"๊ทธ๋Ÿฐ๋ฐ, ์•„๋ž˜์™€ ๊ฐ™์ด `Display`๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…๋“ค์˜ ์ฝœ๋ ‰์…˜์„ ์ €์žฅํ•˜" -"๊ณ  ์‹ถ๋‹ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ์š”?" - -#: src/generics/trait-objects.md:20 -msgid "" -"```rust,editable,compile_fail\n" -"fn main() {\n" -" let xs = vec![123, \"Hello\"];\n" -"}\n" -"```" -msgstr "" - -#: src/generics/trait-objects.md:26 -msgid "For this, we need _trait objects_:" -msgstr "์ด๋ฅผ ์œ„ํ•ด์„œ๋Š” \"ํŠธ๋ ˆ์ž‡ ๊ฐ์ฒด\"๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/generics/trait-objects.md:28 -msgid "" -"```rust,editable\n" -"use std::fmt::Display;\n" -"\n" -"fn main() {\n" -" let xs: Vec> = vec![Box::new(123), Box::" -"new(\"Hello\")];\n" -" for x in xs {\n" -" println!(\"x: {x}\");\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/generics/trait-objects.md:39 -msgid "Memory layout after allocating `xs`:" -msgstr "`xs`๊ฐ€ ํ• ๋‹น๋ ๋•Œ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ์ด์•„์›ƒ:" - -#: src/generics/trait-objects.md:41 -msgid "" -"```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- - -.\n" -": : : :\n" -": " -"xs : : :\n" -": +-----------+-------+ : : +-----+-----" -"+ :\n" -": | ptr | o---+---+-----+-->| o o | o o " -"| :\n" -": | len | 2 | : : +-|-|-+-|-|-" -"+ :\n" -": | capacity | 2 | : : | | | | +----+----+----+----+----" -"+ :\n" -": +-----------+-------+ : : | | | '-->| H | e | l | l | o " -"| :\n" -": : : | | | +----+----+----+----+----" -"+ :\n" -"`- - - - - - - - - - - - - -' : | | " -"| :\n" -" : | | | " -"+-------------------------+ :\n" -" : | | '---->| \"::" -"fmt\" | :\n" -" : | | " -"+-------------------------+ :\n" -" : | " -"| :\n" -" : | | +----+----+----+----" -"+ :\n" -" : | '-->| 7b | 00 | 00 | 00 " -"| :\n" -" : | +----+----+----+----" -"+ :\n" -" : " -"| :\n" -" : | +-------------------------" -"+ :\n" -" : '---->| \"::fmt\" " -"| :\n" -" : +-------------------------" -"+ :\n" -" : :\n" -" : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- - -'\n" -"```" -msgstr "" -"```bob\n" -" ์Šคํƒ ํž™\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- - -.\n" -": : : :\n" -": " -"xs : : :\n" -": +-----------+-------+ : : +-----+-----" -"+ :\n" -": | ptr | o---+---+-----+-->| o o | o o " -"| :\n" -": | len | 2 | : : +-|-|-+-|-|-" -"+ :\n" -": | capacity | 2 | : : | | | | +----+----+----+----+----" -"+ :\n" -": +-----------+-------+ : : | | | '-->| H | e | l | l | o " -"| :\n" -": : : | | | +----+----+----+----+----" -"+ :\n" -"`- - - - - - - - - - - - - -' : | | " -"| :\n" -" : | | | " -"+-------------------------+ :\n" -" : | | '---->| \"::" -"fmt\" | :\n" -" : | | " -"+-------------------------+ :\n" -" : | " -"| :\n" -" : | | +----+----+----+----" -"+ :\n" -" : | '-->| 7b | 00 | 00 | 00 " -"| :\n" -" : | +----+----+----+----" -"+ :\n" -" : " -"| :\n" -" : | +-------------------------" -"+ :\n" -" : '---->| \"::fmt\" " -"| :\n" -" : +-------------------------" -"+ :\n" -" : :\n" -" : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- - -'\n" -"```" - -#: src/generics/trait-objects.md:69 -msgid "" -"Similarly, you need a trait object if you want to return different types " -"implementing a trait:" -msgstr "" -"๋งˆ์ฐฌ๊ฐ€์ง€๋กœ, ๊ฐ™์€ ํŠธ๋ ˆ์ž‡์„ ๊ตฌํ˜„ํ•˜๋Š” ์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…์˜ ๊ฐ’์„ ๋ฆฌํ„ดํ•  ๋•Œ์—๋„ ํŠธ๋ ˆ" -"์ž‡ ๊ฐ์ฒด๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/generics/trait-objects.md:72 -msgid "" -"```rust,editable\n" -"fn numbers(n: i32) -> Box> {\n" -" if n > 0 {\n" -" Box::new(0..n)\n" -" } else {\n" -" Box::new((n..0).rev())\n" -" }\n" -"}\n" -"\n" -"fn main() {\n" -" println!(\"{:?}\", numbers(-5).collect::>());\n" -" println!(\"{:?}\", numbers(5).collect::>());\n" -"}\n" -"\n" -"```" -msgstr "" #: src/exercises/day-3/morning.md:1 msgid "Day 3: Morning Exercises" @@ -11863,6 +13180,13 @@ msgid "" " fn add_widget(&mut self, widget: Box) {\n" " self.widgets.push(widget);\n" " }\n" +"\n" +" fn inner_width(&self) -> usize {\n" +" std::cmp::max(\n" +" self.title.chars().count(),\n" +" self.widgets.iter().map(|w| w.width()).max().unwrap_or(0),\n" +" )\n" +" }\n" "}\n" "\n" "\n" @@ -11908,12 +13232,124 @@ msgid "" "}\n" "```" msgstr "" +"```rust,should_panic\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_imports, unused_variables, dead_code)]\n" +"\n" +"pub trait Widget {\n" +" /// Natural width of `self`.\n" +" fn width(&self) -> usize;\n" +"\n" +" /// Draw the widget into a buffer.\n" +" fn draw_into(&self, buffer: &mut dyn std::fmt::Write);\n" +"\n" +" /// Draw the widget on standard output.\n" +" fn draw(&self) {\n" +" let mut buffer = String::new();\n" +" self.draw_into(&mut buffer);\n" +" println!(\"{buffer}\");\n" +" }\n" +"}\n" +"\n" +"pub struct Label {\n" +" label: String,\n" +"}\n" +"\n" +"impl Label {\n" +" fn new(label: &str) -> Label {\n" +" Label {\n" +" label: label.to_owned(),\n" +" }\n" +" }\n" +"}\n" +"\n" +"pub struct Button {\n" +" label: Label,\n" +" callback: Box,\n" +"}\n" +"\n" +"impl Button {\n" +" fn new(label: &str, callback: Box) -> Button {\n" +" Button {\n" +" label: Label::new(label),\n" +" callback,\n" +" }\n" +" }\n" +"}\n" +"\n" +"pub struct Window {\n" +" title: String,\n" +" widgets: Vec>,\n" +"}\n" +"\n" +"impl Window {\n" +" fn new(title: &str) -> Window {\n" +" Window {\n" +" title: title.to_owned(),\n" +" widgets: Vec::new(),\n" +" }\n" +" }\n" +"\n" +" fn add_widget(&mut self, widget: Box) {\n" +" self.widgets.push(widget);\n" +" }\n" +"\n" +" fn inner_width(&self) -> usize {\n" +" std::cmp::max(\n" +" self.title.chars().count(),\n" +" self.widgets.iter().map(|w| w.width()).max().unwrap_or(0),\n" +" )\n" +" }\n" +"}\n" +"\n" +"\n" +"impl Widget for Label {\n" +" fn width(&self) -> usize {\n" +" unimplemented!()\n" +" }\n" +"\n" +" fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" +" unimplemented!()\n" +" }\n" +"}\n" +"\n" +"impl Widget for Button {\n" +" fn width(&self) -> usize {\n" +" unimplemented!()\n" +" }\n" +"\n" +" fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" +" unimplemented!()\n" +" }\n" +"}\n" +"\n" +"impl Widget for Window {\n" +" fn width(&self) -> usize {\n" +" unimplemented!()\n" +" }\n" +"\n" +" fn draw_into(&self, buffer: &mut dyn std::fmt::Write) {\n" +" unimplemented!()\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let mut window = Window::new(\"Rust GUI Demo 1.23\");\n" +" window.add_widget(Box::new(Label::new(\"This is a small text GUI demo." +"\")));\n" +" window.add_widget(Box::new(Button::new(\n" +" \"Click me!\",\n" +" Box::new(|| println!(\"You clicked the button!\")),\n" +" )));\n" +" window.draw();\n" +"}\n" +"```" -#: src/exercises/day-3/simple-gui.md:123 +#: src/exercises/day-3/simple-gui.md:130 msgid "The output of the above program can be something simple like this:" msgstr "์œ„ ํ”„๋กœ๊ทธ๋žจ์˜ ์ถœ๋ ฅ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค:" -#: src/exercises/day-3/simple-gui.md:125 +#: src/exercises/day-3/simple-gui.md:132 msgid "" "```text\n" "========\n" @@ -11925,8 +13361,17 @@ msgid "" "| Click me! |\n" "```" msgstr "" +"```text\n" +"========\n" +"Rust GUI Demo 1.23\n" +"========\n" +"\n" +"This is a small text GUI demo.\n" +"\n" +"| Click me! |\n" +"```" -#: src/exercises/day-3/simple-gui.md:135 +#: src/exercises/day-3/simple-gui.md:142 msgid "" "If you want to draw aligned text, you can use the [fill/alignment](https://" "doc.rust-lang.org/std/fmt/index.html#fillalignment) formatting operators. In " @@ -11937,7 +13382,7 @@ msgstr "" "fmt/index.html#fillalignment)๋ฅผ ์ฐธ์กฐํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ํŠน์ˆ˜ ๋ฌธ์ž(์—ฌ๊ธฐ์„œ๋Š” " "`'/'`)๋กœ ํŒจ๋”ฉ์„ ์ฃผ๋Š” ๋ฐฉ๋ฒ•๊ณผ ์ •๋ ฌ์„ ์ œ์–ดํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํ™•์ธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค:" -#: src/exercises/day-3/simple-gui.md:140 +#: src/exercises/day-3/simple-gui.md:147 msgid "" "```rust,editable\n" "fn main() {\n" @@ -11948,13 +13393,21 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let width = 10;\n" +" println!(\"left aligned: |{:/width$}|\", \"foo\");\n" +"}\n" +"```" -#: src/exercises/day-3/simple-gui.md:149 +#: src/exercises/day-3/simple-gui.md:156 msgid "" "Using such alignment tricks, you can for example produce output like this:" msgstr "์œ„์˜ ์ •๋ ฌ ํŠธ๋ฆญ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ถœ๋ ฅ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/exercises/day-3/simple-gui.md:151 +#: src/exercises/day-3/simple-gui.md:158 msgid "" "```text\n" "+--------------------------------+\n" @@ -11967,6 +13420,16 @@ msgid "" "+--------------------------------+\n" "```" msgstr "" +"```text\n" +"+--------------------------------+\n" +"| Rust GUI Demo 1.23 |\n" +"+================================+\n" +"| This is a small text GUI demo. |\n" +"| +-----------+ |\n" +"| | Click me! | |\n" +"| +-----------+ |\n" +"+--------------------------------+\n" +"```" #: src/error-handling.md:3 msgid "Error handling in Rust is done using explicit control flow:" @@ -11974,7 +13437,7 @@ msgstr "๋Ÿฌ์ŠคํŠธ์—์„œ ์˜ค๋ฅ˜๋Š” ๋ช…์‹œ์ ์ธ ํ๋ฆ„์„ ๋”ฐ๋ผ ์ฒ˜๋ฆฌ๊ฐ€ ๋ฉ๋‹ˆ #: src/error-handling.md:5 msgid "Functions that can have errors list this in their return type," -msgstr "์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ํ•จ์ˆ˜๋Š” ๋ฐ˜ํ™˜ ํƒ€์ž…์— ์ด๋ฅผ ๋ช…์‹œํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." +msgstr "์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ํ•จ์ˆ˜๋Š” ๋ฐ˜ํ™˜ ํƒ€์ž…์— ์ด๋ฅผ ๋ช…์‹œํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค," #: src/error-handling.md:6 msgid "There are no exceptions." @@ -12027,54 +13490,41 @@ msgstr "" "๊ธฐ๋ณธ์ ์œผ๋กœ, ํŒจ๋‹‰์ด ๋ฐœ์ƒํ•˜๋ฉด ์Šคํƒ ๋˜๊ฐ๊ธฐ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค. ์Šคํƒ ๋˜๊ฐ๊ธฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด " "์บ์น˜๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค:" -#: src/error-handling/panic-unwind.md:5 -msgid "" -"```rust\n" -"use std::panic;\n" -"\n" -"let result = panic::catch_unwind(|| {\n" -" println!(\"hello!\");\n" -"});\n" -"assert!(result.is_ok());\n" -"\n" -"let result = panic::catch_unwind(|| {\n" -" panic!(\"oh no!\");\n" -"});\n" -"assert!(result.is_err());\n" -"```" -msgstr "" - #: src/error-handling/panic-unwind.md:5 msgid "" "```rust,editable\n" "use std::panic;\n" "\n" -"let result = panic::catch_unwind(|| {\n" -" println!(\"hello!\");\n" -"});\n" -"assert!(result.is_ok());\n" -"\n" -"let result = panic::catch_unwind(|| {\n" -" panic!(\"oh no!\");\n" -"});\n" -"assert!(result.is_err());\n" +"fn main() {\n" +" let result = panic::catch_unwind(|| {\n" +" println!(\"hello!\");\n" +" });\n" +" assert!(result.is_ok());\n" +" \n" +" let result = panic::catch_unwind(|| {\n" +" panic!(\"oh no!\");\n" +" });\n" +" assert!(result.is_err());\n" +"}\n" "```" msgstr "" "```rust,editable\n" "use std::panic;\n" "\n" -"let result = panic::catch_unwind(|| {\n" -" println!(\"hello!\");\n" -"});\n" -"assert!(result.is_ok());\n" -"\n" -"let result = panic::catch_unwind(|| {\n" -" panic!(\"oh no!\");\n" -"});\n" -"assert!(result.is_err());\n" +"fn main() {\n" +" let result = panic::catch_unwind(|| {\n" +" println!(\"hello!\");\n" +" });\n" +" assert!(result.is_ok());\n" +" \n" +" let result = panic::catch_unwind(|| {\n" +" panic!(\"oh no!\");\n" +" });\n" +" assert!(result.is_err());\n" +"}\n" "```" -#: src/error-handling/panic-unwind.md:19 +#: src/error-handling/panic-unwind.md:21 msgid "" "This can be useful in servers which should keep running even if a single " "request crashes." @@ -12082,7 +13532,7 @@ msgstr "" "์ด๊ฒƒ์€ ๋‹จ์ผ ์š”์ฒญ์ด ํฌ๋ž˜์‹œ ๋˜๋”๋ผ๋„ ํ”„๋กœ๊ทธ๋žจ์ด ๊ณ„์† ์‹คํ–‰๋˜์•ผ ํ•˜๋Š” ์„œ๋ฒ„์— ์œ ์šฉ" "ํ•ฉ๋‹ˆ๋‹ค." -#: src/error-handling/panic-unwind.md:21 +#: src/error-handling/panic-unwind.md:23 msgid "This does not work if `panic = 'abort'` is set in your `Cargo.toml`." msgstr "" "๋งŒ์•ฝ `Cargo.toml`์„ค์ •ํŒŒ์ผ์— `panic = abort`์„ ์„ค์ •ํ–ˆ๋‹ค๋ฉด ํฌ๋ž˜์‹œ๋ฅผ ์บ์น˜ํ•  ์ˆ˜ " @@ -12100,36 +13550,14 @@ msgstr "" "์—ฌ๋Ÿฌ๋ถ„์€ ์ด๋ฏธ `Result` ์—ด๊ฑฐํ˜•์„ ๋ช‡ ๋ฒˆ ๋ดค์Šต๋‹ˆ๋‹ค. ์ด ํƒ€์ž…์€ ํ”„๋กœ๊ทธ๋žจ์˜ ์ •์ƒ์ " "์ธ ์ˆ˜ํ–‰ ์ค‘์— ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์˜ค๋ฅ˜๊ฐ’๋“ค์„ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค:" -#: src/error-handling/result.md:6 -msgid "" -"```rust\n" -"use std::fs::File;\n" -"use std::io::Read;\n" -"\n" -"fn main() {\n" -" let file = File::open(\"diary.txt\");\n" -" match file {\n" -" Ok(mut file) => {\n" -" let mut contents = String::new();\n" -" file.read_to_string(&mut contents);\n" -" println!(\"Dear diary: {contents}\");\n" -" },\n" -" Err(err) => {\n" -" println!(\"The diary could not be opened: {err}\");\n" -" }\n" -" }\n" -"}\n" -"```" -msgstr "" - #: src/error-handling/result.md:6 msgid "" "```rust,editable\n" -"use std::fs::File;\n" +"use std::fs;\n" "use std::io::Read;\n" "\n" "fn main() {\n" -" let file = File::open(\"diary.txt\");\n" +" let file = fs::File::open(\"diary.txt\");\n" " match file {\n" " Ok(mut file) => {\n" " let mut contents = String::new();\n" @@ -12144,11 +13572,11 @@ msgid "" "```" msgstr "" "```rust,editable\n" -"use std::fs::File;\n" +"use std::fs;\n" "use std::io::Read;\n" "\n" "fn main() {\n" -" let file = File::open(\"diary.txt\");\n" +" let file = fs::File::open(\"diary.txt\");\n" " match file {\n" " Ok(mut file) => {\n" " let mut contents = String::new();\n" @@ -12182,7 +13610,7 @@ msgid "" "that help functional-style programming. " msgstr "" "์ˆ˜์—…์ค‘์—” ์•„๋‹ˆ์ง€๋งŒ `Result`์˜ API ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์ฝ๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ" -"๊ทธ๋ž˜๋ฐ ์Šคํƒ€์ผ์— ๋„์›€์ด ๋˜๋Š” ํŽธ๋ฆฌํ•œ ๋ฉ”์„œ๋“œ์™€ ํ•จ์ˆ˜๋ฅผ ๋งŽ์ด ๋ฐฐ์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +"๊ทธ๋ž˜๋ฐ ์Šคํƒ€์ผ์— ๋„์›€์ด ๋˜๋Š” ํŽธ๋ฆฌํ•œ ๋ฉ”์„œ๋“œ์™€ ํ•จ์ˆ˜๋ฅผ ๋งŽ์ด ๋ฐฐ์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " #: src/error-handling/try-operator.md:1 msgid "Propagating Errors with `?`" @@ -12214,7 +13642,7 @@ msgstr "" #: src/error-handling/try-operator.md:13 msgid "into the much simpler" -msgstr "์ด๋ ‡๊ฒŒ ์งง๊ฒŒ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +msgstr "์ด๋ ‡๊ฒŒ ์งง๊ฒŒ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค" #: src/error-handling/try-operator.md:15 msgid "" @@ -12227,28 +13655,26 @@ msgstr "" "```" #: src/error-handling/try-operator.md:19 -msgid "We can use this to simplify our error handing code:" +msgid "We can use this to simplify our error handling code:" msgstr "์ด์ œ ์šฐ๋ฆฌ ์˜ˆ์ œ์— ์ ์šฉํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค:" #: src/error-handling/try-operator.md:21 msgid "" "```rust,editable\n" -"use std::fs;\n" -"use std::io::{self, Read};\n" +"use std::{fs, io};\n" +"use std::io::Read;\n" "\n" "fn read_username(path: &str) -> Result {\n" " let username_file_result = fs::File::open(path);\n" -"\n" " let mut username_file = match username_file_result {\n" " Ok(file) => file,\n" -" Err(e) => return Err(e),\n" +" Err(err) => return Err(err),\n" " };\n" "\n" " let mut username = String::new();\n" -"\n" " match username_file.read_to_string(&mut username) {\n" " Ok(_) => Ok(username),\n" -" Err(e) => Err(e),\n" +" Err(err) => Err(err),\n" " }\n" "}\n" "\n" @@ -12259,13 +13685,37 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"use std::{fs, io};\n" +"use std::io::Read;\n" +"\n" +"fn read_username(path: &str) -> Result {\n" +" let username_file_result = fs::File::open(path);\n" +" let mut username_file = match username_file_result {\n" +" Ok(file) => file,\n" +" Err(err) => return Err(err),\n" +" };\n" +"\n" +" let mut username = String::new();\n" +" match username_file.read_to_string(&mut username) {\n" +" Ok(_) => Ok(username),\n" +" Err(err) => Err(err),\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" //fs::write(\"config.dat\", \"alice\").unwrap();\n" +" let username = read_username(\"config.dat\");\n" +" println!(\"username or error: {username:?}\");\n" +"}\n" +"```" -#: src/error-handling/try-operator.md:52 +#: src/error-handling/try-operator.md:50 #: src/error-handling/converting-error-types-example.md:52 msgid "The `username` variable can be either `Ok(string)` or `Err(error)`." msgstr "`username` ๋ณ€์ˆ˜๋Š” `Ok(string)`์ด๊ฑฐ๋‚˜ `Err(error)`์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/error-handling/try-operator.md:53 +#: src/error-handling/try-operator.md:51 #: src/error-handling/converting-error-types-example.md:53 msgid "" "Use the `fs::write` call to test out the different scenarios: no file, empty " @@ -12274,6 +13724,33 @@ msgstr "" "`fs::write` ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŒŒ์ผ์ด ์—†๊ฑฐ๋‚˜, ๋น„์—ˆ๊ฑฐ๋‚˜, ์ค‘๋ณต๋˜๋Š” ๊ฒฝ์šฐ ๋“ฑ์„ ํ…Œ" "์ŠคํŠธํ•ด ๋ด…๋‹ˆ๋‹ค." +#: src/error-handling/try-operator.md:52 +msgid "" +"The return type of the function has to be compatible with the nested " +"functions it calls. For instance, a function returning a `Result` " +"can only apply the `?` operator on a function returning a `Result`. It cannot apply the `?` operator on a function returning an " +"`Option` or `Result` unless `OtherErr` implements " +"`From`. Reciprocally, a function returning an `Option` can only " +"apply the `?` operator on a function returning an `Option`." +msgstr "" +"ํ•จ์ˆ˜์˜ ๋ฆฌํ„ด ํƒ€์ž…์€ ๋„ค์ŠคํŒ… ๋˜์–ด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜์˜ ๋ฆฌํ„ด ํƒ€์ž…๊ณผ ํ˜ธํ™˜๋˜์–ด์•ผ ํ•ฉ๋‹ˆ" +"๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `Result`๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋Š” `Result`๋ฅผ ๋ฆฌํ„ดํ•˜" +"๋Š” ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ์—๋งŒ`?`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. `Option`๋‚˜ `Result` (`OtherError`๊ฐ€ `From`๋ฅผ ๊ตฌํ˜„ํ•˜์ง€ ์•Š๋Š” ๋‹ค๊ณ  ๊ฐ€์ •ํ•  ๋•Œ)์™€ ๊ฐ™" +"์€ ํƒ€์ž…์„ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ์—๋Š” `?`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋™์ผํ•œ ์ด์œ " +"๋กœ, `Option`๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋Š” `Option`๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ" +"์—๋งŒ `?`๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/error-handling/try-operator.md:57 +msgid "" +"You can convert incompatible types into one another with the different " +"`Option` and `Result` methods such as `Option::ok_or`, `Result::ok`, " +"`Result::err`." +msgstr "" +"`Option`๊ณผ `Result`๊ฐ„์˜ ๋ณ€ํ™˜์„ ์œ„ํ•ด `Option::ok_or`, `Result::ok`, `Result::" +"err`์™€ ๊ฐ™์€ ํ•จ์ˆ˜๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + #: src/error-handling/converting-error-types.md:3 msgid "" "The effective expansion of `?` is a little more complicated than previously " @@ -12318,55 +13795,6 @@ msgstr "" "`From::from`์„ ํ†ตํ•ด ์›๋ž˜์˜ ์—๋Ÿฌ ํƒ€์ž…์„ ์ด ํ•จ์ˆ˜๊ฐ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ์—๋Ÿฌ ํƒ€์ž…์œผ๋กœ ๋ณ€ํ™˜" "ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/error-handling/converting-error-types-example.md:3 -msgid "" -"```rust,editable\n" -"use std::error::Error;\n" -"use std::fmt::{self, Display, Formatter};\n" -"use std::fs::{self, File};\n" -"use std::io::{self, Read};\n" -"\n" -"#[derive(Debug)]\n" -"enum ReadUsernameError {\n" -" IoError(io::Error),\n" -" EmptyUsername(String),\n" -"}\n" -"\n" -"impl Error for ReadUsernameError {}\n" -"\n" -"impl Display for ReadUsernameError {\n" -" fn fmt(&self, f: &mut Formatter) -> fmt::Result {\n" -" match self {\n" -" Self::IoError(e) => write!(f, \"IO error: {}\", e),\n" -" Self::EmptyUsername(filename) => write!(f, \"Found no username " -"in {}\", filename),\n" -" }\n" -" }\n" -"}\n" -"\n" -"impl From for ReadUsernameError {\n" -" fn from(err: io::Error) -> ReadUsernameError {\n" -" ReadUsernameError::IoError(err)\n" -" }\n" -"}\n" -"\n" -"fn read_username(path: &str) -> Result {\n" -" let mut username = String::with_capacity(100);\n" -" File::open(path)?.read_to_string(&mut username)?;\n" -" if username.is_empty() {\n" -" return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" -" }\n" -" Ok(username)\n" -"}\n" -"\n" -"fn main() {\n" -" //fs::write(\"config.dat\", \"\").unwrap();\n" -" let username = read_username(\"config.dat\");\n" -" println!(\"username or error: {username:?}\");\n" -"}\n" -"```" -msgstr "" - #: src/error-handling/converting-error-types-example.md:3 msgid "" "```rust,editable\n" @@ -12463,17 +13891,27 @@ msgstr "" #: src/error-handling/converting-error-types-example.md:55 msgid "" -"It is good practice for all error types to implement `std::error::Error`, " -"which requires `Debug` and `Display`. It's generally helpful for them to " -"implement `Clone` and `Eq` too where possible, to make life easier for tests " -"and consumers of your library. In this case we can't easily do so, because " -"`io::Error` doesn't implement them." +"It is good practice for all error types that don't need to be `no_std` to " +"implement `std::error::Error`, which requires `Debug` and `Display`. The " +"`Error` crate for `core` is only available in [nightly](https://github.com/" +"rust-lang/rust/issues/103765), so not fully `no_std` compatible yet." msgstr "" -"์—๋Ÿฌ ํƒ€์ž…์ด `std::error::Error`๋ฅผ ๊ตฌํ˜„ํ•˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์€ ์ข‹์€ ์Šต๊ด€์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ" -"๋ฉด `Debug`์™€ `Display` ํŠธ๋ ˆ์ž‡ ๋˜ํ•œ ๊ตฌํ˜„์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด `Clone`๊ณผ " -"`Eq` ํŠธ๋ ˆ์ž‡๋„ ๊ตฌํ˜„ํ•˜๋„๋ก ํ•˜์„ธ์š”. ์—ฌ๋Ÿฌ๋ถ„์˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ ์‰ฌ์›Œ์ง€๊ณ , " -"์‚ฌ์šฉํ•˜๊ธฐ ์ข‹์•„์งˆ ๊ฒ๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์ด ์˜ˆ์ œ์—์„œ๋Š” ๊ทธ๋ ‡๊ฒŒ ํ•˜๊ธฐ ํž˜๋“ญ๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด " -"`io::Error`๋Š” ์ด ํŠธ๋ ˆ์ž‡๋“ค์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." +"๋ชจ๋“  ์—๋Ÿฌ ํƒ€์ž… (`no_std`์ด์–ด์•ผ ํ•˜๋Š” ์—๋Ÿฌ ํƒ€์ž…์„ ์ œ์™ธํ•˜๊ณ )์— ๋Œ€ํ•ด `std::" +"error::Error`๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์€ ์ข‹์€ ์Šต๊ด€์ž…๋‹ˆ๋‹ค. `std::error::Error`๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค" +"๋Š” ๊ฒƒ์€ `Debug`์™€ `Display`๋„ ๊ตฌํ˜„ํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. `core`๋ฅผ ์œ„ํ•œ `Error`ํฌ๋ ˆ" +"์ดํฌ๋Š” [๋‚˜์ดํ‹€๋ฆฌ](https://github.com/rust-lang/rust/issues/103765)์—๋งŒ ์ œ๊ณต" +"์ด ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์•„์ง `no_std`ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค." + +#: src/error-handling/converting-error-types-example.md:57 +msgid "" +"It's generally helpful for them to implement `Clone` and `Eq` too where " +"possible, to make life easier for tests and consumers of your library. In " +"this case we can't easily do so, because `io::Error` doesn't implement them." +msgstr "" +"๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด `Clone`๊ณผ `Eq` ํŠธ๋ ˆ์ž‡๋„ ๊ตฌํ˜„ํ•˜๋„๋ก ํ•˜์„ธ์š”. ์—ฌ๋Ÿฌ๋ถ„์˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ " +"ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ ์‰ฌ์›Œ์ง€๊ณ , ์‚ฌ์šฉํ•˜๊ธฐ ์ข‹์•„์งˆ ๊ฒ๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์ด ์˜ˆ์ œ์—์„œ๋Š” ๊ทธ๋ ‡๊ฒŒ ํ•˜" +"๊ธฐ ํž˜๋“ญ๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด `io::Error`๋Š” ์ด ํŠธ๋ ˆ์ž‡๋“ค์„ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ" +"๋‹ค." #: src/error-handling/deriving-error-enums.md:3 msgid "" @@ -12499,7 +13937,7 @@ msgid "" "}\n" "\n" "fn read_username(path: &str) -> Result {\n" -" let mut username = String::with_capacity(100);\n" +" let mut username = String::new();\n" " fs::File::open(path)?.read_to_string(&mut username)?;\n" " if username.is_empty() {\n" " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" @@ -12530,7 +13968,7 @@ msgstr "" "}\n" "\n" "fn read_username(path: &str) -> Result {\n" -" let mut username = String::with_capacity(100);\n" +" let mut username = String::new();\n" " fs::File::open(path)?.read_to_string(&mut username)?;\n" " if username.is_empty() {\n" " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" @@ -12577,7 +14015,7 @@ msgstr "" #: src/error-handling/dynamic-errors.md:6 msgid "" "```rust,editable,compile_fail\n" -"use std::fs::{self, File};\n" +"use std::fs;\n" "use std::io::Read;\n" "use thiserror::Error;\n" "use std::error::Error;\n" @@ -12587,8 +14025,8 @@ msgid "" "struct EmptyUsernameError(String);\n" "\n" "fn read_username(path: &str) -> Result> {\n" -" let mut username = String::with_capacity(100);\n" -" File::open(path)?.read_to_string(&mut username)?;\n" +" let mut username = String::new();\n" +" fs::File::open(path)?.read_to_string(&mut username)?;\n" " if username.is_empty() {\n" " return Err(EmptyUsernameError(String::from(path)).into());\n" " }\n" @@ -12605,7 +14043,7 @@ msgid "" "```" msgstr "" "```rust,editable,compile_fail\n" -"use std::fs::{self, File};\n" +"use std::fs;\n" "use std::io::Read;\n" "use thiserror::Error;\n" "use std::error::Error;\n" @@ -12615,8 +14053,8 @@ msgstr "" "struct EmptyUsernameError(String);\n" "\n" "fn read_username(path: &str) -> Result> {\n" -" let mut username = String::with_capacity(100);\n" -" File::open(path)?.read_to_string(&mut username)?;\n" +" let mut username = String::new();\n" +" fs::File::open(path)?.read_to_string(&mut username)?;\n" " if username.is_empty() {\n" " return Err(EmptyUsernameError(String::from(path)).into());\n" " }\n" @@ -12760,7 +14198,7 @@ msgstr "๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋Š” `#[test]` ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค:" #: src/testing/unit-tests.md:5 msgid "" -"```rust,ignore\n" +"```rust,editable,ignore\n" "fn first_word(text: &str) -> &str {\n" " match text.find(' ') {\n" " Some(idx) => &text[..idx],\n" @@ -12784,88 +14222,34 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable,ignore\n" +"fn first_word(text: &str) -> &str {\n" +" match text.find(' ') {\n" +" Some(idx) => &text[..idx],\n" +" None => &text,\n" +" }\n" +"}\n" +"\n" +"#[test]\n" +"fn test_empty() {\n" +" assert_eq!(first_word(\"\"), \"\");\n" +"}\n" +"\n" +"#[test]\n" +"fn test_single_word() {\n" +" assert_eq!(first_word(\"Hello\"), \"Hello\");\n" +"}\n" +"\n" +"#[test]\n" +"fn test_multiple_words() {\n" +" assert_eq!(first_word(\"Hello World\"), \"Hello\");\n" +"}\n" +"```" #: src/testing/unit-tests.md:29 msgid "Use `cargo test` to find and run the unit tests." msgstr "`cargo test` ์ปค๋งจ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์ฐพ์•„์„œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค." -#: src/testing/unit-tests.md:5 -msgid "" -"```rust,editable,ignore\n" -"fn first_word(text: &str) -> &str {\n" -" match text.find(' ') {\n" -" Some(idx) => &text[..idx],\n" -" None => &text,\n" -" }\n" -"}\n" -"\n" -"#[test]\n" -"fn test_empty() {\n" -" assert_eq!(first_word(\"\"), \"\");\n" -"}\n" -"\n" -"#[test]\n" -"fn test_single_word() {\n" -" assert_eq!(first_word(\"Hello\"), \"Hello\");\n" -"}\n" -"\n" -"#[test]\n" -"fn test_multiple_words() {\n" -" assert_eq!(first_word(\"Hello World\"), \"Hello\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable,ignore\n" -"fn first_word(text: &str) -> &str {\n" -" match text.find(' ') {\n" -" Some(idx) => &text[..idx],\n" -" None => &text,\n" -" }\n" -"}\n" -"\n" -"#[test]\n" -"fn test_empty() {\n" -" assert_eq!(first_word(\"\"), \"\");\n" -"}\n" -"\n" -"#[test]\n" -"fn test_single_word() {\n" -" assert_eq!(first_word(\"Hello\"), \"Hello\");\n" -"}\n" -"\n" -"#[test]\n" -"fn test_multiple_words() {\n" -" assert_eq!(first_word(\"Hello World\"), \"Hello\");\n" -"}\n" -"```" - -#: src/testing/useful-crates.md:1 -msgid "Useful crates for writing tests" -msgstr "ํ…Œ์ŠคํŠธ ์ž‘์„ฑ์— ์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" - -#: src/testing/useful-crates.md:5 -msgid "Here are some additional crates which we recommend for writing tests:" -msgstr "๋‹ค์Œ์€ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ๊ถŒ์žฅ๋˜๋Š” ์ถ”๊ฐ€ ํฌ๋ ˆ์ดํŠธ์ž…๋‹ˆ๋‹ค." - -#: src/testing/useful-crates.md:7 -msgid "" -"[googletest](https://docs.rs/googletest): Comprehensive test assertion " -"library in the tradition of GoogleTest for C++." -msgstr "" -"[googletest](https://docs.rs/googletest): C++์šฉ GoogleTest์˜ ๋ฐฉ์‹์„ ๋”ฐ๋ฅด๋Š” ํ…Œ" -"์ŠคํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค." - -#: src/testing/useful-crates.md:8 -msgid "[proptest](https://docs.rs/proptest): Property-based testing for Rust." -msgstr "[proptest](https://docs.rs/proptest): Rust์šฉ ์†์„ฑ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ์ž…๋‹ˆ๋‹ค." - -#: src/testing/useful-crates.md:9 -msgid "" -"[rstest](https://docs.rs/rstest): Support for fixtures and parameterised " -"tests." -msgstr "" -"[rstest](https://docs.rs/rstest): ํ”ฝ์Šค์ฒ˜ ๋ฐ ๋งค๊ฐœ๋ณ€์ˆ˜ํ™”๋œ ํ…Œ์ŠคํŠธ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." - #: src/testing/test-modules.md:3 msgid "" "Unit tests are often put in a nested module (run tests on the [Playground]" @@ -13009,6 +14393,37 @@ msgstr "" msgid "These tests only have access to the public API of your crate." msgstr "์ด ํ…Œ์ŠคํŠธ๋Š” ํฌ๋ ˆ์ดํŠธ์˜ ๊ณต๊ฐœ API์—๋งŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." +#: src/testing/useful-crates.md:1 +msgid "Useful crates for writing tests" +msgstr "ํ…Œ์ŠคํŠธ ์ž‘์„ฑ์— ์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" + +#: src/testing/useful-crates.md:3 +msgid "Rust comes with only basic support for writing tests." +msgstr "๋Ÿฌ์ŠคํŠธ๋Š” ํ…Œ์ŠคํŠธ ์ž‘์„ฑ๊ณผ ๊ด€๋ จํ•ด์„œ๋Š” ๊ธฐ๋ณธ์ ์ธ ๊ธฐ๋Šฅ๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." + +#: src/testing/useful-crates.md:5 +msgid "Here are some additional crates which we recommend for writing tests:" +msgstr "๋‹ค์Œ์€ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ๊ถŒ์žฅ๋˜๋Š” ์ถ”๊ฐ€ ํฌ๋ ˆ์ดํŠธ์ž…๋‹ˆ๋‹ค:" + +#: src/testing/useful-crates.md:7 +msgid "" +"[googletest](https://docs.rs/googletest): Comprehensive test assertion " +"library in the tradition of GoogleTest for C++." +msgstr "" +"[googletest](https://docs.rs/googletest): C++์šฉ GoogleTest์˜ ๋ฐฉ์‹์„ ๋”ฐ๋ฅด๋Š” ํ…Œ" +"์ŠคํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค." + +#: src/testing/useful-crates.md:8 +msgid "[proptest](https://docs.rs/proptest): Property-based testing for Rust." +msgstr "[proptest](https://docs.rs/proptest): Rust์šฉ ์†์„ฑ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ์ž…๋‹ˆ๋‹ค." + +#: src/testing/useful-crates.md:9 +msgid "" +"[rstest](https://docs.rs/rstest): Support for fixtures and parameterised " +"tests." +msgstr "" +"[rstest](https://docs.rs/rstest): ํ”ฝ์Šค์ฒ˜ ๋ฐ ๋งค๊ฐœ๋ณ€์ˆ˜ํ™”๋œ ํ…Œ์ŠคํŠธ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." + #: src/unsafe.md:3 msgid "The Rust language has two parts:" msgstr "๋Ÿฌ์ŠคํŠธ๋กœ ์ž‘์„ฑ๋œ ํ”„๋กœ๊ทธ๋žจ์€ ํฌ๊ฒŒ ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค:" @@ -13054,15 +14469,15 @@ msgstr "์›์‹œ ํฌ์ธํ„ฐ ์—ญ์ฐธ์กฐ(๋”ฐ๋ผ๊ฐ€๊ธฐ)" #: src/unsafe.md:17 msgid "Access or modify mutable static variables." -msgstr "์ •์  ๊ฐ€๋ณ€๋ณ€์ˆ˜ ์ ‘๊ทผ ๋ฐ ์ˆ˜์ •" +msgstr "์ •์  ๊ฐ€๋ณ€๋ณ€์ˆ˜ ์ ‘๊ทผ ๋ฐ ์ˆ˜์ •." #: src/unsafe.md:18 msgid "Access `union` fields." -msgstr "`union` ํ•„๋“œ ์ ‘๊ทผ" +msgstr "`union` ํ•„๋“œ ์ ‘๊ทผ." #: src/unsafe.md:19 msgid "Call `unsafe` functions, including `extern` functions." -msgstr "`extern` ํ•จ์ˆ˜๋ฅผ ํฌํ•จํ•œ `unsafe` ํ•จ์ˆ˜ ํ˜ธ์ถœ" +msgstr "`extern` ํ•จ์ˆ˜๋ฅผ ํฌํ•จํ•œ `unsafe` ํ•จ์ˆ˜ ํ˜ธ์ถœ." #: src/unsafe.md:20 msgid "Implement `unsafe` traits." @@ -13105,12 +14520,11 @@ msgid "" " let r1 = &mut num as *mut i32;\n" " let r2 = r1 as *const i32;\n" "\n" -" // Safe because r1 and r2 were obtained from references and so are " -"guaranteed to be non-null and\n" -" // properly aligned, the objects underlying the references from which " -"they were obtained are\n" -" // live throughout the whole unsafe block, and they are not accessed " -"either through the\n" +" // Safe because r1 and r2 were obtained from references and so are\n" +" // guaranteed to be non-null and properly aligned, the objects " +"underlying\n" +" // the references from which they were obtained are live throughout the\n" +" // whole unsafe block, and they are not accessed either through the\n" " // references or concurrently through any other pointers.\n" " unsafe {\n" " println!(\"r1 is: {}\", *r1);\n" @@ -13127,13 +14541,12 @@ msgstr "" " let r1 = &mut num as *mut i32;\n" " let r2 = r1 as *const i32;\n" "\n" -" // ์•„๋ž˜ ์ฝ”๋“œ๋Š” ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค. r1๊ณผ r2๋Š” ์ฐธ์กฐ๋กœ ๋ถ€ํ„ฐ ๋งŒ๋“ค์–ด ์กŒ๊ธฐ ๋•Œ๋ฌธ์— null" -"์ด ์•„๋‹ˆ๋ฉฐ\n" -" // align์ด ๋งž๋‹ค๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋ฉ๋‹ˆ๋‹ค. ์ฐธ์กฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ์ฒด๋“ค์€ unsafe ๋ธ”๋Ÿญ" -"์ด ์ˆ˜ํ–‰๋˜๋Š”\n" -" // ๋™์•ˆ ๋ฉ”๋ชจ๋ฆฌ์— ์‚ด์•„์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด ๊ฐ์ฒด๋“ค์€ r1๊ณผ r2๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ์–ด" -"๋–ค ์ฐธ์กฐ๋‚˜\n" -" // ํฌ์ธํ„ฐ๋กœ๋„ ์ ‘๊ทผ์ด ์•ˆ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.\n" +" // Safe because r1 and r2 were obtained from references and so are\n" +" // guaranteed to be non-null and properly aligned, the objects " +"underlying\n" +" // the references from which they were obtained are live throughout the\n" +" // whole unsafe block, and they are not accessed either through the\n" +" // references or concurrently through any other pointers.\n" " unsafe {\n" " println!(\"r1 is: {}\", *r1);\n" " *r1 = 10;\n" @@ -13142,7 +14555,7 @@ msgstr "" "}\n" "```" -#: src/unsafe/raw-pointers.md:26 +#: src/unsafe/raw-pointers.md:27 msgid "" "It is good practice (and required by the Android Rust style guide) to write " "a comment for each `unsafe` block explaining how the code inside it " @@ -13152,7 +14565,7 @@ msgstr "" "๊ฒƒ์€ ์ข‹์€ ์Šต๊ด€์ž…๋‹ˆ๋‹ค(์‚ฌ์‹ค ์•ˆ๋“œ๋กœ์ด๋“œ์˜ ๋Ÿฌ์ŠคํŠธ ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ์—์„œ๋Š” ์ด๊ฒŒ ํ•„์ˆ˜์ž…" "๋‹ˆ๋‹ค)." -#: src/unsafe/raw-pointers.md:30 +#: src/unsafe/raw-pointers.md:31 msgid "" "In the case of pointer dereferences, this means that the pointers must be " "[_valid_](https://doc.rust-lang.org/std/ptr/index.html#safety), i.e.:" @@ -13160,11 +14573,11 @@ msgstr "" "ํฌ์ธํ„ฐ ์—ญ์ฐธ์กฐ๋ฅผ ํ•  ๊ฒฝ์šฐ, ํฌ์ธํ„ฐ๊ฐ€ [_์œ ํšจ_](https://doc.rust-lang.org/std/ptr/" "index.html#safety)ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด:" -#: src/unsafe/raw-pointers.md:33 +#: src/unsafe/raw-pointers.md:34 msgid "The pointer must be non-null." msgstr "ํฌ์ธํ„ฐ๋Š” null์ด๋ฉด ์•ˆ๋ฉ๋‹ˆ๋‹ค." -#: src/unsafe/raw-pointers.md:34 +#: src/unsafe/raw-pointers.md:35 msgid "" "The pointer must be _dereferenceable_ (within the bounds of a single " "allocated object)." @@ -13172,15 +14585,15 @@ msgstr "" "ํฌ์ธํ„ฐ๋Š” ๋”ฐ๋ผ๊ฐ€๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค (๊ฐ์ฒด์˜ ์–ด๋А ํ•œ ๋ถ€๋ถ„์„ ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ์–ด์•ผ ํ•ฉ" "๋‹ˆ๋‹ค)." -#: src/unsafe/raw-pointers.md:35 +#: src/unsafe/raw-pointers.md:36 msgid "The object must not have been deallocated." msgstr "์ด๋ฏธ ๋ฐ˜ํ™˜๋œ ๊ฐ์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋ฉด ์•ˆ๋ฉ๋‹ˆ๋‹ค." -#: src/unsafe/raw-pointers.md:36 +#: src/unsafe/raw-pointers.md:37 msgid "There must not be concurrent accesses to the same location." msgstr "๊ฐ™์€ ์œ„์น˜์— ๋Œ€ํ•ด ๋™์‹œ์ ์ธ ์ ‘๊ทผ์ด ์žˆ์œผ๋ฉด ์•ˆ๋ฉ๋‹ˆ๋‹ค." -#: src/unsafe/raw-pointers.md:37 +#: src/unsafe/raw-pointers.md:38 msgid "" "If the pointer was obtained by casting a reference, the underlying object " "must be live and no reference may be used to access the memory." @@ -13188,7 +14601,7 @@ msgstr "" "์ฐธ์กฐ๋ฅผ ์บ์ŠคํŒ… ํ•ด์„œ ํฌ์ธํ„ฐ๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค๋ฉด, ๊ทธ ์ฐธ์กฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ์ฒด๋Š” ์‚ด์•„ ์žˆ์–ด" "์•ผ ํ•˜๋ฉฐ, ๊ทธ ๊ฐ์ฒด์˜ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์ ‘๊ทผํ•˜๋Š” ์ฐธ์กฐ๊ฐ€ ํ•˜๋‚˜๋„ ์—†์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." -#: src/unsafe/raw-pointers.md:40 +#: src/unsafe/raw-pointers.md:41 msgid "In most cases the pointer must also be properly aligned." msgstr "๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ ํฌ์ธํ„ฐ๋Š” align๋˜์–ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." @@ -13455,10 +14868,10 @@ msgid "" "`unsafe` block. We can prohibit this with `#[deny(unsafe_op_in_unsafe_fn)]`. " "Try adding it and see what happens." msgstr "" -"unsafe ์ฝ”๋“œ๊ฐ€ unsafe ํ•จ์ˆ˜์˜ ๋‚ด๋ถ€์—์„œ ํ˜ธ์ถœ๋  ๊ฒฝ์šฐ์—๋Š” `unsafe`๋ธ”๋ก์„ ์ง€์ •ํ•˜์ง€ " -"์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค. `unsafe`๋ธ”๋ก์„ ํ•ญ์ƒ ์ง€์ •ํ•˜๋„๋ก ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด " -"`#[deny(unsafe_op_in_unsafe_fn)]`๋ฅผ ์ด์šฉํ•˜์„ธ์š”. ์ด ์–ดํŠธ๋ฆฌ๋ทฐํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด ๋ณด๊ณ  " -"์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”." +"์•ˆ์ „ํ•˜์ง€ ์•Š์€(unsafe) ์ฝ”๋“œ๊ฐ€ ์•ˆ์ „ํ•˜์ง€ ์•Š์€(unsafe) ํ•จ์ˆ˜์˜ ๋‚ด๋ถ€์—์„œ ํ˜ธ์ถœ๋  ๊ฒฝ" +"์šฐ์—๋Š” `unsafe`๋ธ”๋ก์„ ์ง€์ •ํ•˜์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค. `unsafe`๋ธ”๋ก์„ ํ•ญ์ƒ ์ง€์ •ํ•˜๋„๋ก " +"ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด `#[deny(unsafe_op_in_unsafe_fn)]`๋ฅผ ์ด์šฉํ•˜์„ธ์š”. ์ด ์–ดํŠธ๋ฆฌ๋ทฐํŠธ๋ฅผ " +"์ถ”๊ฐ€ํ•ด ๋ณด๊ณ  ์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”." #: src/unsafe/extern-functions.md:1 msgid "Calling External Code" @@ -13603,7 +15016,23 @@ msgstr "3์ผ์ฐจ ์˜คํ›„ ์—ฐ์Šต๋ฌธ์ œ" msgid "Let us build a safe wrapper for reading directory content!" msgstr "๋””๋ ‰ํ„ฐ๋ฆฌ์˜ ๋‚ด์šฉ์„ ์ฝ๋Š” ์•ˆ์ „ํ•œ ๋ž˜ํผ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด ๋ด…์‹œ๋‹ค!" -#: src/exercises/day-3/afternoon.md:7 +#: src/exercises/day-3/afternoon.md:5 +msgid "" +"For this exercise, we suggest using a local dev environment instead of the " +"Playground. This will allow you to run your binary on your own machine." +msgstr "" +"์ด๋ฒˆ ์—ฐ์Šต์—์„œ๋Š”, ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ ๋Œ€์‹  ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์‚ฌ์šฉํ•ด์„œ, ์—ฌ๋Ÿฌ๋ถ„์˜ ์ปดํ“จ" +"ํ„ฐ์—์„œ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์ง์ ‘ ์ˆ˜ํ–‰ํ•ด ๋ณด์„ธ์š”." + +#: src/exercises/day-3/afternoon.md:8 +msgid "" +"To get started, follow the [running locally](../../cargo/running-locally.md) " +"instructions." +msgstr "" +"์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด, [๋กœ์ปฌ ํ™˜๊ฒฝ์—์„œ ์ˆ˜ํ–‰ํ•˜๊ธฐ](../../cargo/running-locally.md)๋ฅผ ๋”ฐ" +"๋ฅด์„ธ์š”." + +#: src/exercises/day-3/afternoon.md:14 msgid "" "After looking at the exercise, you can look at the [solution](solutions-" "afternoon.md) provided." @@ -13639,20 +15068,130 @@ msgstr "[`closedir(3)`](https://man7.org/linux/man-pages/man3/closedir.3.html)" #: src/exercises/day-3/safe-ffi-wrapper.md:13 msgid "" "You will also want to browse the [`std::ffi`](https://doc.rust-lang.org/std/" -"ffi/) module, particular for [`CStr`](https://doc.rust-lang.org/std/ffi/" -"struct.CStr.html) and [`CString`](https://doc.rust-lang.org/std/ffi/struct." -"CString.html) types which are used to hold NUL-terminated strings coming " -"from C. The [Nomicon](https://doc.rust-lang.org/nomicon/ffi.html) also has a " -"very useful chapter about FFI." +"ffi/) module. There you find a number of string types which you need for the " +"exercise:" msgstr "" -"[`std::ffi`](https://doc.rust-lang.org/std/ffi/) ๋ชจ๋“ˆ์„ ํƒ์ƒ‰ํ•˜๋Š”๊ฒŒ ํ•„์š”ํ•  ์ง€" -"๋„ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. C์—์„œ ์‚ฌ์šฉ๋˜๋Š” NUL-terminated ๋ฌธ์ž์—ด์„ ๋‹ด๊ธฐ ์œ„ํ•œ [`CStr`]" -"(https://doc.rust-lang.org/std/ffi/struct.CStr.html)๊ณผ [`CString`](https://" -"doc.rust-lang.org/std/ffi/struct.CString.html) ํƒ€์ž…์„ ํ™•์ธํ•ด ๋ณด์„ธ์š”. " -"[Nomicon](https://doc.rust-lang.org/nomicon/ffi.html)๋ฌธ์„œ ๋˜ํ•œ FFI์— ๋Œ€ํ•œ ์œ " -"์šฉํ•œ ๋‚ด์šฉ์„ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค." +"์•„๋งˆ [`std::ffi`](https://doc.rust-lang.org/std/ffi/)๋ชจ๋“ˆ์„ ์ฐธ์กฐํ•  ํ•„์š”๊ฐ€ ์žˆ" +"์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ฑฐ๊ธฐ์—๋Š” ์ด๋ฒˆ ์˜ˆ์ œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜์˜ ๋ฌธ์ž์—ด ํƒ€์ž…" +"๋“ค์ด ์†Œ๊ฐœ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/exercises/day-3/safe-ffi-wrapper.md:16 +msgid "Encoding" +msgstr "์ธ์ฝ”๋”ฉ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:16 +msgid "Use" +msgstr "์‚ฌ์šฉ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:18 +msgid "" +"[`str`](https://doc.rust-lang.org/std/primitive.str.html) and [`String`]" +"(https://doc.rust-lang.org/std/string/struct.String.html)" +msgstr "" +"[`str`](https://doc.rust-lang.org/std/primitive.str.html)๊ณผ [`String`]" +"(https://doc.rust-lang.org/std/string/struct.String.html)" + +#: src/exercises/day-3/safe-ffi-wrapper.md:18 +msgid "UTF-8" +msgstr "UTF-8" + +#: src/exercises/day-3/safe-ffi-wrapper.md:18 +msgid "Text processing in Rust" +msgstr "๋Ÿฌ์ŠคํŠธ์—์„œ์˜ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:19 +msgid "" +"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html) and [`CString`]" +"(https://doc.rust-lang.org/std/ffi/struct.CString.html)" +msgstr "" +"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html)๊ณผ [`CString`]" +"(https://doc.rust-lang.org/std/ffi/struct.CString.html)" + +#: src/exercises/day-3/safe-ffi-wrapper.md:19 +msgid "NUL-terminated" +msgstr "๋„(NUL)๋กœ ๋๋‚จ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:19 +msgid "Communicating with C functions" +msgstr "Cํ•จ์ˆ˜์™€ ์—ฐ๋™ํ•˜๊ธฐ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:20 +msgid "" +"[`OsStr`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html) and " +"[`OsString`](https://doc.rust-lang.org/std/ffi/struct.OsString.html)" +msgstr "" +"[`OsStr`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html)์™€ [`OsString`]" +"(https://doc.rust-lang.org/std/ffi/struct.OsString.html)" + +#: src/exercises/day-3/safe-ffi-wrapper.md:20 +msgid "OS-specific" +msgstr "OS๊ฐ€ ์ •์˜ํ•จ" + +#: src/exercises/day-3/safe-ffi-wrapper.md:20 +msgid "Communicating with the OS" +msgstr "OS์™€ ์—ฐ๋™ํ•˜๊ธฐ ์œ„ํ•œ ๋ฌธ์ž์—ด" #: src/exercises/day-3/safe-ffi-wrapper.md:22 +msgid "You will convert between all these types:" +msgstr "์ด ํƒ€์ž…๋“ค ๊ฐ„์˜ ๋ณ€ํ™˜์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" + +#: src/exercises/day-3/safe-ffi-wrapper.md:24 +msgid "" +"`&str` to `CString`: you need to allocate space for a trailing `\\0` " +"character," +msgstr "" +"`&str`์—์„œ `CString`์œผ๋กœ์˜ ๋ณ€ํ™˜: ๋งจ ๋งˆ์ง€๋ง‰์˜ `\\0` ๋ฌธ์ž๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ๊ณต๊ฐ„" +"์„ ํ• ๋‹นํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค," + +#: src/exercises/day-3/safe-ffi-wrapper.md:25 +msgid "`CString` to `*const i8`: you need a pointer to call C functions," +msgstr "" +"`CString`์—์„œ `*const i8`๋กœ์˜ ๋ณ€ํ™˜: Cํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํฌ์ธํ„ฐ๊ฐ€ ํ•„์š”ํ•ฉ" +"๋‹ˆ๋‹ค," + +#: src/exercises/day-3/safe-ffi-wrapper.md:26 +msgid "" +"`*const i8` to `&CStr`: you need something which can find the trailing `\\0` " +"character," +msgstr "" +"`*const i8`์—์„œ `&CStr`๋กœ์˜ ๋ณ€ํ™˜: ์ฃผ์–ด์ง„ ๋ฐ”์ดํŠธ ์‹œํ€€์Šค๊ฐ€ `\\0`๋กœ ๋๋‚˜๋Š”์ง€ ํ™•" +"์ธํ•˜๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ," + +#: src/exercises/day-3/safe-ffi-wrapper.md:27 +msgid "" +"`&CStr` to `&[u8]`: a slice of bytes is the universal interface for \"some " +"unknow data\"," +msgstr "" +"`&CStr`์—์„œ `&[u8]`๋กœ์˜ ๋ณ€ํ™˜: ๋ฐ”์ดํŠธ ์Šฌ๋ผ์ด์Šค๋Š” \"์•Œ์ˆ˜์—†๋Š” ๋ฐ์ดํ„ฐ\"์— ๋Œ€ํ•œ ์ผ" +"๋ฐ˜์ ์ธ ์ธํ„ฐํŽ˜์ด์Šค์ž…๋‹ˆ๋‹ค," + +#: src/exercises/day-3/safe-ffi-wrapper.md:28 +msgid "" +"`&[u8]` to `&OsStr`: `&OsStr` is a step towards `OsString`, use [`OsStrExt`]" +"(https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html) to create it," +msgstr "" +"`&[u8]`์—์„œ `&OsStr`๋กœ์˜ ๋ณ€ํ™˜: `&OsStr`๋Š” `OsString`์œผ๋กœ ๊ฐ€๊ธฐ ์œ„ํ•œ ์ค‘๊ฐ„ ๋‹จ๊ณ„ " +"์ž…๋‹ˆ๋‹ค. [`OsStrExt`](https://doc.rust-lang.org/std/os/unix/ffi/trait." +"OsStrExt.html)๋ฅผ ์‚ฌ์šฉํ•ด์„œ `OsStr`๋ฅผ ์ƒ์„ฑํ•˜์„ธ์š”," + +#: src/exercises/day-3/safe-ffi-wrapper.md:31 +msgid "" +"`&OsStr` to `OsString`: you need to clone the data in `&OsStr` to be able to " +"return it and call `readdir` again." +msgstr "" +"`&OsStr`์—์„œ `OsString`์œผ๋กœ์˜ ๋ณ€ํ™˜: `&OsStr`์ด ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ณต์‚ฌํ•จ" +"์œผ๋กœ์จ, ์ด ๋ฐ์ดํ„ฐ๋ฅผ ๋ฆฌํ„ดํ•˜๊ณ , `readdir`ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ค" +"๋‹ˆ๋‹ค." + +#: src/exercises/day-3/safe-ffi-wrapper.md:34 +msgid "" +"The [Nomicon](https://doc.rust-lang.org/nomicon/ffi.html) also has a very " +"useful chapter about FFI." +msgstr "" +"[Nomicon](https://doc.rust-lang.org/nomicon/ffi.html)์— FFI์™€ ๊ด€๋ จํ•œ ์•„์ฃผ ์œ " +"์šฉํ•œ ์ฑ•ํ„ฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/day-3/safe-ffi-wrapper.md:45 msgid "" "Copy the code below to and fill in the missing " "functions and methods:" @@ -13660,14 +15199,16 @@ msgstr "" "์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์— ๋ณต์‚ฌํ•˜๊ณ  ๋น ์ง„ ํ•จ์ˆ˜์™€ ๋ฉ”์„œ๋“œ๋ฅผ ์ฑ„" "์›Œ๋ด…๋‹ˆ๋‹ค:" -#: src/exercises/day-3/safe-ffi-wrapper.md:25 +#: src/exercises/day-3/safe-ffi-wrapper.md:48 msgid "" "```rust,should_panic\n" "// TODO: remove this when you're done with your implementation.\n" "#![allow(unused_imports, unused_variables, dead_code)]\n" "\n" "mod ffi {\n" -" use std::os::raw::{c_char, c_int, c_long, c_ulong, c_ushort};\n" +" use std::os::raw::{c_char, c_int};\n" +" #[cfg(not(target_os = \"macos\"))]\n" +" use std::os::raw::{c_long, c_ulong, c_ushort, c_uchar};\n" "\n" " // Opaque type. See https://doc.rust-lang.org/nomicon/ffi.html.\n" " #[repr(C)]\n" @@ -13677,20 +15218,50 @@ msgid "" "PhantomPinned)>,\n" " }\n" "\n" -" // Layout as per readdir(3) and definitions in /usr/include/x86_64-linux-" -"gnu.\n" +" // Layout according to the Linux man page for readdir(3), where ino_t " +"and\n" +" // off_t are resolved according to the definitions in\n" +" // /usr/include/x86_64-linux-gnu/{sys/types.h, bits/typesizes.h}.\n" +" #[cfg(not(target_os = \"macos\"))]\n" " #[repr(C)]\n" " pub struct dirent {\n" -" pub d_ino: c_long,\n" -" pub d_off: c_ulong,\n" +" pub d_ino: c_ulong,\n" +" pub d_off: c_long,\n" " pub d_reclen: c_ushort,\n" -" pub d_type: c_char,\n" +" pub d_type: c_uchar,\n" " pub d_name: [c_char; 256],\n" " }\n" "\n" +" // Layout according to the macOS man page for dir(5).\n" +" #[cfg(all(target_os = \"macos\"))]\n" +" #[repr(C)]\n" +" pub struct dirent {\n" +" pub d_fileno: u64,\n" +" pub d_seekoff: u64,\n" +" pub d_reclen: u16,\n" +" pub d_namlen: u16,\n" +" pub d_type: u8,\n" +" pub d_name: [c_char; 1024],\n" +" }\n" +"\n" " extern \"C\" {\n" " pub fn opendir(s: *const c_char) -> *mut DIR;\n" +"\n" +" #[cfg(not(all(target_os = \"macos\", target_arch = \"x86_64\")))]\n" " pub fn readdir(s: *mut DIR) -> *const dirent;\n" +"\n" +" // See https://github.com/rust-lang/libc/issues/414 and the section " +"on\n" +" // _DARWIN_FEATURE_64_BIT_INODE in the macOS man page for stat(2).\n" +" //\n" +" // \"Platforms that existed before these updates were available\" " +"refers\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and " +"PowerPC.\n" +" #[cfg(all(target_os = \"macos\", target_arch = \"x86_64\"))]\n" +" #[link_name = \"readdir$INODE64\"]\n" +" pub fn readdir(s: *mut DIR) -> *const dirent;\n" +"\n" " pub fn closedir(s: *mut DIR) -> c_int;\n" " }\n" "}\n" @@ -13734,2790 +15305,114 @@ msgid "" "}\n" "```" msgstr "" - -#: src/welcome-day-4.md:1 -msgid "Welcome to Day 4" -msgstr "4์ผ์ฐจ ๊ฐœ์š”" - -#: src/welcome-day-4.md:3 -msgid "" -"This morning, we will focus on Concurrency: threads, channels, shared state, " -"`Send` and `Sync`. In the afternoon, we will have a chance to see Rust in " -"action." -msgstr "" -"์˜ค์ „์—๋Š” ๋™์‹œ์„ฑ์„ ๋‹ค๋ฃน๋‹ˆ๋‹ค: ์“ฐ๋ ˆ๋“œ, ์ฑ„๋„, ๊ณต์œ  ์ƒํƒœ, `Send`์™€ `Sync`. ์˜คํ›„์—" -"๋Š” ๋Ÿฌ์ŠคํŠธ๊ฐ€ ์‹ค์ œ ์‚ฌ์šฉ๋˜๋Š” ์‚ฌ๋ก€๋ฅผ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค." - -#: src/welcome-day-4.md:8 -msgid "" -"This is a good time to give an outline of what you will cover in the " -"afternoon section, as announced in the course offering." -msgstr "์˜คํ›„์— ๋‹ค๋ฃฐ ๋‚ด์šฉ์˜ ๊ฐœ์š”๋ฅผ ์†Œ๊ฐœํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์Šต๋‹ˆ๋‹ค." - -#: src/concurrency.md:1 -msgid "Fearless Concurrency" -msgstr "๊ฒ‚์—†๋Š” ๋™์‹œ์„ฑ" - -#: src/concurrency.md:3 -msgid "" -"Rust has full support for concurrency using OS threads with mutexes and " -"channels." -msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ๋™์‹œ์„ฑ ์ง€์›์ด ๋ง‰๊ฐ•ํ•ฉ๋‹ˆ๋‹ค. ์šด์˜์ฒด์ œ ๋ ˆ๋ฒจ์˜ ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ๋ฎคํƒ์Šค" -"์™€ ์ฑ„๋„๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency.md:6 -msgid "" -"The Rust type system plays an important role in making many concurrency bugs " -"compile time bugs. This is often referred to as _fearless concurrency_ since " -"you can rely on the compiler to ensure correctness at runtime." -msgstr "" -"๋Ÿฌ์ŠคํŠธ์˜ ํƒ€์ž… ์‹œ์Šคํ…œ์€ ํ”„๋กœ๊ทธ๋žจ์— ๋™์‹œ์„ฑ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์ปดํŒŒ์ผ ์‹œ์— ์—๋Ÿฌ" -"๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ํ•ด ์ค๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ์ด์šฉํ•ด์„œ ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰์‹œ์— ์ •ํ™•ํžˆ ๋™์ž‘" -"ํ•จ์„ ๋ฏธ๋ฆฌ ๋ณด์žฅํ•ด ์ฃผ๊ธฐ ๋•Œ๋ฌธ์—, ์‚ฌ๋žŒ๋“ค์€ ์ด๋ฅผ ์ข…์ข… _๊ฒ์—†๋Š” ๋™์‹œ์„ฑ_ ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ" -"๋‹ค." - -#: src/concurrency/threads.md:3 -msgid "Rust threads work similarly to threads in other languages:" -msgstr "๋Ÿฌ์ŠคํŠธ์˜ ์Šค๋ ˆ๋“œ๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์˜ ์Šค๋ ˆ๋“œ์™€ ์œ ์‚ฌํ•˜๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/concurrency/threads.md:5 -msgid "" -"```rust,editable\n" -"use std::thread;\n" -"use std::time::Duration;\n" +"```rust,should_panic\n" +"// TODO: remove this when you're done with your implementation.\n" +"#![allow(unused_imports, unused_variables, dead_code)]\n" "\n" -"fn main() {\n" -" thread::spawn(|| {\n" -" for i in 1..10 {\n" -" println!(\"Count in thread: {i}!\");\n" -" thread::sleep(Duration::from_millis(5));\n" -" }\n" -" });\n" +"mod ffi {\n" +" use std::os::raw::{c_char, c_int};\n" +" #[cfg(not(target_os = \"macos\"))]\n" +" use std::os::raw::{c_long, c_ulong, c_ushort, c_uchar};\n" "\n" -" for i in 1..5 {\n" -" println!(\"Main thread: {i}\");\n" -" thread::sleep(Duration::from_millis(5));\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" thread::spawn(|| {\n" -" for i in 1..10 {\n" -" println!(\"Count in thread: {i}!\");\n" -" thread::sleep(Duration::from_millis(5));\n" -" }\n" -" });\n" -"\n" -" for i in 1..5 {\n" -" println!(\"Main thread: {i}\");\n" -" thread::sleep(Duration::from_millis(5));\n" -" }\n" -"}\n" -"```" - -#: src/concurrency/threads.md:24 -msgid "Threads are all daemon threads, the main thread does not wait for them." -msgstr "" -"์Šค๋ ˆ๋“œ๋Š” ๋ชจ๋‘ ๋ฐ๋ชฌ ์Šค๋ ˆ๋“œ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ๋Š” ์ด ์Šค๋ ˆ๋“œ๋“ค์ด ๋๋‚˜๊ธฐ๋ฅผ " -"๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:25 -msgid "Thread panics are independent of each other." -msgstr "ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ๋ฐœ์ƒํ•œ ํŒจ๋‹‰์€ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—๊ฒŒ ์˜ํ–ฅ์„ ๋ผ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:26 -msgid "Panics can carry a payload, which can be unpacked with `downcast_ref`." -msgstr "" -"ํŒจ๋‹‰์€ ์ถ”๊ฐ€์ •๋ณด(ํŽ˜์ด๋กœ๋“œ)๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด๋Š” `downcast_ref`๋กœ ํ’€์–ด๋ณผ " -"์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:32 -msgid "" -"Notice that the thread is stopped before it reaches 10 โ€” the main thread is " -"not waiting." -msgstr "" -"๋ฉ”์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์ž์‹ ์Šค๋ ˆ๋“œ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ž์‹ ์Šค๋ ˆ๋“œ์˜ for๋ฌธ์€ 10๊นŒ" -"์ง€ ๊ฐ€์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:35 -msgid "" -"Use `let handle = thread::spawn(...)` and later `handle.join()` to wait for " -"the thread to finish." -msgstr "" -"๋งŒ์•ฝ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์ž์‹ ์Šค๋ ˆ๋“œ๊ฐ€ ๋๋‚  ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๊ธฐ๋ฅผ ์›ํ•œ๋‹ค๋ฉด `let " -"handle = thread::spawn(...)`์œผ๋กœ ์Šค๋ ˆ๋“œ๋ฅผ ์„ ์–ธํ•œ ํ›„ `handle.join()`๋กœ ์—ฐ๊ฒฐํ•˜" -"์—ฌ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:38 -msgid "Trigger a panic in the thread, notice how this doesn't affect `main`." -msgstr "" -"์ž์‹ ์Šค๋ ˆ๋“œ์—์„œ ๋ฐœ์ƒํ•œ ํŒจ๋‹‰์ด ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—๋Š” ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š์Œ์„ ํ™•์ธํ•˜์‹œ๊ธฐ " -"๋ฐ”๋ž๋‹ˆ๋‹ค." - -#: src/concurrency/threads.md:40 -msgid "" -"Use the `Result` return value from `handle.join()` to get access to the " -"panic payload. This is a good time to talk about [`Any`](https://doc.rust-" -"lang.org/std/any/index.html)." -msgstr "" -"`handle.join()`์‚ฌ์šฉ์‹œ `Result` ๋ฐ˜ํ™˜๊ฐ’์„ ํ†ตํ•ด ํŒจ๋‹‰์˜ ์ถ”๊ฐ€์ •๋ณด์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต" -"๋‹ˆ๋‹ค. ์ด ์‹œ์ ์—์„œ [`Any`](https://doc.rust-lang.org/std/any/index.html)์— ๋Œ€" -"ํ•ด ์ด์•ผ๊ธฐ๋ฅผ ํ•ด ๋ณด๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/scoped-threads.md:3 -msgid "Normal threads cannot borrow from their environment:" -msgstr "๋ณดํ†ต, ์Šค๋ ˆ๋“œ๋Š” ์Šค๋ ˆ๋“œ ๋ฐ–์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋นŒ๋ฆด ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/scoped-threads.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let s = String::from(\"Hello\");\n" -"\n" -" thread::spawn(|| {\n" -" println!(\"Length: {}\", s.len());\n" -" });\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let s = String::from(\"Hello\");\n" -"\n" -" thread::spawn(|| {\n" -" println!(\"Length: {}\", s.len());\n" -" });\n" -"}\n" -"```" - -#: src/concurrency/scoped-threads.md:17 -msgid "" -"However, you can use a [scoped thread](https://doc.rust-lang.org/std/thread/" -"fn.scope.html) for this:" -msgstr "" -"ํ•˜์ง€๋งŒ, [scoped thread](https://doc.rust-lang.org/std/thread/fn.scope.html)์—" -"์„œ๋Š” ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค:" - -#: src/concurrency/scoped-threads.md:19 -msgid "" -"```rust,editable\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let s = String::from(\"Hello\");\n" -"\n" -" thread::scope(|scope| {\n" -" scope.spawn(|| {\n" -" println!(\"Length: {}\", s.len());\n" -" });\n" -" });\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let s = String::from(\"Hello\");\n" -"\n" -" thread::scope(|scope| {\n" -" scope.spawn(|| {\n" -" println!(\"Length: {}\", s.len());\n" -" });\n" -" });\n" -"}\n" -"```" - -#: src/concurrency/scoped-threads.md:37 -msgid "" -"The reason for that is that when the `thread::scope` function completes, all " -"the threads are guaranteed to be joined, so they can return borrowed data." -msgstr "" -"`thread::scope` ํ•จ์ˆ˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๊ทธ ์•ˆ์—์„œ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์Šค๋ ˆ๋“œ๋“ค์ด ์ข…๋ฃŒํ–ˆ์Œ์ด " -"๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ๊ทธ ๋•Œ ๋นŒ๋ ธ๋˜ ๋ฐ์ดํ„ฐ๋“ค์„ ๋‹ค์‹œ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/scoped-threads.md:38 -msgid "" -"Normal Rust borrowing rules apply: you can either borrow mutably by one " -"thread, or immutably by any number of threads." -msgstr "" -"์ผ๋ฐ˜์ ์ธ ๋Ÿฌ์ŠคํŠธ์˜ ๋นŒ๋ฆผ ๊ทœ์น™์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค: ํ•œ ์Šค๋ ˆ๋“œ์— ์˜ํ•œ ๊ฐ€๋ณ€ ๋นŒ๋ฆผ ๋˜๋Š” ์—ฌ" -"๋Ÿฌ ์Šค๋ ˆ๋“œ์— ๋Œ€ํ•œ ๋ถˆ๋ณ€ ๋นŒ๋ฆผ์ค‘ ํ•˜๋‚˜๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/channels.md:3 -msgid "" -"Rust channels have two parts: a `Sender` and a `Receiver`. The two " -"parts are connected via the channel, but you only see the end-points." -msgstr "" -"๋Ÿฌ์ŠคํŠธ์˜ ์ฑ„๋„์€ `Sender` ์™€ `Receiver` ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ด ๋‘˜์€ " -"์ฑ„๋„์„ ํ†ตํ•ด ์„œ๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์ง€๋งŒ, ์šฐ๋ฆฌ๋Š” ์ฑ„๋„์„ ๋ณผ ์ˆ˜๋Š” ์—†๊ณ  ์ด ์–‘ ๋๋‹จ๋งŒ์„ " -"์‚ฌ์šฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/channels.md:6 -msgid "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::channel();\n" -"\n" -" tx.send(10).unwrap();\n" -" tx.send(20).unwrap();\n" -"\n" -" println!(\"Received: {:?}\", rx.recv());\n" -" println!(\"Received: {:?}\", rx.recv());\n" -"\n" -" let tx2 = tx.clone();\n" -" tx2.send(30).unwrap();\n" -" println!(\"Received: {:?}\", rx.recv());\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::channel();\n" -"\n" -" tx.send(10).unwrap();\n" -" tx.send(20).unwrap();\n" -"\n" -" println!(\"Received: {:?}\", rx.recv());\n" -" println!(\"Received: {:?}\", rx.recv());\n" -"\n" -" let tx2 = tx.clone();\n" -" tx2.send(30).unwrap();\n" -" println!(\"Received: {:?}\", rx.recv());\n" -"}\n" -"```" - -#: src/concurrency/channels.md:27 -msgid "" -"`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender` " -"implement `Clone` (so you can make multiple producers) but `Receiver` does " -"not." -msgstr "" -"`mpsc`๋Š” โ€œMulti-Produce, Single-Consumerโ€๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. `Sender`์™€ " -"`SyncSender`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•˜์ง€๋งŒ (์ฆ‰, ์—ฌ๋Ÿฌ๊ฐœ์˜ producer๋ฅผ ๋งŒ๋“ค์ˆ˜ ์žˆ์Šต๋‹ˆ" -"๋‹ค) `Receiver`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/channels.md:29 -msgid "" -"`send()` and `recv()` return `Result`. If they return `Err`, it means the " -"counterpart `Sender` or `Receiver` is dropped and the channel is closed." -msgstr "" -"`send()`์™€ `recv()`๋Š” `Result`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์ผ `Err`๊ฐ€ ๋ฐ˜ํ™˜๋œ๋‹ค๋ฉด, ์ƒ๋Œ€๋ฐฉ" -"์˜ `Sender`๋˜๋Š” `Receiver`๊ฐ€ ์‚ญ์ œ๋˜์—ˆ๊ณ  ์ฑ„๋„์ด ๋‹ซํ˜”๋‹ค๋Š” ๋œป์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/channels/unbounded.md:3 -msgid "You get an unbounded and asynchronous channel with `mpsc::channel()`:" -msgstr "`mpsc::channel()` ํ•จ์ˆ˜๋Š” ๊ฒฝ๊ณ„๊ฐ€ ์—†๋Š” ๋น„๋™๊ธฐ ์ฑ„๋„์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:" - -#: src/concurrency/channels/unbounded.md:5 -msgid "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::channel();\n" -"\n" -" thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" for i in 1..10 {\n" -" tx.send(format!(\"Message {i}\")).unwrap();\n" -" println!(\"{thread_id:?}: sent Message {i}\");\n" -" }\n" -" println!(\"{thread_id:?}: done\");\n" -" });\n" -" thread::sleep(Duration::from_millis(100));\n" -"\n" -" for msg in rx.iter() {\n" -" println!(\"Main: got {}\", msg);\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/concurrency/channels/unbounded.md:5 -msgid "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::channel();\n" -"\n" -" thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" for i in 1..10 {\n" -" tx.send(format!(\"Message {i}\")).unwrap();\n" -" println!(\"{thread_id:?}: sent Message {i}\");\n" -" }\n" -" println!(\"{thread_id:?}: done\");\n" -" });\n" -" thread::sleep(Duration::from_millis(100));\n" -"\n" -" for msg in rx.iter() {\n" -" println!(\"Main: got {msg}\");\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::channel();\n" -"\n" -" thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" for i in 1..10 {\n" -" tx.send(format!(\"Message {i}\")).unwrap();\n" -" println!(\"{thread_id:?}: sent Message {i}\");\n" -" }\n" -" println!(\"{thread_id:?}: done\");\n" -" });\n" -" thread::sleep(Duration::from_millis(100));\n" -"\n" -" for msg in rx.iter() {\n" -" println!(\"Main: got {msg}\");\n" -" }\n" -"}\n" -"```" - -#: src/concurrency/channels/bounded.md:3 -msgid "Bounded and synchronous channels make `send` block the current thread:" -msgstr "๊ฒฝ๊ณ„๊ฐ€ ์žˆ๋Š” ๋™๊ธฐ ์ฑ„๋„์€ `send`๊ฐ€ ํ˜„์ œ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กœํ‚น ํ•˜๋„๋ก ๋งŒ๋“ญ๋‹ˆ๋‹ค:" - -#: src/concurrency/channels/bounded.md:5 -msgid "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::sync_channel(3);\n" -"\n" -" thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" for i in 1..10 {\n" -" tx.send(format!(\"Message {i}\")).unwrap();\n" -" println!(\"{thread_id:?}: sent Message {i}\");\n" -" }\n" -" println!(\"{thread_id:?}: done\");\n" -" });\n" -" thread::sleep(Duration::from_millis(100));\n" -"\n" -" for msg in rx.iter() {\n" -" println!(\"Main: got {msg}\");\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::sync::mpsc;\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"fn main() {\n" -" let (tx, rx) = mpsc::sync_channel(3);\n" -"\n" -" thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" for i in 1..10 {\n" -" tx.send(format!(\"Message {i}\")).unwrap();\n" -" println!(\"{thread_id:?}: sent Message {i}\");\n" -" }\n" -" println!(\"{thread_id:?}: done\");\n" -" });\n" -" thread::sleep(Duration::from_millis(100));\n" -"\n" -" for msg in rx.iter() {\n" -" println!(\"Main: got {msg}\");\n" -" }\n" -"}\n" -"```" - -#: src/concurrency/shared_state.md:3 -msgid "" -"Rust uses the type system to enforce synchronization of shared data. This is " -"primarily done via two types:" -msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ์ฃผ๋กœ ์•„๋ž˜ ๋‘ ๊ฐ€์ง€ ํƒ€์ž…์„ ์ด์šฉํ•ด์„œ ๊ณต์œ  ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/concurrency/shared_state.md:6 -msgid "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html), atomic " -"reference counted `T`: handles sharing between threads and takes care to " -"deallocate `T` when the last reference is dropped," -msgstr "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html), `T`์— ๋Œ€ํ•œ ์•„" -"ํ† ๋ฏน ์ฐธ์กฐ ์นด์šดํŠธ: ์ด ์ฐธ์กฐ๋Š” ๋‹ค์ˆ˜์˜ ์Šค๋ ˆ๋“œ ์‚ฌ์ด์—์„œ ๊ณต์œ ๋  ์ˆ˜ ์žˆ๊ณ , ์ฐธ์กฐํ•˜๋˜ " -"๋งˆ์ง€๋ง‰ ์Šค๋ ˆ๋“œ๊ฐ€ ์ข…๋ฃŒํ•  ๊ฒฝ์šฐ `T`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state.md:8 -msgid "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html): ensures " -"mutually exclusive access to the `T` value." -msgstr "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html): `T`๊ฐ’์— " -"๋Œ€ํ•œ ์ƒํ˜ธ ๋ฐฐ์ œ ์—‘์„ธ์Šค๋ฅผ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:1 -msgid "`Arc`" -msgstr "`Arc`" - -#: src/concurrency/shared_state/arc.md:3 -msgid "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html) allows shared " -"read-only access via its `clone` method:" -msgstr "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html)์˜ `clone` ๋ฉ”์„œ" -"๋“œ๋ฅผ ์ด์šฉํ•˜๋ฉด ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๊ฐ€ ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋™์‹œ์— (_์—ญ์ฃผ_: ๊ทธ๋ฆฌ๊ณ  ์•ˆ์ „ํ•˜๊ฒŒ. ์Šค๋ ˆ" -"๋“œ๊ฐ€ ํ•˜๋‚˜๋ผ๋„ ์‚ด์•„์žˆ๋Š” ๋™์•ˆ์—๋Š” `T`๊ฐ€ ๋ฐ˜ํ™˜๋˜์ง€ ์•Š์Œ) ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/shared_state/arc.md:5 -msgid "" -"```rust,editable\n" -"use std::thread;\n" -"use std::sync::Arc;\n" -"\n" -"fn main() {\n" -" let v = Arc::new(vec![10, 20, 30]);\n" -" let mut handles = Vec::new();\n" -" for _ in 1..5 {\n" -" let v = v.clone();\n" -" handles.push(thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" println!(\"{thread_id:?}: {v:?}\");\n" -" }));\n" +" // Opaque type. See https://doc.rust-lang.org/nomicon/ffi.html.\n" +" #[repr(C)]\n" +" pub struct DIR {\n" +" _data: [u8; 0],\n" +" _marker: core::marker::PhantomData<(*mut u8, core::marker::" +"PhantomPinned)>,\n" " }\n" "\n" -" handles.into_iter().for_each(|h| h.join().unwrap());\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/concurrency/shared_state/arc.md:29 -msgid "" -"`Arc` stands for \"Atomic Reference Counted\", a thread safe version of `Rc` " -"that uses atomic operations." -msgstr "" -"`Arc`๋Š” \"Atomic Reference Counted\"๋ฅผ ์˜๋ฏธํ•˜๋ฉฐ, ์Šค๋ ˆ๋“œ ์•ˆ์ •์„ฑ์„ ๋ณด์žฅํ•˜๋Š” " -"`Rc`๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:31 -msgid "" -"`Arc` implements `Clone` whether or not `T` does. It implements `Send` " -"and `Sync` iff `T` implements them both." -msgstr "" -"`T`๊ฐ€ `Clone`์„ ๊ตฌํ˜„ํ•˜๋“  ์•ˆํ•˜๋“  `Arc`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. `Send`์™€ " -"`Sync`๋Š” `T`๊ฐ€ ์ด๋“ค์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:33 -msgid "" -"`Arc::clone()` has the cost of atomic operations that get executed, but " -"after that the use of the `T` is free." -msgstr "" -"`Arc::clone()`๋Š” ์•„ํ† ๋ฏน ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ ๋•Œ ์ฝ”์ŠคํŠธ๊ฐ€ ์ข€ ์žˆ์ง€๋งŒ, ์ผ" -"๋‹จ `clone()`์ด ๋๋‚œ ํ›„ `T`๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์—๋Š” ์•„๋ฌด๋Ÿฐ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:35 -msgid "" -"Beware of reference cycles, `Arc` does not use a garbage collector to detect " -"them." -msgstr "" -"์ˆœํ™˜ ์ฐธ์กฐ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ๋Š” ์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๊ฐ€" -"๋น„์ง€ ์ปฌ๋ž™ํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:36 -msgid "`std::sync::Weak` can help." -msgstr "์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ํ”ผํ•˜๋Š”๋ฐ `std::sync::Weak`๊ฐ€ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/mutex.md:1 -msgid "`Mutex`" -msgstr "`Mutex`" - -#: src/concurrency/shared_state/mutex.md:3 -msgid "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) ensures " -"mutual exclusion _and_ allows mutable access to `T` behind a read-only " -"interface:" -msgstr "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)๋ฅผ ์ด์šฉํ•˜" -"๋ฉด ๋ถˆ๋ณ€ ์ฐธ์กฐ๋ฅผ ํ†ตํ•ด์„œ๋„ `T`์˜ ๊ฐ’์„ ์ˆ˜์ •ํ•  ์ˆ˜๊ฐ€ ์žˆ์œผ๋ฉฐ, _์ด์— ๋”ํ•ด์„œ_ ํ•œ ๋ฒˆ์— " -"ํ•œ ์Šค๋ ˆ๋“œ๋งŒ `T`์˜ ๊ฐ’์„ ์ ‘๊ทผ(์ฝ๊ฑฐ๋‚˜ ์“ฐ๊ฑฐ๋‚˜)ํ•จ์„ ๋ณด์žฅํ•ด ์ค๋‹ˆ๋‹ค:" - -#: src/concurrency/shared_state/mutex.md:6 -msgid "" -"```rust,editable\n" -"use std::sync::Mutex;\n" -"\n" -"fn main() {\n" -" let v = Mutex::new(vec![10, 20, 30]);\n" -" println!(\"v: {:?}\", v.lock().unwrap());\n" -"\n" -" {\n" -" let mut guard = v.lock().unwrap();\n" -" guard.push(40);\n" +" // Layout according to the Linux man page for readdir(3), where ino_t " +"and\n" +" // off_t are resolved according to the definitions in\n" +" // /usr/include/x86_64-linux-gnu/{sys/types.h, bits/typesizes.h}.\n" +" #[cfg(not(target_os = \"macos\"))]\n" +" #[repr(C)]\n" +" pub struct dirent {\n" +" pub d_ino: c_ulong,\n" +" pub d_off: c_long,\n" +" pub d_reclen: c_ushort,\n" +" pub d_type: c_uchar,\n" +" pub d_name: [c_char; 256],\n" " }\n" "\n" -" println!(\"v: {:?}\", v.lock().unwrap());\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::sync::Mutex;\n" -"\n" -"fn main() {\n" -" let v = Mutex::new(vec![10, 20, 30]);\n" -" println!(\"v: {:?}\", v.lock().unwrap());\n" -"\n" -" {\n" -" let mut guard = v.lock().unwrap();\n" -" guard.push(40);\n" +" // Layout according to the macOS man page for dir(5).\n" +" #[cfg(all(target_os = \"macos\"))]\n" +" #[repr(C)]\n" +" pub struct dirent {\n" +" pub d_fileno: u64,\n" +" pub d_seekoff: u64,\n" +" pub d_reclen: u16,\n" +" pub d_namlen: u16,\n" +" pub d_type: u8,\n" +" pub d_name: [c_char; 1024],\n" " }\n" "\n" -" println!(\"v: {:?}\", v.lock().unwrap());\n" -"}\n" -"```" - -#: src/concurrency/shared_state/mutex.md:22 -msgid "" -"Notice how we have a [`impl Sync for Mutex`](https://doc.rust-" -"lang.org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E) blanket " -"implementation." -msgstr "" -"๋ชจ๋“  `Mutex`๋Š” [`impl Sync for Mutex`](https://doc.rust-lang." -"org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E)๋ฅผ ์ž๋™์œผ๋กœ ๊ตฌํ˜„ํ•จ" -"์„ ์ฐธ์กฐํ•˜์„ธ์š”." - -#: src/concurrency/shared_state/mutex.md:31 -msgid "" -"`Mutex` in Rust looks like a collection with just one element - the " -"protected data." -msgstr "" -"๋Ÿฌ์ŠคํŠธ์˜ `Mutex`๋Š” ์˜ค์ง ํ•˜๋‚˜์˜ ๋ฐ์ดํ„ฐ๋งŒ ๋‹ด์„ ์ˆ˜ ์žˆ๋Š” ์ปฌ๋ ‰์…˜์ฒ˜๋Ÿผ ๋ณผ ์ˆ˜๋„ ์žˆ์Šต" -"๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์ปฌ๋ ‰์…˜๊ณผ ๋‹ค๋ฅธ ์ ์€, ๊ทธ ๋ฐ์ดํ„ฐ๊ฐ€ ๋™์‹œ์„ฑ ๋ฌธ์ œ๋กœ๋ถ€ํ„ฐ ์ž์œ ๋กญ๋‹ค๋Š” ์ ์ž…" -"๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/mutex.md:32 -msgid "" -"It is not possible to forget to acquire the mutex before accessing the " -"protected data." -msgstr "" -"`Mutex`๋Š” ๋ฎคํ…์Šค๋ฅผ ํš๋“ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ณดํ˜ธ๋œ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅ ํ•˜๋„" -"๋ก ๋””์ž์ธ ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/mutex.md:33 -msgid "" -"You can get an `&mut T` from an `&Mutex` by taking the lock. The " -"`MutexGuard` ensures that the `&mut T` doesn't outlive the lock being held." -msgstr "" -"`&Mutex`์— ๋Œ€ํ•ด lock์„ ํš๋“ํ•˜๋ฉด `&mut T`๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. `MutexGuard`" -"๋Š” `&mut T`๊ฐ€ ํš๋“ํ•œ lock๋ณด๋‹ค ์˜ค๋ž˜ ์‚ด์•„๋‚จ์ง€ ์•Š์Œ์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/mutex.md:35 -msgid "`Mutex` implements both `Send` and `Sync` iff `T` implements `Send`." -msgstr "" -"`Mutex`๋Š” ์˜ค์ง `T`๊ฐ€ `Send`๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ `Send`์™€ `Sync`๋ฅผ ๊ตฌํ˜„ํ•ฉ๋‹ˆ" -"๋‹ค." - -#: src/concurrency/shared_state/mutex.md:36 -msgid "A read-write lock counterpart - `RwLock`." -msgstr "์ฝ๊ธฐ-์“ฐ๊ธฐ lock์€ `RwLock`์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/mutex.md:37 -msgid "Why does `lock()` return a `Result`? " -msgstr "์™œ `lock()`์ด `Result`๋ฅผ ๋ฐ˜ํ™˜ํ• ๊นŒ์š”?" - -#: src/concurrency/shared_state/mutex.md:38 -msgid "" -"If the thread that held the `Mutex` panicked, the `Mutex` becomes " -"\"poisoned\" to signal that the data it protected might be in an " -"inconsistent state. Calling `lock()` on a poisoned mutex fails with a " -"[`PoisonError`](https://doc.rust-lang.org/std/sync/struct.PoisonError.html). " -"You can call `into_inner()` on the error to recover the data regardless." -msgstr "" -"`Mutex`๋ฅผ ํš๋“ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ํŒจ๋‹‰์ด ๋ฐœ์ƒํ•˜๋ฉด, ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ์ƒํ™ฉ์ด " -"๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ `Mutex`๊ฐ€ \"์ค‘๋…(poisoned)\" ๋˜์—ˆ๋‹ค๊ณ  ํ‘œํ˜„ํ•˜๋ฉฐ, ์ค‘๋…๋œ " -"๋ฎคํ…์Šค์—์„œ `lock()`์„ ํ˜ธ์ถœํ•˜๋ฉด ์‹คํŒจํ•˜๊ณ  [`PoisonError`](https://doc.rust-" -"lang.org/std/sync/struct.PoisonError.html)๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋กœ๋ถ€ํ„ฐ ๋ฐ" -"์ดํ„ฐ๋ฅผ ๋ณต๊ตฌํ•˜๊ธฐ ์œ„ํ•ด `into_inner()`๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/example.md:3 -msgid "Let us see `Arc` and `Mutex` in action:" -msgstr "`Arc`์™€ `Mutex`์˜ ๋™์ž‘์„ ์‚ดํŽด๋ด…์‹œ๋‹ค:" - -#: src/concurrency/shared_state/example.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"use std::thread;\n" -"// use std::sync::{Arc, Mutex};\n" +" extern \"C\" {\n" +" pub fn opendir(s: *const c_char) -> *mut DIR;\n" "\n" -"fn main() {\n" -" let mut v = vec![10, 20, 30];\n" -" let handle = thread::spawn(|| {\n" -" v.push(10);\n" -" });\n" -" v.push(1000);\n" +" #[cfg(not(all(target_os = \"macos\", target_arch = \"x86_64\")))]\n" +" pub fn readdir(s: *mut DIR) -> *const dirent;\n" "\n" -" handle.join().unwrap();\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/concurrency/shared_state/example.md:23 -msgid "Possible solution:" -msgstr "๊ฐ€๋Šฅํ•œ ํ•ด๊ฒฐ์ฑ…:" - -#: src/concurrency/shared_state/example.md:25 -msgid "" -"```rust,editable\n" -"use std::sync::{Arc, Mutex};\n" -"use std::thread;\n" +" // See https://github.com/rust-lang/libc/issues/414 and the section " +"on\n" +" // _DARWIN_FEATURE_64_BIT_INODE in the macOS man page for stat(2).\n" +" //\n" +" // \"Platforms that existed before these updates were available\" " +"refers\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and " +"PowerPC.\n" +" #[cfg(all(target_os = \"macos\", target_arch = \"x86_64\"))]\n" +" #[link_name = \"readdir$INODE64\"]\n" +" pub fn readdir(s: *mut DIR) -> *const dirent;\n" "\n" -"fn main() {\n" -" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" -"\n" -" let v2 = v.clone();\n" -" let handle = thread::spawn(move || {\n" -" let mut v2 = v2.lock().unwrap();\n" -" v2.push(10);\n" -" });\n" -"\n" -" {\n" -" let mut v = v.lock().unwrap();\n" -" v.push(1000);\n" -" }\n" -"\n" -" handle.join().unwrap();\n" -"\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" -msgstr "" - -#: src/concurrency/shared_state/example.md:49 -msgid "Notable parts:" -msgstr "๋ˆˆ์—ฌ๊ฒจ ๋ณผ ๋ถ€๋ถ„:" - -#: src/concurrency/shared_state/example.md:51 -msgid "" -"`v` is wrapped in both `Arc` and `Mutex`, because their concerns are " -"orthogonal." -msgstr "" -"`v`๋Š” `Arc`์™€ `Mutex` ๋ชจ๋‘์— ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” `Arc`์™€ `Mutex`๊ฐ€ ์„œ๋กœ " -"์™„์ „ํžˆ ๋‹ค๋ฅธ ๋ฌธ์ œ๋ฅผ ์œ„ํ•œ ๋„๊ตฌ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/example.md:52 -msgid "" -"Wrapping a `Mutex` in an `Arc` is a common pattern to share mutable state " -"between threads." -msgstr "" -"`Mutex`๋ฅผ `Arc`๋กœ ๋ž˜ํ•‘ํ•˜๋Š” ๊ฒƒ์€ ๊ฐ€๋ณ€ ์ƒํƒœ๋ฅผ ์Šค๋ ˆ๋“œ๋“ค ๊ฐ„์— ๊ณต์œ ํ•  ๋•Œ ํ”ํžˆ ์‚ฌ์šฉ" -"ํ•˜๋Š” ํŒจํ„ด์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/example.md:53 -msgid "" -"`v: Arc<_>` needs to be cloned as `v2` before it can be moved into another " -"thread. Note `move` was added to the lambda signature." -msgstr "" -"`v: Arc<_>`๋ฅผ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด, ๋จผ์ € `v2`๋กœ ๋ณต์‚ฌ๋ฅผ ํ•˜๊ณ  ์ด๋ฅผ ๊ทธ ์Šค" -"๋ ˆ๋“œ๋กœ ์ด๋™ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋žŒ๋‹ค์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜์— `move`๊ฐ€ ์žˆ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/example.md:54 -msgid "" -"Blocks are introduced to narrow the scope of the `LockGuard` as much as " -"possible." -msgstr "๋ธ”๋ก์€ `LockGuard`์˜ ๋ฒ”์œ„๋ฅผ ์ตœ๋Œ€ํ•œ ์ขํžˆ๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync.md:1 -msgid "`Send` and `Sync`" -msgstr "`Send`์™€ `Sync`" - -#: src/concurrency/send-sync.md:3 -msgid "" -"How does Rust know to forbid shared access across thread? The answer is in " -"two traits:" -msgstr "" -"๋Ÿฌ์ŠคํŠธ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด์„œ ์Šค๋ ˆ๋“œ ๊ฐ„์— ํŠน์ • ๋ฐ์ดํ„ฐ ํƒ€์ž…์ด ๊ณต์œ ๋  ์ˆ˜ ์žˆ๊ฑฐ๋‚˜, ์•ˆ๋œ๋‹ค" -"๋Š” ๊ฒƒ์„ ์•Œ๊นŒ์š”? ์ •๋‹ต์€ ๋‹ค์Œ ๋‘ ํŠธ๋ ˆ์ž‡์— ์žˆ์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync.md:5 -msgid "" -"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): a type `T` " -"is `Send` if it is safe to move a `T` across a thread boundary." -msgstr "" -"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): `T`๊ฐ€ ์Šค๋ ˆ๋“œ " -"๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, `T`์˜ ํƒ€์ž…์€ `Send`์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync.md:7 -msgid "" -"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): a type `T` " -"is `Sync` if it is safe to move a `&T` across a thread boundary." -msgstr "" -"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): `&T`๊ฐ€ ์Šค๋ ˆ" -"๋“œ ๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, `&T`์˜ ํƒ€์ž…์€ `Sync`์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync.md:10 -msgid "" -"`Send` and `Sync` are [unsafe traits](../unsafe/unsafe-traits.md). The " -"compiler will automatically derive them for your types as long as they only " -"contain `Send` and `Sync` types. You can also implement them manually when " -"you know it is valid." -msgstr "" -"`Send`์™€ `Sync` ํŠธ๋ ˆ์ž‡์€ [์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํŠธ๋ ˆ์ž‡](../unsafe/unsafe-traits.md)์ž…" -"๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ํƒ€์ž…์˜ ์š”์†Œ๋“ค์ด ๋ชจ๋‘ `Send`์™€ `Sync` ํƒ€์ž…์ด๋ฉด ์ž๋™์œผ๋กœ ์ด ํŠธ" -"๋ ˆ์ž‡๋“ค์„ ์ ์šฉ์‹œ์ผœ ์ค๋‹ˆ๋‹ค. ๋ฌผ๋ก  ์—ฌ๋Ÿฌ๋ถ„ ์Šค์Šค๋กœ ๋งž๋‹ค๊ณ  ์•Œ๊ณ  ์žˆ๋‹ค๋ฉด ์ง์ ‘ ๊ตฌํ˜„ํ•ด" -"๋„ ๋ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync.md:20 -msgid "" -"One can think of these traits as markers that the type has certain thread-" -"safety properties." -msgstr "" -"`Sync`์™€ `Send`๋Š” ์–ด๋–ค ํƒ€์ž…์ด ํŠน์ •ํ•œ ์Šค๋ ˆ๋“œ-์•ˆ์ „ ์†์„ฑ์„ ๊ฐ€์ง์„ ๋‚˜ํƒ€๋‚ด๋Š” ๋งˆ์ปค" -"๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync.md:21 -msgid "They can be used in the generic constraints as normal traits." -msgstr "" -"์ด ๋‘ ํŠธ๋ ˆ์ดํŠธ๋Š” ์ œ๋„ˆ๋ฆญ์—์„œ ์ œ์•ฝ ์กฐ๊ฑด์„ ๋‚˜ํƒ€๋‚ด๋Š” ํŠธ๋ ˆ์ดํŠธ๋กœ ์‚ฌ์šฉ๋  ์ˆ˜๋„ ์žˆ์Šต" -"๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/send.md:1 -msgid "`Send`" -msgstr "`Send`" - -#: src/concurrency/send-sync/send.md:3 -msgid "" -"A type `T` is [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html) " -"if it is safe to move a `T` value to another thread." -msgstr "" -"`T`๊ฐ€ ์Šค๋ ˆ๋“œ ๊ฐ„์— ์•ˆ์ „ํ•˜๊ฒŒ ์ด๋™๋  ์ˆ˜ ์žˆ๋‹ค๋ฉด, `T`์˜ ํƒ€์ž…์€ `Send`์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/send.md:5 -msgid "" -"The effect of moving ownership to another thread is that _destructors_ will " -"run in that thread. So the question is when you can allocate a value in one " -"thread and deallocate it in another." -msgstr "" -"์†Œ์œ ๊ถŒ์„ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™ํ•˜๋ฉด ์†Œ๋ฉธ์ž๊ฐ€ ํ•ด๋‹น ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ " -"์˜๋ฌธ์€ \"์–ธ์ œ ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ๊ฐ’์„ ํ• ๋‹นํ•˜๊ณ  ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—์„œ ๊ฐ’์„ ํ• ๋‹น ํ•ด์ œํ•  " -"์ˆ˜ ์žˆ๋Š”๊ฐ€\" ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/sync.md:1 -msgid "`Sync`" -msgstr "`Sync`" - -#: src/concurrency/send-sync/sync.md:3 -msgid "" -"A type `T` is [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) " -"if it is safe to access a `T` value from multiple threads at the same time." -msgstr "" -"`&T`๊ฐ€ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์—์„œ ์•ˆ์ „ํ•˜๊ฒŒ ์ ‘๊ทผ๋  ์ˆ˜ ์žˆ๋‹ค๋ฉด, `&T`์˜ ํƒ€์ž…์€ `Sync`์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/sync.md:6 -msgid "More precisely, the definition is:" -msgstr "์ข€ ๋” ์ •ํ™•ํ•œ ์ •์˜๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync/sync.md:8 -msgid "`T` is `Sync` if and only if `&T` is `Send`" -msgstr "`&T`๊ฐ€ `Send`์ธ ๊ฒฝ์šฐ์—๋งŒ `T`์˜ ํƒ€์ž…์ด `Sync`๊ฐ€ ๋ฉ๋‹ˆ๋‹ค" - -#: src/concurrency/send-sync/sync.md:14 -msgid "" -"This statement is essentially a shorthand way of saying that if a type is " -"thread-safe for shared use, it is also thread-safe to pass references of it " -"across threads." -msgstr "" -"์œ„ ๋ฌธ์žฅ์„ ํ’€์–ด์„œ ์ด์•ผ๊ธฐ ํ•˜๋ฉด, ์–ด๋–ค ํƒ€์ž…์ด ์Šค๋ ˆ๋“œ ๊ฐ„์— ๊ณต์œ ๋˜์–ด์„œ ์‚ฌ์šฉ๋˜๊ธฐ์— " -"์•ˆ์ „ํ•˜๋‹ค๋ฉด ๊ทธ ํƒ€์ž…์˜ ์ฐธ์กฐ ํƒ€์ž…์€ ์Šค๋ ˆ๋“œ ๊ฐ„์— ์ด๋™ ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/sync.md:16 -msgid "" -"This is because if a type is Sync it means that it can be shared across " -"multiple threads without the risk of data races or other synchronization " -"issues, so it is safe to move it to another thread. A reference to the type " -"is also safe to move to another thread, because the data it references can " -"be accessed from any thread safely." -msgstr "" -"์ด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฆ๋ช…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: ์–ด๋–ค ํƒ€์ž…์ด `Sync`๋ผ๋Š” ๋ง์€ ๊ณง ๊ทธ ํƒ€์ž…" -"์ด ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๋“ค ์‚ฌ์ด์—์„œ ๋ฐ์ดํ„ฐ ๋ ˆ์ด์Šค๋‚˜ ์—ฌํƒ€ ๋™๊ธฐํ™” ๋ฌธ์ œ ์—†์ด ๊ณต์œ  ๊ฐ€๋Šฅํ•˜๋‹ค" -"๋Š” ๋ง์ž…๋‹ˆ๋‹ค. ์Šค๋ ˆ๋“œ ๊ฐ„ ๊ณต์œ ๊ฐ€ ์•ˆ์ „ํ•˜๋‹ค๋ฉด, ์Šค๋ ˆ๋“œ๊ฐ„ ์ด๋™๋„ ์•ˆ์ „ํ•  ์ˆ˜ ๋ฐ–์— ์—†์Šต" -"๋‹ˆ๋‹ค. ์–ด๋–ค ํƒ€์ž…์˜ ์Šค๋ ˆ๋“œ๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, ๊ทธ ํƒ€์ž…์˜ ์ฐธ์กฐ ๋˜ํ•œ ์Šค๋ ˆ๋“œ๊ฐ„ ์ด" -"๋™์ด ์•ˆ์ „ํ•  ์ˆ˜ ๋ฐ–์— ์—†์Šต๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/examples.md:3 -msgid "`Send + Sync`" -msgstr "`Send + Sync`" - -#: src/concurrency/send-sync/examples.md:5 -msgid "Most types you come across are `Send + Sync`:" -msgstr "์—ฌ๋Ÿฌ๋ถ„์ด ๋‹ค๋ฃจ๊ฒŒ ๋  ๋Œ€๋ถ€๋ถ„์˜ ํƒ€์ž…์€ `Send + Sync`์ž…๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync/examples.md:7 -msgid "`i8`, `f32`, `bool`, `char`, `&str`, ..." -msgstr "`i8`, `f32`, `bool`, `char`, `&str`, ..." - -#: src/concurrency/send-sync/examples.md:8 -msgid "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." -msgstr "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." - -#: src/concurrency/send-sync/examples.md:9 -msgid "`String`, `Option`, `Vec`, `Box`, ..." -msgstr "`String`, `Option`, `Vec`, `Box`, ..." - -#: src/concurrency/send-sync/examples.md:10 -msgid "`Arc`: Explicitly thread-safe via atomic reference count." -msgstr "`Arc`: ์ฐธ์กฐ ์นด์šดํŠธ ์กฐ์ž‘์„ ์•„ํ† ๋ฏน ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•จ." - -#: src/concurrency/send-sync/examples.md:11 -msgid "`Mutex`: Explicitly thread-safe via internal locking." -msgstr "" -"`Mutex`: ๊ฐ’์„ ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด ๋ฎคํƒ์Šค๋ฅผ ์ž ๊ถˆ์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•จ." - -#: src/concurrency/send-sync/examples.md:12 -msgid "`AtomicBool`, `AtomicU8`, ...: Uses special atomic instructions." -msgstr "" -"`AtomicBool`, `AtomicU8`, ...: ๊ฐ’์„ ์ ‘๊ทผํ•  ๋•Œ ํŠน๋ณ„ํ•œ ์•„ํ† ๋ฏน ๋ช…๋ น์–ด๋“ค์„ ์‚ฌ์šฉํ•ฉ" -"๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/examples.md:14 -msgid "" -"The generic types are typically `Send + Sync` when the type parameters are " -"`Send + Sync`." -msgstr "" -"์ œ๋„ค๋ฆญ ํƒ€์ž…์€ ์ผ๋ฐ˜์ ์œผ๋กœ ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๊ฐ€ `Send + Sync`์ด๋ฉด `Send + Sync` ์ž…๋‹ˆ" -"๋‹ค." - -#: src/concurrency/send-sync/examples.md:17 -msgid "`Send + !Sync`" -msgstr "`Send + !Sync`" - -#: src/concurrency/send-sync/examples.md:19 -msgid "" -"These types can be moved to other threads, but they're not thread-safe. " -"Typically because of interior mutability:" -msgstr "" -"์•„๋ž˜ ํƒ€์ž…๋“ค์€ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜ ์žˆ์ง€๋งŒ ๋‚ด๋ถ€์ ์œผ๋กœ ๊ฐ’์ด ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๊ธฐ " -"๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync/examples.md:22 -msgid "`mpsc::Sender`" -msgstr "`mpsc::Sender`" - -#: src/concurrency/send-sync/examples.md:23 -msgid "`mpsc::Receiver`" -msgstr "`mpsc::Receiver`" - -#: src/concurrency/send-sync/examples.md:24 -msgid "`Cell`" -msgstr "`Cell`" - -#: src/concurrency/send-sync/examples.md:25 -msgid "`RefCell`" -msgstr "`RefCell`" - -#: src/concurrency/send-sync/examples.md:27 -msgid "`!Send + Sync`" -msgstr "`!Send + Sync`" - -#: src/concurrency/send-sync/examples.md:29 -msgid "" -"These types are thread-safe, but they cannot be moved to another thread:" -msgstr "์•„๋ž˜ ํƒ€์ž…๋“ค์€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€๋งŒ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync/examples.md:31 -msgid "" -"`MutexGuard`: Uses OS level primitives which must be deallocated on the " -"thread which created them." -msgstr "" -"`MutexGuard`: ๋‚ด๋ถ€์ ์œผ๋กœ, ์šด์˜์ฒด์ œ๊ฐ€ ์ œ๊ณตํ•˜๋Š” primitive๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๋ฐ, ์ด " -"primitive๋Š” ์ƒ์„ฑ๋œ ์Šค๋ ˆ๋“œ์—์„œ ํ•ด์ œ๊ฐ€ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•ฉ๋‹ˆ๋‹ค. (_์—ญ์ฃผ_: ๊ทธ๋ž˜์„œ ๋‹ค๋ฅธ " -"์Šค๋ ˆ๋“œ๋กœ ์˜ฎ๊ธธ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.)" - -#: src/concurrency/send-sync/examples.md:34 -msgid "`!Send + !Sync`" -msgstr "`!Send + !Sync`" - -#: src/concurrency/send-sync/examples.md:36 -msgid "These types are not thread-safe and cannot be moved to other threads:" -msgstr "" -"์•„๋ž˜ ํƒ€์ž…๋“ค์€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€๋„ ์•Š๊ณ  ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜๋„ ์—†์Šต๋‹ˆ๋‹ค:" - -#: src/concurrency/send-sync/examples.md:38 -msgid "" -"`Rc`: each `Rc` has a reference to an `RcBox`, which contains a non-" -"atomic reference count." -msgstr "" -"`Rc`: `Rc` ๋Š” ์•„ํ† ๋ฏนํ•˜์ง€ ์•Š์€ ๋ฐฉ์‹์œผ๋กœ ์ฐธ์กฐ ์นด์šดํŠธ๋ฅผ ์กฐ์ž‘ํ•˜๋Š” " -"`RcBox`๋ฅผ ์ฐธ์กฐํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/examples.md:40 -msgid "" -"`*const T`, `*mut T`: Rust assumes raw pointers may have special concurrency " -"considerations." -msgstr "" -"`*const T`, `*mut T`: ๋Ÿฌ์ŠคํŠธ๋Š” ํฌ์ธํ„ฐ๊ฐ€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€ ์•Š๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/send-sync/send.md:13 -msgid "" -"As an example, a connection to the SQLite library must only be accessed from " -"a single thread." -msgstr "" -"์˜ˆ๋ฅผ ๋“ค์–ด SQLite ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—ฐ๊ฒฐ์€ ๋‹จ์ผ ์Šค๋ ˆ๋“œ์—์„œ๋งŒ ์•ก์„ธ์Šคํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." - -#: src/concurrency/shared_state/arc.md:5 -msgid "" -"```rust,editable\n" -"use std::thread;\n" -"use std::sync::Arc;\n" -"\n" -"fn main() {\n" -" let v = Arc::new(vec![10, 20, 30]);\n" -" let mut handles = Vec::new();\n" -" for _ in 1..5 {\n" -" let v = Arc::clone(&v);\n" -" handles.push(thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" println!(\"{thread_id:?}: {v:?}\");\n" -" }));\n" -" }\n" -"\n" -" handles.into_iter().for_each(|h| h.join().unwrap());\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::thread;\n" -"use std::sync::Arc;\n" -"\n" -"fn main() {\n" -" let v = Arc::new(vec![10, 20, 30]);\n" -" let mut handles = Vec::new();\n" -" for _ in 1..5 {\n" -" let v = Arc::clone(&v);\n" -" handles.push(thread::spawn(move || {\n" -" let thread_id = thread::current().id();\n" -" println!(\"{thread_id:?}: {v:?}\");\n" -" }));\n" -" }\n" -"\n" -" handles.into_iter().for_each(|h| h.join().unwrap());\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" - -#: src/concurrency/shared_state/example.md:25 -msgid "" -"```rust,editable\n" -"use std::sync::{Arc, Mutex};\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" -"\n" -" let v2 = Arc::clone(&v);\n" -" let handle = thread::spawn(move || {\n" -" let mut v2 = v2.lock().unwrap();\n" -" v2.push(10);\n" -" });\n" -"\n" -" {\n" -" let mut v = v.lock().unwrap();\n" -" v.push(1000);\n" -" }\n" -"\n" -" handle.join().unwrap();\n" -"\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"use std::sync::{Arc, Mutex};\n" -"use std::thread;\n" -"\n" -"fn main() {\n" -" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" -"\n" -" let v2 = Arc::clone(&v);\n" -" let handle = thread::spawn(move || {\n" -" let mut v2 = v2.lock().unwrap();\n" -" v2.push(10);\n" -" });\n" -"\n" -" {\n" -" let mut v = v.lock().unwrap();\n" -" v.push(1000);\n" -" }\n" -"\n" -" handle.join().unwrap();\n" -"\n" -" println!(\"v: {v:?}\");\n" -"}\n" -"```" - -#: src/async.md:3 -msgid "" -"\"Async\" is a concurrency model where multiple tasks are executed " -"concurrently by executing each task until it would block, then switching to " -"another task that is ready to make progress. The model allows running a " -"larger number of tasks on a limited number of threads. This is because the " -"per-task overhead is typically very low and operating systems provide " -"primitives for efficiently identifying I/O that is able to proceed." -msgstr "" -"\"Async\"๋Š” ๋ธ”๋Ÿญ๋ (๋” ์ด์ƒ ์ง„ํ–‰ํ•  ์ˆ˜ ์—†์„) ๋•Œ๊นŒ์ง€ ๊ฐ ์ž‘์—…์„ ์‹คํ–‰ํ•œ ๋‹ค์Œ ์ง„ํ–‰" -"ํ•  ์ค€๋น„๊ฐ€ ๋œ ๋‹ค๋ฅธ ์ž‘์—…์œผ๋กœ ์ „ํ™˜ํ•˜์—ฌ ์—ฌ๋Ÿฌ ์ž‘์—…์„ ๋™์‹œ์— ์‹คํ–‰ํ•˜๋Š” ๋™์‹œ ์‹คํ–‰ ๋ชจ" -"๋ธ์ž…๋‹ˆ๋‹ค. ์ด ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ œํ•œ๋œ ์ˆ˜์˜ ์Šค๋ ˆ๋“œ์—์„œ ๋” ๋งŽ์€ ์ž‘์—…์„ ์‹คํ–‰ํ•  ์ˆ˜ " -"์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š”, ํ•œ ์ž‘์—…์„ ์œ ์ง€ํ•˜๊ณ  ์ˆ˜ํ–‰ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ (์Šค๋ ˆ๋“œ์— ๋น„" -"ํ•ด) ๋งค์šฐ ๋‚ฎ๊ณ  ์šด์˜์ฒด์ œ๊ฐ€ ์—ฌ๋Ÿฌ I/O๋“ค์—์„œ ํ˜„์žฌ ์ง„ํ–‰ ๊ฐ€๋Šฅํ•œ I/O๋“ค์„ ํšจ๊ณผ์ ์œผ๋กœ " -"์‹๋ณ„ํ•ด ์ฃผ๋Š” ํ”„๋ฆฌ๋ฏธํ‹ฐ๋ธŒ๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/async.md:10 -msgid "" -"Rust's asynchronous operation is based on \"futures\", which represent work " -"that may be completed in the future. Futures are \"polled\" until they " -"signal that they are complete." -msgstr "" -"Rust์˜ ๋น„๋™๊ธฐ ์ž‘์—…์€ \"futures\"๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋ฉฐ ์ด๋Š” ๋ฏธ๋ž˜์— ์™„๋ฃŒ๋  ์ˆ˜ ์žˆ๋Š” " -"์ž‘์—…์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Futures๋Š” ์™„๋ฃŒ๋˜์—ˆ๋‹ค๋Š” ์‹ ํ˜ธ๋ฅผ ๋ณด๋‚ผ ๋•Œ๊นŒ์ง€ \"ํด๋ง\"๋ฉ๋‹ˆ๋‹ค." - -#: src/async.md:14 -msgid "" -"Futures are polled by an async runtime, and several different runtimes are " -"available." -msgstr "" -"Futures๋Š” ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์— ์˜ํ•ด ํด๋ง๋˜๋ฉฐ, ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์—๋Š” ์—ฌ๋Ÿฌ ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜" -"๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async.md:19 -msgid "" -"Python has a similar model in its `asyncio`. However, its `Future` type is " -"callback-based, and not polled. Async Python programs require a \"loop\", " -"similar to a runtime in Rust." -msgstr "" -"ํŒŒ์ด์ฌ์—๋„ `asyncio`๋ผ๋Š” ์œ ์‚ฌํ•œ ๋ชจ๋ธ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ํŒŒ์ด์ฌ์˜ `Future` ํƒ€" -"์ž…์€ ์ฝœ๋ฐฑ ๊ธฐ๋ฐ˜์ด๋ฉฐ ํด๋ง๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํŒŒ์ด์ฌ์œผ๋กœ ๋น„๋™๊ธฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ•  ๋•Œ์—" -"๋Š”, Rust์—์„œ ๋Ÿฐํƒ€์ž„์ด ๋‚ด๋ถ€์ ์œผ๋กœ ํ•ด ์ฃผ๋Š” ๊ฒƒ๊ณผ ์œ ์‚ฌํ•œ, \"๋ฃจํ”„\"๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ " -"์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." - -#: src/async.md:23 -msgid "" -"JavaScript's `Promise` is similar, but again callback-based. The language " -"runtime implements the event loop, so many of the details of Promise " -"resolution are hidden." -msgstr "" -"์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ `Promise`๋„ ๋น„์Šทํ•˜์ง€๋งŒ ์—ญ์‹œ ์ฝœ๋ฐฑ ๊ธฐ๋ฐ˜์ž…๋‹ˆ๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ" -"๋Š” ์ด๋ฒคํŠธ ๋ฃจํ”„๊ฐ€๋Ÿฐํƒ€์ž„ ์—”์ง„์—์„œ ๊ตฌํ˜„๋˜๋ฏ€๋กœ `Promise`๊ฐ€ ์ฒ˜๋ฆฌ๋˜๋Š” ์„ธ๋ถ€ ๊ณผ์ •์ด " -"์ˆจ๊ฒจ์ง‘๋‹ˆ๋‹ค." - -#: src/async/async-await.md:1 -msgid "`async`/`await`" -msgstr "`async`/`await`" - -#: src/async/async-await.md:3 -msgid "" -"At a high level, async Rust code looks very much like \"normal\" sequential " -"code:" -msgstr "" -"๊ฒ‰์—์„œ ๋ณด์•˜์„ ๋•Œ, ๋น„๋™๊ธฐ Rust ์ฝ”๋“œ๋Š” ์ผ๋ฐ˜์ ์ธ ์ ˆ์ฐจ์  ์ฝ”๋“œ์™€ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/async-await.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"use futures::executor::block_on;\n" -"\n" -"async fn count_to(count: i32) {\n" -" for i in 1..=count {\n" -" println!(\"Count is: {i}!\");\n" +" pub fn closedir(s: *mut DIR) -> c_int;\n" " }\n" "}\n" "\n" -"async fn async_main(count: i32) {\n" -" count_to(count).await;\n" -"}\n" +"use std::ffi::{CStr, CString, OsStr, OsString};\n" +"use std::os::unix::ffi::OsStrExt;\n" "\n" -"fn main() {\n" -" block_on(async_main(10));\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use futures::executor::block_on;\n" -"\n" -"async fn count_to(count: i32) {\n" -" for i in 1..=count {\n" -" println!(\"Count is: {i}!\");\n" -" }\n" -"}\n" -"\n" -"async fn async_main(count: i32) {\n" -" count_to(count).await;\n" -"}\n" -"\n" -"fn main() {\n" -" block_on(async_main(10));\n" -"}\n" -"```" - -#: src/async/async-await.md:27 -msgid "" -"Note that this is a simplified example to show the syntax. There is no long " -"running operation or any real concurrency in it!" -msgstr "" -"Rust ๋น„๋™๊ธฐ ๋ฌธ๋ฒ•์„ ๋ณด์—ฌ์ฃผ๋Š” ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” ์˜ค๋ž˜ ์‹คํ–‰๋˜๋Š” ์ž‘์—…์ด" -"๋‚˜, ์‹ค์ œ๋กœ ๋™์‹œ์— ์ˆ˜ํ–‰๋˜๋Š” ๊ฒƒ๋“ค์€ ์—†์Šต๋‹ˆ๋‹ค." - -#: src/async/async-await.md:30 -msgid "What is the return type of an async call?" -msgstr "`async`ํ•จ์ˆ˜์˜ ๋ฆฌํ„ด ํƒ€์ž…์€ ๋ฌด์—‡์ธ๊ฐ€์š”?" - -#: src/async/async-await.md:31 -msgid "Use `let future: () = async_main(10);` in `main` to see the type." -msgstr "" -"`main`์—์„œ \\`let future: () = async_main(10);์„ ์‚ฌ์šฉํ•˜์—ฌ ํƒ€์ž…์„ ํ™•์ธํ•˜์„ธ์š”." - -#: src/async/async-await.md:33 -msgid "" -"The \"async\" keyword is syntactic sugar. The compiler replaces the return " -"type with a future. " -msgstr "" -"\"async\" ํ‚ค์›Œ๋“œ๋Š” ๋ฌธ๋ฒ• ์„คํƒ•(syntactic sugar)์ž…๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๋ฆฌํ„ด ํƒ€์ž…์„ " -"future๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค. " - -#: src/async/async-await.md:36 -msgid "" -"You cannot make `main` async, without additional instructions to the " -"compiler on how to use the returned future." -msgstr "" -"`main`์„ ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋กœ ๋งŒ๋“ค์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๊ทธ๋ ‡๊ฒŒ ํ•  ๊ฒฝ์šฐ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ๋ฆฌ" -"ํ„ด ํƒ€์ž…์ธ future๋ฅผ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•  ์ง€ ๋ชจ๋ฅด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/async/async-await.md:39 -msgid "" -"You need an executor to run async code. `block_on` blocks the current thread " -"until the provided future has run to completion. " -msgstr "" -"๋น„๋™๊ธฐ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋ ค๋ฉด ์‹คํ–‰์ž(executor)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. `block_on` ์‹คํ–‰์ž๋Š” " -"์ œ๊ณต๋œ future๊ฐ€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ํ˜„์žฌ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กํ•ฉ๋‹ˆ๋‹ค. " - -#: src/async/async-await.md:42 -msgid "" -"`.await` asynchronously waits for the completion of another operation. " -"Unlike `block_on`, `.await` doesn't block the current thread." -msgstr "" -"`.await`๋Š” ๋‹ค๋ฅธ ์ž‘์—…์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๋น„๋™๊ธฐ์ ์œผ๋กœ ๋Œ€๊ธฐํ•ฉ๋‹ˆ๋‹ค. `block_on`๊ณผ ๋‹ฌ" -"๋ฆฌ `.await`๋Š” ํ˜„์žฌ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/async/async-await.md:45 -msgid "" -"`.await` can only be used inside an `async` function (or block; these are " -"introduced later). " -msgstr "" -"`.await`๋Š” `async` ํ•จ์ˆ˜(๋˜๋Š” ๋‚˜์ค‘์— ์†Œ๊ฐœ๋  `async` ๋ธ”๋ก) ์•ˆ์—์„œ๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ " -"์žˆ์Šต๋‹ˆ๋‹ค. " - -#: src/async/futures.md:3 -msgid "" -"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) is a " -"trait, implemented by objects that represent an operation that may not be " -"complete yet. A future can be polled, and `poll` returns a [`Poll`](https://" -"doc.rust-lang.org/std/task/enum.Poll.html)." -msgstr "" -"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html)๋Š” ํŠธ๋ ˆ์ž‡์ž…" -"๋‹ˆ๋‹ค.์ด ํŠธ๋ ˆ์ž‡์€ ์•„์ง ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์„ ์ˆ˜๋„ ์žˆ๋Š” ์ž‘์—…์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Future๋Š” " -"`poll` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ํด๋ง๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด ํ•จ์ˆ˜๋Š” [`Poll`](https://doc.rust-" -"lang.org/std/task/enum.Poll.html)์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/futures.md:8 -msgid "" -"```rust\n" -"use std::pin::Pin;\n" -"use std::task::Context;\n" -"\n" -"pub trait Future {\n" -" type Output;\n" -" fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll;\n" -"}\n" -"\n" -"pub enum Poll {\n" -" Ready(T),\n" -" Pending,\n" -"}\n" -"```" -msgstr "" -"```rust\n" -"use std::pin::Pin;\n" -"use std::task::Context;\n" -"\n" -"pub trait Future {\n" -" type Output;\n" -" fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll;\n" -"}\n" -"\n" -"pub enum Poll {\n" -" Ready(T),\n" -" Pending,\n" -"}\n" -"```" - -#: src/async/futures.md:23 -msgid "" -"An async function returns an `impl Future`. It's also possible (but " -"uncommon) to implement `Future` for your own types. For example, the " -"`JoinHandle` returned from `tokio::spawn` implements `Future` to allow " -"joining to it." -msgstr "" -"๋น„๋™๊ธฐ ํ•จ์ˆ˜๋Š” `impl Future`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ํƒ€์ž…์„ ๋งŒ๋“ค๊ณ  ์ด ํƒ€์ž…์ด " -"`Future`๋ฅผ ๊ตฌํ˜„ํ•˜๊ฒŒ ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์ผ๋ฐ˜์ ์ด์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `tokio::" -"spawn`๊ฐ€ ๋ฆฌํ„ดํ•˜๋Š” `JoinHandle`์€ `Future`๋ฅผ ๊ตฌํ˜„ํ•˜๋ฉฐ, ์ด๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ์Šค๋ ˆ๋“œ" -"์— joinํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/futures.md:27 -msgid "" -"The `.await` keyword, applied to a Future, causes the current async function " -"to pause until that Future is ready, and then evaluates to its output." -msgstr "" -"Future์— `.await`๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด, ํ•ด๋‹น Future๊ฐ€ ์ค€๋น„๋  ๋•Œ๊นŒ์ง€ ํ˜„์žฌ ๋น„๋™๊ธฐ ํ•จ์ˆ˜๊ฐ€ " -"์ผ์‹œ ์ค‘์ง€๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ Future๊ฐ€ ์ค€๋น„๊ฐ€ ๋˜๋ฉด, ๊ทธ ๊ฐ’์ด `.await` ๊ตฌ๋ฌธ์˜ ๊ฐ’" -"์ด ๋ฉ๋‹ˆ๋‹ค." - -#: src/async/futures.md:32 -msgid "" -"The `Future` and `Poll` types are implemented exactly as shown; click the " -"links to show the implementations in the docs." -msgstr "" -"`Future` ์™€ `Poll` ํƒ€์ž…์˜ ์‹ค์ œ ์ •์˜๋Š” ์œ„์— ๋ณด์ด๋Š” ๊ทธ๋Œ€๋กœ ์ž…๋‹ˆ๋‹ค. ๋งํฌ๋ฅผ ํด๋ฆญ" -"ํ•˜๋ฉด Rust ๋ฌธ์„œ์—์„œ ํ•œ ๋ฒˆ ๋” ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/futures.md:35 -msgid "" -"We will not get to `Pin` and `Context`, as we will focus on writing async " -"code, rather than building new async primitives. Briefly:" -msgstr "" -"๋ณธ ๊ฐ•์˜์˜ ๋ชฉ์ ์€ ๋น„๋™๊ธฐ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š”๋ฐ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ์ƒˆ๋กœ์šด ๋น„๋™๊ธฐ ํ”„๋ฆฌ๋ฏธํ‹ฐ" -"๋ธŒ๋ฅผ ๋งŒ๋“œ๋Š”๋ฐ ํ•„์š”ํ•œ `Pin`๊ณผ `Context`๋Š” ๋‹ค๋ฃจ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๋“ค์— ๋Œ€ํ•ด ๊ฐ„๋‹จ" -"ํžˆ ์„ค๋ช…ํ•˜์ž๋ฉด:" - -#: src/async/futures.md:38 -msgid "" -"`Context` allows a Future to schedule itself to be polled again when an " -"event occurs." -msgstr "" -"`Context`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Future๊ฐ€ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•  ๋•Œ ๋‹ค์‹œ ํด๋ง๋˜๋„๋ก ์˜ˆ์•ฝํ•  ์ˆ˜ ์žˆ" -"์Šต๋‹ˆ๋‹ค." - -#: src/async/futures.md:41 -msgid "" -"`Pin` ensures that the Future isn't moved in memory, so that pointers into " -"that future remain valid. This is required to allow references to remain " -"valid after an `.await`." -msgstr "" -"'Pin'์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ”๋ชจ๋ฆฌ์—์„œ Future์˜ ์œ„์น˜๊ฐ€ ๊ณ ์ •๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น future์˜ ํฌ" -"์ธํ„ฐ๊ฐ€ ํ•ญ์ƒ ์œ ํšจํ•˜๊ฒŒ ์œ ์ง€๋ฉ๋‹ˆ๋‹ค. ์ด๋Š” `.await` ํ›„์— ์ฐธ์กฐ๋ฅผ ์œ ํšจํ•œ ์ƒํƒœ๋กœ ์œ ์ง€" -"ํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:3 -msgid "" -"A _runtime_ provides support for performing operations asynchronously (a " -"_reactor_) and is responsible for executing futures (an _executor_). Rust " -"does not have a \"built-in\" runtime, but several options are available:" -msgstr "" -"๋น„๋™๊ธฐ _๋Ÿฐํƒ€์ž„_์€ _๋ฆฌ์•กํ„ฐ_ (๋น„๋™๊ธฐ์‹ ์ž‘์—… ์‹คํ–‰์„ ์ง€์›)์™€ _์‹คํ–‰์ž_ (futures๋ฅผ " -"์‹คํ–‰)์˜ ๋‘ ๊ฐ€์ง€ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. Rust ์–ธ์–ด ์ž์ฒด์—์„œ ๊ธฐ๋ณธ ์ œ๊ณตํ•˜๋Š” ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„" -"์€ ์—†์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„ ํฌ๋ ˆ์ž‡๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:7 -msgid "" -"[Tokio](https://tokio.rs/) - performant, with a well-developed ecosystem of " -"functionality like [Hyper](https://hyper.rs/) for HTTP or [Tonic](https://" -"github.com/hyperium/tonic) for gRPC." -msgstr "" -"[Tokio](https://tokio.rs/) - ์„ฑ๋Šฅ์ด ์šฐ์ˆ˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  HTTP๋ฅผ ์ง€์›ํ•˜๋Š” " -"[Hyper](https://hyper.rs/) ์™€ gRPC๋ฅผ ์ง€์›ํ•˜๋Š” [Tonic](https://github.com/" -"hyperium/tonic)๊ณผ ๊ฐ™์€ ์ž˜ ๋ฐœ๋‹ฌ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ƒํƒœ๊ณ„๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:10 -msgid "" -"[async-std](https://async.rs/) - aims to be a \"std for async\", and " -"includes a basic runtime in `async::task`." -msgstr "" -"[async-std](https://async.rs/) - ๋น„๋™๊ธฐ์—์„œ์˜ `std`๋ฅผ ๋ชฉํ‘œ๋กœ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. " -"`async::task`์— ๊ธฐ๋ณธ ๋Ÿฐํƒ€์ž„์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:12 -msgid "[smol](https://docs.rs/smol/latest/smol/) - simple and lightweight" -msgstr "[smol](https://docs.rs/smol/latest/smol/) - ๊ฐ„๋‹จํ•˜๊ณ  ๊ฐ€๋ณ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:14 -msgid "" -"Several larger applications have their own runtimes. For example, [Fuchsia]" -"(https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-" -"async/src/lib.rs) already has one." -msgstr "" -"์—ฌ๋Ÿฌ ๋Œ€๊ทœ๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—๋Š” ์ž์ฒด ๋Ÿฐํƒ€์ž„์ด ์žˆ๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋“ค ๋“ค์–ด " -"[Fuchsia](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/" -"fuchsia-async/src/lib.rs)๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:20 -msgid "" -"Note that of the listed runtimes, only Tokio is supported in the Rust " -"playground. The playground also does not permit any I/O, so most interesting " -"async things can't run in the playground." -msgstr "" -"Rust ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ์—์„œ๋Š” ์œ„์— ๋‚˜์—ด๋œ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„ ์ค‘์—์„œ Tokio๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ " -"์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ Rust ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ๋Š” I/O๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š์œผ๋ฏ€๋กœ async๋ฅผ ๊ฐ€์ง€๊ณ  " -"ํ•  ์ˆ˜ ์žˆ๋Š” ๋งŽ์€ ํฅ๋ฏธ๋กœ์šด ์ž‘์—…๋“ค์ด ๋ถˆ๊ฐ€๋Šฅ ํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/runtimes.md:24 -msgid "" -"Futures are \"inert\" in that they do not do anything (not even start an I/O " -"operation) unless there is an executor polling them. This differs from JS " -"Promises, for example, which will run to completion even if they are never " -"used." -msgstr "" -"Futures๋Š” ์‹คํ–‰์ž๊ฐ€ ํด๋งํ•˜์ง€ ์•Š๋Š” ํ•œ ์•„๋ฌด๊ฒƒ๋„ ํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ์ ์—์„œ(I/O ์ž‘์—…์กฐ" -"์ฐจ ์‹œ์ž‘ํ•˜์ง€ ์•Š์Œ) \"๋น„ํ™œ์„ฑ\" ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ์—๋„ ์™„๋ฃŒ๋  " -"๋•Œ ๊นŒ์ง€ ์‹คํ–‰๋˜๋Š”, ์ž๋ฐ” ์Šคํฌ๋ฆฝํŠธ์˜ promise์™€ ๋‹ค๋ฆ…๋‹ˆ๋‹ค." - -#: src/async/runtimes/tokio.md:1 src/SUMMARY.md:283 -msgid "Tokio" -msgstr "Tokio" - -#: src/async/runtimes/tokio.md:4 -msgid "Tokio provides: " -msgstr "Tokio๋Š” ๋‹ค์Œ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. " - -#: src/async/runtimes/tokio.md:6 -msgid "A multi-threaded runtime for executing asynchronous code." -msgstr "๋น„๋™๊ธฐ ์ฝ”๋“œ ์‹คํ–‰์„ ์œ„ํ•œ ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋Ÿฐํƒ€์ž„" - -#: src/async/runtimes/tokio.md:7 -msgid "An asynchronous version of the standard library." -msgstr "ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋น„๋™๊ธฐ ๋ฒ„์ „" - -#: src/async/runtimes/tokio.md:8 -msgid "A large ecosystem of libraries." -msgstr "๋Œ€๊ทœ๋ชจ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ƒํƒœ๊ณ„" - -#: src/async/runtimes/tokio.md:10 -msgid "" -"```rust,editable,compile_fail\n" -"use tokio::time;\n" -"\n" -"async fn count_to(count: i32) {\n" -" for i in 1..=count {\n" -" println!(\"Count in task: {i}!\");\n" -" time::sleep(time::Duration::from_millis(5)).await;\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" tokio::spawn(count_to(10));\n" -"\n" -" for i in 1..5 {\n" -" println!(\"Main task: {i}\");\n" -" time::sleep(time::Duration::from_millis(5)).await;\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use tokio::time;\n" -"\n" -"async fn count_to(count: i32) {\n" -" for i in 1..=count {\n" -" println!(\"Count in task: {i}!\");\n" -" time::sleep(time::Duration::from_millis(5)).await;\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" tokio::spawn(count_to(10));\n" -"\n" -" for i in 1..5 {\n" -" println!(\"Main task: {i}\");\n" -" time::sleep(time::Duration::from_millis(5)).await;\n" -" }\n" -"}\n" -"```" - -#: src/async/runtimes/tokio.md:33 -msgid "With the `tokio::main` macro we can now make `main` async." -msgstr "" -"์ด์ œ `tokio::main` ๋งคํฌ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด `main`์„ ๋น„๋™๊ธฐ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/runtimes/tokio.md:35 -msgid "The `spawn` function creates a new, concurrent \"task\"." -msgstr "`spawn` ํ•จ์ˆ˜๋Š” ๋™์‹œ ์‹คํ–‰๋˜๋Š” ์ƒˆ๋กœ์šด \"์ž‘์—…\"์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค." - -#: src/async/runtimes/tokio.md:37 -msgid "Note: `spawn` takes a `Future`, you don't call `.await` on `count_to`." -msgstr "" -"์ฐธ๊ณ : `spawn`์€ `Future`๋ฅผ ์ธ์ž๋กœ ๋ฐ›์Šต๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— `count_to`์— `.await`๋ฅผ ํ˜ธ" -"์ถœํ•˜์ง€ ์•Š๋Š” ์ ์„ ์ฃผ๋ชฉํ•˜์„ธ์š”." - -#: src/async/runtimes/tokio.md:39 -msgid "**Further exploration:**" -msgstr "**์‹ฌํ™” ํ•™์Šต:**" - -#: src/async/runtimes/tokio.md:41 -msgid "" -"Why does `count_to` not (usually) get to 10? This is an example of async " -"cancellation. `tokio::spawn` returns a handle which can be awaited to wait " -"until it finishes." -msgstr "" -"`count_to`๊ฐ€ 10์— ๋„๋‹ฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์€๋ฐ ๊ทธ ์ด์œ ๋Š” ๋ฌด์—‡์ผ๊นŒ์š”? ์ด๋Š” ๋น„๋™" -"๊ธฐ์ ์ธ ์ทจ์†Œ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์˜ˆ์ž…๋‹ˆ๋‹ค. `tokio::spawn`์ด ๋ฆฌํ„ดํ•˜๋Š” ๊ฒƒ์€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ" -"์ง€ ๊ธฐ๋‹ค๋ฆฌ๋„๋ก ๋Œ€๊ธฐํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ํ•ธ๋“ค์ž…๋‹ˆ๋‹ค." - -#: src/async/runtimes/tokio.md:45 -msgid "Try `count_to(10).await` instead of spawning." -msgstr "`tokio::spawn` ๋Œ€์‹  `count_to(10).await`๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”." - -#: src/async/runtimes/tokio.md:47 -msgid "Try awaiting the task returned from `tokio::spawn`." -msgstr "`tokio::spawn`์—์„œ ๋ฐ˜ํ™˜๋œ ์ž‘์—…์„ `await` ํ•ด ๋ณด์„ธ์š”." - -#: src/async/tasks.md:3 -msgid "Rust has a task system, which is a form of lightweight threading." -msgstr "Rust์˜ ํƒœ์Šคํฌ(์ž‘์—…) ์‹œ์Šคํ…œ์€ ๊ฒฝ๋Ÿ‰ ์Šค๋ ˆ๋”ฉ์˜ ํ•œ ์ข…๋ฅ˜๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/tasks.md:5 -msgid "" -"A task has a single top-level future which the executor polls to make " -"progress. That future may have one or more nested futures that its `poll` " -"method polls, corresponding loosely to a call stack. Concurrency within a " -"task is possible by polling multiple child futures, such as racing a timer " -"and an I/O operation." -msgstr "" -"ํ•˜๋‚˜์˜ ์ž‘์—…์—๋Š”, ์‹คํ–‰์ž๊ฐ€ ์ด ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ๊ณ„์† ํด๋งํ•˜๋Š”, ์ตœ์ƒ์œ„ " -"future๊ฐ€ ํ•œ ๊ฐœ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด future์—๋Š” `poll` ๋ฉ”์„œ๋“œ๊ฐ€ ํด๋งํ•˜๋Š” ์ค‘์ฒฉ๋œ future" -"๊ฐ€ ํ•œ ๊ฐœ ์ด์ƒ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ค‘์ฒฉ๋œ future๋Š” ์ผ๋ฐ˜์ ์ธ ํ•จ์ˆ˜ ํ˜ธ์ถœ ์Šค" -"ํƒํ•˜๊ณ  ๋น„์Šทํ•œ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ํ•œ ์ž‘์—… ์•ˆ์—์„œ ์—ฌ๋Ÿฌ ์ž์‹ future๋“ค์„ ํด๋งํ•˜๋ฉด, ํƒ€" -"์ด๋จธ๋ฅผ ์ผœ๋Š” ๊ฒƒ๊ณผ ์–ด๋–ค I/O์ž‘์—…์„ ๋™์‹œ์— ์ˆ˜ํ–‰์‹œํ‚จ ํ›„ ํƒ€์ด๋จธ์™€ I/O ์ค‘ ๋จผ์ € ๋๋‚˜" -"๋Š” ๊ฒƒ์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€๋™์‹œ์„ฑ๋„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/tasks.md:10 -msgid "" -"```rust,compile_fail\n" -"use tokio::io::{self, AsyncReadExt, AsyncWriteExt};\n" -"use tokio::net::TcpListener;\n" -"\n" -"#[tokio::main]\n" -"async fn main() -> io::Result<()> {\n" -" let listener = TcpListener::bind(\"127.0.0.1:6142\").await?;\n" -"\tprintln!(\"listening on port 6142\");\n" -"\n" -" loop {\n" -" let (mut socket, addr) = listener.accept().await?;\n" -"\n" -" println!(\"connection from {addr:?}\");\n" -"\n" -" tokio::spawn(async move {\n" -" if let Err(e) = socket.write_all(b\"Who are you?\\n\").await {\n" -" println!(\"socket error: {e:?}\");\n" -" return;\n" -" }\n" -"\n" -" let mut buf = vec![0; 1024];\n" -" let reply = match socket.read(&mut buf).await {\n" -" Ok(n) => {\n" -" let name = std::str::from_utf8(&buf[..n]).unwrap()." -"trim();\n" -" format!(\"Thanks for dialing in, {name}!\\n\")\n" -" }\n" -" Err(e) => {\n" -" println!(\"socket error: {e:?}\");\n" -" return;\n" -" }\n" -" };\n" -"\n" -" if let Err(e) = socket.write_all(reply.as_bytes()).await {\n" -" println!(\"socket error: {e:?}\");\n" -" }\n" -" });\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,compile_fail\n" -"use tokio::io::{self, AsyncReadExt, AsyncWriteExt};\n" -"use tokio::net::TcpListener;\n" -"\n" -"#[tokio::main]\n" -"async fn main() -> io::Result<()> {\n" -" let listener = TcpListener::bind(\"127.0.0.1:6142\").await?;\n" -"\tprintln!(\"listening on port 6142\");\n" -"\n" -" loop {\n" -" let (mut socket, addr) = listener.accept().await?;\n" -"\n" -" println!(\"connection from {addr:?}\");\n" -"\n" -" tokio::spawn(async move {\n" -" if let Err(e) = socket.write_all(b\"Who are you?\\n\").await {\n" -" println!(\"socket error: {e:?}\");\n" -" return;\n" -" }\n" -"\n" -" let mut buf = vec![0; 1024];\n" -" let reply = match socket.read(&mut buf).await {\n" -" Ok(n) => {\n" -" let name = std::str::from_utf8(&buf[..n]).unwrap()." -"trim();\n" -" format!(\"Thanks for dialing in, {name}!\\n\")\n" -" }\n" -" Err(e) => {\n" -" println!(\"socket error: {e:?}\");\n" -" return;\n" -" }\n" -" };\n" -"\n" -" if let Err(e) = socket.write_all(reply.as_bytes()).await {\n" -" println!(\"socket error: {e:?}\");\n" -" }\n" -" });\n" -" }\n" -"}\n" -"```" - -#: src/async/tasks.md:52 src/async/control-flow/join.md:36 -msgid "" -"Copy this example into your prepared `src/main.rs` and run it from there." -msgstr "" -"์ด ์˜ˆ์ œ๋ฅผ, ๋กœ์ปฌ ์ปดํ“จํ„ฐ์— ๋งŒ๋“ค์–ด ๋‘” `src/main.rs`์— ๋ณต์‚ฌํ•˜๊ณ  ๊ฑฐ๊ธฐ์—์„œ ์‹คํ–‰ํ•˜์„ธ" -"์š”." - -#: src/async/tasks.md:54 -msgid "" -"Ask students to visualize what the state of the example server would be with " -"a few connected clients. What tasks exist? What are their Futures?" -msgstr "" -"์ˆ˜๊ฐ•์ƒ๋“ค์—๊ฒŒ ์ด ์„œ๋ฒ„์— ๋ช‡ ๊ฐœ์˜ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์—ฐ๊ฒฐ๋˜๋ฉด ์ด ์„œ๋ฒ„์˜ ์ƒํƒœ๊ฐ€ ์–ด๋–ป๊ฒŒ " -"๋ณ€ํ• ์ง€ ๊ทธ๋ฆผ์„ ๊ทธ๋ ค๋ณด๋„๋ก ํ•˜์„ธ์š”. ์–ด๋–ค ํƒœ์Šคํฌ๋“ค์ด ์žˆ๋Š”์ง€, ์ด ํƒœ์Šคํฌ๋“ค์˜ Future" -"๋Š” ์–ด๋–ค ์ƒํƒœ์— ์žˆ๋Š”์ง€ ๋ฌผ์–ด๋ด…๋‹ˆ๋‹ค." - -#: src/async/tasks.md:57 -msgid "" -"This is the first time we've seen an `async` block. This is similar to a " -"closure, but does not take any arguments. Its return value is a Future, " -"similar to an `async fn`. " -msgstr "" -"`async` ๋ธ”๋ก์„ ์ฒ˜์Œ ๋ณด๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ํด๋กœ์ €์™€ ๋น„์Šทํ•˜์ง€๋งŒ ์ธ์ž๋ฅผ ๋ฐ›์ง€ " -"์•Š์Šต๋‹ˆ๋‹ค. ๋ฆฌํ„ด ํƒ€์ž…์€ `async fn`๊ณผ ๋น„์Šทํ•œ Future์ž…๋‹ˆ๋‹ค. " - -#: src/async/tasks.md:61 -msgid "" -"Refactor the async block into a function, and improve the error handling " -"using `?`." -msgstr "" -"Async ๋ธ”๋ก์„ ํ•จ์ˆ˜๋กœ ๋ฆฌํŒฉํ„ฐ๋งํ•˜๊ณ  `?`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ๋ฅผ ๊ฐœ์„ ํ•ด ๋ด…์‹œ๋‹ค." - -#: src/async/channels.md:3 -msgid "" -"Several crates have support for asynchronous channels. For instance `tokio`:" -msgstr "" -"์—ฌ๋Ÿฌ ํฌ๋ ˆ์ดํŠธ์—์„œ ๋น„๋™๊ธฐ ์ฑ„๋„์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `tokio`์—์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™" -"์ดํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/channels.md:5 -msgid "" -"```rust,editable,compile_fail\n" -"use tokio::sync::mpsc::{self, Receiver};\n" -"\n" -"async fn ping_handler(mut input: Receiver<()>) {\n" -" let mut count: usize = 0;\n" -"\n" -" while let Some(_) = input.recv().await {\n" -" count += 1;\n" -" println!(\"Received {count} pings so far.\");\n" -" }\n" -"\n" -" println!(\"ping_handler complete\");\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (sender, receiver) = mpsc::channel(32);\n" -" let ping_handler_task = tokio::spawn(ping_handler(receiver));\n" -" for i in 0..10 {\n" -" sender.send(()).await.expect(\"Failed to send ping.\");\n" -" println!(\"Sent {} pings so far.\", i + 1);\n" -" }\n" -"\n" -" std::mem::drop(sender);\n" -" ping_handler_task.await.expect(\"Something went wrong in ping handler " -"task.\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use tokio::sync::mpsc::{self, Receiver};\n" -"\n" -"async fn ping_handler(mut input: Receiver<()>) {\n" -" let mut count: usize = 0;\n" -"\n" -" while let Some(_) = input.recv().await {\n" -" count += 1;\n" -" println!(\"Received {count} pings so far.\");\n" -" }\n" -"\n" -" println!(\"ping_handler complete\");\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (sender, receiver) = mpsc::channel(32);\n" -" let ping_handler_task = tokio::spawn(ping_handler(receiver));\n" -" for i in 0..10 {\n" -" sender.send(()).await.expect(\"Failed to send ping.\");\n" -" println!(\"Sent {} pings so far.\", i + 1);\n" -" }\n" -"\n" -" std::mem::drop(sender);\n" -" ping_handler_task.await.expect(\"Something went wrong in ping handler " -"task.\");\n" -"}\n" -"```" - -#: src/async/channels.md:35 -msgid "Change the channel size to `3` and see how it affects the execution." -msgstr "์ฑ„๋„ ํฌ๊ธฐ๋ฅผ `3`์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋™์ž‘์ด ์–ด๋–ป๊ฒŒ ๋ฐ”๋€Œ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”." - -#: src/async/channels.md:37 -msgid "" -"Overall, the interface is similar to the `sync` channels as seen in the " -"[morning class](concurrency/channels.md)." -msgstr "" -"๋น„๋™๊ธฐ ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋Š” [์˜ค์ „ ๊ณผ์ •](concurrency/channels.md)" -"์—์„œ ๋ฐฐ์šด `sync` ์ฑ„๋„๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/channels.md:40 -msgid "Try removing the `std::mem::drop` call. What happens? Why?" -msgstr "" -"`std::mem::drop` ํ˜ธ์ถœํ•˜๋Š” ์ค„์„ ์‚ญ์ œํ•ด ๋ณด์„ธ์š”. ์–ด๋–ค ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋‚˜์š”? ์ด์œ ๊ฐ€ " -"๋ฌด์—‡์ธ๊ฐ€์š”?" - -#: src/async/channels.md:42 -msgid "" -"The [Flume](https://docs.rs/flume/latest/flume/) crate has channels that " -"implement both `sync` and `async` `send` and `recv`. This can be convenient " -"for complex applications with both IO and heavy CPU processing tasks." -msgstr "" -"[Flume](https://docs.rs/flume/latest/flume/) ํฌ๋ ˆ์ดํŠธ์—๋Š” `sync`์™€ `async`, " -"`send`์™€ `recv`๋ฅผ ๋ชจ๋‘ ๊ตฌํ˜„ํ•˜๋Š” ์ฑ„๋„์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ IO์™€ CPU ์ฒ˜๋ฆฌ ์ž‘์—…์ด " -"๋งŽ์€ ๋ณต์žกํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌํ˜„ํ•  ๋•Œ ๋งค์šฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/channels.md:46 -msgid "" -"What makes working with `async` channels preferable is the ability to " -"combine them with other `future`s to combine them and create complex control " -"flow." -msgstr "" -"`async` ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ์ด์œ ๋Š” ์ด๋ฅผ ๋‹ค๋ฅธ `future`์™€ ๊ฒฐํ•ฉํ•˜์—ฌ ๋ณต" -"์žกํ•œ ์ œ์–ด ํ๋ฆ„์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/async/control-flow.md:3 -msgid "" -"Futures can be combined together to produce concurrent compute flow graphs. " -"We have already seen tasks, that function as independent threads of " -"execution." -msgstr "" -"Future๋“ค์„ ๊ฒฐํ•ฉํ•˜์—ฌ ๊ณ„์‚ฐ ๊ณผ์ •์„ ๋™์‹œ์„ฑ์ด ์žˆ๋Š” ํ”Œ๋กœ์šฐ ๊ทธ๋ž˜ํ”„ ํ˜•ํƒœ๋กœ ๋ชจ๋ธ๋ง ํ•  " -"์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ž์„œ ๋ฐฐ์šด, ๊ฐ ํƒœ์Šคํฌ๊ฐ€ ๋…๋ฆฝ์ ์œผ๋กœ ์ˆ˜ํ–‰๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ๋„ Future๋“ค" -"์„ ๊ฒฐํ•ฉํ•˜๋Š” ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/control-flow.md:6 -msgid "[Join](control-flow/join.md)" -msgstr "[Join](control-flow/join.md)" - -#: src/async/control-flow.md:7 -msgid "[Select](control-flow/select.md)" -msgstr "[Select](control-flow/select.md)" - -#: src/async/control-flow/join.md:1 src/SUMMARY.md:287 -msgid "Join" -msgstr "Join" - -#: src/async/control-flow/join.md:3 -msgid "" -"A join operation waits until all of a set of futures are ready, and returns " -"a collection of their results. This is similar to `Promise.all` in " -"JavaScript or `asyncio.gather` in Python." -msgstr "" -"Join ์—ฐ์‚ฐ์€ ๋ชจ๋“  future๊ฐ€ ์ค€๋น„๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฐ ํ›„, ๊ฐ future์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋‹ด์€ " -"์ปฌ๋ ‰์…˜์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ `Promise.all`์ด๋‚˜ ํŒŒ์ด์ฌ์˜ `asyncio." -"gather`์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/control-flow/join.md:7 -msgid "" -"```rust,editable,compile_fail\n" -"use anyhow::Result;\n" -"use futures::future;\n" -"use reqwest;\n" -"use std::collections::HashMap;\n" -"\n" -"async fn size_of_page(url: &str) -> Result {\n" -" let resp = reqwest::get(url).await?;\n" -" Ok(resp.text().await?.len())\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let urls: [&str; 4] = [\n" -" \"https://google.com\",\n" -" \"https://httpbin.org/ip\",\n" -" \"https://play.rust-lang.org/\",\n" -" \"BAD_URL\",\n" -" ];\n" -" let futures_iter = urls.into_iter().map(size_of_page);\n" -" let results = future::join_all(futures_iter).await;\n" -" let page_sizes_dict: HashMap<&str, Result> =\n" -" urls.into_iter().zip(results.into_iter()).collect();\n" -" println!(\"{:?}\", page_sizes_dict);\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use anyhow::Result;\n" -"use futures::future;\n" -"use reqwest;\n" -"use std::collections::HashMap;\n" -"\n" -"async fn size_of_page(url: &str) -> Result {\n" -" let resp = reqwest::get(url).await?;\n" -" Ok(resp.text().await?.len())\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let urls: [&str; 4] = [\n" -" \"https://google.com\",\n" -" \"https://httpbin.org/ip\",\n" -" \"https://play.rust-lang.org/\",\n" -" \"BAD_URL\",\n" -" ];\n" -" let futures_iter = urls.into_iter().map(size_of_page);\n" -" let results = future::join_all(futures_iter).await;\n" -" let page_sizes_dict: HashMap<&str, Result> =\n" -" urls.into_iter().zip(results.into_iter()).collect();\n" -" println!(\"{:?}\", page_sizes_dict);\n" -"}\n" -"```" - -#: src/async/control-flow/join.md:38 -msgid "" -"For multiple futures of disjoint types, you can use `std::future::join!` but " -"you must know how many futures you will have at compile time. This is " -"currently in the `futures` crate, soon to be stabilised in `std::future`." -msgstr "" -"์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…์„ ๊ฐ€์ง€๋Š” ์—ฌ๋Ÿฌ ์—ฌ๋Ÿฌ futures๋“ค์„ joinํ•˜๊ณ ์ž ํ•  ๊ฒฝ์šฐ `std::" -"future::join!`์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋งคํฌ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด futures๊ฐ€ ๋ช‡ ๊ฐœ" -"๋‚˜ ์žˆ์„์ง€ ์ปดํŒŒ์ผ ํ•  ๋•Œ ์•Œ์•„์•ผ ํ•œ๋‹ค๋Š” ์ ์„ ์ฃผ์˜ํ•˜์„ธ์š”. ์ด ๋งคํฌ๋กœ๋Š” ์ง€๊ธˆ์€ " -"'futures' ํฌ๋ ˆ์ดํŠธ์— ์žˆ์œผ๋ฉฐ ๊ณง ์•ˆ์ •ํ™” ๋˜์–ด `std::future`์— ํฌํ•จ๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค." - -#: src/async/control-flow/join.md:42 -msgid "" -"The risk of `join` is that one of the futures may never resolve, this would " -"cause your program to stall. " -msgstr "" -"'join'์˜ ์œ„ํ—˜์„ฑ์€ futures๋“ค ์ค‘ ํ•˜๋‚˜๊ฐ€ ์˜์˜ ๋๋‚˜์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. " -"๊ทธ๋Ÿฌ๋ฉด ํ”„๋กœ๊ทธ๋žจ์ด ๋”์ด์ƒ ์ง„ํ–‰์„ ๋ชปํ•˜๊ณ  ๋ฉˆ์ถฐ์žˆ์„(stall) ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " - -#: src/async/control-flow/join.md:45 -msgid "" -"You can also combine `join_all` with `join!` for instance to join all " -"requests to an http service as well as a database query. Try adding a " -"`tokio::time::sleep` to the future, using `futures::join!`. This is not a " -"timeout (that requires `select!`, explained in the next chapter), but " -"demonstrates `join!`." -msgstr "" -"`join_all`์„ `join!`๊ณผ ๊ฒฐํ•ฉํ•˜์—ฌ http ์„œ๋น„์Šค์™€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋Œ€ํ•œ ๋ชจ๋“  ์š”์ฒญ๋“ค" -"์„ ํ•œ๊บผ๋ฒˆ์— ์ง„ํ–‰์‹œํ‚ฌ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. `futures::join!`์„ ์‚ฌ์šฉํ•˜์—ฌ `tokio::" -"time::sleep`์„ future์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์ด๊ฑด ํƒ€์ž„์•„์›ƒ์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹˜์„ " -"์ฃผ์˜ํ•˜์„ธ์š”. ์‹ค์ œ๋กœ, ํƒ€์ž„์•„์›ƒ์€ ๋‹ค์Œ ์žฅ์—์„œ ์„ค๋ช…ํ•˜๋Š” `select!`๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ตฌ" -"ํ˜„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” `tokio::time::sleep`์„ ์‚ฌ์šฉํ•œ ๊ฒƒ์€ ๋‹จ์ˆœํžˆ `join!`์˜ " -"๋™์ž‘์„ ์„ค๋ช…ํ•˜๊ธฐ ์œ„ํ•จ์ž…๋‹ˆ๋‹ค." - -#: src/async/control-flow/select.md:3 -msgid "" -"A select operation waits until any of a set of futures is ready, and " -"responds to that future's result. In JavaScript, this is similar to `Promise." -"race`. In Python, it compares to `asyncio.wait(task_set, return_when=asyncio." -"FIRST_COMPLETED)`." -msgstr "" -"Select ์—ฐ์‚ฐ์€ ์—ฌ๋Ÿฌ future๋“ค ๋ชจ๋‘์— ๋Œ€ํ•ด์„œ ์ค€๋น„๋  ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€, ๊ทธ ์ค‘ ์–ด" -"๋–ค ํ•œ future๊ฐ€ ์ตœ์ดˆ๋กœ ์ค€๋น„ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด ํ•ด๋‹น future์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. ์ด" -"๊ฒƒ์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ์˜ `Promise.race`์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ด์ฌ์—์„œ๋ผ๋ฉด `asyncio." -"wait(task_set, return_when=asyncio.FIRST_COMPLETED)`๊ฐ€ ํ•˜๋Š” ๋™์ž‘๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ" -"๋‹ค." - -#: src/async/control-flow/select.md:8 -msgid "" -"Similar to a match statement, the body of `select!` has a number of arms, " -"each of the form `pattern = future => statement`. When the `future` is " -"ready, the `statement` is executed with the variables in `pattern` bound to " -"the `future`'s result." -msgstr "" -"`select!` ์•ˆ์—๋Š”, `match`๋ฌธ๊ณผ ๋น„์Šทํ•˜๊ฒŒ, `pattern = future => statement` ํ˜•ํƒœ" -"์˜ ๋ธŒ๋žœ์น˜(arm) ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์–ด๋–ค 'future'๊ฐ€ ์ง„ํ–‰ ๊ฐ€๋Šฅ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด '๊ทธ " -"`future`์˜ ๊ฒฐ๊ณผ๊ฐ’์ด `pattern`์œผ๋กœ ๋ฐ”์ธ๋”ฉ ๋˜๋ฉฐ, ๊ทธ ์ƒํƒœ์—์„œ \\`statement'๊ฐ€ ์ˆ˜" -"ํ–‰๋ฉ๋‹ˆ๋‹ค." - -#: src/async/control-flow/select.md:13 -msgid "" -"```rust,editable,compile_fail\n" -"use tokio::sync::mpsc::{self, Receiver};\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"#[derive(Debug, PartialEq)]\n" -"enum Animal {\n" -" Cat { name: String },\n" -" Dog { name: String },\n" -"}\n" -"\n" -"async fn first_animal_to_finish_race(\n" -" mut cat_rcv: Receiver,\n" -" mut dog_rcv: Receiver,\n" -") -> Option {\n" -" tokio::select! {\n" -" cat_name = cat_rcv.recv() => Some(Animal::Cat { name: cat_name? }),\n" -" dog_name = dog_rcv.recv() => Some(Animal::Dog { name: dog_name? })\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (cat_sender, cat_receiver) = mpsc::channel(32);\n" -" let (dog_sender, dog_receiver) = mpsc::channel(32);\n" -" tokio::spawn(async move {\n" -" sleep(Duration::from_millis(500)).await;\n" -" cat_sender\n" -" .send(String::from(\"Felix\"))\n" -" .await\n" -" .expect(\"Failed to send cat.\");\n" -" });\n" -" tokio::spawn(async move {\n" -" sleep(Duration::from_millis(50)).await;\n" -" dog_sender\n" -" .send(String::from(\"Rex\"))\n" -" .await\n" -" .expect(\"Failed to send dog.\");\n" -" });\n" -"\n" -" let winner = first_animal_to_finish_race(cat_receiver, dog_receiver)\n" -" .await\n" -" .expect(\"Failed to receive winner\");\n" -"\n" -" println!(\"Winner is {winner:?}\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use tokio::sync::mpsc::{self, Receiver};\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"#[derive(Debug, PartialEq)]\n" -"enum Animal {\n" -" Cat { name: String },\n" -" Dog { name: String },\n" -"}\n" -"\n" -"async fn first_animal_to_finish_race(\n" -" mut cat_rcv: Receiver,\n" -" mut dog_rcv: Receiver,\n" -") -> Option {\n" -" tokio::select! {\n" -" cat_name = cat_rcv.recv() => Some(Animal::Cat { name: cat_name? }),\n" -" dog_name = dog_rcv.recv() => Some(Animal::Dog { name: dog_name? })\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (cat_sender, cat_receiver) = mpsc::channel(32);\n" -" let (dog_sender, dog_receiver) = mpsc::channel(32);\n" -" tokio::spawn(async move {\n" -" sleep(Duration::from_millis(500)).await;\n" -" cat_sender\n" -" .send(String::from(\"Felix\"))\n" -" .await\n" -" .expect(\"Failed to send cat.\");\n" -" });\n" -" tokio::spawn(async move {\n" -" sleep(Duration::from_millis(50)).await;\n" -" dog_sender\n" -" .send(String::from(\"Rex\"))\n" -" .await\n" -" .expect(\"Failed to send dog.\");\n" -" });\n" -"\n" -" let winner = first_animal_to_finish_race(cat_receiver, dog_receiver)\n" -" .await\n" -" .expect(\"Failed to receive winner\");\n" -"\n" -" println!(\"Winner is {winner:?}\");\n" -"}\n" -"```" - -#: src/async/control-flow/select.md:62 -msgid "" -"In this example, we have a race between a cat and a dog. " -"`first_animal_to_finish_race` listens to both channels and will pick " -"whichever arrives first. Since the dog takes 50ms, it wins against the cat " -"that take 500ms seconds." -msgstr "" -"์ด ์˜ˆ์ œ์—์„œ๋Š” ๊ณ ์–‘์ด์™€ ๊ฐœ๋ฅผ ๊ฒฝ์ฃผ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค(๋™์‹œ์— ์‹œ์ž‘์‹œํ‚จ ํ›„, ๋‘˜ ์ค‘ ๋จผ์ € ๋" -"๋‚˜๋Š” ์ชฝ์ด ์ด๊น€). `first_animal_to_finish_race`ํ•จ์ˆ˜๋Š” ๋‘ ์ฑ„๋„ ๋ชจ๋‘์— ๊ท€๊ธฐ์šธ์ด" -"๊ณ (listenํ•˜๊ณ ) ์žˆ๋‹ค๊ฐ€, ๋ฉ”์‹œ์ง€๊ฐ€ ๋จผ์ € ๋„์ฐฉํ•œ ์ฑ„๋„์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ๊ฐœ๋Š” 50ms๋งŒ์— " -"์ž‘์—…์„ ๋๋‚ด๊ณ  ๊ณ ์–‘์ด๋Š” 500ms๊ฐ€ ๊ฑธ๋ฆฌ๊ธฐ ๋•Œ๋ฌธ์—, ๊ฐœ๊ฐ€ ์ด๊น๋‹ˆ๋‹ค." - -#: src/async/control-flow/select.md:67 -msgid "" -"You can use `oneshot` channels in this example as the channels are supposed " -"to receive only one `send`." -msgstr "" -"์ด ์˜ˆ์ œ์—์„œ๋Š” `oneshot` ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ๋””์ž์ธ ์ž…๋‹ˆ๋‹ค. ๊ฐ ์ฑ„๋„" -"์ด ํ•œ ๋ฒˆ์˜ `send`๋งŒ ์ˆ˜์‹ ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." - -#: src/async/control-flow/select.md:70 -msgid "" -"Try adding a deadline to the race, demonstrating selecting different sorts " -"of futures." -msgstr "" -"์ด ๊ฒฝ์ฃผ์— ํƒ€์ž„์•„์›ƒ์„ ์ถ”๊ฐ€ํ•ด์„œ, ์„œ๋กœ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ futures๋“ค์„ ๋™์‹œ์— `select`" -"ํ•  ์ˆ˜ ์žˆ์Œ์„ ํ™•์ธํ•ด ๋ณด์„ธ์š”." - -#: src/async/control-flow/select.md:73 -msgid "" -"Note that `select!` moves the values it is given. It is easiest to use when " -"every execution of `select!` creates new futures. An alternative is to pass " -"`&mut future` instead of the future itself, but this can lead to issues, " -"further discussed in the pinning slide." -msgstr "" -"`select!`๋Š” ๋งค์นญ๋˜์ง€ ์•Š์€ ๋‹ค๋ฅธ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์— ๋Œ€ํ•ด drop์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ " -"๊ฒฝ์Ÿ์—์„œ ์ง„ ๋ชจ๋“  future๋“ค์€ ์ทจ์†Œ(cancel) ๋ฉ๋‹ˆ๋‹ค. `select!`๋ฅผ ์‹คํ–‰ํ•  ๋•Œ๋งˆ๋‹ค " -"์ƒˆ๋กœ์šด futures๊ฐ€ ๋งŒ๋“ค์–ด์ง€๋Š” ๊ฒฝ์šฐ๋ผ๋ฉด, ์ด๋Ÿฌํ•œ ์ ์ด ๋งค์šฐ ํŽธํ•˜๊ฒŒ ๋А๊ปด์งˆ ๊ฒƒ์ž…๋‹ˆ" -"๋‹ค. Future๊ฐ€ ์ทจ์†Œ๋˜๋Š” ๊ฒƒ์„ ๋ง‰๊ธฐ ์œ„ํ•ด future๋ฅผ ์ง์ ‘ ์ „๋‹ฌํ•˜๋Š” ๋Œ€์‹  `&mut " -"future`๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต" -"๋‹ˆ๋‹ค (์™œ ๊ทธ๋Ÿฐ์ง€๋Š” `Pin`์„ค๋ช…ํ•  ๋•Œ ์ž์„ธํžˆ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค)." - -#: src/async/pitfalls.md:1 -msgid "Pitfalls of async/await" -msgstr "async/await์—์„œ ์ฃผ์˜ํ•ด์•ผํ•  ํ•จ์ •" - -#: src/async/pitfalls.md:3 -msgid "" -"Async / await provides convenient and efficient abstraction for concurrent " -"asynchronous programming. However, the async/await model in Rust also comes " -"with its share of pitfalls and footguns. We illustrate some of them in this " -"chapter:" -msgstr "" -"Async์™€ await๋Š” ๋™์‹œ ๋น„๋™๊ธฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์œ„ํ•œ ํŽธ๋ฆฌํ•˜๊ณ  ํšจ์œจ์ ์ธ ์ถ”์ƒํ™”๋ฅผ ์ œ๊ณต" -"ํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Rust์˜ async/await ๋ชจ๋ธ์—๋„ ๋ฌธ์ œ๋Š” ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์žฅ์—์„œ ๋ช‡ ๊ฐ€" -"์ง€ ์˜ˆ๋ฅผ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls.md:5 -msgid "[Blocking the Executor](pitfalls/blocking-executor.md)" -msgstr "[์‹คํ–‰์ž ์ฐจ๋‹จ](pitfalls/blocking-executor.md)" - -#: src/async/pitfalls.md:6 -msgid "[Pin](pitfalls/pin.md)" -msgstr "[๊ณ ์ •](pitfalls/pin.md)" - -#: src/async/pitfalls.md:7 -msgid "[Async Traits](pitfall/async-traits.md)" -msgstr "[๋น„๋™๊ธฐ ํŠธ๋ ˆ์ž‡](pitfall/async-traits.md)" - -#: src/async/pitfalls/blocking-executor.md:1 -msgid "Blocking the executor" -msgstr "์‹คํ–‰์ž(executor)๋ฅผ ๋ธ”๋ก์‹œํ‚ด" - -#: src/async/pitfalls/blocking-executor.md:3 -msgid "" -"Most async runtimes only allow IO tasks to run concurrently. This means that " -"CPU blocking tasks will block the executor and prevent other tasks from " -"being executed. An easy workaround is to use async equivalent methods where " -"possible." -msgstr "" -"๋Œ€๋ถ€๋ถ„์˜ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์€ IO ์ž‘์—…๋งŒ ๋™์‹œ์— ์‹คํ–‰๋˜๋„๋ก ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, CPU๋ฅผ ๋ธ”" -"๋Ÿญํ•˜๋Š” ํƒœ์Šคํฌ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ์ด๋Š” ์‹คํ–‰์ž(executor)๋ฅผ ๋ธ”๋Ÿญํ•˜๊ฒŒ ๋˜๋ฉฐ, ๊ทธ ๊ฒฐ๊ณผ๋กœ " -"๋‹ค๋ฅธ ํƒœ์Šคํฌ๊ฐ€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์€, ํ•ญ์ƒ async" -"๋ฅผ ์ง€์›ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." - -#: src/async/pitfalls/blocking-executor.md:7 -msgid "" -"```rust,editable,compile_fail\n" -"use futures::future::join_all;\n" -"use std::time::Instant;\n" -"\n" -"async fn sleep_ms(start: &Instant, id: u64, duration_ms: u64) {\n" -" std::thread::sleep(std::time::Duration::from_millis(duration_ms));\n" -" println!(\n" -" \"future {id} slept for {duration_ms}ms, finished after {}ms\",\n" -" start.elapsed().as_millis()\n" -" );\n" -"}\n" -"\n" -"#[tokio::main(flavor = \"current_thread\")]\n" -"async fn main() {\n" -" let start = Instant::now();\n" -" let sleep_futures = (1..=10).map(|t| sleep_ms(&start, t, t * 10));\n" -" join_all(sleep_futures).await;\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use futures::future::join_all;\n" -"use std::time::Instant;\n" -"\n" -"async fn sleep_ms(start: &Instant, id: u64, duration_ms: u64) {\n" -" std::thread::sleep(std::time::Duration::from_millis(duration_ms));\n" -" println!(\n" -" \"future {id} slept for {duration_ms}ms, finished after {}ms\",\n" -" start.elapsed().as_millis()\n" -" );\n" -"}\n" -"\n" -"#[tokio::main(flavor = \"current_thread\")]\n" -"async fn main() {\n" -" let start = Instant::now();\n" -" let sleep_futures = (1..=10).map(|t| sleep_ms(&start, t, t * 10));\n" -" join_all(sleep_futures).await;\n" -"}\n" -"```" - -#: src/async/pitfalls/blocking-executor.md:29 -msgid "" -"Run the code and see that the sleeps happen consecutively rather than " -"concurrently." -msgstr "" -"์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ sleep๋“ค์ด ๋™์‹œ์— ์ง„ํ–‰๋˜์ง€ ์•Š๊ณ  ์ˆœ์ฐจ์ ์œผ๋กœ์œผ๋กœ ์ง„ํ–‰๋˜๋Š”์ง€ ํ™•์ธ" -"ํ•˜์„ธ์š”." - -#: src/async/pitfalls/blocking-executor.md:32 -msgid "" -"The `\"current_thread\"` flavor puts all tasks on a single thread. This " -"makes the effect more obvious, but the bug is still present in the multi-" -"threaded flavor." -msgstr "" -"`flavor`๋ฅผ `\"current_thread\"` ๋กœ ์„ค์ •ํ•˜๋ฉด ๋ชจ๋“  ํƒœ์Šคํฌ๊ฐ€ ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ " -"์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฌธ์ œ ์ƒํ™ฉ์ด ๋” ๋ถ„๋ช…ํžˆ ๋“œ๋Ÿฌ๋‚ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ฒ„๊ทธ๋Š” ๋ฉ€" -"ํ‹ฐ์Šค๋ ˆ๋“œ์ธ ๊ฒฝ์šฐ์—๋„ ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/pitfalls/blocking-executor.md:36 -msgid "" -"Switch the `std::thread::sleep` to `tokio::time::sleep` and await its result." -msgstr "" -"`std::thread::sleep`์„ `tokio::time::sleep`์œผ๋กœ ๋ฐ”๊พธ๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋ฅผ `await`ํ•ด ๋ณด" -"์„ธ์š”." - -#: src/async/pitfalls/blocking-executor.md:38 -msgid "" -"Another fix would be to `tokio::task::spawn_blocking` which spawns an actual " -"thread and transforms its handle into a future without blocking the executor." -msgstr "" -"๋˜ ๋‹ค๋ฅธ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ `tokio::task::spawn_blocking`์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์‹ค์ œ ์Šค๋ ˆ๋“œ๋ฅผ " -"์ƒ์„ฑํ•˜๊ณ , ๊ทธ ์Šค๋ ˆ๋“œ์— ๋Œ€ํ•œ ํ•ธ๋“ค์„ future๋กœ ๋ณ€ํ™˜ํ•จ์œผ๋กœ์จ ์‹คํ–‰์ž๊ฐ€ ๋ธ”๋ก๋˜๋Š” ๊ฒƒ" -"์„ ๋ง‰์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/blocking-executor.md:41 -msgid "" -"You should not think of tasks as OS threads. They do not map 1 to 1 and most " -"executors will allow many tasks to run on a single OS thread. This is " -"particularly problematic when interacting with other libraries via FFI, " -"where that library might depend on thread-local storage or map to specific " -"OS threads (e.g., CUDA). Prefer `tokio::task::spawn_blocking` in such " -"situations." -msgstr "" -"ํƒœ์Šคํฌ๋ฅผ OS ์Šค๋ ˆ๋“œ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์•ˆ ๋ฉ๋‹ˆ๋‹ค. ํƒœ์Šคํฌ์™€ OS์Šค๋ ˆ๋“œ๋Š” ์ผ๋Œ€์ผ ๋งคํ•‘ ๊ด€" -"๊ณ„์— ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์‹คํ–‰์ž๋Š” ํ•˜๋‚˜์˜ OS ์Šค๋ ˆ๋“œ์—์„œ ์ตœ๋Œ€ํ•œ ๋งŽ์€ ํƒœ์Šคํฌ" -"๋ฅผ ์ˆ˜ํ–‰ํ•˜๋„๋ก ์„ค๊ณ„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์ ์€ FFI๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ์ƒํ˜ธ์ž‘์šฉ" -"ํ•  ๋•Œ ํŠนํžˆ ๋ฌธ์ œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์Šค๋ ˆ๋“œ ๋กœ์ปฌ ์ €์žฅ์†Œ๋ฅผ " -"์ด์šฉํ•˜๊ฑฐ๋‚˜ ํŠน์ • OS ์Šค๋ ˆ๋“œ์— ๋งคํ•‘๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(์˜ˆ: CUDA). ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์—์„œ๋Š” " -"`tokio::task::spawn_blocking`์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/blocking-executor.md:47 -msgid "" -"Use sync mutexes with care. Holding a mutex over an `.await` may cause " -"another task to block, and that task may be running on the same thread." -msgstr "" -"๋™๊ธฐํ™” ๋ฎคํ…์Šค๋ฅผ ์ฃผ์˜ํ•ด์„œ ์‚ฌ์šฉํ•˜์„ธ์š”. `.await` ์œ„์— ๋ฎคํ…์Šค๋ฅผ ์ ์šฉํ•˜๋ฉด ๋‹ค๋ฅธ ์ž‘" -"์—…์ด ์ฐจ๋‹จ๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ ํ•ด๋‹น ์ž‘์—…์€ ๋™์ผํ•œ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰ ์ค‘์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/pin.md:1 src/SUMMARY.md:291 -msgid "Pin" -msgstr "Future ๊ณ ์ •(Pin)ํ•˜๊ธฐ" - -#: src/async/pitfalls/pin.md:3 -msgid "" -"When you await a future, all local variables (that would ordinarily be " -"stored on a stack frame) are instead stored in the Future for the current " -"async block. If your future has pointers to data on the stack, those " -"pointers might get invalidated. This is unsafe." -msgstr "" -"Future์— ๋Œ€ํ•ด `await`๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๊ทธ future๊ฐ€ ์ค€๋น„๋˜๊ธฐ๋ฅผ ๊ธฐ๋‹ค๋ฆด ๋•Œ, ๋ชจ๋“  ๋กœ์ปฌ " -"๋ณ€์ˆ˜(์ผ๋ฐ˜์ ์œผ๋กœ ์Šคํƒ ํ”„๋ ˆ์ž„์— ์ €์žฅ๋จ)๋Š” ๊ทธ future๊ฐ์ฒด ์•ˆ์— ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ " -"๊ทธ future์— ์Šคํƒ์— ์žˆ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๋กœ์˜ ํฌ์ธํ„ฐ๊ฐ€ ์žˆ์œผ๋ฉด ์ด๋Ÿฌํ•œ ํฌ์ธํ„ฐ๋Š” ์˜ฌ๋ฐ”" -"๋ฅด์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ˆ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/pin.md:8 -msgid "" -"Therefore, you must guarantee that the addresses your future points to don't " -"change. That is why we need to `pin` futures. Using the same future " -"repeatedly in a `select!` often leads to issues with pinned values." -msgstr "" -"๋”ฐ๋ผ์„œ future๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ฃผ์†Œ๊ฐ€ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š๋„๋ก ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด future๋ฅผ " -"`pin`(๊ณ ์ •)ํ•ด์•ผ ํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค. `select!`์—์„œ ๋™์ผํ•œ future๋ฅผ ๋ฐ˜๋ณต์ ์œผ๋กœ ์‚ฌ" -"์šฉํ•˜๋ฉด ๊ณ ์ • ๊ฐ’ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/pin.md:12 -msgid "" -"```rust,editable,compile_fail\n" -"use tokio::sync::{mpsc, oneshot};\n" -"use tokio::task::spawn;\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"// A work item. In this case, just sleep for the given time and respond\n" -"// with a message on the `respond_on` channel.\n" "#[derive(Debug)]\n" -"struct Work {\n" -" input: u32,\n" -" respond_on: oneshot::Sender,\n" +"struct DirectoryIterator {\n" +" path: CString,\n" +" dir: *mut ffi::DIR,\n" "}\n" "\n" -"// A worker which listens for work on a queue and performs it.\n" -"async fn worker(mut work_queue: mpsc::Receiver) {\n" -" let mut iterations = 0;\n" -" loop {\n" -" tokio::select! {\n" -" Some(work) = work_queue.recv() => {\n" -" sleep(Duration::from_millis(10)).await; // Pretend to work.\n" -" work.respond_on\n" -" .send(work.input * 1000)\n" -" .expect(\"failed to send response\");\n" -" iterations += 1;\n" -" }\n" -" // TODO: report number of iterations every 100ms\n" -" }\n" +"impl DirectoryIterator {\n" +" fn new(path: &str) -> Result {\n" +" // Call opendir and return a Ok value if that worked,\n" +" // otherwise return Err with a message.\n" +" unimplemented!()\n" " }\n" "}\n" "\n" -"// A requester which requests work and waits for it to complete.\n" -"async fn do_work(work_queue: &mpsc::Sender, input: u32) -> u32 {\n" -" let (tx, rx) = oneshot::channel();\n" -" work_queue\n" -" .send(Work {\n" -" input,\n" -" respond_on: tx,\n" -" })\n" -" .await\n" -" .expect(\"failed to send on work queue\");\n" -" rx.await.expect(\"failed waiting for response\")\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (tx, rx) = mpsc::channel(10);\n" -" spawn(worker(rx));\n" -" for i in 0..100 {\n" -" let resp = do_work(&tx, i).await;\n" -" println!(\"work result for iteration {i}: {resp}\");\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use tokio::sync::{mpsc, oneshot};\n" -"use tokio::task::spawn;\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"// ์ž‘์—… ํ•ญ๋ชฉ. ์ด ๊ฒฝ์šฐ ์ง€์ •๋œ ์‹œ๊ฐ„ ๋™์•ˆ ์ ˆ์ „ ๋ชจ๋“œ๋กœ ์žˆ๋‹ค๊ฐ€\n" -"// `respond_on` ์ฑ„๋„์˜ ๋ฉ”์‹œ์ง€๋กœ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค.\n" -"#[derive(Debug)]\n" -"struct Work {\n" -" input: u32,\n" -" respond_on: oneshot::Sender,\n" -"}\n" -"\n" -"// ๋Œ€๊ธฐ์—ด์—์„œ ์ž‘์—…์„ ๋ฆฌ์Šจํ•˜๊ณ  ์‹คํ–‰ํ•˜๋Š” worker์ž…๋‹ˆ๋‹ค.\n" -"async fn worker(mut work_queue: mpsc::Receiver) {\n" -" let mut iterations = 0;\n" -" loop {\n" -" tokio::select! {\n" -" Some(work) = work_queue.recv() => {\n" -" sleep(Duration::from_millis(10)).await; // Pretend to work.\n" -" work.respond_on\n" -" .send(work.input * 1000)\n" -" .expect(\"failed to send response\");\n" -" iterations += 1;\n" -" }\n" -" // TODO: 100ms๋งˆ๋‹ค ๋ฐ˜๋ณต ํšŸ์ˆ˜๋ฅผ ๋ณด๊ณ ํ•ฉ๋‹ˆ๋‹ค.\n" -" }\n" +"impl Iterator for DirectoryIterator {\n" +" type Item = OsString;\n" +" fn next(&mut self) -> Option {\n" +" // Keep calling readdir until we get a NULL pointer back.\n" +" unimplemented!()\n" " }\n" "}\n" "\n" -"// ์ž‘์—…์„ ์š”์ฒญํ•˜๊ณ  ์ž‘์—…์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์š”์ฒญ์ž์ž…๋‹ˆ๋‹ค.\n" -"async fn do_work(work_queue: &mpsc::Sender, input: u32) -> u32 {\n" -" let (tx, rx) = oneshot::channel();\n" -" work_queue\n" -" .send(Work {\n" -" input,\n" -" respond_on: tx,\n" -" })\n" -" .await\n" -" .expect(\"failed to send on work queue\");\n" -" rx.await.expect(\"failed waiting for response\")\n" +"impl Drop for DirectoryIterator {\n" +" fn drop(&mut self) {\n" +" // Call closedir as needed.\n" +" unimplemented!()\n" +" }\n" "}\n" "\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let (tx, rx) = mpsc::channel(10);\n" -" spawn(worker(rx));\n" -" for i in 0..100 {\n" -" let resp = do_work(&tx, i).await;\n" -" println!(\"work result for iteration {i}: {resp}\");\n" -" }\n" +"fn main() -> Result<(), String> {\n" +" let iter = DirectoryIterator::new(\".\")?;\n" +" println!(\"files: {:#?}\", iter.collect::>());\n" +" Ok(())\n" "}\n" "```" -#: src/async/pitfalls/pin.md:68 -msgid "" -"You may recognize this as an example of the actor pattern. Actors typically " -"call `select!` in a loop." -msgstr "" -"์œ„์—์„œ ์†Œ๊ฐœํ•œ ๊ฒƒ์€ ์•กํ„ฐ(actor) ํŒจํ„ด์˜ ํ•œ ์˜ˆ๋ผ๊ณ  ๋ด๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค. ์•กํ„ฐ๋Š” ์ผ๋ฐ˜" -"์ ์œผ๋กœ ๋ฃจํ”„ ์•ˆ์—์„œ `select!`๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/pitfalls/pin.md:71 -msgid "" -"This serves as a summation of a few of the previous lessons, so take your " -"time with it." -msgstr "์ด์ „ ๊ฐ•์˜ ๋ช‡ ๊ฐœ์˜ ๋‚ด์šฉ์„ ์š”์•ฝํ•œ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ฒœ์ฒœํžˆ ์‚ดํŽด๋ณด์„ธ์š”." - -#: src/async/pitfalls/pin.md:74 -msgid "" -"Naively add a `_ = sleep(Duration::from_millis(100)) => { println!(..) }` to " -"the `select!`. This will never execute. Why?" -msgstr "" -"`_ = sleep(Duration::from_millis(100)) => { println!(..) }`์„ `select!`์— ์ถ”" -"๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์ด ์ž‘์—…์€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์™œ ๊ทธ๋Ÿด๊นŒ์š”?" - -#: src/async/pitfalls/pin.md:77 -msgid "" -"Instead, add a `timeout_fut` containing that future outside of the `loop`:" -msgstr "" -"๋Œ€์‹ , ํ•ด๋‹น future๊ฐ€ ํฌํ•จ๋œ `timeout_fut`๋ฅผ `loop` ์™ธ๋ถ€์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”." - -#: src/async/pitfalls/pin.md:79 -msgid "" -"```rust,compile_fail\n" -"let mut timeout_fut = sleep(Duration::from_millis(100));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,compile_fail\n" -"let mut timeout_fut = sleep(Duration::from_millis(100));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" - -#: src/async/pitfalls/pin.md:88 -msgid "" -"This still doesn't work. Follow the compiler errors, adding `&mut` to the " -"`timeout_fut` in the `select!` to work around the move, then using `Box::" -"pin`:" -msgstr "" -"์—ฌ์ „ํžˆ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ ์˜ค๋ฅ˜๋ฅผ ๋”ฐ๋ผ `select!`์˜ `timeout_fut`์— " -"`&mut`๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ Move ์‹œ๋ฉ˜ํ‹ฑ ๊ด€๋ จํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  `Box::pin`์„ ์‚ฌ์šฉํ•˜์„ธ์š”." - -#: src/async/pitfalls/pin.md:92 -msgid "" -"```rust,compile_fail\n" -"let mut timeout_fut = Box::pin(sleep(Duration::from_millis(100)));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = &mut timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" -msgstr "" -"```rust,compile_fail\n" -"let mut timeout_fut = Box::pin(sleep(Duration::from_millis(100)));\n" -"loop {\n" -" select! {\n" -" ..,\n" -" _ = &mut timeout_fut => { println!(..); },\n" -" }\n" -"}\n" -"```" - -#: src/async/pitfalls/pin.md:102 -msgid "" -"This compiles, but once the timeout expires it is `Poll::Ready` on every " -"iteration (a fused future would help with this). Update to reset " -"`timeout_fut` every time it expires." -msgstr "" -"์ด๋Š” ์ปดํŒŒ์ผ์€ ๋˜์ง€๋งŒ ํƒ€์ž„ ์•„์›ƒ์ด ๋˜๋ฉด ๋งค๋ฒˆ ๋ฐ˜๋ณตํ•  ๋•Œ ๋งˆ๋‹ค `Poll::Ready`๊ฐ€ ๋ฉ" -"๋‹ˆ๋‹ค(์œตํ•ฉ๋œ future๊ฐ€ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Œ). ํƒ€์ž„ ์•„์›ƒ ๋  ๋•Œ๋งˆ๋‹ค `timeout_fut`๋ฅผ " -"๋ฆฌ์…‹ํ•˜๋„๋ก ์ˆ˜์ •ํ•˜์„ธ์š”." - -#: src/async/pitfalls/pin.md:106 -msgid "" -"Box allocates on the heap. In some cases, `std::pin::pin!` (only recently " -"stabilized, with older code often using `tokio::pin!`) is also an option, " -"but that is difficult to use for a future that is reassigned." -msgstr "" -"Box๋Š” ํž™์— ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค. ๊ฒฝ์šฐ์— ๋”ฐ๋ผ `std::pin::pin!`(์ตœ๊ทผ์—์•ผ ์•ˆ์ •ํ™”๋˜์—ˆ์œผ๋ฉฐ " -"์ด์ „ ์ฝ”๋“œ๋Š” `tokio::pin!`์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Œ)๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ด๋Š” ์žฌ" -"ํ• ๋‹น๋œ future์— ์‚ฌ์šฉํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/pin.md:110 -msgid "" -"Another alternative is to not use `pin` at all but spawn another task that " -"will send to a `oneshot` channel every 100ms." -msgstr "" -"๋˜ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์€ `pin`์„ ์•„์˜ˆ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  100ms๋งˆ๋‹ค `oneshot` ์ฑ„๋„์— ์ „์†กํ•  " -"๋‹ค๋ฅธ ์ž‘์—…์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." - -#: src/async/pitfalls/async-traits.md:3 -msgid "" -"Async methods in traits are not yet supported in the stable channel ([An " -"experimental feature exists in nightly and should be stabilized in the mid " -"term.](https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-" -"nightly.html))" -msgstr "" -"ํŠธ๋ ˆ์ž‡์— async ๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์€ ์•„์ง ์•ˆ์ •ํ™” ๋ฒ„์ „ ์ฑ„๋„์—์„œ ์ง€์›๋˜์ง€ ์•Š์Šต" -"๋‹ˆ๋‹ค([์‹คํ—˜์šฉ ๊ธฐ๋Šฅ์€ nightly์— ์กด์žฌํ•˜๋ฉฐ ์กฐ๋งŒ๊ฐ„ ์•ˆ์ •ํ™” ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค](https://" -"blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-nightly.html))." - -#: src/async/pitfalls/async-traits.md:5 -msgid "" -"The crate [async_trait](https://docs.rs/async-trait/latest/async_trait/) " -"provides a workaround through a macro:" -msgstr "" -"ํฌ๋ ˆ์ดํŠธ [async_trait](https://docs.rs/async-trait/latest/async_trait/)์€ ๋งค" -"ํฌ๋กœ๋ฅผ ํ†ตํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." - -#: src/async/pitfalls/async-traits.md:7 -msgid "" -"```rust,editable,compile_fail\n" -"use async_trait::async_trait;\n" -"use std::time::Instant;\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"#[async_trait]\n" -"trait Sleeper {\n" -" async fn sleep(&self);\n" -"}\n" -"\n" -"struct FixedSleeper {\n" -" sleep_ms: u64,\n" -"}\n" -"\n" -"#[async_trait]\n" -"impl Sleeper for FixedSleeper {\n" -" async fn sleep(&self) {\n" -" sleep(Duration::from_millis(self.sleep_ms)).await;\n" -" }\n" -"}\n" -"\n" -"async fn run_all_sleepers_multiple_times(sleepers: Vec>, " -"n_times: usize) {\n" -" for _ in 0..n_times {\n" -" println!(\"running all sleepers..\");\n" -" for sleeper in &sleepers {\n" -" let start = Instant::now();\n" -" sleeper.sleep().await;\n" -" println!(\"slept for {}ms\", start.elapsed().as_millis());\n" -" }\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let sleepers: Vec> = vec![\n" -" Box::new(FixedSleeper { sleep_ms: 50 }),\n" -" Box::new(FixedSleeper { sleep_ms: 100 }),\n" -" ];\n" -" run_all_sleepers_multiple_times(sleepers, 5).await;\n" -"}\n" -"```" -msgstr "" -"```rust,editable,compile_fail\n" -"use async_trait::async_trait;\n" -"use std::time::Instant;\n" -"use tokio::time::{sleep, Duration};\n" -"\n" -"#[async_trait]\n" -"trait Sleeper {\n" -" async fn sleep(&self);\n" -"}\n" -"\n" -"struct FixedSleeper {\n" -" sleep_ms: u64,\n" -"}\n" -"\n" -"#[async_trait]\n" -"impl Sleeper for FixedSleeper {\n" -" async fn sleep(&self) {\n" -" sleep(Duration::from_millis(self.sleep_ms)).await;\n" -" }\n" -"}\n" -"\n" -"async fn run_all_sleepers_multiple_times(sleepers: Vec>, " -"n_times: usize) {\n" -" for _ in 0..n_times {\n" -" println!(\"running all sleepers..\");\n" -" for sleeper in &sleepers {\n" -" let start = Instant::now();\n" -" sleeper.sleep().await;\n" -" println!(\"slept for {}ms\", start.elapsed().as_millis());\n" -" }\n" -" }\n" -"}\n" -"\n" -"#[tokio::main]\n" -"async fn main() {\n" -" let sleepers: Vec> = vec![\n" -" Box::new(FixedSleeper { sleep_ms: 50 }),\n" -" Box::new(FixedSleeper { sleep_ms: 100 }),\n" -" ];\n" -" run_all_sleepers_multiple_times(sleepers, 5).await;\n" -"}\n" -"```" - -#: src/async/pitfalls/async-traits.md:51 -msgid "" -"`async_trait` is easy to use, but note that it's using heap allocations to " -"achieve this. This heap allocation has performance overhead." -msgstr "" -"`async_trait`์€ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฝ์ง€๋งŒ ์ด๋ฅผ ์œ„ํ•ด ํž™์— ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹นํ•œ๋‹ค๋Š” ์ ์— ์œ ์˜" -"ํ•˜์„ธ์š”. ์ด ํž™ ํ• ๋‹น์—๋Š” ์„ฑ๋Šฅ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/async/pitfalls/async-traits.md:54 -msgid "" -"The challenges in language support for `async trait` are deep Rust and " -"probably not worth describing in-depth. Niko Matsakis did a good job of " -"explaining them in [this post](https://smallcultfollowing.com/babysteps/" -"blog/2019/10/26/async-fn-in-traits-are-hard/) if you are interested in " -"digging deeper." -msgstr "" -"`async trait` ๋ฅผ ์–ธ์–ด ์ฐจ์›์—์„œ ์ง€์›ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ด€๋ จ๋œ ๋ฌธ์ œ๋Š” ๋งค์šฐ ์ „๋ฌธ์ ์ธ ํ† ํ”ฝ" -"์ด๋ฉฐ ๋”ฐ๋ผ์„œ ์ด ๊ฐ•์˜์—์„œ ๋‹ค๋ฃฐ ๋‚ด์šฉ์€ ์•„๋‹™๋‹ˆ๋‹ค. [์ด ๊ฒŒ์‹œ๋ฌผ](https://" -"smallcultfollowing.com/babysteps/blog/2019/10/26/async-fn-in-traits-are-" -"hard/)์— ์ด์— ๊ด€ํ•œ ๋‹ˆ์ฝ” ๋งˆ์‚ฌํ‚ค์Šค์˜ ์ข‹์€ ์„ค๋ช…์ด ์žˆ์œผ๋ฏ€๋กœ ๊ด€์‹ฌ์ด ์žˆ๋‹ค๋ฉด ์ฐธ๊ณ ํ•˜" -"์„ธ์š”." - -#: src/async/pitfalls/async-traits.md:60 -msgid "" -"Try creating a new sleeper struct that will sleep for a random amount of " -"time and adding it to the Vec." -msgstr "" -"์ž„์˜์˜ ์‹œ๊ฐ„ ๋™์•ˆ sleep ํ•˜๋Š” ์ƒˆ๋กœ์šด sleeper ๊ตฌ์กฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด Vec์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ" -"์š”." - -#: src/exercises/day-4/morning.md:3 -msgid "Let us practice our new concurrency skills with" -msgstr "๋™์‹œ์„ฑ ๊ธฐ๋ฒ•๋“ค์„ ์—ฐ์Šตํ•ด ๋ด…์‹œ๋‹ค" - -#: src/exercises/day-4/morning.md:5 -msgid "Dining philosophers: a classic problem in concurrency." -msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž ๋ฌธ์ œ: ๊ณ ์ ์ ์ธ ๋™์‹œ์„ฑ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค." - -#: src/exercises/day-4/morning.md:7 -msgid "" -"Multi-threaded link checker: a larger project where you'll use Cargo to " -"download dependencies and then check links in parallel." -msgstr "" -"๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ: ๋ณ‘๋ ฌ์ ์œผ๋กœ ์›นํŽ˜์ด์ง€์˜ ๋งํฌ๋“ค์„ ์ฒดํฌํ•ฉ๋‹ˆ๋‹ค. ์นด๊ณ ๋ฅผ ํ†ต" -"ํ•ด ๋ช‡ ๊ฐ€์ง€ ์˜์กด์„ฑ๋“ค์„ ๋‹ค์šด๋„๋ฅด ๋ฐ›์•„์•ผ ํ•˜๋Š” ํฐ ํ”„๋กœ์ ํŠธ ์ž…๋‹ˆ๋‹ค." - -#: src/exercises/day-4/dining-philosophers.md:3 -msgid "The dining philosophers problem is a classic problem in concurrency:" -msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž ๋ฌธ์ œ๋Š” ๋™์‹œ์„ฑ์— ์žˆ์–ด์„œ ๊ณ ์ „์ ์ธ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/dining-philosophers.md:5 -msgid "" -"Five philosophers dine together at the same table. Each philosopher has " -"their own place at the table. There is a fork between each plate. The dish " -"served is a kind of spaghetti which has to be eaten with two forks. Each " -"philosopher can only alternately think and eat. Moreover, a philosopher can " -"only eat their spaghetti when they have both a left and right fork. Thus two " -"forks will only be available when their two nearest neighbors are thinking, " -"not eating. After an individual philosopher finishes eating, they will put " -"down both forks." -msgstr "" -"5๋ช…์˜ ์ฒ ํ•™์ž๊ฐ€ ์›ํƒ์—์„œ ์‹์‚ฌ๋ฅผ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์›ํƒ์—์„œ ์ž์‹ ์˜ ์ž๋ฆฌ" -"์— ์•‰์•„์žˆ์Šต๋‹ˆ๋‹ค. ํฌํฌ๋Š” ๊ฐ ์ ‘์‹œ ์‚ฌ์ด์— ์žˆ์Šต๋‹ˆ๋‹ค. ์ œ๊ณต๋˜๋Š” ์š”๋ฆฌ๋ฅผ ๋จน๊ธฐ ์œ„ํ•ด์„œ" -"๋Š” ๋‘ ๊ฐœ์˜ ํฌํฌ๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์ƒ๊ฐ์„ ํ•˜๋‹ค๊ฐ€ ๋ฐฐ๊ฐ€ ๊ณ ํ”„๋ฉด ์ž" -"์‹ ์˜ ์ขŒ,์šฐ์˜ ํฌํฌ๋ฅผ ๋“ค์–ด ์š”๋ฆฌ๋ฅผ ๋จน์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์š”๋ฆฌ๋ฅผ ๋จน์€ ํ›„์—๋Š” ํฌํฌ๋ฅผ " -"๋‹ค์‹œ ์ž๋ฆฌ์— ๋‚ด๋ ค๋†“์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์ž์‹ ์˜ ์ขŒ,์šฐ์— ํฌํฌ๊ฐ€ ์žˆ์„๋•Œ๋งŒ ์š”๋ฆฌ๋ฅผ ๋จน" -"์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋‘ ๊ฐœ์˜ ํฌํฌ๋Š” ์˜ค์ง ์ž์‹ ์˜ ์ขŒ,์šฐ ์ฒ ํ•™์ž๊ฐ€ ์ƒ๊ฐ์„ ํ•  ๋•Œ" -"๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/exercises/day-4/dining-philosophers.md:13 -msgid "" -"You will need a local [Cargo installation](../../cargo/running-locally.md) " -"for this exercise. Copy the code below to `src/main.rs` file, fill out the " -"blanks, and test that `cargo run` does not deadlock:" -msgstr "" -"์ด๋ฒˆ ํ›ˆ๋ จ์—์„œ๋Š” [์นด๊ณ  ์„ค์น˜ํ•˜๊ธฐ](../../cargo/running-locally.md)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ" -"๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๋ณต์‚ฌํ•ด์„œ `src/main.rs`์— ๋ถ™์—ฌ๋†“๊ณ  ๋นˆ ๋ถ€๋ถ„์„ ์ฑ„์šฐ๊ณ , `cargo " -"run` ์ปค๋งจ๋“œ๋กœ ํ…Œ์ŠคํŠธ ํ•ด์„œ ๊ต์ฐฉ์ƒํƒœ(๋ฐ๋“œ๋ฝ)๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/dining-philosophers.md:17 -msgid "" -"```rust,compile_fail\n" -"use std::sync::mpsc;\n" -"use std::sync::{Arc, Mutex};\n" -"use std::thread;\n" -"use std::time::Duration;\n" -"\n" -"struct Fork;\n" -"\n" -"struct Philosopher {\n" -" name: String,\n" -" // left_fork: ...\n" -" // right_fork: ...\n" -" // thoughts: ...\n" -"}\n" -"\n" -"impl Philosopher {\n" -" fn think(&self) {\n" -" self.thoughts\n" -" .send(format!(\"Eureka! {} has a new idea!\", &self.name))\n" -" .unwrap();\n" -" }\n" -"\n" -" fn eat(&self) {\n" -" // Pick up forks...\n" -" println!(\"{} is eating...\", &self.name);\n" -" thread::sleep(Duration::from_millis(10));\n" -" }\n" -"}\n" -"\n" -"static PHILOSOPHERS: &[&str] =\n" -" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" -"\n" -"fn main() {\n" -" // Create forks\n" -"\n" -" // Create philosophers\n" -"\n" -" // Make them think and eat\n" -"\n" -" // Output their thoughts\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:3 -msgid "" -"Let us use our new knowledge to create a multi-threaded link checker. It " -"should start at a webpage and check that links on the page are valid. It " -"should recursively check other pages on the same domain and keep doing this " -"until all pages have been validated." -msgstr "" -"์ƒˆ๋กœ ๋ฐฐ์šด๊ฒƒ๋“ค์„ ํ™œ์šฉํ•ด์„œ ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์ด ๊ฒ€์‚ฌ๊ธฐ๋Š” ์›นํŽ˜" -"์ด์ง€ ์•ˆ์— ์žˆ๋Š” ๋งํฌ๋“ค์ด ์œ ํšจํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์žฌ๊ท€์ ์œผ๋กœ ๋™์ผ ๋„๋ฉ”์ธ์˜ " -"๋‹ค๋ฅธ ๋ชจ๋“  ํŽ˜์ด์ง€๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค." - -#: src/exercises/day-4/link-checker.md:8 -msgid "" -"For this, you will need an HTTP client such as \\[`reqwest`\\]\\[1\\]. " -"Create a new Cargo project and `reqwest` it as a dependency with:" -msgstr "" -"์ด๋ฅผ ์œ„ํ•ด์„œ \\[`reqwest`\\]\\[1\\]์™€ ๊ฐ™์€ HTTP ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ƒˆ๋กœ" -"์šด ๋กœ์ปฌ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  \\[`reqwest`\\]\\[1\\]๋ฅผ ์˜์กด์„ฑ์— ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์š”:" - -#: src/exercises/day-4/link-checker.md:11 -msgid "" -"```shell\n" -"$ cargo new link-checker\n" -"$ cd link-checker\n" -"$ cargo add --features blocking,rustls-tls reqwest\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:17 -msgid "" -"If `cargo add` fails with `error: no such subcommand`, then please edit the " -"`Cargo.toml` file by hand. Add the dependencies listed below." -msgstr "" -"๋งŒ์ผ `cargo add` ์ปค๋งจ๋“œ๊ฐ€ `error: no such subcommand` ๋กœ ์‹คํŒจํ•œ๋‹ค๋ฉด `Cargo." -"toml` ํŒŒ์ผ์„ ์ง์ ‘ ์ˆ˜์ •ํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์— ์ „์ฒด ์˜์กด์„ฑ ๋‚ด์šฉ์ด ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/exercises/day-4/link-checker.md:20 -msgid "" -"You will also need a way to find links. We can use \\[`scraper`\\]\\[2\\] " -"for that:" -msgstr "๋งํฌ๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด์„œ \\[`scraper`\\]\\[2\\]๋„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/link-checker.md:22 -msgid "" -"```shell\n" -"$ cargo add scraper\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:26 -msgid "" -"Finally, we'll need some way of handling errors. We use " -"\\[`thiserror`\\]\\[3\\] for that:" -msgstr "" -"๋งˆ์ง€๋ง‰์œผ๋กœ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ \\[`thiserror`\\]\\[3\\]๋„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/link-checker.md:29 -msgid "" -"```shell\n" -"$ cargo add thiserror\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:33 -msgid "" -"The `cargo add` calls will update the `Cargo.toml` file to look like this:" -msgstr "๋ชจ๋“  `cargo add`๊ฐ€ ๋๋‚˜๋ฉด `Cargo.toml`์— ์•„๋ž˜ ๋‚ด์šฉ์ด ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/link-checker.md:35 -msgid "" -"```toml\n" -"[dependencies]\n" -"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-" -"tls\"] }\n" -"scraper = \"0.13.0\"\n" -"thiserror = \"1.0.37\"\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:42 -msgid "" -"You can now download the start page. Try with a small site such as `https://" -"www.google.org/`." -msgstr "์ด์ œ `https://www.google.org/` ๊ฐ™์€ ์›น ํŽ˜์ด์ง€๋ฅผ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/exercises/day-4/link-checker.md:45 -msgid "Your `src/main.rs` file should look something like this:" -msgstr "`rc/main.rs`ํŒŒ์ผ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค:" - -#: src/exercises/day-4/link-checker.md:47 -msgid "" -"```rust,compile_fail\n" -"use reqwest::blocking::{get, Response};\n" -"use reqwest::Url;\n" -"use scraper::{Html, Selector};\n" -"use thiserror::Error;\n" -"\n" -"#[derive(Error, Debug)]\n" -"enum Error {\n" -" #[error(\"request error: {0}\")]\n" -" ReqwestError(#[from] reqwest::Error),\n" -"}\n" -"\n" -"fn extract_links(response: Response) -> Result, Error> {\n" -" let base_url = response.url().to_owned();\n" -" let document = response.text()?;\n" -" let html = Html::parse_document(&document);\n" -" let selector = Selector::parse(\"a\").unwrap();\n" -"\n" -" let mut valid_urls = Vec::new();\n" -" for element in html.select(&selector) {\n" -" if let Some(href) = element.value().attr(\"href\") {\n" -" match base_url.join(href) {\n" -" Ok(url) => valid_urls.push(url),\n" -" Err(err) => {\n" -" println!(\"On {base_url}: could not parse {href:?}: " -"{err} (ignored)\",);\n" -" }\n" -" }\n" -" }\n" -" }\n" -"\n" -" Ok(valid_urls)\n" -"}\n" -"\n" -"fn main() {\n" -" let start_url = Url::parse(\"https://www.google.org\").unwrap();\n" -" let response = get(start_url).unwrap();\n" -" match extract_links(response) {\n" -" Ok(links) => println!(\"Links: {links:#?}\"),\n" -" Err(err) => println!(\"Could not extract links: {err:#}\"),\n" -" }\n" -"}\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:90 -msgid "Run the code in `src/main.rs` with" -msgstr "์•„๋ž˜ ์ปค๋งจ๋“œ๋กœ ์†Œ์Šค๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค" - -#: src/exercises/day-4/link-checker.md:92 -msgid "" -"```shell\n" -"$ cargo run\n" -"```" -msgstr "" - -#: src/exercises/day-4/link-checker.md:96 -msgid "Tasks" -msgstr "ํ•  ์ผ" - -#: src/exercises/day-4/link-checker.md:98 -msgid "" -"Use threads to check the links in parallel: send the URLs to be checked to a " -"channel and let a few threads check the URLs in parallel." -msgstr "" -"์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋งํฌ๋ฅผ ๋ณ‘๋ ฌ๋กœ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค: URL์„ ์ฑ„๋„๋กœ ๋ณด๋‚ด์„œ ๋ช‡ ๊ฐœ์˜ ์Šค๋ ˆ" -"๋“œ๊ฐ€ URL์„ ๋ณ‘๋ ฌ๋กœ ์ฒดํฌํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค." - -#: src/exercises/day-4/link-checker.md:100 -msgid "" -"Extend this to recursively extract links from all pages on the `www.google." -"org` domain. Put an upper limit of 100 pages or so so that you don't end up " -"being blocked by the site." -msgstr "" -"`www.google.org`๋„๋ฉ”์ธ์˜ ๋ชจ๋“  ํŽ˜์ด์ง€๋ฅผ ์žฌ๊ท€์ ์œผ๋กœ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ฝ”๋“œ๋ฅผ ํ™•์žฅํ•ด" -"์„œ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค: ์ฐจ๋‹จ๋‹นํ•˜์ง€ ์•Š๋„๋ก 100ํŽ˜์ด์ง€ ์ •๋„๋กœ ์ œํ•œ์„ ๋‘์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." +#: src/android.md:1 +#, fuzzy +msgid "Welcome to Rust in Android" +msgstr "1์ผ์ฐจ ๊ฐœ์š”" #: src/android.md:3 msgid "" @@ -16548,11 +15443,12 @@ msgstr "" "์ˆ˜ํ–‰ํ•  ๊ฒ๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๋ ค๋ฉด ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”:" #: src/android/setup.md:6 +#, fuzzy msgid "" "```shell\n" -"$ source build/envsetup.sh\n" -"$ lunch aosp_cf_x86_64_phone-userdebug\n" -"$ acloud create\n" +"source build/envsetup.sh\n" +"lunch aosp_cf_x86_64_phone-userdebug\n" +"acloud create\n" "```" msgstr "" "```shell\n" @@ -16726,30 +15622,27 @@ msgid "You can now build, push, and run the binary:" msgstr "๊ทธ๋Ÿฐ ๋‹ค์Œ, ์ด ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ๋นŒ๋“œํ•˜๊ณ , ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค์— ๋„ฃ๊ณ , ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" #: src/android/build-rules/binary.md:29 +#, fuzzy msgid "" "```shell\n" -"$ m hello_rust\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\n" -"$ adb shell /data/local/tmp/hello_rust\n" -"Hello from Rust!\n" +"m hello_rust\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" +"adb shell /data/local/tmp/hello_rust\n" "```" msgstr "" +"```shell\n" +"$ m hello_rust_logs\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_logs\n" +"```" -#: src/android/build-rules/binary.md:29 +#: src/android/build-rules/binary.md:35 msgid "" -"```shell\n" -"$ m hello_rust\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust\n" +"```text\n" "Hello from Rust!\n" "```" msgstr "" -"```shell\n" -"$ m hello_rust\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust\n" -"Hello from Rust!\n" -"```" #: src/android/build-rules/library.md:1 msgid "Rust Libraries" @@ -16872,26 +15765,13 @@ msgid "You build, push, and run the binary like before:" msgstr "์ด์ „์ฒ˜๋Ÿผ, ๋นŒ๋“œํ•˜๊ณ , ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค๋กœ ๋„ฃ๊ณ , ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" #: src/android/build-rules/library.md:61 +#, fuzzy msgid "" "```shell\n" -"$ m hello_rust_with_dep\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" -"tmp\n" -"$ adb shell /data/local/tmp/hello_rust_with_dep\n" -"Hello Bob, it is very\n" -"nice to meet you!\n" -"```" -msgstr "" - -#: src/android/build-rules/library.md:61 -msgid "" -"```shell\n" -"$ m hello_rust_with_dep\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" +"m hello_rust_with_dep\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust_with_dep\n" -"Hello Bob, it is very\n" -"nice to meet you!\n" +"adb shell /data/local/tmp/hello_rust_with_dep\n" "```" msgstr "" "```shell\n" @@ -16903,21 +15783,13 @@ msgstr "" "nice to meet you!\n" "```" -#: src/android/logging.md:44 +#: src/android/build-rules/library.md:67 msgid "" -"```shell\n" -"$ m hello_rust_logs\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" -"tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust_logs\n" +"```text\n" +"Hello Bob, it is very\n" +"nice to meet you!\n" "```" msgstr "" -"```shell\n" -"$ m hello_rust_logs\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" -"tmp\"\n" -"$ adb shell /data/local/tmp/hello_rust_logs\n" -"```" #: src/android/aidl.md:3 msgid "" @@ -17195,21 +16067,13 @@ msgid "We can now build, push, and start the service:" msgstr "์„œ๋น„์Šค๋ฅผ ๋นŒ๋“œํ•˜๊ณ , ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค์— ๋„ฃ๊ณ , ์‹œ์ž‘ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" #: src/android/aidl/deploy.md:5 +#, fuzzy msgid "" "```shell\n" -"$ m birthday_server\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/tmp\n" -"$ adb shell /data/local/tmp/birthday_server\n" -"```" -msgstr "" - -#: src/android/aidl/deploy.md:5 -msgid "" -"```shell\n" -"$ m birthday_server\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"m birthday_server\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" "tmp\"\n" -"$ adb shell /data/local/tmp/birthday_server\n" +"adb shell /data/local/tmp/birthday_server\n" "```" msgstr "" "```shell\n" @@ -17224,25 +16088,49 @@ msgid "In another terminal, check that the service runs:" msgstr "๋‹ค๋ฅธ ํ„ฐ๋ฏธ๋„์„ ๋„์›Œ์„œ ์„œ๋น„์Šค๊ฐ€ ์ž˜ ์ˆ˜ํ–‰๋˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" #: src/android/aidl/deploy.md:13 +#, fuzzy msgid "" "```shell\n" +"adb shell service check birthdayservice\n" +"```" +msgstr "" +"```shell\n" "$ adb shell service check birthdayservice\n" "Service birthdayservice: found\n" "```" + +#: src/android/aidl/deploy.md:17 +#, fuzzy +msgid "" +"```text\n" +"Service birthdayservice: found\n" +"```" msgstr "" "```shell\n" "$ adb shell service check birthdayservice\n" "Service birthdayservice: found\n" "```" -#: src/android/aidl/deploy.md:18 +#: src/android/aidl/deploy.md:21 msgid "You can also call the service with `service call`:" msgstr "`service call`๋ช…๋ ์–ด๋กœ ์„œ๋น„์Šค๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค:" -#: src/android/aidl/deploy.md:20 +#: src/android/aidl/deploy.md:23 +#, fuzzy msgid "" "```shell\n" -"$ $ adb shell service call birthdayservice 1 s16 Bob i32 24\n" +"adb shell service call birthdayservice 1 s16 Bob i32 24\n" +"```" +msgstr "" +"```shell\n" +"$ adb shell service check birthdayservice\n" +"Service birthdayservice: found\n" +"```" + +#: src/android/aidl/deploy.md:27 +#, fuzzy +msgid "" +"```text\n" "Result: Parcel(\n" " 0x00000000: 00000000 00000036 00610048 00700070 '....6...H.a.p.p.'\n" " 0x00000010: 00200079 00690042 00740072 00640068 'y. .B.i.r.t.h.d.'\n" @@ -17385,32 +16273,28 @@ msgid "Build, push, and run the client on your device:" msgstr "๋นŒ๋“œํ•˜๊ณ , ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค๋กœ ๋„ฃ๊ณ , ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" #: src/android/aidl/client.md:56 +#, fuzzy msgid "" "```shell\n" -"$ m birthday_client\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/tmp\n" -"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" -"Happy Birthday Charlie, congratulations with the 60 years!\n" +"m birthday_client\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" +"tmp\"\n" +"adb shell /data/local/tmp/birthday_client Charlie 60\n" "```" msgstr "" +"```shell\n" +"$ m birthday_server\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_server\n" +"```" -#: src/android/aidl/client.md:56 +#: src/android/aidl/client.md:62 msgid "" -"```shell\n" -"$ m birthday_client\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" -"tmp\"\n" -"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" +"```text\n" "Happy Birthday Charlie, congratulations with the 60 years!\n" "```" msgstr "" -"```shell\n" -"$ m birthday_client\n" -"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/" -"tmp\"\n" -"$ adb shell /data/local/tmp/birthday_client Charlie 60\n" -"Happy Birthday Charlie, congratulations with the 60 years!\n" -"```" #: src/android/aidl/changing.md:3 msgid "" @@ -17533,22 +16417,41 @@ msgid "Build, push, and run the binary on your device:" msgstr "๋นŒ๋“œํ•˜๊ณ , ๊ฐ€์ƒ ๋””๋ฐ”์ด์Šค์— ๋„ฃ๊ณ , ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" #: src/android/logging.md:44 +#, fuzzy msgid "" "```shell\n" -"$ m hello_rust_logs\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/tmp\n" -"$ adb shell /data/local/tmp/hello_rust_logs\n" +"m hello_rust_logs\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"tmp\"\n" +"adb shell /data/local/tmp/hello_rust_logs\n" "```" msgstr "" +"```shell\n" +"$ m hello_rust_logs\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/hello_rust_logs\n" +"```" #: src/android/logging.md:50 msgid "The logs show up in `adb logcat`:" msgstr "`adb logcat`์ปค๋งจ๋“œ๋กœ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" #: src/android/logging.md:52 +#, fuzzy msgid "" "```shell\n" -"$ adb logcat -s rust\n" +"adb logcat -s rust\n" +"```" +msgstr "" +"```shell\n" +"$ sudo apt install cargo rust-src rustfmt\n" +"```" + +#: src/android/logging.md:56 +#, fuzzy +msgid "" +"```text\n" "09-08 08:38:32.454 2420 2420 D rust: hello_rust_logs: Starting program.\n" "09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going " "fine.\n" @@ -17797,14 +16700,21 @@ msgid "" msgstr "" #: src/android/interoperability/with-c/bindgen.md:100 +#, fuzzy msgid "" "```shell\n" -"$ m print_birthday_card\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/" -"tmp\n" -"$ adb shell /data/local/tmp/print_birthday_card\n" +"m print_birthday_card\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/" +"tmp\"\n" +"adb shell /data/local/tmp/print_birthday_card\n" "```" msgstr "" +"```shell\n" +"$ m birthday_server\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_server\n" +"```" #: src/android/interoperability/with-c/bindgen.md:106 msgid "Finally, we can run auto-generated tests to ensure the bindings work:" @@ -17830,7 +16740,7 @@ msgstr "" #: src/android/interoperability/with-c/bindgen.md:122 msgid "" "```shell\n" -"$ atest libbirthday_bindgen_test\n" +"atest libbirthday_bindgen_test\n" "```" msgstr "" @@ -17937,13 +16847,21 @@ msgid "" msgstr "" #: src/android/interoperability/with-c/rust.md:75 +#, fuzzy msgid "" "```shell\n" -"$ m analyze_numbers\n" -"$ adb push $ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/tmp\n" -"$ adb shell /data/local/tmp/analyze_numbers\n" +"m analyze_numbers\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/" +"tmp\"\n" +"adb shell /data/local/tmp/analyze_numbers\n" "```" msgstr "" +"```shell\n" +"$ m birthday_server\n" +"$ adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/" +"tmp\"\n" +"$ adb shell /data/local/tmp/birthday_server\n" +"```" #: src/android/interoperability/with-c/rust.md:83 msgid "" @@ -17975,6 +16893,42 @@ msgstr "" "์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ๋Š”[CXX ํŠœํ† ๋ฆฌ์–ผ](https://cxx.rs/tutorial.html) ๋ฅผ ์ฐธ์กฐ" "ํ•ฉ๋‹ˆ๋‹ค." +#: src/android/interoperability/cpp.md:14 +msgid "" +"At this point, the instructor should switch to the [CXX tutorial](https://" +"cxx.rs/tutorial.html)." +msgstr "" + +#: src/android/interoperability/cpp.md:16 +msgid "Walk the students through the tutorial step by step." +msgstr "" + +#: src/android/interoperability/cpp.md:18 +msgid "" +"Highlight how CXX presents a clean interface without unsafe code in _both " +"languages_." +msgstr "" + +#: src/android/interoperability/cpp.md:20 +msgid "" +"Show the correspondence between [Rust and C++ types](https://cxx.rs/bindings." +"html):" +msgstr "" + +#: src/android/interoperability/cpp.md:22 +msgid "" +"Explain how a Rust `String` cannot map to a C++ `std::string` (the latter " +"does not uphold the UTF-8 invariant). Show that despite being different " +"types, `rust::String` in C++ can be easily constructed from a C++ `std::" +"string`, making it very ergonomic to use." +msgstr "" + +#: src/android/interoperability/cpp.md:28 +msgid "" +"Explain that a Rust function returning `Result` becomes a function " +"which throws a `E` exception in C++ (and vice versa)." +msgstr "" + #: src/android/interoperability/java.md:1 msgid "Interoperability with Java" msgstr "Java์™€์˜ ์ƒํ˜ธ์šด์šฉ์„ฑ" @@ -18131,11 +17085,12 @@ msgid "Finally, you can build, sync, and run the binary:" msgstr "๋งˆ์ง€๋ง‰์œผ๋กœ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ๋นŒ๋“œ, ์‹ฑํฌ, ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:" #: src/android/interoperability/java.md:75 +#, fuzzy msgid "" "```shell\n" -"$ m helloworld_jni\n" -"$ adb sync # requires adb root && adb remount\n" -"$ adb shell /system/bin/helloworld_jni\n" +"m helloworld_jni\n" +"adb sync # requires adb root && adb remount\n" +"adb shell /system/bin/helloworld_jni\n" "```" msgstr "" "```shell\n" @@ -18144,23 +17099,24 @@ msgstr "" "$ adb shell /system/bin/helloworld_jni\n" "```" -#: src/exercises/day-4/android.md:3 +#: src/exercises/android/morning.md:3 +#, fuzzy msgid "" -"For the last exercise, we will look at one of the projects you work with. " -"Let us group up and do this together. Some suggestions:" +"This is a group exercise: We will look at one of the projects you work with " +"and try to integrate some Rust into it. Some suggestions:" msgstr "" "๋งˆ์ง€๋ง‰ ์—ฐ์Šต๋ฌธ์ œ๋Š” ์—ฌ๋Ÿฌ๋ถ„์ด ์ž‘์—…ํ•˜๊ณ  ์žˆ๋Š” ํ”„๋กœ์ ํŠธ ์ค‘ ํ•˜๋‚˜๋ฅผ FFI๋กœ ๋Ÿฌ์ŠคํŠธ์™€ ์—ฐ" "๊ณ„ ํ•ด๋ณด๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ช‡ ๊ฐ€์ง€ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค:" -#: src/exercises/day-4/android.md:6 +#: src/exercises/android/morning.md:6 msgid "Call your AIDL service with a client written in Rust." msgstr "๋‹น์‹ ์˜ AIDL์„œ๋น„์Šค๋ฅผ ๋Ÿฌ์ŠคํŠธ ํด๋ผ์ด์–ธํŠธ์—์„œ ํ˜ธ์ถœํ•ด๋ด…๋‹ˆ๋‹ค." -#: src/exercises/day-4/android.md:8 +#: src/exercises/android/morning.md:8 msgid "Move a function from your project to Rust and call it." msgstr "๋‹น์‹ ์˜ ํ”„๋กœ์ ํŠธ์˜ ํ•จ์ˆ˜๋ฅผ ๋Ÿฌ์ŠคํŠธ๋กœ ์˜ฎ๊ธฐ๊ณ  ํ˜ธ์ถœํ•ด๋ด…๋‹ˆ๋‹ค." -#: src/exercises/day-4/android.md:12 +#: src/exercises/android/morning.md:12 msgid "" "No solution is provided here since this is open-ended: it relies on someone " "in the class having a piece of code which you can turn in to Rust on the fly." @@ -18168,6 +17124,11 @@ msgstr "" "์ด ์—ฐ์Šต๋ฌธ์ œ๋Š” ์—ด๋ ค์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹ต์ด ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํด๋ž˜์Šค์—์„œ ์ œ์ถœ๋œ ์ฝ”" "๋“œ์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค." +#: src/bare-metal.md:1 +#, fuzzy +msgid "Welcome to Bare Metal Rust" +msgstr "Welcome to Comprehensive Rust ๐Ÿฆ€" + #: src/bare-metal.md:3 msgid "" "This is a standalone one-day course about bare-metal Rust, aimed at people " @@ -18577,10 +17538,6 @@ msgid "This example will build but not run, as it doesn't have an entry point." msgstr "" "์ด ์˜ˆ์‹œ ์ฝ”๋“œ๋Š” ๋นŒ๋“œ๋Š” ๋˜์ง€๋งŒ, ์ง„์ž…์ ์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— ์‹คํ–‰๋˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค." -#: src/bare-metal/microcontrollers.md:1 src/SUMMARY.md:215 -msgid "Microcontrollers" -msgstr "๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ" - #: src/bare-metal/microcontrollers.md:3 msgid "" "The `cortex_m_rt` crate provides (among other things) a reset handler for " @@ -18644,10 +17601,6 @@ msgstr "" msgid "Run the example with `cargo embed --bin minimal`" msgstr "`cargo embed --bin minimal`์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์‹œ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค." -#: src/bare-metal/microcontrollers/mmio.md:1 src/SUMMARY.md:216 -msgid "Raw MMIO" -msgstr "์›์‹œ MMIO" - #: src/bare-metal/microcontrollers/mmio.md:3 msgid "" "Most microcontrollers access peripherals via memory-mapped IO. Let's try " @@ -19050,6 +18003,11 @@ msgstr "" "cargo embed --bin hal\n" "```" +#: src/bare-metal/microcontrollers/board-support.md:1 +#, fuzzy +msgid "Board support crates" +msgstr "๋ณด๋“œ ์ง€์› ํฌ๋ ˆ์ดํŠธ" + #: src/bare-metal/microcontrollers/board-support.md:3 msgid "" "Board support crates provide a further level of wrapping for a specific " @@ -19449,6 +18407,11 @@ msgstr "" "cargo embed --bin board_support debug\n" "```" +#: src/bare-metal/microcontrollers/debugging.md:19 +#, fuzzy +msgid "In another terminal in the same directory:" +msgstr "๋‹ค๋ฅธ ํ„ฐ๋ฏธ๋„์„ ๋„์›Œ์„œ ์„œ๋น„์Šค๊ฐ€ ์ž˜ ์ˆ˜ํ–‰๋˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" + #: src/bare-metal/microcontrollers/debugging.md:21 msgid "" "```sh\n" @@ -19583,6 +18546,201 @@ msgstr "" "FreeRTOS๋Š” ๋Œ€๋ถ€๋ถ„ C๋กœ ์ž‘์„ฑ๋˜์ง€๋งŒ, ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ Rust๋กœ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด " "์ฃผ๋Š” Rust ๋ฐ”์ธ๋”ฉ์ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค." +#: src/exercises/bare-metal/morning.md:3 +msgid "" +"We will read the direction from an I2C compass, and log the readings to a " +"serial port." +msgstr "" + +#: src/exercises/bare-metal/compass.md:3 +msgid "" +"We will read the direction from an I2C compass, and log the readings to a " +"serial port. If you have time, try displaying it on the LEDs somehow too, or " +"use the buttons somehow." +msgstr "" + +#: src/exercises/bare-metal/compass.md:6 +msgid "Hints:" +msgstr "" + +#: src/exercises/bare-metal/compass.md:8 +msgid "" +"Check the documentation for the [`lsm303agr`](https://docs.rs/lsm303agr/" +"latest/lsm303agr/) and [`microbit-v2`](https://docs.rs/microbit-v2/latest/" +"microbit/) crates, as well as the [micro:bit hardware](https://tech.microbit." +"org/hardware/)." +msgstr "" + +#: src/exercises/bare-metal/compass.md:11 +msgid "" +"The LSM303AGR Inertial Measurement Unit is connected to the internal I2C bus." +msgstr "" + +#: src/exercises/bare-metal/compass.md:12 +msgid "" +"TWI is another name for I2C, so the I2C master peripheral is called TWIM." +msgstr "" + +#: src/exercises/bare-metal/compass.md:13 +msgid "" +"The LSM303AGR driver needs something implementing the `embedded_hal::" +"blocking::i2c::WriteRead` trait. The [`microbit::hal::Twim`](https://docs.rs/" +"microbit-v2/latest/microbit/hal/struct.Twim.html) struct implements this." +msgstr "" + +#: src/exercises/bare-metal/compass.md:17 +msgid "" +"You have a [`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/" +"struct.Board.html) struct with fields for the various pins and peripherals." +msgstr "" + +#: src/exercises/bare-metal/compass.md:19 +msgid "" +"You can also look at the [nRF52833 datasheet](https://infocenter.nordicsemi." +"com/pdf/nRF52833_PS_v1.5.pdf) if you want, but it shouldn't be necessary for " +"this exercise." +msgstr "" + +#: src/exercises/bare-metal/compass.md:23 +msgid "" +"Download the [exercise template](../../comprehensive-rust-exercises.zip) and " +"look in the `compass` directory for the following files." +msgstr "" + +#: src/exercises/bare-metal/compass.md:26 src/exercises/bare-metal/rtc.md:19 +#, fuzzy +msgid "`src/main.rs`:" +msgstr "_hello_rust/src/main.rs_:" + +#: src/exercises/bare-metal/compass.md:30 +msgid "" +"```rust,compile_fail\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"extern crate panic_halt as _;\n" +"\n" +"use core::fmt::Write;\n" +"use cortex_m_rt::entry;\n" +"use microbit::{hal::uarte::{Baudrate, Parity, Uarte}, Board};\n" +"\n" +"#[entry]\n" +"fn main() -> ! {\n" +" let board = Board::take().unwrap();\n" +"\n" +" // Configure serial port.\n" +" let mut serial = Uarte::new(\n" +" board.UARTE0,\n" +" board.uart.into(),\n" +" Parity::EXCLUDED,\n" +" Baudrate::BAUD115200,\n" +" );\n" +"\n" +" // Set up the I2C controller and Inertial Measurement Unit.\n" +" // TODO\n" +"\n" +" writeln!(serial, \"Ready.\").unwrap();\n" +"\n" +" loop {\n" +" // Read compass data and log it to the serial port.\n" +" // TODO\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/compass.md:64 src/exercises/bare-metal/rtc.md:385 +msgid "`Cargo.toml` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/compass.md:68 +msgid "" +"```toml\n" +"[workspace]\n" +"\n" +"[package]\n" +"name = \"compass\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"publish = false\n" +"\n" +"[dependencies]\n" +"cortex-m-rt = \"0.7.3\"\n" +"embedded-hal = \"0.2.6\"\n" +"lsm303agr = \"0.2.2\"\n" +"microbit-v2 = \"0.13.0\"\n" +"panic-halt = \"0.2.0\"\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/compass.md:85 +msgid "`Embed.toml` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/compass.md:89 +#, fuzzy +msgid "" +"```toml\n" +"[default.general]\n" +"chip = \"nrf52833_xxAA\"\n" +"\n" +"[debug.gdb]\n" +"enabled = true\n" +"\n" +"[debug.reset]\n" +"halt_afterwards = true\n" +"```" +msgstr "" +"```toml\n" +"[default.general]\n" +"chip = \"nrf52833_xxAA\"\n" +"\n" +"[debug.gdb]\n" +"enabled = true\n" +"```" + +#: src/exercises/bare-metal/compass.md:100 src/exercises/bare-metal/rtc.md:985 +msgid "`.cargo/config.toml` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/compass.md:104 +msgid "" +"```toml\n" +"[build]\n" +"target = \"thumbv7em-none-eabihf\" # Cortex-M4F\n" +"\n" +"[target.'cfg(all(target_arch = \"arm\", target_os = \"none\"))']\n" +"rustflags = [\"-C\", \"link-arg=-Tlink.x\"]\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/compass.md:112 +msgid "See the serial output on Linux with:" +msgstr "" + +#: src/exercises/bare-metal/compass.md:114 +msgid "" +"```sh\n" +"picocom --baud 115200 --imap lfcrlf /dev/ttyACM0\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/compass.md:118 +msgid "" +"Or on Mac OS something like (the device name may be slightly different):" +msgstr "" + +#: src/exercises/bare-metal/compass.md:120 +msgid "" +"```sh\n" +"picocom --baud 115200 --imap lfcrlf /dev/tty.usbmodem14502\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/compass.md:124 +msgid "Use Ctrl+A Ctrl+Q to quit picocom." +msgstr "" + #: src/bare-metal/aps.md:1 msgid "Application processors" msgstr "์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ" @@ -19619,6 +18777,154 @@ msgstr "" "'virt' ๋ณด๋“œ๋Š” ํŠน์ • ์‹ค์ œ ํ•˜๋“œ์›จ์–ด๋ฅผ ์—๋ฎฌ๋ ˆ์ด์…˜ ํ•˜์ง€ ์•Š์œผ๋ฉฐ, ๊ฐ€์ƒ ๋จธ์‹ ์šฉ์œผ๋กœ๋งŒ " "์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค." +#: src/bare-metal/aps/entry-point.md:3 +msgid "" +"Before we can start running Rust code, we need to do some initialisation." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:5 +msgid "" +"```armasm\n" +".section .init.entry, \"ax\"\n" +".global entry\n" +"entry:\n" +" /*\n" +" * Load and apply the memory management configuration, ready to enable " +"MMU and\n" +" * caches.\n" +" */\n" +" adrp x30, idmap\n" +" msr ttbr0_el1, x30\n" +"\n" +" mov_i x30, .Lmairval\n" +" msr mair_el1, x30\n" +"\n" +" mov_i x30, .Ltcrval\n" +" /* Copy the supported PA range into TCR_EL1.IPS. */\n" +" mrs x29, id_aa64mmfr0_el1\n" +" bfi x30, x29, #32, #4\n" +"\n" +" msr tcr_el1, x30\n" +"\n" +" mov_i x30, .Lsctlrval\n" +"\n" +" /*\n" +" * Ensure everything before this point has completed, then invalidate " +"any\n" +" * potentially stale local TLB entries before they start being used.\n" +" */\n" +" isb\n" +" tlbi vmalle1\n" +" ic iallu\n" +" dsb nsh\n" +" isb\n" +"\n" +" /*\n" +" * Configure sctlr_el1 to enable MMU and cache and don't proceed until " +"this\n" +" * has completed.\n" +" */\n" +" msr sctlr_el1, x30\n" +" isb\n" +"\n" +" /* Disable trapping floating point access in EL1. */\n" +" mrs x30, cpacr_el1\n" +" orr x30, x30, #(0x3 << 20)\n" +" msr cpacr_el1, x30\n" +" isb\n" +"\n" +" /* Zero out the bss section. */\n" +" adr_l x29, bss_begin\n" +" adr_l x30, bss_end\n" +"0: cmp x29, x30\n" +" b.hs 1f\n" +" stp xzr, xzr, [x29], #16\n" +" b 0b\n" +"\n" +"1: /* Prepare the stack. */\n" +" adr_l x30, boot_stack_end\n" +" mov sp, x30\n" +"\n" +" /* Set up exception vector. */\n" +" adr x30, vector_table_el1\n" +" msr vbar_el1, x30\n" +"\n" +" /* Call into Rust code. */\n" +" bl main\n" +"\n" +" /* Loop forever waiting for interrupts. */\n" +"2: wfi\n" +" b 2b\n" +"```" +msgstr "" + +#: src/bare-metal/aps/entry-point.md:77 +msgid "" +"This is the same as it would be for C: initialising the processor state, " +"zeroing the BSS, and setting up the stack pointer." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:79 +msgid "" +"The BSS (block starting symbol, for historical reasons) is the part of the " +"object file which containing statically allocated variables which are " +"initialised to zero. They are omitted from the image, to avoid wasting space " +"on zeroes. The compiler assumes that the loader will take care of zeroing " +"them." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:83 +msgid "" +"The BSS may already be zeroed, depending on how memory is initialised and " +"the image is loaded, but we zero it to be sure." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:85 +msgid "" +"We need to enable the MMU and cache before reading or writing any memory. If " +"we don't:" +msgstr "" + +#: src/bare-metal/aps/entry-point.md:86 +msgid "" +"Unaligned accesses will fault. We build the Rust code for the `aarch64-" +"unknown-none` target which sets `+strict-align` to prevent the compiler " +"generating unaligned accesses, so it should be fine in this case, but this " +"is not necessarily the case in general." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:89 +msgid "" +"If it were running in a VM, this can lead to cache coherency issues. The " +"problem is that the VM is accessing memory directly with the cache disabled, " +"while the host has cachable aliases to the same memory. Even if the host " +"doesn't explicitly access the memory, speculative accesses can lead to cache " +"fills, and then changes from one or the other will get lost when the cache " +"is cleaned or the VM enables the cache. (Cache is keyed by physical address, " +"not VA or IPA.)" +msgstr "" + +#: src/bare-metal/aps/entry-point.md:94 +msgid "" +"For simplicity, we just use a hardcoded pagetable (see `idmap.S`) which " +"identity maps the first 1 GiB of address space for devices, the next 1 GiB " +"for DRAM, and another 1 GiB higher up for more devices. This matches the " +"memory layout that QEMU uses." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:97 +msgid "" +"We also set up the exception vector (`vbar_el1`), which we'll see more about " +"later." +msgstr "" + +#: src/bare-metal/aps/entry-point.md:98 +msgid "" +"All examples this afternoon assume we will be running at exception level 1 " +"(EL1). If you need to run at a different exception level you'll need to " +"modify `entry.S` accordingly." +msgstr "" + #: src/bare-metal/aps/inline-assembly.md:1 msgid "Inline assembly" msgstr "์ธ๋ผ์ธ ์–ด์…ˆ๋ธ”๋ฆฌ" @@ -19976,6 +19282,49 @@ msgstr "" "์ด๋Š” ์•ˆ์ „ํ•˜์ง€ ์•Š์€ ์ฝ”๋“œ์˜ ์•ˆ์ „ํ•œ ๋ž˜ํผ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ์ผ๋ฐ˜์ ์ธ ํŒจํ„ด์ž…๋‹ˆ๋‹ค. ์•ˆ์ „์— " "๊ด€ํ•œ ์ฆ๋ช… ๋ถ€๋‹ด์„ ์—ฌ๋Ÿฌ ๋งŽ์€ ์œ„์น˜์—์„œ ์†Œ์ˆ˜์˜ ์œ„์น˜๋กœ ์˜ฎ๊ธฐ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." +#: src/bare-metal/aps/uart/traits.md:1 +#, fuzzy +msgid "More traits" +msgstr "ํŠธ๋ ˆ์ž‡(Trait)" + +#: src/bare-metal/aps/uart/traits.md:3 +msgid "" +"We derived the `Debug` trait. It would be useful to implement a few more " +"traits too." +msgstr "" + +#: src/bare-metal/aps/uart/traits.md:5 +msgid "" +"```rust,editable,compile_fail\n" +"use core::fmt::{self, Write};\n" +"\n" +"impl Write for Uart {\n" +" fn write_str(&mut self, s: &str) -> fmt::Result {\n" +" for c in s.as_bytes() {\n" +" self.write_byte(*c);\n" +" }\n" +" Ok(())\n" +" }\n" +"}\n" +"\n" +"// Safe because it just contains a pointer to device memory, which can be\n" +"// accessed from any context.\n" +"unsafe impl Send for Uart {}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/uart/traits.md:24 +msgid "" +"Implementing `Write` lets us use the `write!` and `writeln!` macros with our " +"`Uart` type." +msgstr "" + +#: src/bare-metal/aps/uart/traits.md:25 +msgid "" +"Run the example in QEMU with `make qemu_minimal` under `src/bare-metal/aps/" +"examples`." +msgstr "" + #: src/bare-metal/aps/better-uart.md:1 msgid "A better UART driver" msgstr "๋” ๋‚˜์€ UART ๋“œ๋ผ์ด๋ฒ„" @@ -20155,6 +19504,306 @@ msgstr "3" msgid "There are also some ID registers which have been omitted for brevity." msgstr "๊ฐ„๊ฒฐ์„ฑ์„ ์œ„ํ•ด ์ผ๋ถ€ ID ๋ ˆ์ง€์Šคํ„ฐ๋Š” ์ƒ๋žต๋˜์—ˆ์Šต๋‹ˆ๋‹ค." +#: src/bare-metal/aps/better-uart/bitflags.md:3 +msgid "" +"The [`bitflags`](https://crates.io/crates/bitflags) crate is useful for " +"working with bitflags." +msgstr "" + +#: src/bare-metal/aps/better-uart/bitflags.md:5 +msgid "" +"```rust,editable,compile_fail\n" +"use bitflags::bitflags;\n" +"\n" +"bitflags! {\n" +" /// Flags from the UART flag register.\n" +" #[repr(transparent)]\n" +" #[derive(Copy, Clone, Debug, Eq, PartialEq)]\n" +" struct Flags: u16 {\n" +" /// Clear to send.\n" +" const CTS = 1 << 0;\n" +" /// Data set ready.\n" +" const DSR = 1 << 1;\n" +" /// Data carrier detect.\n" +" const DCD = 1 << 2;\n" +" /// UART busy transmitting data.\n" +" const BUSY = 1 << 3;\n" +" /// Receive FIFO is empty.\n" +" const RXFE = 1 << 4;\n" +" /// Transmit FIFO is full.\n" +" const TXFF = 1 << 5;\n" +" /// Receive FIFO is full.\n" +" const RXFF = 1 << 6;\n" +" /// Transmit FIFO is empty.\n" +" const TXFE = 1 << 7;\n" +" /// Ring indicator.\n" +" const RI = 1 << 8;\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/better-uart/bitflags.md:37 +msgid "" +"The `bitflags!` macro creates a newtype something like `Flags(u16)`, along " +"with a bunch of method implementations to get and set flags." +msgstr "" + +#: src/bare-metal/aps/better-uart/registers.md:1 +#, fuzzy +msgid "Multiple registers" +msgstr "๋” ๋งŽ์€ ๋ ˆ์ง€์Šคํ„ฐ" + +#: src/bare-metal/aps/better-uart/registers.md:3 +msgid "" +"We can use a struct to represent the memory layout of the UART's registers." +msgstr "" + +#: src/bare-metal/aps/better-uart/registers.md:5 +msgid "" +"```rust,editable,compile_fail\n" +"#[repr(C, align(4))]\n" +"struct Registers {\n" +" dr: u16,\n" +" _reserved0: [u8; 2],\n" +" rsr: ReceiveStatus,\n" +" _reserved1: [u8; 19],\n" +" fr: Flags,\n" +" _reserved2: [u8; 6],\n" +" ilpr: u8,\n" +" _reserved3: [u8; 3],\n" +" ibrd: u16,\n" +" _reserved4: [u8; 2],\n" +" fbrd: u8,\n" +" _reserved5: [u8; 3],\n" +" lcr_h: u8,\n" +" _reserved6: [u8; 3],\n" +" cr: u16,\n" +" _reserved7: [u8; 3],\n" +" ifls: u8,\n" +" _reserved8: [u8; 3],\n" +" imsc: u16,\n" +" _reserved9: [u8; 2],\n" +" ris: u16,\n" +" _reserved10: [u8; 2],\n" +" mis: u16,\n" +" _reserved11: [u8; 2],\n" +" icr: u16,\n" +" _reserved12: [u8; 2],\n" +" dmacr: u8,\n" +" _reserved13: [u8; 3],\n" +"}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/better-uart/registers.md:41 +msgid "" +"[`#[repr(C)]`](https://doc.rust-lang.org/reference/type-layout.html#the-c-" +"representation) tells the compiler to lay the struct fields out in order, " +"following the same rules as C. This is necessary for our struct to have a " +"predictable layout, as default Rust representation allows the compiler to " +"(among other things) reorder fields however it sees fit." +msgstr "" + +#: src/bare-metal/aps/better-uart/driver.md:3 +msgid "Now let's use the new `Registers` struct in our driver." +msgstr "" + +#: src/bare-metal/aps/better-uart/driver.md:5 +#, fuzzy +msgid "" +"```rust,editable,compile_fail\n" +"/// Driver for a PL011 UART.\n" +"#[derive(Debug)]\n" +"pub struct Uart {\n" +" registers: *mut Registers,\n" +"}\n" +"\n" +"impl Uart {\n" +" /// Constructs a new instance of the UART driver for a PL011 device at " +"the\n" +" /// given base address.\n" +" ///\n" +" /// # Safety\n" +" ///\n" +" /// The given base address must point to the 8 MMIO control registers of " +"a\n" +" /// PL011 device, which must be mapped into the address space of the " +"process\n" +" /// as device memory and not have any other aliases.\n" +" pub unsafe fn new(base_address: *mut u32) -> Self {\n" +" Self {\n" +" registers: base_address as *mut Registers,\n" +" }\n" +" }\n" +"\n" +" /// Writes a single byte to the UART.\n" +" pub fn write_byte(&self, byte: u8) {\n" +" // Wait until there is room in the TX buffer.\n" +" while self.read_flag_register().contains(Flags::TXFF) {}\n" +"\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL011 device which is appropriately mapped.\n" +" unsafe {\n" +" // Write to the TX buffer.\n" +" addr_of_mut!((*self.registers).dr).write_volatile(byte.into());\n" +" }\n" +"\n" +" // Wait until the UART is no longer busy.\n" +" while self.read_flag_register().contains(Flags::BUSY) {}\n" +" }\n" +"\n" +" /// Reads and returns a pending byte, or `None` if nothing has been " +"received.\n" +" pub fn read_byte(&self) -> Option {\n" +" if self.read_flag_register().contains(Flags::RXFE) {\n" +" None\n" +" } else {\n" +" let data = unsafe { addr_of!((*self.registers).dr)." +"read_volatile() };\n" +" // TODO: Check for error conditions in bits 8-11.\n" +" Some(data as u8)\n" +" }\n" +" }\n" +"\n" +" fn read_flag_register(&self) -> Flags {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL011 device which is appropriately mapped.\n" +" unsafe { addr_of!((*self.registers).fr).read_volatile() }\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"const FLAG_REGISTER_OFFSET: usize = 0x18;\n" +"const FR_BUSY: u8 = 1 << 3;\n" +"const FR_TXFF: u8 = 1 << 5;\n" +"\n" +"/// PL011 UART์šฉ ์ตœ์†Œ ๋“œ๋ผ์ด๋ฒ„์ž…๋‹ˆ๋‹ค.\n" +"#[derive(Debug)]\n" +"pub struct Uart {\n" +" base_address: *mut u8,\n" +"}\n" +"\n" +"impl Uart {\n" +" /// Constructs a new instance of the UART driver for a PL011 device at " +"the\n" +" /// given base address.\n" +" ///\n" +" /// # Safety\n" +" ///\n" +" /// The given base address must point to the 8 MMIO control registers of " +"a\n" +" /// PL011 device, which must be mapped into the address space of the " +"process\n" +" /// as device memory and not have any other aliases.\n" +" pub unsafe fn new(base_address: *mut u8) -> Self {\n" +" Self { base_address }\n" +" }\n" +"\n" +" /// UART์— ํ•œ ๋ฐ”์ดํŠธ๋ฅผ ์”๋‹ˆ๋‹ค.\n" +" pub fn write_byte(&self, byte: u8) {\n" +" // Wait until there is room in the TX buffer.\n" +" while self.read_flag_register() & FR_TXFF != 0 {}\n" +"\n" +" // `base_address`๊ฐ€ PL011์˜ ์ปจํŠธ๋กค ๋ ˆ์ง€์Šคํ„ฐ๊ฐ€ ๋งคํ•‘๋œ ์ฃผ์†Œ๋ฅผ ๊ฐ€๋ฆฌํ‚ค" +"๊ณ \n" +" // ์žˆ์œผ๋ฏ€๋กœ ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.\n" +" unsafe {\n" +" // Write to the TX buffer.\n" +" self.base_address.write_volatile(byte);\n" +" }\n" +"\n" +" // UART๊ฐ€ ๋” ์ด์ƒ ์‚ฌ์šฉ ์ค‘์ด ์•„๋‹ ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.\n" +" while self.read_flag_register() & FR_BUSY != 0 {}\n" +" }\n" +"\n" +" fn read_flag_register(&self) -> u8 {\n" +" // Safe because we know that the base address points to the control\n" +" // registers of a PL011 device which is appropriately mapped.\n" +" unsafe { self.base_address.add(FLAG_REGISTER_OFFSET)." +"read_volatile() }\n" +" }\n" +"}\n" +"```" + +#: src/bare-metal/aps/better-uart/driver.md:64 +msgid "" +"Note the use of `addr_of!` / `addr_of_mut!` to get pointers to individual " +"fields without creating an intermediate reference, which would be unsound." +msgstr "" + +#: src/bare-metal/aps/better-uart/using.md:1 +#: src/bare-metal/aps/logging/using.md:1 +#, fuzzy +msgid "Using it" +msgstr "Bindgen ์‚ฌ์šฉํ•˜๊ธฐ" + +#: src/bare-metal/aps/better-uart/using.md:3 +msgid "" +"Let's write a small program using our driver to write to the serial console, " +"and echo incoming bytes." +msgstr "" + +#: src/bare-metal/aps/better-uart/using.md:6 +msgid "" +"```rust,editable,compile_fail\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"mod exceptions;\n" +"mod pl011;\n" +"\n" +"use crate::pl011::Uart;\n" +"use core::fmt::Write;\n" +"use core::panic::PanicInfo;\n" +"use log::error;\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"/// Base address of the primary PL011 UART.\n" +"const PL011_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {\n" +" // Safe because `PL011_BASE_ADDRESS` is the base address of a PL011 " +"device,\n" +" // and nothing else accesses that address range.\n" +" let mut uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };\n" +"\n" +" writeln!(uart, \"main({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})\").unwrap();\n" +"\n" +" loop {\n" +" if let Some(byte) = uart.read_byte() {\n" +" uart.write_byte(byte);\n" +" match byte {\n" +" b'\\r' => {\n" +" uart.write_byte(b'\\n');\n" +" }\n" +" b'q' => break,\n" +" _ => {}\n" +" }\n" +" }\n" +" }\n" +"\n" +" writeln!(uart, \"Bye!\").unwrap();\n" +" system_off::().unwrap();\n" +"}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/better-uart/using.md:51 +msgid "" +"As in the [inline assembly](../inline-assembly.md) example, this `main` " +"function is called from our entry point code in `entry.S`. See the speaker " +"notes there for details." +msgstr "" + +#: src/bare-metal/aps/better-uart/using.md:53 +msgid "" +"Run the example in QEMU with `make qemu` under `src/bare-metal/aps/examples`." +msgstr "" + #: src/bare-metal/aps/logging.md:3 msgid "" "It would be nice to be able to use the logging macros from the [`log`]" @@ -20260,23 +19909,177 @@ msgstr "" "`log`ํ•จ์ˆ˜ ์•ˆ์—์„œ `unwrap`ํ•˜๋Š” ๊ฒƒ์€ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค.. ์™œ๋ƒํ•˜๋ฉด `set_logger`๋ฅผ ํ˜ธ์ถœ" "ํ•˜๊ธฐ ์ „์— `LOGGER`๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." +#: src/bare-metal/aps/logging/using.md:3 +msgid "We need to initialise the logger before we use it." +msgstr "" + +#: src/bare-metal/aps/logging/using.md:5 +msgid "" +"```rust,editable,compile_fail\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"mod exceptions;\n" +"mod logger;\n" +"mod pl011;\n" +"\n" +"use crate::pl011::Uart;\n" +"use core::panic::PanicInfo;\n" +"use log::{error, info, LevelFilter};\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"/// Base address of the primary PL011 UART.\n" +"const PL011_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {\n" +" // Safe because `PL011_BASE_ADDRESS` is the base address of a PL011 " +"device,\n" +" // and nothing else accesses that address range.\n" +" let uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };\n" +" logger::init(uart, LevelFilter::Trace).unwrap();\n" +"\n" +" info!(\"main({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})\");\n" +"\n" +" assert_eq!(x1, 42);\n" +"\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[panic_handler]\n" +"fn panic(info: &PanicInfo) -> ! {\n" +" error!(\"{info}\");\n" +" system_off::().unwrap();\n" +" loop {}\n" +"}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/logging/using.md:46 +msgid "Note that our panic handler can now log details of panics." +msgstr "" + +#: src/bare-metal/aps/logging/using.md:47 +msgid "" +"Run the example in QEMU with `make qemu_logger` under `src/bare-metal/aps/" +"examples`." +msgstr "" + +#: src/bare-metal/aps/exceptions.md:3 +msgid "" +"AArch64 defines an exception vector table with 16 entries, for 4 types of " +"exceptions (synchronous, IRQ, FIQ, SError) from 4 states (current EL with " +"SP0, current EL with SPx, lower EL using AArch64, lower EL using AArch32). " +"We implement this in assembly to save volatile registers to the stack before " +"calling into Rust code:" +msgstr "" + +#: src/bare-metal/aps/exceptions.md:8 +msgid "" +"```rust,editable,compile_fail\n" +"use log::error;\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn sync_exception_current(_elr: u64, _spsr: u64) {\n" +" error!(\"sync_exception_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn irq_current(_elr: u64, _spsr: u64) {\n" +" error!(\"irq_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn fiq_current(_elr: u64, _spsr: u64) {\n" +" error!(\"fiq_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn serr_current(_elr: u64, _spsr: u64) {\n" +" error!(\"serr_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn sync_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"sync_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn irq_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"irq_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn fiq_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"fiq_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn serr_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"serr_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"```" +msgstr "" + +#: src/bare-metal/aps/exceptions.md:64 +msgid "EL is exception level; all our examples this afternoon run in EL1." +msgstr "" + +#: src/bare-metal/aps/exceptions.md:65 +msgid "" +"For simplicity we aren't distinguishing between SP0 and SPx for the current " +"EL exceptions, or between AArch32 and AArch64 for the lower EL exceptions." +msgstr "" + +#: src/bare-metal/aps/exceptions.md:67 +msgid "" +"For this example we just log the exception and power down, as we don't " +"expect any of them to actually happen." +msgstr "" + +#: src/bare-metal/aps/exceptions.md:69 +msgid "" +"We can think of exception handlers and our main execution context more or " +"less like different threads. [`Send` and `Sync`](../../concurrency/send-sync." +"md) will control what we can share between them, just like with threads. For " +"example, if we want to share some value between exception handlers and the " +"rest of the program, and it's `Send` but not `Sync`, then we'll need to wrap " +"it in something like a `Mutex` and put it in a static." +msgstr "" + #: src/bare-metal/aps/other-projects.md:3 +#, fuzzy msgid "[oreboot](https://github.com/oreboot/oreboot)" msgstr "[oreboot](https://github.com/oreboot/oreboot)" #: src/bare-metal/aps/other-projects.md:4 +#, fuzzy msgid "\"coreboot without the C\"" msgstr "\"C๊ฐ€ ์—†๋Š” coreboot\"" #: src/bare-metal/aps/other-projects.md:5 +#, fuzzy msgid "Supports x86, aarch64 and RISC-V." msgstr "x86, aarch64, RISC-V๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." #: src/bare-metal/aps/other-projects.md:6 +#, fuzzy msgid "Relies on LinuxBoot rather than having many drivers itself." msgstr "์ž์ฒด์ ์œผ๋กœ ์—ฌ๋Ÿฌ ๋“œ๋ผ์ด๋ฒ„๋ฅผ ๋ณด์œ ํ•˜๋Š” ๋Œ€์‹  LinuxBoot์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค." #: src/bare-metal/aps/other-projects.md:7 +#, fuzzy msgid "" "[Rust RaspberryPi OS tutorial](https://github.com/rust-embedded/rust-" "raspberrypi-OS-tutorials)" @@ -20285,6 +20088,7 @@ msgstr "" "raspberrypi-OS-tutorials)" #: src/bare-metal/aps/other-projects.md:8 +#, fuzzy msgid "" "Initialisation, UART driver, simple bootloader, JTAG, exception levels, " "exception handling, page tables" @@ -20292,21 +20096,47 @@ msgstr "" "์ดˆ๊ธฐํ™”, UART ๋“œ๋ผ์ด๋ฒ„, ๊ฐ„๋‹จํ•œ ๋ถ€ํŠธ๋กœ๋”, JTAG, ์˜ˆ์™ธ ์ˆ˜์ค€, ์˜ˆ์™ธ ์ฒ˜๋ฆฌ, ํŽ˜์ด์ง€ ํ…Œ" "์ด๋ธ”" -#: src/bare-metal/aps/other-projects.md:9 -msgid "Not all very well written, so beware." +#: src/bare-metal/aps/other-projects.md:10 +#, fuzzy +msgid "" +"Some dodginess around cache maintenance and initialisation in Rust, not " +"necessarily a good example to copy for production code." msgstr "์ž˜ ์ž‘์„ฑ๋˜์ง€ ์•Š์€ ๊ฒƒ๋„ ์žˆ์œผ๋ฏ€๋กœ ์ฃผ์˜ํ•˜์„ธ์š”." -#: src/bare-metal/aps/other-projects.md:10 +#: src/bare-metal/aps/other-projects.md:12 +#, fuzzy msgid "[`cargo-call-stack`](https://crates.io/crates/cargo-call-stack)" msgstr "[`cargo-call-stack`](https://crates.io/crates/cargo-call-stack)" -#: src/bare-metal/aps/other-projects.md:11 +#: src/bare-metal/aps/other-projects.md:13 +#, fuzzy msgid "Static analysis to determine maximum stack usage." msgstr "์ตœ๋Œ€ ์Šคํƒ ์‚ฌ์šฉ๋Ÿ‰์„ ๊ฒฐ์ •ํ•˜๋Š” ์ •์  ๋ถ„์„" -#: src/bare-metal/useful-crates.md:1 src/SUMMARY.md:168 -msgid "Useful crates" -msgstr "์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" +#: src/bare-metal/aps/other-projects.md:17 +msgid "" +"The RaspberryPi OS tutorial runs Rust code before the MMU and caches are " +"enabled. This will read and write memory (e.g. the stack). However:" +msgstr "" + +#: src/bare-metal/aps/other-projects.md:19 +msgid "" +"Without the MMU and cache, unaligned accesses will fault. It builds with " +"`aarch64-unknown-none` which sets `+strict-align` to prevent the compiler " +"generating unaligned accesses so it should be alright, but this is not " +"necessarily the case in general." +msgstr "" + +#: src/bare-metal/aps/other-projects.md:22 +msgid "" +"If it were running in a VM, this can lead to cache coherency issues. The " +"problem is that the VM is accessing memory directly with the cache disabled, " +"while the host has cachable aliases to the same memory. Even if the host " +"doesn't explicitly access the memory, speculative accesses can lead to cache " +"fills, and then changes from one or the other will get lost. Again this is " +"alright in this particular case (running directly on the hardware with no " +"hypervisor), but isn't a good pattern in general." +msgstr "" #: src/bare-metal/useful-crates.md:3 msgid "" @@ -20658,6 +20488,11 @@ msgstr "" "Rust ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ์—๋Š” `tinyvec`๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฏ€๋กœ ์ด ์˜ˆ์‹œ๋Š” ์ธ๋ผ์ธ์œผ๋กœ ์‹ค" "ํ–‰๋ฉ๋‹ˆ๋‹ค." +#: src/bare-metal/useful-crates/spin.md:1 +#, fuzzy +msgid "`spin`" +msgstr "ํšŒ์ „" + #: src/bare-metal/useful-crates/spin.md:3 msgid "" "`std::sync::Mutex` and the other synchronisation primitives from `std::sync` " @@ -20825,10 +20660,6 @@ msgstr "" "}\n" "```" -#: src/bare-metal/android/vmbase.md:1 src/SUMMARY.md:250 -msgid "vmbase" -msgstr "vmbase" - #: src/bare-metal/android/vmbase.md:3 msgid "" "For VMs running under crosvm on aarch64, the [vmbase](https://android." @@ -20883,6 +20714,4495 @@ msgstr "" "`vmbase`๊ฐ€ ์ œ๊ณตํ•˜๋Š” ์ง„์ž…์ ์€ ์ฝ˜์†”์„ ์ดˆ๊ธฐํ™” ํ•˜๋ฉฐ, main ํ•จ์ˆ˜๊ฐ€ ๋ฆฌํ„ดํ•˜๋ฉด " "PSCI_SYSTEM_OFF ๋ฉ”์‹œ์ง€๋ฅผ PSCI๋ฅผ ํ†ตํ•ด ๋ณด๋‚ด์–ด์„œ VM์„ ์ข…๋ฃŒ์‹œํ‚ต๋‹ˆ๋‹ค." +#: src/exercises/bare-metal/afternoon.md:3 +msgid "We will write a driver for the PL031 real-time clock device." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:1 +#: src/exercises/bare-metal/solutions-afternoon.md:3 +#, fuzzy +msgid "RTC driver" +msgstr "RTC ๋“œ๋ผ์ด๋ฒ„" + +#: src/exercises/bare-metal/rtc.md:3 +#, fuzzy +msgid "" +"The QEMU aarch64 virt machine has a [PL031](https://developer.arm.com/" +"documentation/ddi0224/c) real-time clock at 0x9010000. For this exercise, " +"you should write a driver for it." +msgstr "" +"QEMU์˜ 'virt' ๋ณด๋“œ์—๋Š” [PL011](https://developer.arm.com/documentation/" +"ddi0224/c) UART๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ ์ด๋ฅผ ์œ„ํ•œ ๋“œ๋ผ์ด๋ฒ„๋ฅผ ์ž‘์„ฑํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/bare-metal/rtc.md:6 +msgid "" +"Use it to print the current time to the serial console. You can use the " +"[`chrono`](https://crates.io/crates/chrono) crate for date/time formatting." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:8 +msgid "" +"Use the match register and raw interrupt status to busy-wait until a given " +"time, e.g. 3 seconds in the future. (Call [`core::hint::spin_loop`](https://" +"doc.rust-lang.org/core/hint/fn.spin_loop.html) inside the loop.)" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:10 +msgid "" +"_Extension if you have time:_ Enable and handle the interrupt generated by " +"the RTC match. You can use the driver provided in the [`arm-gic`](https://" +"docs.rs/arm-gic/) crate to configure the Arm Generic Interrupt Controller." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:12 +msgid "Use the RTC interrupt, which is wired to the GIC as `IntId::spi(2)`." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:13 +msgid "" +"Once the interrupt is enabled, you can put the core to sleep via `arm_gic::" +"wfi()`, which will cause the core to sleep until it receives an interrupt." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:16 +msgid "" +"Download the [exercise template](../../comprehensive-rust-exercises.zip) and " +"look in the `rtc` directory for the following files." +msgstr "" + +#: src/exercises/bare-metal/rtc.md:23 +msgid "" +"```rust,compile_fail\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"mod exceptions;\n" +"mod logger;\n" +"mod pl011;\n" +"\n" +"use crate::pl011::Uart;\n" +"use arm_gic::gicv3::GicV3;\n" +"use core::panic::PanicInfo;\n" +"use log::{error, info, trace, LevelFilter};\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"/// Base addresses of the GICv3.\n" +"const GICD_BASE_ADDRESS: *mut u64 = 0x800_0000 as _;\n" +"const GICR_BASE_ADDRESS: *mut u64 = 0x80A_0000 as _;\n" +"\n" +"/// Base address of the primary PL011 UART.\n" +"const PL011_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {\n" +" // Safe because `PL011_BASE_ADDRESS` is the base address of a PL011 " +"device,\n" +" // and nothing else accesses that address range.\n" +" let uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };\n" +" logger::init(uart, LevelFilter::Trace).unwrap();\n" +"\n" +" info!(\"main({:#x}, {:#x}, {:#x}, {:#x})\", x0, x1, x2, x3);\n" +"\n" +" // Safe because `GICD_BASE_ADDRESS` and `GICR_BASE_ADDRESS` are the " +"base\n" +" // addresses of a GICv3 distributor and redistributor respectively, and\n" +" // nothing else accesses those address ranges.\n" +" let mut gic = unsafe { GicV3::new(GICD_BASE_ADDRESS, " +"GICR_BASE_ADDRESS) };\n" +" gic.setup();\n" +"\n" +" // TODO: Create instance of RTC driver and print current time.\n" +"\n" +" // TODO: Wait for 3 seconds.\n" +"\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[panic_handler]\n" +"fn panic(info: &PanicInfo) -> ! {\n" +" error!(\"{info}\");\n" +" system_off::().unwrap();\n" +" loop {}\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:75 +msgid "" +"`src/exceptions.rs` (you should only need to change this for the 3rd part of " +"the exercise):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:79 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"use arm_gic::gicv3::GicV3;\n" +"use log::{error, info, trace};\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn sync_exception_current(_elr: u64, _spsr: u64) {\n" +" error!(\"sync_exception_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn irq_current(_elr: u64, _spsr: u64) {\n" +" trace!(\"irq_current\");\n" +" let intid = GicV3::get_and_acknowledge_interrupt().expect(\"No pending " +"interrupt\");\n" +" info!(\"IRQ {intid:?}\");\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn fiq_current(_elr: u64, _spsr: u64) {\n" +" error!(\"fiq_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn serr_current(_elr: u64, _spsr: u64) {\n" +" error!(\"serr_current\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn sync_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"sync_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn irq_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"irq_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn fiq_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"fiq_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[no_mangle]\n" +"extern \"C\" fn serr_lower(_elr: u64, _spsr: u64) {\n" +" error!(\"serr_lower\");\n" +" system_off::().unwrap();\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:149 +msgid "`src/logger.rs` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:153 +#, fuzzy +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: main\n" +"use crate::pl011::Uart;\n" +"use core::fmt::Write;\n" +"use log::{LevelFilter, Log, Metadata, Record, SetLoggerError};\n" +"use spin::mutex::SpinMutex;\n" +"\n" +"static LOGGER: Logger = Logger {\n" +" uart: SpinMutex::new(None),\n" +"};\n" +"\n" +"struct Logger {\n" +" uart: SpinMutex>,\n" +"}\n" +"\n" +"impl Log for Logger {\n" +" fn enabled(&self, _metadata: &Metadata) -> bool {\n" +" true\n" +" }\n" +"\n" +" fn log(&self, record: &Record) {\n" +" writeln!(\n" +" self.uart.lock().as_mut().unwrap(),\n" +" \"[{}] {}\",\n" +" record.level(),\n" +" record.args()\n" +" )\n" +" .unwrap();\n" +" }\n" +"\n" +" fn flush(&self) {}\n" +"}\n" +"\n" +"/// Initialises UART logger.\n" +"pub fn init(uart: Uart, max_level: LevelFilter) -> Result<(), " +"SetLoggerError> {\n" +" LOGGER.uart.lock().replace(uart);\n" +"\n" +" log::set_logger(&LOGGER)?;\n" +" log::set_max_level(max_level);\n" +" Ok(())\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use crate::pl011::Uart;\n" +"use core::fmt::Write;\n" +"use log::{LevelFilter, Log, Metadata, Record, SetLoggerError};\n" +"use spin::mutex::SpinMutex;\n" +"\n" +"static LOGGER: Logger = Logger {\n" +" uart: SpinMutex::new(None),\n" +"};\n" +"\n" +"struct Logger {\n" +" uart: SpinMutex>,\n" +"}\n" +"\n" +"impl Log for Logger {\n" +" fn enabled(&self, _metadata: &Metadata) -> bool {\n" +" true\n" +" }\n" +"\n" +" fn log(&self, record: &Record) {\n" +" writeln!(\n" +" self.uart.lock().as_mut().unwrap(),\n" +" \"[{}] {}\",\n" +" record.level(),\n" +" record.args()\n" +" )\n" +" .unwrap();\n" +" }\n" +"\n" +" fn flush(&self) {}\n" +"}\n" +"\n" +"/// UART ๋กœ๊ฑฐ๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.\n" +"pub fn init(uart: Uart, max_level: LevelFilter) -> Result<(), " +"SetLoggerError> {\n" +" LOGGER.uart.lock().replace(uart);\n" +"\n" +" log::set_logger(&LOGGER)?;\n" +" log::set_max_level(max_level);\n" +" Ok(())\n" +"}\n" +"```" + +#: src/exercises/bare-metal/rtc.md:210 +msgid "`src/pl011.rs` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:214 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"#![allow(unused)]\n" +"\n" +"use core::fmt::{self, Write};\n" +"use core::ptr::{addr_of, addr_of_mut};\n" +"\n" +"// ANCHOR: Flags\n" +"use bitflags::bitflags;\n" +"\n" +"bitflags! {\n" +" /// Flags from the UART flag register.\n" +" #[repr(transparent)]\n" +" #[derive(Copy, Clone, Debug, Eq, PartialEq)]\n" +" struct Flags: u16 {\n" +" /// Clear to send.\n" +" const CTS = 1 << 0;\n" +" /// Data set ready.\n" +" const DSR = 1 << 1;\n" +" /// Data carrier detect.\n" +" const DCD = 1 << 2;\n" +" /// UART busy transmitting data.\n" +" const BUSY = 1 << 3;\n" +" /// Receive FIFO is empty.\n" +" const RXFE = 1 << 4;\n" +" /// Transmit FIFO is full.\n" +" const TXFF = 1 << 5;\n" +" /// Receive FIFO is full.\n" +" const RXFF = 1 << 6;\n" +" /// Transmit FIFO is empty.\n" +" const TXFE = 1 << 7;\n" +" /// Ring indicator.\n" +" const RI = 1 << 8;\n" +" }\n" +"}\n" +"// ANCHOR_END: Flags\n" +"\n" +"bitflags! {\n" +" /// Flags from the UART Receive Status Register / Error Clear Register.\n" +" #[repr(transparent)]\n" +" #[derive(Copy, Clone, Debug, Eq, PartialEq)]\n" +" struct ReceiveStatus: u16 {\n" +" /// Framing error.\n" +" const FE = 1 << 0;\n" +" /// Parity error.\n" +" const PE = 1 << 1;\n" +" /// Break error.\n" +" const BE = 1 << 2;\n" +" /// Overrun error.\n" +" const OE = 1 << 3;\n" +" }\n" +"}\n" +"\n" +"// ANCHOR: Registers\n" +"#[repr(C, align(4))]\n" +"struct Registers {\n" +" dr: u16,\n" +" _reserved0: [u8; 2],\n" +" rsr: ReceiveStatus,\n" +" _reserved1: [u8; 19],\n" +" fr: Flags,\n" +" _reserved2: [u8; 6],\n" +" ilpr: u8,\n" +" _reserved3: [u8; 3],\n" +" ibrd: u16,\n" +" _reserved4: [u8; 2],\n" +" fbrd: u8,\n" +" _reserved5: [u8; 3],\n" +" lcr_h: u8,\n" +" _reserved6: [u8; 3],\n" +" cr: u16,\n" +" _reserved7: [u8; 3],\n" +" ifls: u8,\n" +" _reserved8: [u8; 3],\n" +" imsc: u16,\n" +" _reserved9: [u8; 2],\n" +" ris: u16,\n" +" _reserved10: [u8; 2],\n" +" mis: u16,\n" +" _reserved11: [u8; 2],\n" +" icr: u16,\n" +" _reserved12: [u8; 2],\n" +" dmacr: u8,\n" +" _reserved13: [u8; 3],\n" +"}\n" +"// ANCHOR_END: Registers\n" +"\n" +"// ANCHOR: Uart\n" +"/// Driver for a PL011 UART.\n" +"#[derive(Debug)]\n" +"pub struct Uart {\n" +" registers: *mut Registers,\n" +"}\n" +"\n" +"impl Uart {\n" +" /// Constructs a new instance of the UART driver for a PL011 device at " +"the\n" +" /// given base address.\n" +" ///\n" +" /// # Safety\n" +" ///\n" +" /// The given base address must point to the MMIO control registers of " +"a\n" +" /// PL011 device, which must be mapped into the address space of the " +"process\n" +" /// as device memory and not have any other aliases.\n" +" pub unsafe fn new(base_address: *mut u32) -> Self {\n" +" Self {\n" +" registers: base_address as *mut Registers,\n" +" }\n" +" }\n" +"\n" +" /// Writes a single byte to the UART.\n" +" pub fn write_byte(&self, byte: u8) {\n" +" // Wait until there is room in the TX buffer.\n" +" while self.read_flag_register().contains(Flags::TXFF) {}\n" +"\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL011 device which is appropriately mapped.\n" +" unsafe {\n" +" // Write to the TX buffer.\n" +" addr_of_mut!((*self.registers).dr).write_volatile(byte.into());\n" +" }\n" +"\n" +" // Wait until the UART is no longer busy.\n" +" while self.read_flag_register().contains(Flags::BUSY) {}\n" +" }\n" +"\n" +" /// Reads and returns a pending byte, or `None` if nothing has been " +"received.\n" +" pub fn read_byte(&self) -> Option {\n" +" if self.read_flag_register().contains(Flags::RXFE) {\n" +" None\n" +" } else {\n" +" let data = unsafe { addr_of!((*self.registers).dr)." +"read_volatile() };\n" +" // TODO: Check for error conditions in bits 8-11.\n" +" Some(data as u8)\n" +" }\n" +" }\n" +"\n" +" fn read_flag_register(&self) -> Flags {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL011 device which is appropriately mapped.\n" +" unsafe { addr_of!((*self.registers).fr).read_volatile() }\n" +" }\n" +"}\n" +"// ANCHOR_END: Uart\n" +"\n" +"impl Write for Uart {\n" +" fn write_str(&mut self, s: &str) -> fmt::Result {\n" +" for c in s.as_bytes() {\n" +" self.write_byte(*c);\n" +" }\n" +" Ok(())\n" +" }\n" +"}\n" +"\n" +"// Safe because it just contains a pointer to device memory, which can be\n" +"// accessed from any context.\n" +"unsafe impl Send for Uart {}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:389 +msgid "" +"```toml\n" +"[workspace]\n" +"\n" +"[package]\n" +"name = \"rtc\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"publish = false\n" +"\n" +"[dependencies]\n" +"arm-gic = \"0.1.0\"\n" +"bitflags = \"2.0.0\"\n" +"chrono = { version = \"0.4.24\", default-features = false }\n" +"log = \"0.4.17\"\n" +"smccc = \"0.1.1\"\n" +"spin = \"0.9.8\"\n" +"\n" +"[build-dependencies]\n" +"cc = \"1.0.73\"\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:410 +msgid "`build.rs` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:414 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"use cc::Build;\n" +"use std::env;\n" +"\n" +"fn main() {\n" +" #[cfg(target_os = \"linux\")]\n" +" env::set_var(\"CROSS_COMPILE\", \"aarch64-linux-gnu\");\n" +" #[cfg(not(target_os = \"linux\"))]\n" +" env::set_var(\"CROSS_COMPILE\", \"aarch64-none-elf\");\n" +"\n" +" Build::new()\n" +" .file(\"entry.S\")\n" +" .file(\"exceptions.S\")\n" +" .file(\"idmap.S\")\n" +" .compile(\"empty\")\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:446 +msgid "`entry.S` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:450 +msgid "" +"```armasm\n" +"/*\n" +" * Copyright 2023 Google LLC\n" +" *\n" +" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +" * you may not use this file except in compliance with the License.\n" +" * You may obtain a copy of the License at\n" +" *\n" +" * https://www.apache.org/licenses/LICENSE-2.0\n" +" *\n" +" * Unless required by applicable law or agreed to in writing, software\n" +" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +" * See the License for the specific language governing permissions and\n" +" * limitations under the License.\n" +" */\n" +"\n" +".macro adr_l, reg:req, sym:req\n" +"\tadrp \\reg, \\sym\n" +"\tadd \\reg, \\reg, :lo12:\\sym\n" +".endm\n" +"\n" +".macro mov_i, reg:req, imm:req\n" +"\tmovz \\reg, :abs_g3:\\imm\n" +"\tmovk \\reg, :abs_g2_nc:\\imm\n" +"\tmovk \\reg, :abs_g1_nc:\\imm\n" +"\tmovk \\reg, :abs_g0_nc:\\imm\n" +".endm\n" +"\n" +".set .L_MAIR_DEV_nGnRE,\t0x04\n" +".set .L_MAIR_MEM_WBWA,\t0xff\n" +".set .Lmairval, .L_MAIR_DEV_nGnRE | (.L_MAIR_MEM_WBWA << 8)\n" +"\n" +"/* 4 KiB granule size for TTBR0_EL1. */\n" +".set .L_TCR_TG0_4KB, 0x0 << 14\n" +"/* 4 KiB granule size for TTBR1_EL1. */\n" +".set .L_TCR_TG1_4KB, 0x2 << 30\n" +"/* Disable translation table walk for TTBR1_EL1, generating a translation " +"fault instead. */\n" +".set .L_TCR_EPD1, 0x1 << 23\n" +"/* Translation table walks for TTBR0_EL1 are inner sharable. */\n" +".set .L_TCR_SH_INNER, 0x3 << 12\n" +"/*\n" +" * Translation table walks for TTBR0_EL1 are outer write-back read-allocate " +"write-allocate\n" +" * cacheable.\n" +" */\n" +".set .L_TCR_RGN_OWB, 0x1 << 10\n" +"/*\n" +" * Translation table walks for TTBR0_EL1 are inner write-back read-allocate " +"write-allocate\n" +" * cacheable.\n" +" */\n" +".set .L_TCR_RGN_IWB, 0x1 << 8\n" +"/* Size offset for TTBR0_EL1 is 2**39 bytes (512 GiB). */\n" +".set .L_TCR_T0SZ_512, 64 - 39\n" +".set .Ltcrval, .L_TCR_TG0_4KB | .L_TCR_TG1_4KB | .L_TCR_EPD1 | ." +"L_TCR_RGN_OWB\n" +".set .Ltcrval, .Ltcrval | .L_TCR_RGN_IWB | .L_TCR_SH_INNER | ." +"L_TCR_T0SZ_512\n" +"\n" +"/* Stage 1 instruction access cacheability is unaffected. */\n" +".set .L_SCTLR_ELx_I, 0x1 << 12\n" +"/* SP alignment fault if SP is not aligned to a 16 byte boundary. */\n" +".set .L_SCTLR_ELx_SA, 0x1 << 3\n" +"/* Stage 1 data access cacheability is unaffected. */\n" +".set .L_SCTLR_ELx_C, 0x1 << 2\n" +"/* EL0 and EL1 stage 1 MMU enabled. */\n" +".set .L_SCTLR_ELx_M, 0x1 << 0\n" +"/* Privileged Access Never is unchanged on taking an exception to EL1. */\n" +".set .L_SCTLR_EL1_SPAN, 0x1 << 23\n" +"/* SETEND instruction disabled at EL0 in aarch32 mode. */\n" +".set .L_SCTLR_EL1_SED, 0x1 << 8\n" +"/* Various IT instructions are disabled at EL0 in aarch32 mode. */\n" +".set .L_SCTLR_EL1_ITD, 0x1 << 7\n" +".set .L_SCTLR_EL1_RES1, (0x1 << 11) | (0x1 << 20) | (0x1 << 22) | (0x1 << " +"28) | (0x1 << 29)\n" +".set .Lsctlrval, .L_SCTLR_ELx_M | .L_SCTLR_ELx_C | .L_SCTLR_ELx_SA | ." +"L_SCTLR_EL1_ITD | .L_SCTLR_EL1_SED\n" +".set .Lsctlrval, .Lsctlrval | .L_SCTLR_ELx_I | .L_SCTLR_EL1_SPAN | ." +"L_SCTLR_EL1_RES1\n" +"\n" +"/**\n" +" * This is a generic entry point for an image. It carries out the operations " +"required to prepare the\n" +" * loaded image to be run. Specifically, it zeroes the bss section using " +"registers x25 and above,\n" +" * prepares the stack, enables floating point, and sets up the exception " +"vector. It preserves x0-x3\n" +" * for the Rust entry point, as these may contain boot parameters.\n" +" */\n" +".section .init.entry, \"ax\"\n" +".global entry\n" +"entry:\n" +"\t/* Load and apply the memory management configuration, ready to enable MMU " +"and caches. */\n" +"\tadrp x30, idmap\n" +"\tmsr ttbr0_el1, x30\n" +"\n" +"\tmov_i x30, .Lmairval\n" +"\tmsr mair_el1, x30\n" +"\n" +"\tmov_i x30, .Ltcrval\n" +"\t/* Copy the supported PA range into TCR_EL1.IPS. */\n" +"\tmrs x29, id_aa64mmfr0_el1\n" +"\tbfi x30, x29, #32, #4\n" +"\n" +"\tmsr tcr_el1, x30\n" +"\n" +"\tmov_i x30, .Lsctlrval\n" +"\n" +"\t/*\n" +"\t * Ensure everything before this point has completed, then invalidate any " +"potentially stale\n" +"\t * local TLB entries before they start being used.\n" +"\t */\n" +"\tisb\n" +"\ttlbi vmalle1\n" +"\tic iallu\n" +"\tdsb nsh\n" +"\tisb\n" +"\n" +"\t/*\n" +"\t * Configure sctlr_el1 to enable MMU and cache and don't proceed until " +"this has completed.\n" +"\t */\n" +"\tmsr sctlr_el1, x30\n" +"\tisb\n" +"\n" +"\t/* Disable trapping floating point access in EL1. */\n" +"\tmrs x30, cpacr_el1\n" +"\torr x30, x30, #(0x3 << 20)\n" +"\tmsr cpacr_el1, x30\n" +"\tisb\n" +"\n" +"\t/* Zero out the bss section. */\n" +"\tadr_l x29, bss_begin\n" +"\tadr_l x30, bss_end\n" +"0:\tcmp x29, x30\n" +"\tb.hs 1f\n" +"\tstp xzr, xzr, [x29], #16\n" +"\tb 0b\n" +"\n" +"1:\t/* Prepare the stack. */\n" +"\tadr_l x30, boot_stack_end\n" +"\tmov sp, x30\n" +"\n" +"\t/* Set up exception vector. */\n" +"\tadr x30, vector_table_el1\n" +"\tmsr vbar_el1, x30\n" +"\n" +"\t/* Call into Rust code. */\n" +"\tbl main\n" +"\n" +"\t/* Loop forever waiting for interrupts. */\n" +"2:\twfi\n" +"\tb 2b\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:595 +msgid "`exceptions.S` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:599 +msgid "" +"```armasm\n" +"/*\n" +" * Copyright 2023 Google LLC\n" +" *\n" +" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +" * you may not use this file except in compliance with the License.\n" +" * You may obtain a copy of the License at\n" +" *\n" +" * https://www.apache.org/licenses/LICENSE-2.0\n" +" *\n" +" * Unless required by applicable law or agreed to in writing, software\n" +" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +" * See the License for the specific language governing permissions and\n" +" * limitations under the License.\n" +" */\n" +"\n" +"/**\n" +" * Saves the volatile registers onto the stack. This currently takes 14\n" +" * instructions, so it can be used in exception handlers with 18 " +"instructions\n" +" * left.\n" +" *\n" +" * On return, x0 and x1 are initialised to elr_el2 and spsr_el2 " +"respectively,\n" +" * which can be used as the first and second arguments of a subsequent " +"call.\n" +" */\n" +".macro save_volatile_to_stack\n" +"\t/* Reserve stack space and save registers x0-x18, x29 & x30. */\n" +"\tstp x0, x1, [sp, #-(8 * 24)]!\n" +"\tstp x2, x3, [sp, #8 * 2]\n" +"\tstp x4, x5, [sp, #8 * 4]\n" +"\tstp x6, x7, [sp, #8 * 6]\n" +"\tstp x8, x9, [sp, #8 * 8]\n" +"\tstp x10, x11, [sp, #8 * 10]\n" +"\tstp x12, x13, [sp, #8 * 12]\n" +"\tstp x14, x15, [sp, #8 * 14]\n" +"\tstp x16, x17, [sp, #8 * 16]\n" +"\tstr x18, [sp, #8 * 18]\n" +"\tstp x29, x30, [sp, #8 * 20]\n" +"\n" +"\t/*\n" +"\t * Save elr_el1 & spsr_el1. This such that we can take nested exception\n" +"\t * and still be able to unwind.\n" +"\t */\n" +"\tmrs x0, elr_el1\n" +"\tmrs x1, spsr_el1\n" +"\tstp x0, x1, [sp, #8 * 22]\n" +".endm\n" +"\n" +"/**\n" +" * Restores the volatile registers from the stack. This currently takes 14\n" +" * instructions, so it can be used in exception handlers while still leaving " +"18\n" +" * instructions left; if paired with save_volatile_to_stack, there are 4\n" +" * instructions to spare.\n" +" */\n" +".macro restore_volatile_from_stack\n" +"\t/* Restore registers x2-x18, x29 & x30. */\n" +"\tldp x2, x3, [sp, #8 * 2]\n" +"\tldp x4, x5, [sp, #8 * 4]\n" +"\tldp x6, x7, [sp, #8 * 6]\n" +"\tldp x8, x9, [sp, #8 * 8]\n" +"\tldp x10, x11, [sp, #8 * 10]\n" +"\tldp x12, x13, [sp, #8 * 12]\n" +"\tldp x14, x15, [sp, #8 * 14]\n" +"\tldp x16, x17, [sp, #8 * 16]\n" +"\tldr x18, [sp, #8 * 18]\n" +"\tldp x29, x30, [sp, #8 * 20]\n" +"\n" +"\t/* Restore registers elr_el1 & spsr_el1, using x0 & x1 as scratch. */\n" +"\tldp x0, x1, [sp, #8 * 22]\n" +"\tmsr elr_el1, x0\n" +"\tmsr spsr_el1, x1\n" +"\n" +"\t/* Restore x0 & x1, and release stack space. */\n" +"\tldp x0, x1, [sp], #8 * 24\n" +".endm\n" +"\n" +"/**\n" +" * This is a generic handler for exceptions taken at the current EL while " +"using\n" +" * SP0. It behaves similarly to the SPx case by first switching to SPx, " +"doing\n" +" * the work, then switching back to SP0 before returning.\n" +" *\n" +" * Switching to SPx and calling the Rust handler takes 16 instructions. To\n" +" * restore and return we need an additional 16 instructions, so we can " +"implement\n" +" * the whole handler within the allotted 32 instructions.\n" +" */\n" +".macro current_exception_sp0 handler:req\n" +"\tmsr spsel, #1\n" +"\tsave_volatile_to_stack\n" +"\tbl \\handler\n" +"\trestore_volatile_from_stack\n" +"\tmsr spsel, #0\n" +"\teret\n" +".endm\n" +"\n" +"/**\n" +" * This is a generic handler for exceptions taken at the current EL while " +"using\n" +" * SPx. It saves volatile registers, calls the Rust handler, restores " +"volatile\n" +" * registers, then returns.\n" +" *\n" +" * This also works for exceptions taken from EL0, if we don't care about\n" +" * non-volatile registers.\n" +" *\n" +" * Saving state and jumping to the Rust handler takes 15 instructions, and\n" +" * restoring and returning also takes 15 instructions, so we can fit the " +"whole\n" +" * handler in 30 instructions, under the limit of 32.\n" +" */\n" +".macro current_exception_spx handler:req\n" +"\tsave_volatile_to_stack\n" +"\tbl \\handler\n" +"\trestore_volatile_from_stack\n" +"\teret\n" +".endm\n" +"\n" +".section .text.vector_table_el1, \"ax\"\n" +".global vector_table_el1\n" +".balign 0x800\n" +"vector_table_el1:\n" +"sync_cur_sp0:\n" +"\tcurrent_exception_sp0 sync_exception_current\n" +"\n" +".balign 0x80\n" +"irq_cur_sp0:\n" +"\tcurrent_exception_sp0 irq_current\n" +"\n" +".balign 0x80\n" +"fiq_cur_sp0:\n" +"\tcurrent_exception_sp0 fiq_current\n" +"\n" +".balign 0x80\n" +"serr_cur_sp0:\n" +"\tcurrent_exception_sp0 serr_current\n" +"\n" +".balign 0x80\n" +"sync_cur_spx:\n" +"\tcurrent_exception_spx sync_exception_current\n" +"\n" +".balign 0x80\n" +"irq_cur_spx:\n" +"\tcurrent_exception_spx irq_current\n" +"\n" +".balign 0x80\n" +"fiq_cur_spx:\n" +"\tcurrent_exception_spx fiq_current\n" +"\n" +".balign 0x80\n" +"serr_cur_spx:\n" +"\tcurrent_exception_spx serr_current\n" +"\n" +".balign 0x80\n" +"sync_lower_64:\n" +"\tcurrent_exception_spx sync_lower\n" +"\n" +".balign 0x80\n" +"irq_lower_64:\n" +"\tcurrent_exception_spx irq_lower\n" +"\n" +".balign 0x80\n" +"fiq_lower_64:\n" +"\tcurrent_exception_spx fiq_lower\n" +"\n" +".balign 0x80\n" +"serr_lower_64:\n" +"\tcurrent_exception_spx serr_lower\n" +"\n" +".balign 0x80\n" +"sync_lower_32:\n" +"\tcurrent_exception_spx sync_lower\n" +"\n" +".balign 0x80\n" +"irq_lower_32:\n" +"\tcurrent_exception_spx irq_lower\n" +"\n" +".balign 0x80\n" +"fiq_lower_32:\n" +"\tcurrent_exception_spx fiq_lower\n" +"\n" +".balign 0x80\n" +"serr_lower_32:\n" +"\tcurrent_exception_spx serr_lower\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:780 +msgid "`idmap.S` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:784 +msgid "" +"```armasm\n" +"/*\n" +" * Copyright 2023 Google LLC\n" +" *\n" +" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +" * you may not use this file except in compliance with the License.\n" +" * You may obtain a copy of the License at\n" +" *\n" +" * https://www.apache.org/licenses/LICENSE-2.0\n" +" *\n" +" * Unless required by applicable law or agreed to in writing, software\n" +" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +" * See the License for the specific language governing permissions and\n" +" * limitations under the License.\n" +" */\n" +"\n" +".set .L_TT_TYPE_BLOCK, 0x1\n" +".set .L_TT_TYPE_PAGE, 0x3\n" +".set .L_TT_TYPE_TABLE, 0x3\n" +"\n" +"/* Access flag. */\n" +".set .L_TT_AF, 0x1 << 10\n" +"/* Not global. */\n" +".set .L_TT_NG, 0x1 << 11\n" +".set .L_TT_XN, 0x3 << 53\n" +"\n" +".set .L_TT_MT_DEV, 0x0 << 2\t\t\t// MAIR #0 (DEV_nGnRE)\n" +".set .L_TT_MT_MEM, (0x1 << 2) | (0x3 << 8)\t// MAIR #1 (MEM_WBWA), inner " +"shareable\n" +"\n" +".set .L_BLOCK_DEV, .L_TT_TYPE_BLOCK | .L_TT_MT_DEV | .L_TT_AF | .L_TT_XN\n" +".set .L_BLOCK_MEM, .L_TT_TYPE_BLOCK | .L_TT_MT_MEM | .L_TT_AF | .L_TT_NG\n" +"\n" +".section \".rodata.idmap\", \"a\", %progbits\n" +".global idmap\n" +".align 12\n" +"idmap:\n" +"\t/* level 1 */\n" +"\t.quad\t\t.L_BLOCK_DEV | 0x0\t\t // 1 GiB of device mappings\n" +"\t.quad\t\t.L_BLOCK_MEM | 0x40000000\t// 1 GiB of DRAM\n" +"\t.fill\t\t254, 8, 0x0\t\t\t// 254 GiB of unmapped VA space\n" +"\t.quad\t\t.L_BLOCK_DEV | 0x4000000000 // 1 GiB of device mappings\n" +"\t.fill\t\t255, 8, 0x0\t\t\t// 255 GiB of remaining VA space\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:829 +msgid "`image.ld` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:833 +msgid "" +"```ld\n" +"/*\n" +" * Copyright 2023 Google LLC\n" +" *\n" +" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" +" * you may not use this file except in compliance with the License.\n" +" * You may obtain a copy of the License at\n" +" *\n" +" * https://www.apache.org/licenses/LICENSE-2.0\n" +" *\n" +" * Unless required by applicable law or agreed to in writing, software\n" +" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" +" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +" * See the License for the specific language governing permissions and\n" +" * limitations under the License.\n" +" */\n" +"\n" +"/*\n" +" * Code will start running at this symbol which is placed at the start of " +"the\n" +" * image.\n" +" */\n" +"ENTRY(entry)\n" +"\n" +"MEMORY\n" +"{\n" +"\timage : ORIGIN = 0x40080000, LENGTH = 2M\n" +"}\n" +"\n" +"SECTIONS\n" +"{\n" +"\t/*\n" +"\t * Collect together the code.\n" +"\t */\n" +"\t.init : ALIGN(4096) {\n" +"\t\ttext_begin = .;\n" +"\t\t*(.init.entry)\n" +"\t\t*(.init.*)\n" +"\t} >image\n" +"\t.text : {\n" +"\t\t*(.text.*)\n" +"\t} >image\n" +"\ttext_end = .;\n" +"\n" +"\t/*\n" +"\t * Collect together read-only data.\n" +"\t */\n" +"\t.rodata : ALIGN(4096) {\n" +"\t\trodata_begin = .;\n" +"\t\t*(.rodata.*)\n" +"\t} >image\n" +"\t.got : {\n" +"\t\t*(.got)\n" +"\t} >image\n" +"\trodata_end = .;\n" +"\n" +"\t/*\n" +"\t * Collect together the read-write data including .bss at the end which\n" +"\t * will be zero'd by the entry code.\n" +"\t */\n" +"\t.data : ALIGN(4096) {\n" +"\t\tdata_begin = .;\n" +"\t\t*(.data.*)\n" +"\t\t/*\n" +"\t\t * The entry point code assumes that .data is a multiple of 32\n" +"\t\t * bytes long.\n" +"\t\t */\n" +"\t\t. = ALIGN(32);\n" +"\t\tdata_end = .;\n" +"\t} >image\n" +"\n" +"\t/* Everything beyond this point will not be included in the binary. */\n" +"\tbin_end = .;\n" +"\n" +"\t/* The entry point code assumes that .bss is 16-byte aligned. */\n" +"\t.bss : ALIGN(16) {\n" +"\t\tbss_begin = .;\n" +"\t\t*(.bss.*)\n" +"\t\t*(COMMON)\n" +"\t\t. = ALIGN(16);\n" +"\t\tbss_end = .;\n" +"\t} >image\n" +"\n" +"\t.stack (NOLOAD) : ALIGN(4096) {\n" +"\t\tboot_stack_begin = .;\n" +"\t\t. += 40 * 4096;\n" +"\t\t. = ALIGN(4096);\n" +"\t\tboot_stack_end = .;\n" +"\t} >image\n" +"\n" +"\t. = ALIGN(4K);\n" +"\tPROVIDE(dma_region = .);\n" +"\n" +"\t/*\n" +"\t * Remove unused sections from the image.\n" +"\t */\n" +"\t/DISCARD/ : {\n" +"\t\t/* The image loads itself so doesn't need these sections. */\n" +"\t\t*(.gnu.hash)\n" +"\t\t*(.hash)\n" +"\t\t*(.interp)\n" +"\t\t*(.eh_frame_hdr)\n" +"\t\t*(.eh_frame)\n" +"\t\t*(.note.gnu.build-id)\n" +"\t}\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:940 +msgid "`Makefile` (you shouldn't need to change this):" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:944 +msgid "" +"```makefile\n" +"# Copyright 2023 Google LLC\n" +"#\n" +"# Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"# you may not use this file except in compliance with the License.\n" +"# You may obtain a copy of the License at\n" +"#\n" +"# http://www.apache.org/licenses/LICENSE-2.0\n" +"#\n" +"# Unless required by applicable law or agreed to in writing, software\n" +"# distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"# See the License for the specific language governing permissions and\n" +"# limitations under the License.\n" +"\n" +"UNAME := $(shell uname -s)\n" +"ifeq ($(UNAME),Linux)\n" +"\tTARGET = aarch64-linux-gnu\n" +"else\n" +"\tTARGET = aarch64-none-elf\n" +"endif\n" +"OBJCOPY = $(TARGET)-objcopy\n" +"\n" +".PHONY: build qemu_minimal qemu qemu_logger\n" +"\n" +"all: rtc.bin\n" +"\n" +"build:\n" +"\tcargo build\n" +"\n" +"rtc.bin: build\n" +"\t$(OBJCOPY) -O binary target/aarch64-unknown-none/debug/rtc $@\n" +"\n" +"qemu: rtc.bin\n" +"\tqemu-system-aarch64 -machine virt,gic-version=3 -cpu max -serial mon:stdio " +"-display none -kernel $< -s\n" +"\n" +"clean:\n" +"\tcargo clean\n" +"\trm -f *.bin\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:989 +msgid "" +"```toml\n" +"[build]\n" +"target = \"aarch64-unknown-none\"\n" +"rustflags = [\"-C\", \"link-arg=-Timage.ld\"]\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/rtc.md:995 +msgid "Run the code in QEMU with `make qemu`." +msgstr "" + +#: src/concurrency.md:1 +#, fuzzy +msgid "Welcome to Concurrency in Rust" +msgstr "Welcome to Comprehensive Rust ๐Ÿฆ€" + +#: src/concurrency.md:3 +msgid "" +"Rust has full support for concurrency using OS threads with mutexes and " +"channels." +msgstr "" +"๋Ÿฌ์ŠคํŠธ๋Š” ๋™์‹œ์„ฑ ์ง€์›์ด ๋ง‰๊ฐ•ํ•ฉ๋‹ˆ๋‹ค. ์šด์˜์ฒด์ œ ๋ ˆ๋ฒจ์˜ ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ๋ฎคํƒ์Šค" +"์™€ ์ฑ„๋„๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency.md:6 +msgid "" +"The Rust type system plays an important role in making many concurrency bugs " +"compile time bugs. This is often referred to as _fearless concurrency_ since " +"you can rely on the compiler to ensure correctness at runtime." +msgstr "" +"๋Ÿฌ์ŠคํŠธ์˜ ํƒ€์ž… ์‹œ์Šคํ…œ์€ ํ”„๋กœ๊ทธ๋žจ์— ๋™์‹œ์„ฑ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์ปดํŒŒ์ผ ์‹œ์— ์—๋Ÿฌ" +"๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ํ•ด ์ค๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ์ด์šฉํ•ด์„œ ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰์‹œ์— ์ •ํ™•ํžˆ ๋™์ž‘" +"ํ•จ์„ ๋ฏธ๋ฆฌ ๋ณด์žฅํ•ด ์ฃผ๊ธฐ ๋•Œ๋ฌธ์—, ์‚ฌ๋žŒ๋“ค์€ ์ด๋ฅผ ์ข…์ข… _๊ฒ์—†๋Š” ๋™์‹œ์„ฑ_ ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ" +"๋‹ค." + +#: src/concurrency/threads.md:3 +msgid "Rust threads work similarly to threads in other languages:" +msgstr "๋Ÿฌ์ŠคํŠธ์˜ ์Šค๋ ˆ๋“œ๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์˜ ์Šค๋ ˆ๋“œ์™€ ์œ ์‚ฌํ•˜๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค:" + +#: src/concurrency/threads.md:5 +msgid "" +"```rust,editable\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" thread::spawn(|| {\n" +" for i in 1..10 {\n" +" println!(\"Count in thread: {i}!\");\n" +" thread::sleep(Duration::from_millis(5));\n" +" }\n" +" });\n" +"\n" +" for i in 1..5 {\n" +" println!(\"Main thread: {i}\");\n" +" thread::sleep(Duration::from_millis(5));\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" thread::spawn(|| {\n" +" for i in 1..10 {\n" +" println!(\"Count in thread: {i}!\");\n" +" thread::sleep(Duration::from_millis(5));\n" +" }\n" +" });\n" +"\n" +" for i in 1..5 {\n" +" println!(\"Main thread: {i}\");\n" +" thread::sleep(Duration::from_millis(5));\n" +" }\n" +"}\n" +"```" + +#: src/concurrency/threads.md:24 +msgid "Threads are all daemon threads, the main thread does not wait for them." +msgstr "" +"์Šค๋ ˆ๋“œ๋Š” ๋ชจ๋‘ ๋ฐ๋ชฌ ์Šค๋ ˆ๋“œ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ๋Š” ์ด ์Šค๋ ˆ๋“œ๋“ค์ด ๋๋‚˜๊ธฐ๋ฅผ " +"๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:25 +msgid "Thread panics are independent of each other." +msgstr "ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ๋ฐœ์ƒํ•œ ํŒจ๋‹‰์€ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—๊ฒŒ ์˜ํ–ฅ์„ ๋ผ์น˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:26 +msgid "Panics can carry a payload, which can be unpacked with `downcast_ref`." +msgstr "" +"ํŒจ๋‹‰์€ ์ถ”๊ฐ€์ •๋ณด(ํŽ˜์ด๋กœ๋“œ)๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด๋Š” `downcast_ref`๋กœ ํ’€์–ด๋ณผ " +"์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:32 +msgid "" +"Notice that the thread is stopped before it reaches 10 โ€” the main thread is " +"not waiting." +msgstr "" +"๋ฉ”์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์ž์‹ ์Šค๋ ˆ๋“œ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ž์‹ ์Šค๋ ˆ๋“œ์˜ for๋ฌธ์€ 10๊นŒ" +"์ง€ ๊ฐ€์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:35 +msgid "" +"Use `let handle = thread::spawn(...)` and later `handle.join()` to wait for " +"the thread to finish." +msgstr "" +"๋งŒ์•ฝ ๋ฉ”์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์ž์‹ ์Šค๋ ˆ๋“œ๊ฐ€ ๋๋‚  ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๊ธฐ๋ฅผ ์›ํ•œ๋‹ค๋ฉด `let " +"handle = thread::spawn(...)`์œผ๋กœ ์Šค๋ ˆ๋“œ๋ฅผ ์„ ์–ธํ•œ ํ›„ `handle.join()`๋กœ ์—ฐ๊ฒฐํ•˜" +"์—ฌ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:38 +msgid "Trigger a panic in the thread, notice how this doesn't affect `main`." +msgstr "" +"์ž์‹ ์Šค๋ ˆ๋“œ์—์„œ ๋ฐœ์ƒํ•œ ํŒจ๋‹‰์ด ๋ฉ”์ธ ์Šค๋ ˆ๋“œ์—๋Š” ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š์Œ์„ ํ™•์ธํ•˜์‹œ๊ธฐ " +"๋ฐ”๋ž๋‹ˆ๋‹ค." + +#: src/concurrency/threads.md:40 +msgid "" +"Use the `Result` return value from `handle.join()` to get access to the " +"panic payload. This is a good time to talk about [`Any`](https://doc.rust-" +"lang.org/std/any/index.html)." +msgstr "" +"`handle.join()`์‚ฌ์šฉ์‹œ `Result` ๋ฐ˜ํ™˜๊ฐ’์„ ํ†ตํ•ด ํŒจ๋‹‰์˜ ์ถ”๊ฐ€์ •๋ณด์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต" +"๋‹ˆ๋‹ค. ์ด ์‹œ์ ์—์„œ [`Any`](https://doc.rust-lang.org/std/any/index.html)์— ๋Œ€" +"ํ•ด ์ด์•ผ๊ธฐ๋ฅผ ํ•ด ๋ณด๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/scoped-threads.md:3 +msgid "Normal threads cannot borrow from their environment:" +msgstr "๋ณดํ†ต, ์Šค๋ ˆ๋“œ๋Š” ์Šค๋ ˆ๋“œ ๋ฐ–์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋นŒ๋ฆด ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/scoped-threads.md:5 +#, fuzzy +msgid "" +"```rust,editable,compile_fail\n" +"use std::thread;\n" +"\n" +"fn foo() {\n" +" let s = String::from(\"Hello\");\n" +" thread::spawn(|| {\n" +" println!(\"Length: {}\", s.len());\n" +" });\n" +"}\n" +"\n" +"fn main() {\n" +" foo();\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let s = String::from(\"Hello\");\n" +"\n" +" thread::spawn(|| {\n" +" println!(\"Length: {}\", s.len());\n" +" });\n" +"}\n" +"```" + +#: src/concurrency/scoped-threads.md:20 +msgid "" +"However, you can use a [scoped thread](https://doc.rust-lang.org/std/thread/" +"fn.scope.html) for this:" +msgstr "" +"ํ•˜์ง€๋งŒ, [scoped thread](https://doc.rust-lang.org/std/thread/fn.scope.html)์—" +"์„œ๋Š” ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค:" + +#: src/concurrency/scoped-threads.md:22 +msgid "" +"```rust,editable\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let s = String::from(\"Hello\");\n" +"\n" +" thread::scope(|scope| {\n" +" scope.spawn(|| {\n" +" println!(\"Length: {}\", s.len());\n" +" });\n" +" });\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let s = String::from(\"Hello\");\n" +"\n" +" thread::scope(|scope| {\n" +" scope.spawn(|| {\n" +" println!(\"Length: {}\", s.len());\n" +" });\n" +" });\n" +"}\n" +"```" + +#: src/concurrency/scoped-threads.md:40 +msgid "" +"The reason for that is that when the `thread::scope` function completes, all " +"the threads are guaranteed to be joined, so they can return borrowed data." +msgstr "" +"`thread::scope` ํ•จ์ˆ˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๊ทธ ์•ˆ์—์„œ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์Šค๋ ˆ๋“œ๋“ค์ด ์ข…๋ฃŒํ–ˆ์Œ์ด " +"๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ๊ทธ ๋•Œ ๋นŒ๋ ธ๋˜ ๋ฐ์ดํ„ฐ๋“ค์„ ๋‹ค์‹œ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/scoped-threads.md:41 +msgid "" +"Normal Rust borrowing rules apply: you can either borrow mutably by one " +"thread, or immutably by any number of threads." +msgstr "" +"์ผ๋ฐ˜์ ์ธ ๋Ÿฌ์ŠคํŠธ์˜ ๋นŒ๋ฆผ ๊ทœ์น™์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค: ํ•œ ์Šค๋ ˆ๋“œ์— ์˜ํ•œ ๊ฐ€๋ณ€ ๋นŒ๋ฆผ ๋˜๋Š” ์—ฌ" +"๋Ÿฌ ์Šค๋ ˆ๋“œ์— ๋Œ€ํ•œ ๋ถˆ๋ณ€ ๋นŒ๋ฆผ์ค‘ ํ•˜๋‚˜๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/channels.md:3 +msgid "" +"Rust channels have two parts: a `Sender` and a `Receiver`. The two " +"parts are connected via the channel, but you only see the end-points." +msgstr "" +"๋Ÿฌ์ŠคํŠธ์˜ ์ฑ„๋„์€ `Sender` ์™€ `Receiver` ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ด ๋‘˜์€ " +"์ฑ„๋„์„ ํ†ตํ•ด ์„œ๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์ง€๋งŒ, ์šฐ๋ฆฌ๋Š” ์ฑ„๋„์„ ๋ณผ ์ˆ˜๋Š” ์—†๊ณ  ์ด ์–‘ ๋๋‹จ๋งŒ์„ " +"์‚ฌ์šฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/channels.md:6 +msgid "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::channel();\n" +"\n" +" tx.send(10).unwrap();\n" +" tx.send(20).unwrap();\n" +"\n" +" println!(\"Received: {:?}\", rx.recv());\n" +" println!(\"Received: {:?}\", rx.recv());\n" +"\n" +" let tx2 = tx.clone();\n" +" tx2.send(30).unwrap();\n" +" println!(\"Received: {:?}\", rx.recv());\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::channel();\n" +"\n" +" tx.send(10).unwrap();\n" +" tx.send(20).unwrap();\n" +"\n" +" println!(\"Received: {:?}\", rx.recv());\n" +" println!(\"Received: {:?}\", rx.recv());\n" +"\n" +" let tx2 = tx.clone();\n" +" tx2.send(30).unwrap();\n" +" println!(\"Received: {:?}\", rx.recv());\n" +"}\n" +"```" + +#: src/concurrency/channels.md:27 +msgid "" +"`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender` " +"implement `Clone` (so you can make multiple producers) but `Receiver` does " +"not." +msgstr "" +"`mpsc`๋Š” โ€œMulti-Produce, Single-Consumerโ€๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. `Sender`์™€ " +"`SyncSender`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•˜์ง€๋งŒ (์ฆ‰, ์—ฌ๋Ÿฌ๊ฐœ์˜ producer๋ฅผ ๋งŒ๋“ค์ˆ˜ ์žˆ์Šต๋‹ˆ" +"๋‹ค) `Receiver`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/channels.md:29 +msgid "" +"`send()` and `recv()` return `Result`. If they return `Err`, it means the " +"counterpart `Sender` or `Receiver` is dropped and the channel is closed." +msgstr "" +"`send()`์™€ `recv()`๋Š” `Result`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์ผ `Err`๊ฐ€ ๋ฐ˜ํ™˜๋œ๋‹ค๋ฉด, ์ƒ๋Œ€๋ฐฉ" +"์˜ `Sender`๋˜๋Š” `Receiver`๊ฐ€ ์‚ญ์ œ๋˜์—ˆ๊ณ  ์ฑ„๋„์ด ๋‹ซํ˜”๋‹ค๋Š” ๋œป์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/channels/unbounded.md:3 +msgid "You get an unbounded and asynchronous channel with `mpsc::channel()`:" +msgstr "`mpsc::channel()` ํ•จ์ˆ˜๋Š” ๊ฒฝ๊ณ„๊ฐ€ ์—†๋Š” ๋น„๋™๊ธฐ ์ฑ„๋„์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:" + +#: src/concurrency/channels/unbounded.md:5 +msgid "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::channel();\n" +"\n" +" thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" for i in 1..10 {\n" +" tx.send(format!(\"Message {i}\")).unwrap();\n" +" println!(\"{thread_id:?}: sent Message {i}\");\n" +" }\n" +" println!(\"{thread_id:?}: done\");\n" +" });\n" +" thread::sleep(Duration::from_millis(100));\n" +"\n" +" for msg in rx.iter() {\n" +" println!(\"Main: got {msg}\");\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::channel();\n" +"\n" +" thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" for i in 1..10 {\n" +" tx.send(format!(\"Message {i}\")).unwrap();\n" +" println!(\"{thread_id:?}: sent Message {i}\");\n" +" }\n" +" println!(\"{thread_id:?}: done\");\n" +" });\n" +" thread::sleep(Duration::from_millis(100));\n" +"\n" +" for msg in rx.iter() {\n" +" println!(\"Main: got {msg}\");\n" +" }\n" +"}\n" +"```" + +#: src/concurrency/channels/bounded.md:3 +#, fuzzy +msgid "" +"With bounded (synchronous) channels, `send` can block the current thread:" +msgstr "๊ฒฝ๊ณ„๊ฐ€ ์žˆ๋Š” ๋™๊ธฐ ์ฑ„๋„์€ `send`๊ฐ€ ํ˜„์ œ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กœํ‚น ํ•˜๋„๋ก ๋งŒ๋“ญ๋‹ˆ๋‹ค:" + +#: src/concurrency/channels/bounded.md:5 +msgid "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::sync_channel(3);\n" +"\n" +" thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" for i in 1..10 {\n" +" tx.send(format!(\"Message {i}\")).unwrap();\n" +" println!(\"{thread_id:?}: sent Message {i}\");\n" +" }\n" +" println!(\"{thread_id:?}: done\");\n" +" });\n" +" thread::sleep(Duration::from_millis(100));\n" +"\n" +" for msg in rx.iter() {\n" +" println!(\"Main: got {msg}\");\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::mpsc;\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"fn main() {\n" +" let (tx, rx) = mpsc::sync_channel(3);\n" +"\n" +" thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" for i in 1..10 {\n" +" tx.send(format!(\"Message {i}\")).unwrap();\n" +" println!(\"{thread_id:?}: sent Message {i}\");\n" +" }\n" +" println!(\"{thread_id:?}: done\");\n" +" });\n" +" thread::sleep(Duration::from_millis(100));\n" +"\n" +" for msg in rx.iter() {\n" +" println!(\"Main: got {msg}\");\n" +" }\n" +"}\n" +"```" + +#: src/concurrency/channels/bounded.md:31 +msgid "" +"Calling `send` will block the current thread until there is space in the " +"channel for the new message. The thread can be blocked indefinitely if there " +"is nobody who reads from the channel." +msgstr "" + +#: src/concurrency/channels/bounded.md:32 +msgid "" +"A call to `send` will abort with an error (that is why it returns `Result`) " +"if the channel is closed. A channel is closed when the receiver is dropped." +msgstr "" + +#: src/concurrency/channels/bounded.md:33 +msgid "" +"A bounded channel with a size of zero is called a \"rendezvous channel\". " +"Every send will block the current thread until another thread calls `read`." +msgstr "" + +#: src/concurrency/send-sync.md:1 +msgid "`Send` and `Sync`" +msgstr "`Send`์™€ `Sync`" + +#: src/concurrency/send-sync.md:3 +msgid "" +"How does Rust know to forbid shared access across thread? The answer is in " +"two traits:" +msgstr "" +"๋Ÿฌ์ŠคํŠธ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด์„œ ์Šค๋ ˆ๋“œ ๊ฐ„์— ํŠน์ • ๋ฐ์ดํ„ฐ ํƒ€์ž…์ด ๊ณต์œ ๋  ์ˆ˜ ์žˆ๊ฑฐ๋‚˜, ์•ˆ๋œ๋‹ค" +"๋Š” ๊ฒƒ์„ ์•Œ๊นŒ์š”? ์ •๋‹ต์€ ๋‹ค์Œ ๋‘ ํŠธ๋ ˆ์ž‡์— ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync.md:5 +msgid "" +"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): a type `T` " +"is `Send` if it is safe to move a `T` across a thread boundary." +msgstr "" +"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): `T`๊ฐ€ ์Šค๋ ˆ๋“œ " +"๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, `T`์˜ ํƒ€์ž…์€ `Send`์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync.md:7 +msgid "" +"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): a type `T` " +"is `Sync` if it is safe to move a `&T` across a thread boundary." +msgstr "" +"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): `&T`๊ฐ€ ์Šค๋ ˆ" +"๋“œ ๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, `&T`์˜ ํƒ€์ž…์€ `Sync`์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync.md:10 +msgid "" +"`Send` and `Sync` are [unsafe traits](../unsafe/unsafe-traits.md). The " +"compiler will automatically derive them for your types as long as they only " +"contain `Send` and `Sync` types. You can also implement them manually when " +"you know it is valid." +msgstr "" +"`Send`์™€ `Sync` ํŠธ๋ ˆ์ž‡์€ [์•ˆ์ „ํ•˜์ง€ ์•Š์€ ํŠธ๋ ˆ์ž‡](../unsafe/unsafe-traits.md)์ž…" +"๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ํƒ€์ž…์˜ ์š”์†Œ๋“ค์ด ๋ชจ๋‘ `Send`์™€ `Sync` ํƒ€์ž…์ด๋ฉด ์ž๋™์œผ๋กœ ์ด ํŠธ" +"๋ ˆ์ž‡๋“ค์„ ์ ์šฉ์‹œ์ผœ ์ค๋‹ˆ๋‹ค. ๋ฌผ๋ก  ์—ฌ๋Ÿฌ๋ถ„ ์Šค์Šค๋กœ ๋งž๋‹ค๊ณ  ์•Œ๊ณ  ์žˆ๋‹ค๋ฉด ์ง์ ‘ ๊ตฌํ˜„ํ•ด" +"๋„ ๋ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync.md:20 +msgid "" +"One can think of these traits as markers that the type has certain thread-" +"safety properties." +msgstr "" +"`Sync`์™€ `Send`๋Š” ์–ด๋–ค ํƒ€์ž…์ด ํŠน์ •ํ•œ ์Šค๋ ˆ๋“œ-์•ˆ์ „ ์†์„ฑ์„ ๊ฐ€์ง์„ ๋‚˜ํƒ€๋‚ด๋Š” ๋งˆ์ปค" +"๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync.md:21 +msgid "They can be used in the generic constraints as normal traits." +msgstr "" +"์ด ๋‘ ํŠธ๋ ˆ์ดํŠธ๋Š” ์ œ๋„ˆ๋ฆญ์—์„œ ์ œ์•ฝ ์กฐ๊ฑด์„ ๋‚˜ํƒ€๋‚ด๋Š” ํŠธ๋ ˆ์ดํŠธ๋กœ ์‚ฌ์šฉ๋  ์ˆ˜๋„ ์žˆ์Šต" +"๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/send.md:1 +msgid "`Send`" +msgstr "`Send`" + +#: src/concurrency/send-sync/send.md:3 +msgid "" +"A type `T` is [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html) " +"if it is safe to move a `T` value to another thread." +msgstr "" +"`T`๊ฐ€ ์Šค๋ ˆ๋“œ ๊ฐ„์— ์•ˆ์ „ํ•˜๊ฒŒ ์ด๋™๋  ์ˆ˜ ์žˆ๋‹ค๋ฉด, `T`์˜ ํƒ€์ž…์€ `Send`์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/send.md:5 +msgid "" +"The effect of moving ownership to another thread is that _destructors_ will " +"run in that thread. So the question is when you can allocate a value in one " +"thread and deallocate it in another." +msgstr "" +"์†Œ์œ ๊ถŒ์„ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™ํ•˜๋ฉด ์†Œ๋ฉธ์ž๊ฐ€ ํ•ด๋‹น ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ " +"์˜๋ฌธ์€ \"์–ธ์ œ ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ๊ฐ’์„ ํ• ๋‹นํ•˜๊ณ  ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—์„œ ๊ฐ’์„ ํ• ๋‹น ํ•ด์ œํ•  " +"์ˆ˜ ์žˆ๋Š”๊ฐ€\" ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/send.md:13 +msgid "" +"As an example, a connection to the SQLite library must only be accessed from " +"a single thread." +msgstr "" +"์˜ˆ๋ฅผ ๋“ค์–ด SQLite ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—ฐ๊ฒฐ์€ ๋‹จ์ผ ์Šค๋ ˆ๋“œ์—์„œ๋งŒ ์•ก์„ธ์Šคํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/sync.md:1 +msgid "`Sync`" +msgstr "`Sync`" + +#: src/concurrency/send-sync/sync.md:3 +msgid "" +"A type `T` is [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) " +"if it is safe to access a `T` value from multiple threads at the same time." +msgstr "" +"`&T`๊ฐ€ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์—์„œ ์•ˆ์ „ํ•˜๊ฒŒ ์ ‘๊ทผ๋  ์ˆ˜ ์žˆ๋‹ค๋ฉด, `&T`์˜ ํƒ€์ž…์€ `Sync`์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/sync.md:6 +msgid "More precisely, the definition is:" +msgstr "์ข€ ๋” ์ •ํ™•ํ•œ ์ •์˜๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync/sync.md:8 +msgid "`T` is `Sync` if and only if `&T` is `Send`" +msgstr "`&T`๊ฐ€ `Send`์ธ ๊ฒฝ์šฐ์—๋งŒ `T`์˜ ํƒ€์ž…์ด `Sync`๊ฐ€ ๋ฉ๋‹ˆ๋‹ค" + +#: src/concurrency/send-sync/sync.md:14 +msgid "" +"This statement is essentially a shorthand way of saying that if a type is " +"thread-safe for shared use, it is also thread-safe to pass references of it " +"across threads." +msgstr "" +"์œ„ ๋ฌธ์žฅ์„ ํ’€์–ด์„œ ์ด์•ผ๊ธฐ ํ•˜๋ฉด, ์–ด๋–ค ํƒ€์ž…์ด ์Šค๋ ˆ๋“œ ๊ฐ„์— ๊ณต์œ ๋˜์–ด์„œ ์‚ฌ์šฉ๋˜๊ธฐ์— " +"์•ˆ์ „ํ•˜๋‹ค๋ฉด ๊ทธ ํƒ€์ž…์˜ ์ฐธ์กฐ ํƒ€์ž…์€ ์Šค๋ ˆ๋“œ ๊ฐ„์— ์ด๋™ ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/sync.md:16 +msgid "" +"This is because if a type is Sync it means that it can be shared across " +"multiple threads without the risk of data races or other synchronization " +"issues, so it is safe to move it to another thread. A reference to the type " +"is also safe to move to another thread, because the data it references can " +"be accessed from any thread safely." +msgstr "" +"์ด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฆ๋ช…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: ์–ด๋–ค ํƒ€์ž…์ด `Sync`๋ผ๋Š” ๋ง์€ ๊ณง ๊ทธ ํƒ€์ž…" +"์ด ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๋“ค ์‚ฌ์ด์—์„œ ๋ฐ์ดํ„ฐ ๋ ˆ์ด์Šค๋‚˜ ์—ฌํƒ€ ๋™๊ธฐํ™” ๋ฌธ์ œ ์—†์ด ๊ณต์œ  ๊ฐ€๋Šฅํ•˜๋‹ค" +"๋Š” ๋ง์ž…๋‹ˆ๋‹ค. ์Šค๋ ˆ๋“œ ๊ฐ„ ๊ณต์œ ๊ฐ€ ์•ˆ์ „ํ•˜๋‹ค๋ฉด, ์Šค๋ ˆ๋“œ๊ฐ„ ์ด๋™๋„ ์•ˆ์ „ํ•  ์ˆ˜ ๋ฐ–์— ์—†์Šต" +"๋‹ˆ๋‹ค. ์–ด๋–ค ํƒ€์ž…์˜ ์Šค๋ ˆ๋“œ๊ฐ„ ์ด๋™์ด ์•ˆ์ „ํ•˜๋‹ค๋ฉด, ๊ทธ ํƒ€์ž…์˜ ์ฐธ์กฐ ๋˜ํ•œ ์Šค๋ ˆ๋“œ๊ฐ„ ์ด" +"๋™์ด ์•ˆ์ „ํ•  ์ˆ˜ ๋ฐ–์— ์—†์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/examples.md:3 +msgid "`Send + Sync`" +msgstr "`Send + Sync`" + +#: src/concurrency/send-sync/examples.md:5 +msgid "Most types you come across are `Send + Sync`:" +msgstr "์—ฌ๋Ÿฌ๋ถ„์ด ๋‹ค๋ฃจ๊ฒŒ ๋  ๋Œ€๋ถ€๋ถ„์˜ ํƒ€์ž…์€ `Send + Sync`์ž…๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync/examples.md:7 +msgid "`i8`, `f32`, `bool`, `char`, `&str`, ..." +msgstr "`i8`, `f32`, `bool`, `char`, `&str`, ..." + +#: src/concurrency/send-sync/examples.md:8 +msgid "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." +msgstr "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." + +#: src/concurrency/send-sync/examples.md:9 +msgid "`String`, `Option`, `Vec`, `Box`, ..." +msgstr "`String`, `Option`, `Vec`, `Box`, ..." + +#: src/concurrency/send-sync/examples.md:10 +msgid "`Arc`: Explicitly thread-safe via atomic reference count." +msgstr "`Arc`: ์ฐธ์กฐ ์นด์šดํŠธ ์กฐ์ž‘์„ ์•„ํ† ๋ฏน ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•จ." + +#: src/concurrency/send-sync/examples.md:11 +msgid "`Mutex`: Explicitly thread-safe via internal locking." +msgstr "" +"`Mutex`: ๊ฐ’์„ ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด ๋ฎคํƒ์Šค๋ฅผ ์ž ๊ถˆ์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•จ." + +#: src/concurrency/send-sync/examples.md:12 +msgid "`AtomicBool`, `AtomicU8`, ...: Uses special atomic instructions." +msgstr "" +"`AtomicBool`, `AtomicU8`, ...: ๊ฐ’์„ ์ ‘๊ทผํ•  ๋•Œ ํŠน๋ณ„ํ•œ ์•„ํ† ๋ฏน ๋ช…๋ น์–ด๋“ค์„ ์‚ฌ์šฉํ•ฉ" +"๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/examples.md:14 +msgid "" +"The generic types are typically `Send + Sync` when the type parameters are " +"`Send + Sync`." +msgstr "" +"์ œ๋„ค๋ฆญ ํƒ€์ž…์€ ์ผ๋ฐ˜์ ์œผ๋กœ ํƒ€์ž… ํŒŒ๋ผ๋ฉ”ํ„ฐ๊ฐ€ `Send + Sync`์ด๋ฉด `Send + Sync` ์ž…๋‹ˆ" +"๋‹ค." + +#: src/concurrency/send-sync/examples.md:17 +msgid "`Send + !Sync`" +msgstr "`Send + !Sync`" + +#: src/concurrency/send-sync/examples.md:19 +msgid "" +"These types can be moved to other threads, but they're not thread-safe. " +"Typically because of interior mutability:" +msgstr "" +"์•„๋ž˜ ํƒ€์ž…๋“ค์€ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜ ์žˆ์ง€๋งŒ ๋‚ด๋ถ€์ ์œผ๋กœ ๊ฐ’์ด ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๊ธฐ " +"๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync/examples.md:22 +msgid "`mpsc::Sender`" +msgstr "`mpsc::Sender`" + +#: src/concurrency/send-sync/examples.md:23 +msgid "`mpsc::Receiver`" +msgstr "`mpsc::Receiver`" + +#: src/concurrency/send-sync/examples.md:24 +msgid "`Cell`" +msgstr "`Cell`" + +#: src/concurrency/send-sync/examples.md:25 +msgid "`RefCell`" +msgstr "`RefCell`" + +#: src/concurrency/send-sync/examples.md:27 +msgid "`!Send + Sync`" +msgstr "`!Send + Sync`" + +#: src/concurrency/send-sync/examples.md:29 +msgid "" +"These types are thread-safe, but they cannot be moved to another thread:" +msgstr "์•„๋ž˜ ํƒ€์ž…๋“ค์€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€๋งŒ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync/examples.md:31 +msgid "" +"`MutexGuard`: Uses OS level primitives which must be deallocated on the " +"thread which created them." +msgstr "" +"`MutexGuard`: ๋‚ด๋ถ€์ ์œผ๋กœ, ์šด์˜์ฒด์ œ๊ฐ€ ์ œ๊ณตํ•˜๋Š” primitive๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๋ฐ, ์ด " +"primitive๋Š” ์ƒ์„ฑ๋œ ์Šค๋ ˆ๋“œ์—์„œ ํ•ด์ œ๊ฐ€ ์ด๋ฃจ์–ด์ ธ์•ผ ํ•ฉ๋‹ˆ๋‹ค. (_์—ญ์ฃผ_: ๊ทธ๋ž˜์„œ ๋‹ค๋ฅธ " +"์Šค๋ ˆ๋“œ๋กœ ์˜ฎ๊ธธ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.)" + +#: src/concurrency/send-sync/examples.md:34 +msgid "`!Send + !Sync`" +msgstr "`!Send + !Sync`" + +#: src/concurrency/send-sync/examples.md:36 +msgid "These types are not thread-safe and cannot be moved to other threads:" +msgstr "" +"์•„๋ž˜ ํƒ€์ž…๋“ค์€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€๋„ ์•Š๊ณ  ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋กœ ์ด๋™๋  ์ˆ˜๋„ ์—†์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/send-sync/examples.md:38 +msgid "" +"`Rc`: each `Rc` has a reference to an `RcBox`, which contains a non-" +"atomic reference count." +msgstr "" +"`Rc`: `Rc` ๋Š” ์•„ํ† ๋ฏนํ•˜์ง€ ์•Š์€ ๋ฐฉ์‹์œผ๋กœ ์ฐธ์กฐ ์นด์šดํŠธ๋ฅผ ์กฐ์ž‘ํ•˜๋Š” " +"`RcBox`๋ฅผ ์ฐธ์กฐํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/send-sync/examples.md:40 +msgid "" +"`*const T`, `*mut T`: Rust assumes raw pointers may have special concurrency " +"considerations." +msgstr "" +"`*const T`, `*mut T`: ๋Ÿฌ์ŠคํŠธ๋Š” ํฌ์ธํ„ฐ๊ฐ€ ์Šค๋ ˆ๋“œ ์•ˆ์ „ํ•˜์ง€ ์•Š๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state.md:3 +msgid "" +"Rust uses the type system to enforce synchronization of shared data. This is " +"primarily done via two types:" +msgstr "" +"๋Ÿฌ์ŠคํŠธ๋Š” ์ฃผ๋กœ ์•„๋ž˜ ๋‘ ๊ฐ€์ง€ ํƒ€์ž…์„ ์ด์šฉํ•ด์„œ ๊ณต์œ  ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค:" + +#: src/concurrency/shared_state.md:6 +msgid "" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html), atomic " +"reference counted `T`: handles sharing between threads and takes care to " +"deallocate `T` when the last reference is dropped," +msgstr "" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html), `T`์— ๋Œ€ํ•œ ์•„" +"ํ† ๋ฏน ์ฐธ์กฐ ์นด์šดํŠธ: ์ด ์ฐธ์กฐ๋Š” ๋‹ค์ˆ˜์˜ ์Šค๋ ˆ๋“œ ์‚ฌ์ด์—์„œ ๊ณต์œ ๋  ์ˆ˜ ์žˆ๊ณ , ์ฐธ์กฐํ•˜๋˜ " +"๋งˆ์ง€๋ง‰ ์Šค๋ ˆ๋“œ๊ฐ€ ์ข…๋ฃŒํ•  ๊ฒฝ์šฐ `T`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state.md:8 +msgid "" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html): ensures " +"mutually exclusive access to the `T` value." +msgstr "" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html): `T`๊ฐ’์— " +"๋Œ€ํ•œ ์ƒํ˜ธ ๋ฐฐ์ œ ์—‘์„ธ์Šค๋ฅผ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/arc.md:1 +msgid "`Arc`" +msgstr "`Arc`" + +#: src/concurrency/shared_state/arc.md:3 +#, fuzzy +msgid "" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html) allows shared " +"read-only access via `Arc::clone`:" +msgstr "" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html)์˜ `clone` ๋ฉ”์„œ" +"๋“œ๋ฅผ ์ด์šฉํ•˜๋ฉด ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๊ฐ€ ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋™์‹œ์— (_์—ญ์ฃผ_: ๊ทธ๋ฆฌ๊ณ  ์•ˆ์ „ํ•˜๊ฒŒ. ์Šค๋ ˆ" +"๋“œ๊ฐ€ ํ•˜๋‚˜๋ผ๋„ ์‚ด์•„์žˆ๋Š” ๋™์•ˆ์—๋Š” `T`๊ฐ€ ๋ฐ˜ํ™˜๋˜์ง€ ์•Š์Œ) ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:" + +#: src/concurrency/shared_state/arc.md:5 +msgid "" +"```rust,editable\n" +"use std::thread;\n" +"use std::sync::Arc;\n" +"\n" +"fn main() {\n" +" let v = Arc::new(vec![10, 20, 30]);\n" +" let mut handles = Vec::new();\n" +" for _ in 1..5 {\n" +" let v = Arc::clone(&v);\n" +" handles.push(thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" println!(\"{thread_id:?}: {v:?}\");\n" +" }));\n" +" }\n" +"\n" +" handles.into_iter().for_each(|h| h.join().unwrap());\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::thread;\n" +"use std::sync::Arc;\n" +"\n" +"fn main() {\n" +" let v = Arc::new(vec![10, 20, 30]);\n" +" let mut handles = Vec::new();\n" +" for _ in 1..5 {\n" +" let v = Arc::clone(&v);\n" +" handles.push(thread::spawn(move || {\n" +" let thread_id = thread::current().id();\n" +" println!(\"{thread_id:?}: {v:?}\");\n" +" }));\n" +" }\n" +"\n" +" handles.into_iter().for_each(|h| h.join().unwrap());\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" + +#: src/concurrency/shared_state/arc.md:29 +#, fuzzy +msgid "" +"`Arc` stands for \"Atomic Reference Counted\", a thread safe version of `Rc` " +"that uses atomic operations." +msgstr "" +"`Arc`๋Š” \"Atomic Reference Counted\"๋ฅผ ์˜๋ฏธํ•˜๋ฉฐ, ์Šค๋ ˆ๋“œ ์•ˆ์ •์„ฑ์„ ๋ณด์žฅํ•˜๋Š” " +"`Rc`๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/arc.md:31 +#, fuzzy +msgid "" +"`Arc` implements `Clone` whether or not `T` does. It implements `Send` " +"and `Sync` if and only if `T` implements them both." +msgstr "" +"`T`๊ฐ€ `Clone`์„ ๊ตฌํ˜„ํ•˜๋“  ์•ˆํ•˜๋“  `Arc`๋Š” `Clone`์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. `Send`์™€ " +"`Sync`๋Š” `T`๊ฐ€ ์ด๋“ค์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/arc.md:33 +#, fuzzy +msgid "" +"`Arc::clone()` has the cost of atomic operations that get executed, but " +"after that the use of the `T` is free." +msgstr "" +"`Arc::clone()`๋Š” ์•„ํ† ๋ฏน ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ ๋•Œ ์ฝ”์ŠคํŠธ๊ฐ€ ์ข€ ์žˆ์ง€๋งŒ, ์ผ" +"๋‹จ `clone()`์ด ๋๋‚œ ํ›„ `T`๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์—๋Š” ์•„๋ฌด๋Ÿฐ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/arc.md:35 +#, fuzzy +msgid "" +"Beware of reference cycles, `Arc` does not use a garbage collector to detect " +"them." +msgstr "" +"์ˆœํ™˜ ์ฐธ์กฐ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋Ÿฌ์ŠคํŠธ๋Š” ์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๊ฐ€" +"๋น„์ง€ ์ปฌ๋ž™ํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/arc.md:36 +#, fuzzy +msgid "`std::sync::Weak` can help." +msgstr "์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ํ”ผํ•˜๋Š”๋ฐ `std::sync::Weak`๊ฐ€ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/mutex.md:1 +msgid "`Mutex`" +msgstr "`Mutex`" + +#: src/concurrency/shared_state/mutex.md:3 +msgid "" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) ensures " +"mutual exclusion _and_ allows mutable access to `T` behind a read-only " +"interface:" +msgstr "" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)๋ฅผ ์ด์šฉํ•˜" +"๋ฉด ๋ถˆ๋ณ€ ์ฐธ์กฐ๋ฅผ ํ†ตํ•ด์„œ๋„ `T`์˜ ๊ฐ’์„ ์ˆ˜์ •ํ•  ์ˆ˜๊ฐ€ ์žˆ์œผ๋ฉฐ, _์ด์— ๋”ํ•ด์„œ_ ํ•œ ๋ฒˆ์— " +"ํ•œ ์Šค๋ ˆ๋“œ๋งŒ `T`์˜ ๊ฐ’์„ ์ ‘๊ทผ(์ฝ๊ฑฐ๋‚˜ ์“ฐ๊ฑฐ๋‚˜)ํ•จ์„ ๋ณด์žฅํ•ด ์ค๋‹ˆ๋‹ค:" + +#: src/concurrency/shared_state/mutex.md:6 +msgid "" +"```rust,editable\n" +"use std::sync::Mutex;\n" +"\n" +"fn main() {\n" +" let v = Mutex::new(vec![10, 20, 30]);\n" +" println!(\"v: {:?}\", v.lock().unwrap());\n" +"\n" +" {\n" +" let mut guard = v.lock().unwrap();\n" +" guard.push(40);\n" +" }\n" +"\n" +" println!(\"v: {:?}\", v.lock().unwrap());\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::Mutex;\n" +"\n" +"fn main() {\n" +" let v = Mutex::new(vec![10, 20, 30]);\n" +" println!(\"v: {:?}\", v.lock().unwrap());\n" +"\n" +" {\n" +" let mut guard = v.lock().unwrap();\n" +" guard.push(40);\n" +" }\n" +"\n" +" println!(\"v: {:?}\", v.lock().unwrap());\n" +"}\n" +"```" + +#: src/concurrency/shared_state/mutex.md:22 +msgid "" +"Notice how we have a [`impl Sync for Mutex`](https://doc.rust-" +"lang.org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E) blanket " +"implementation." +msgstr "" +"๋ชจ๋“  `Mutex`๋Š” [`impl Sync for Mutex`](https://doc.rust-lang." +"org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E)๋ฅผ ์ž๋™์œผ๋กœ ๊ตฌํ˜„ํ•จ" +"์„ ์ฐธ์กฐํ•˜์„ธ์š”." + +#: src/concurrency/shared_state/mutex.md:31 +#, fuzzy +msgid "" +"`Mutex` in Rust looks like a collection with just one element - the " +"protected data." +msgstr "" +"๋Ÿฌ์ŠคํŠธ์˜ `Mutex`๋Š” ์˜ค์ง ํ•˜๋‚˜์˜ ๋ฐ์ดํ„ฐ๋งŒ ๋‹ด์„ ์ˆ˜ ์žˆ๋Š” ์ปฌ๋ ‰์…˜์ฒ˜๋Ÿผ ๋ณผ ์ˆ˜๋„ ์žˆ์Šต" +"๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์ปฌ๋ ‰์…˜๊ณผ ๋‹ค๋ฅธ ์ ์€, ๊ทธ ๋ฐ์ดํ„ฐ๊ฐ€ ๋™์‹œ์„ฑ ๋ฌธ์ œ๋กœ๋ถ€ํ„ฐ ์ž์œ ๋กญ๋‹ค๋Š” ์ ์ž…" +"๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/mutex.md:32 +#, fuzzy +msgid "" +"It is not possible to forget to acquire the mutex before accessing the " +"protected data." +msgstr "" +"`Mutex`๋Š” ๋ฎคํ…์Šค๋ฅผ ํš๋“ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ณดํ˜ธ๋œ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅ ํ•˜๋„" +"๋ก ๋””์ž์ธ ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/mutex.md:33 +#, fuzzy +msgid "" +"You can get an `&mut T` from an `&Mutex` by taking the lock. The " +"`MutexGuard` ensures that the `&mut T` doesn't outlive the lock being held." +msgstr "" +"`&Mutex`์— ๋Œ€ํ•ด lock์„ ํš๋“ํ•˜๋ฉด `&mut T`๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. `MutexGuard`" +"๋Š” `&mut T`๊ฐ€ ํš๋“ํ•œ lock๋ณด๋‹ค ์˜ค๋ž˜ ์‚ด์•„๋‚จ์ง€ ์•Š์Œ์„ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/mutex.md:35 +#, fuzzy +msgid "" +"`Mutex` implements both `Send` and `Sync` iff (if and only if) `T` " +"implements `Send`." +msgstr "" +"`Mutex`๋Š” ์˜ค์ง `T`๊ฐ€ `Send`๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ `Send`์™€ `Sync`๋ฅผ ๊ตฌํ˜„ํ•ฉ๋‹ˆ" +"๋‹ค." + +#: src/concurrency/shared_state/mutex.md:36 +#, fuzzy +msgid "A read-write lock counterpart - `RwLock`." +msgstr "์ฝ๊ธฐ-์“ฐ๊ธฐ lock์€ `RwLock`์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/mutex.md:37 +#, fuzzy +msgid "Why does `lock()` return a `Result`? " +msgstr "์™œ `lock()`์ด `Result`๋ฅผ ๋ฐ˜ํ™˜ํ• ๊นŒ์š”?" + +#: src/concurrency/shared_state/mutex.md:38 +#, fuzzy +msgid "" +"If the thread that held the `Mutex` panicked, the `Mutex` becomes " +"\"poisoned\" to signal that the data it protected might be in an " +"inconsistent state. Calling `lock()` on a poisoned mutex fails with a " +"[`PoisonError`](https://doc.rust-lang.org/std/sync/struct.PoisonError.html). " +"You can call `into_inner()` on the error to recover the data regardless." +msgstr "" +"`Mutex`๋ฅผ ํš๋“ํ•œ ์Šค๋ ˆ๋“œ์—์„œ ํŒจ๋‹‰์ด ๋ฐœ์ƒํ•˜๋ฉด, ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ์ƒํ™ฉ์ด " +"๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ `Mutex`๊ฐ€ \"์ค‘๋…(poisoned)\" ๋˜์—ˆ๋‹ค๊ณ  ํ‘œํ˜„ํ•˜๋ฉฐ, ์ค‘๋…๋œ " +"๋ฎคํ…์Šค์—์„œ `lock()`์„ ํ˜ธ์ถœํ•˜๋ฉด ์‹คํŒจํ•˜๊ณ  [`PoisonError`](https://doc.rust-" +"lang.org/std/sync/struct.PoisonError.html)๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋กœ๋ถ€ํ„ฐ ๋ฐ" +"์ดํ„ฐ๋ฅผ ๋ณต๊ตฌํ•˜๊ธฐ ์œ„ํ•ด `into_inner()`๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/example.md:3 +msgid "Let us see `Arc` and `Mutex` in action:" +msgstr "`Arc`์™€ `Mutex`์˜ ๋™์ž‘์„ ์‚ดํŽด๋ด…์‹œ๋‹ค:" + +#: src/concurrency/shared_state/example.md:5 +#, fuzzy +msgid "" +"```rust,editable,compile_fail\n" +"use std::thread;\n" +"// use std::sync::{Arc, Mutex};\n" +"\n" +"fn main() {\n" +" let v = vec![10, 20, 30];\n" +" let handle = thread::spawn(|| {\n" +" v.push(10);\n" +" });\n" +" v.push(1000);\n" +"\n" +" handle.join().unwrap();\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::{Arc, Mutex};\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" +"\n" +" let v2 = Arc::clone(&v);\n" +" let handle = thread::spawn(move || {\n" +" let mut v2 = v2.lock().unwrap();\n" +" v2.push(10);\n" +" });\n" +"\n" +" {\n" +" let mut v = v.lock().unwrap();\n" +" v.push(1000);\n" +" }\n" +"\n" +" handle.join().unwrap();\n" +"\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" + +#: src/concurrency/shared_state/example.md:23 +msgid "Possible solution:" +msgstr "๊ฐ€๋Šฅํ•œ ํ•ด๊ฒฐ์ฑ…:" + +#: src/concurrency/shared_state/example.md:25 +msgid "" +"```rust,editable\n" +"use std::sync::{Arc, Mutex};\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" +"\n" +" let v2 = Arc::clone(&v);\n" +" let handle = thread::spawn(move || {\n" +" let mut v2 = v2.lock().unwrap();\n" +" v2.push(10);\n" +" });\n" +"\n" +" {\n" +" let mut v = v.lock().unwrap();\n" +" v.push(1000);\n" +" }\n" +"\n" +" handle.join().unwrap();\n" +"\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"use std::sync::{Arc, Mutex};\n" +"use std::thread;\n" +"\n" +"fn main() {\n" +" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n" +"\n" +" let v2 = Arc::clone(&v);\n" +" let handle = thread::spawn(move || {\n" +" let mut v2 = v2.lock().unwrap();\n" +" v2.push(10);\n" +" });\n" +"\n" +" {\n" +" let mut v = v.lock().unwrap();\n" +" v.push(1000);\n" +" }\n" +"\n" +" handle.join().unwrap();\n" +"\n" +" println!(\"v: {v:?}\");\n" +"}\n" +"```" + +#: src/concurrency/shared_state/example.md:49 +msgid "Notable parts:" +msgstr "๋ˆˆ์—ฌ๊ฒจ ๋ณผ ๋ถ€๋ถ„:" + +#: src/concurrency/shared_state/example.md:51 +msgid "" +"`v` is wrapped in both `Arc` and `Mutex`, because their concerns are " +"orthogonal." +msgstr "" +"`v`๋Š” `Arc`์™€ `Mutex` ๋ชจ๋‘์— ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” `Arc`์™€ `Mutex`๊ฐ€ ์„œ๋กœ " +"์™„์ „ํžˆ ๋‹ค๋ฅธ ๋ฌธ์ œ๋ฅผ ์œ„ํ•œ ๋„๊ตฌ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/example.md:52 +msgid "" +"Wrapping a `Mutex` in an `Arc` is a common pattern to share mutable state " +"between threads." +msgstr "" +"`Mutex`๋ฅผ `Arc`๋กœ ๋ž˜ํ•‘ํ•˜๋Š” ๊ฒƒ์€ ๊ฐ€๋ณ€ ์ƒํƒœ๋ฅผ ์Šค๋ ˆ๋“œ๋“ค ๊ฐ„์— ๊ณต์œ ํ•  ๋•Œ ํ”ํžˆ ์‚ฌ์šฉ" +"ํ•˜๋Š” ํŒจํ„ด์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/example.md:53 +msgid "" +"`v: Arc<_>` needs to be cloned as `v2` before it can be moved into another " +"thread. Note `move` was added to the lambda signature." +msgstr "" +"`v: Arc<_>`๋ฅผ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด, ๋จผ์ € `v2`๋กœ ๋ณต์‚ฌ๋ฅผ ํ•˜๊ณ  ์ด๋ฅผ ๊ทธ ์Šค" +"๋ ˆ๋“œ๋กœ ์ด๋™ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋žŒ๋‹ค์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜์— `move`๊ฐ€ ์žˆ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." + +#: src/concurrency/shared_state/example.md:54 +msgid "" +"Blocks are introduced to narrow the scope of the `LockGuard` as much as " +"possible." +msgstr "๋ธ”๋ก์€ `LockGuard`์˜ ๋ฒ”์œ„๋ฅผ ์ตœ๋Œ€ํ•œ ์ขํžˆ๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/morning.md:3 +msgid "Let us practice our new concurrency skills with" +msgstr "๋™์‹œ์„ฑ ๊ธฐ๋ฒ•๋“ค์„ ์—ฐ์Šตํ•ด ๋ด…์‹œ๋‹ค" + +#: src/exercises/concurrency/morning.md:5 +msgid "Dining philosophers: a classic problem in concurrency." +msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž ๋ฌธ์ œ: ๊ณ ์ ์ ์ธ ๋™์‹œ์„ฑ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/morning.md:7 +msgid "" +"Multi-threaded link checker: a larger project where you'll use Cargo to " +"download dependencies and then check links in parallel." +msgstr "" +"๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ: ๋ณ‘๋ ฌ์ ์œผ๋กœ ์›นํŽ˜์ด์ง€์˜ ๋งํฌ๋“ค์„ ์ฒดํฌํ•ฉ๋‹ˆ๋‹ค. ์นด๊ณ ๋ฅผ ํ†ต" +"ํ•ด ๋ช‡ ๊ฐ€์ง€ ์˜์กด์„ฑ๋“ค์„ ๋‹ค์šด๋„๋ฅด ๋ฐ›์•„์•ผ ํ•˜๋Š” ํฐ ํ”„๋กœ์ ํŠธ ์ž…๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/dining-philosophers.md:3 +msgid "The dining philosophers problem is a classic problem in concurrency:" +msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž ๋ฌธ์ œ๋Š” ๋™์‹œ์„ฑ์— ์žˆ์–ด์„œ ๊ณ ์ „์ ์ธ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/dining-philosophers.md:5 +msgid "" +"Five philosophers dine together at the same table. Each philosopher has " +"their own place at the table. There is a fork between each plate. The dish " +"served is a kind of spaghetti which has to be eaten with two forks. Each " +"philosopher can only alternately think and eat. Moreover, a philosopher can " +"only eat their spaghetti when they have both a left and right fork. Thus two " +"forks will only be available when their two nearest neighbors are thinking, " +"not eating. After an individual philosopher finishes eating, they will put " +"down both forks." +msgstr "" +"5๋ช…์˜ ์ฒ ํ•™์ž๊ฐ€ ์›ํƒ์—์„œ ์‹์‚ฌ๋ฅผ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์›ํƒ์—์„œ ์ž์‹ ์˜ ์ž๋ฆฌ" +"์— ์•‰์•„์žˆ์Šต๋‹ˆ๋‹ค. ํฌํฌ๋Š” ๊ฐ ์ ‘์‹œ ์‚ฌ์ด์— ์žˆ์Šต๋‹ˆ๋‹ค. ์ œ๊ณต๋˜๋Š” ์š”๋ฆฌ๋ฅผ ๋จน๊ธฐ ์œ„ํ•ด์„œ" +"๋Š” ๋‘ ๊ฐœ์˜ ํฌํฌ๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์ƒ๊ฐ์„ ํ•˜๋‹ค๊ฐ€ ๋ฐฐ๊ฐ€ ๊ณ ํ”„๋ฉด ์ž" +"์‹ ์˜ ์ขŒ,์šฐ์˜ ํฌํฌ๋ฅผ ๋“ค์–ด ์š”๋ฆฌ๋ฅผ ๋จน์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์š”๋ฆฌ๋ฅผ ๋จน์€ ํ›„์—๋Š” ํฌํฌ๋ฅผ " +"๋‹ค์‹œ ์ž๋ฆฌ์— ๋‚ด๋ ค๋†“์Šต๋‹ˆ๋‹ค. ์ฒ ํ•™์ž๋Š” ์ž์‹ ์˜ ์ขŒ,์šฐ์— ํฌํฌ๊ฐ€ ์žˆ์„๋•Œ๋งŒ ์š”๋ฆฌ๋ฅผ ๋จน" +"์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋‘ ๊ฐœ์˜ ํฌํฌ๋Š” ์˜ค์ง ์ž์‹ ์˜ ์ขŒ,์šฐ ์ฒ ํ•™์ž๊ฐ€ ์ƒ๊ฐ์„ ํ•  ๋•Œ" +"๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/dining-philosophers.md:13 +#, fuzzy +msgid "" +"You will need a local [Cargo installation](../../cargo/running-locally.md) " +"for this exercise. Copy the code below to a file called `src/main.rs`, fill " +"out the blanks, and test that `cargo run` does not deadlock:" +msgstr "" +"์ด๋ฒˆ ํ›ˆ๋ จ์—์„œ๋Š” [์นด๊ณ  ์„ค์น˜ํ•˜๊ธฐ](../../cargo/running-locally.md)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ" +"๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๋ณต์‚ฌํ•ด์„œ `src/main.rs`์— ๋ถ™์—ฌ๋†“๊ณ  ๋นˆ ๋ถ€๋ถ„์„ ์ฑ„์šฐ๊ณ , `cargo " +"run` ์ปค๋งจ๋“œ๋กœ ํ…Œ์ŠคํŠธ ํ•ด์„œ ๊ต์ฐฉ์ƒํƒœ(๋ฐ๋“œ๋ฝ)๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/dining-philosophers.md:19 +msgid "" +"```rust,compile_fail\n" +"use std::sync::{mpsc, Arc, Mutex};\n" +"use std::thread;\n" +"use std::time::Duration;\n" +"\n" +"struct Fork;\n" +"\n" +"struct Philosopher {\n" +" name: String,\n" +" // left_fork: ...\n" +" // right_fork: ...\n" +" // thoughts: ...\n" +"}\n" +"\n" +"impl Philosopher {\n" +" fn think(&self) {\n" +" self.thoughts\n" +" .send(format!(\"Eureka! {} has a new idea!\", &self.name))\n" +" .unwrap();\n" +" }\n" +"\n" +" fn eat(&self) {\n" +" // Pick up forks...\n" +" println!(\"{} is eating...\", &self.name);\n" +" thread::sleep(Duration::from_millis(10));\n" +" }\n" +"}\n" +"\n" +"static PHILOSOPHERS: &[&str] =\n" +" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +"\n" +"fn main() {\n" +" // Create forks\n" +"\n" +" // Create philosophers\n" +"\n" +" // Make each of them think and eat 100 times\n" +"\n" +" // Output their thoughts\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/dining-philosophers.md:61 +msgid "You can use the following `Cargo.toml`:" +msgstr "" + +#: src/exercises/concurrency/dining-philosophers.md:65 +msgid "" +"```toml\n" +"[package]\n" +"name = \"dining-philosophers\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"```" +msgstr "" + +#: src/exercises/concurrency/link-checker.md:3 +msgid "" +"Let us use our new knowledge to create a multi-threaded link checker. It " +"should start at a webpage and check that links on the page are valid. It " +"should recursively check other pages on the same domain and keep doing this " +"until all pages have been validated." +msgstr "" +"์ƒˆ๋กœ ๋ฐฐ์šด๊ฒƒ๋“ค์„ ํ™œ์šฉํ•ด์„œ ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์ด ๊ฒ€์‚ฌ๊ธฐ๋Š” ์›นํŽ˜" +"์ด์ง€ ์•ˆ์— ์žˆ๋Š” ๋งํฌ๋“ค์ด ์œ ํšจํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์žฌ๊ท€์ ์œผ๋กœ ๋™์ผ ๋„๋ฉ”์ธ์˜ " +"๋‹ค๋ฅธ ๋ชจ๋“  ํŽ˜์ด์ง€๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/link-checker.md:8 +msgid "" +"For this, you will need an HTTP client such as [`reqwest`](https://docs.rs/" +"reqwest/). Create a new Cargo project and `reqwest` it as a dependency with:" +msgstr "" +"์ด๋ฅผ ์œ„ํ•ด์„œ [`reqwest`](https://docs.rs/reqwest/)์™€ ๊ฐ™์€ HTTP ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํ•„" +"์š”ํ•ฉ๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ๋กœ์ปฌ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  [`reqwest`](https://docs.rs/reqwest/)" +"๋ฅผ ์˜์กด์„ฑ์— ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์š”:" + +#: src/exercises/concurrency/link-checker.md:11 +#, fuzzy +msgid "" +"```shell\n" +"cargo new link-checker\n" +"cd link-checker\n" +"cargo add --features blocking,rustls-tls reqwest\n" +"```" +msgstr "" +"```shell\n" +"cargo init concurrency\n" +"cd concurrency\n" +"cargo add tokio --features full\n" +"cargo run\n" +"```" + +#: src/exercises/concurrency/link-checker.md:17 +msgid "" +"If `cargo add` fails with `error: no such subcommand`, then please edit the " +"`Cargo.toml` file by hand. Add the dependencies listed below." +msgstr "" +"๋งŒ์ผ `cargo add` ์ปค๋งจ๋“œ๊ฐ€ `error: no such subcommand` ๋กœ ์‹คํŒจํ•œ๋‹ค๋ฉด `Cargo." +"toml` ํŒŒ์ผ์„ ์ง์ ‘ ์ˆ˜์ •ํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์— ์ „์ฒด ์˜์กด์„ฑ ๋‚ด์šฉ์ด ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/link-checker.md:20 +msgid "" +"You will also need a way to find links. We can use [`scraper`](https://docs." +"rs/scraper/) for that:" +msgstr "๋งํฌ๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด์„œ [`scraper`](https://docs.rs/scraper/)๋„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/link-checker.md:22 +#, fuzzy +msgid "" +"```shell\n" +"cargo add scraper\n" +"```" +msgstr "" +"```sh\n" +"cargo embed --bin pac\n" +"```" + +#: src/exercises/concurrency/link-checker.md:26 +msgid "" +"Finally, we'll need some way of handling errors. We use [`thiserror`]" +"(https://docs.rs/thiserror/) for that:" +msgstr "" +"๋งˆ์ง€๋ง‰์œผ๋กœ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ [`thiserror`](https://docs.rs/thiserror/)" +"๋„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/link-checker.md:29 +#, fuzzy +msgid "" +"```shell\n" +"cargo add thiserror\n" +"```" +msgstr "" +"```sh\n" +"cargo embed --bin mmio\n" +"```" + +#: src/exercises/concurrency/link-checker.md:33 +msgid "" +"The `cargo add` calls will update the `Cargo.toml` file to look like this:" +msgstr "๋ชจ๋“  `cargo add`๊ฐ€ ๋๋‚˜๋ฉด `Cargo.toml`์— ์•„๋ž˜ ๋‚ด์šฉ์ด ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/link-checker.md:37 +msgid "" +"```toml\n" +"[package]\n" +"name = \"link-checker\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"publish = false\n" +"\n" +"[dependencies]\n" +"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-" +"tls\"] }\n" +"scraper = \"0.13.0\"\n" +"thiserror = \"1.0.37\"\n" +"```" +msgstr "" + +#: src/exercises/concurrency/link-checker.md:50 +msgid "" +"You can now download the start page. Try with a small site such as `https://" +"www.google.org/`." +msgstr "์ด์ œ `https://www.google.org/` ๊ฐ™์€ ์›น ํŽ˜์ด์ง€๋ฅผ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/link-checker.md:53 +msgid "Your `src/main.rs` file should look something like this:" +msgstr "`rc/main.rs`ํŒŒ์ผ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/link-checker.md:57 +msgid "" +"```rust,compile_fail\n" +"use reqwest::{blocking::Client, Url};\n" +"use scraper::{Html, Selector};\n" +"use thiserror::Error;\n" +"\n" +"#[derive(Error, Debug)]\n" +"enum Error {\n" +" #[error(\"request error: {0}\")]\n" +" ReqwestError(#[from] reqwest::Error),\n" +" #[error(\"bad http response: {0}\")]\n" +" BadResponse(String),\n" +"}\n" +"\n" +"#[derive(Debug)]\n" +"struct CrawlCommand {\n" +" url: Url,\n" +" extract_links: bool,\n" +"}\n" +"\n" +"fn visit_page(client: &Client, command: &CrawlCommand) -> Result, " +"Error> {\n" +" println!(\"Checking {:#}\", command.url);\n" +" let response = client.get(command.url.clone()).send()?;\n" +" if !response.status().is_success() {\n" +" return Err(Error::BadResponse(response.status().to_string()));\n" +" }\n" +"\n" +" let mut link_urls = Vec::new();\n" +" if !command.extract_links {\n" +" return Ok(link_urls);\n" +" }\n" +"\n" +" let base_url = response.url().to_owned();\n" +" let body_text = response.text()?;\n" +" let document = Html::parse_document(&body_text);\n" +"\n" +" let selector = Selector::parse(\"a\").unwrap();\n" +" let href_values = document\n" +" .select(&selector)\n" +" .filter_map(|element| element.value().attr(\"href\"));\n" +" for href in href_values {\n" +" match base_url.join(href) {\n" +" Ok(link_url) => {\n" +" link_urls.push(link_url);\n" +" }\n" +" Err(err) => {\n" +" println!(\"On {base_url:#}: ignored unparsable {href:?}: " +"{err}\");\n" +" }\n" +" }\n" +" }\n" +" Ok(link_urls)\n" +"}\n" +"\n" +"fn main() {\n" +" let client = Client::new();\n" +" let start_url = Url::parse(\"https://www.google.org\").unwrap();\n" +" let crawl_command = CrawlCommand{ url: start_url, extract_links: " +"true };\n" +" match visit_page(&client, &crawl_command) {\n" +" Ok(links) => println!(\"Links: {links:#?}\"),\n" +" Err(err) => println!(\"Could not extract links: {err:#}\"),\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/link-checker.md:120 +msgid "Run the code in `src/main.rs` with" +msgstr "์•„๋ž˜ ์ปค๋งจ๋“œ๋กœ ์†Œ์Šค๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค" + +#: src/exercises/concurrency/link-checker.md:122 +#, fuzzy +msgid "" +"```shell\n" +"cargo run\n" +"```" +msgstr "" +"```sh\n" +"cargo embed --bin pac\n" +"```" + +#: src/exercises/concurrency/link-checker.md:128 +msgid "" +"Use threads to check the links in parallel: send the URLs to be checked to a " +"channel and let a few threads check the URLs in parallel." +msgstr "" +"์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋งํฌ๋ฅผ ๋ณ‘๋ ฌ๋กœ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค: URL์„ ์ฑ„๋„๋กœ ๋ณด๋‚ด์„œ ๋ช‡ ๊ฐœ์˜ ์Šค๋ ˆ" +"๋“œ๊ฐ€ URL์„ ๋ณ‘๋ ฌ๋กœ ์ฒดํฌํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค." + +#: src/exercises/concurrency/link-checker.md:130 +msgid "" +"Extend this to recursively extract links from all pages on the `www.google." +"org` domain. Put an upper limit of 100 pages or so so that you don't end up " +"being blocked by the site." +msgstr "" +"`www.google.org`๋„๋ฉ”์ธ์˜ ๋ชจ๋“  ํŽ˜์ด์ง€๋ฅผ ์žฌ๊ท€์ ์œผ๋กœ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ฝ”๋“œ๋ฅผ ํ™•์žฅํ•ด" +"์„œ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค: ์ฐจ๋‹จ๋‹นํ•˜์ง€ ์•Š๋„๋ก 100ํŽ˜์ด์ง€ ์ •๋„๋กœ ์ œํ•œ์„ ๋‘์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." + +#: src/async.md:1 +#, fuzzy +msgid "Async Rust" +msgstr "๋น„๋™๊ธฐ" + +#: src/async.md:3 +msgid "" +"\"Async\" is a concurrency model where multiple tasks are executed " +"concurrently by executing each task until it would block, then switching to " +"another task that is ready to make progress. The model allows running a " +"larger number of tasks on a limited number of threads. This is because the " +"per-task overhead is typically very low and operating systems provide " +"primitives for efficiently identifying I/O that is able to proceed." +msgstr "" +"\"Async\"๋Š” ๋ธ”๋Ÿญ๋ (๋” ์ด์ƒ ์ง„ํ–‰ํ•  ์ˆ˜ ์—†์„) ๋•Œ๊นŒ์ง€ ๊ฐ ์ž‘์—…์„ ์‹คํ–‰ํ•œ ๋‹ค์Œ ์ง„ํ–‰" +"ํ•  ์ค€๋น„๊ฐ€ ๋œ ๋‹ค๋ฅธ ์ž‘์—…์œผ๋กœ ์ „ํ™˜ํ•˜์—ฌ ์—ฌ๋Ÿฌ ์ž‘์—…์„ ๋™์‹œ์— ์‹คํ–‰ํ•˜๋Š” ๋™์‹œ ์‹คํ–‰ ๋ชจ" +"๋ธ์ž…๋‹ˆ๋‹ค. ์ด ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ œํ•œ๋œ ์ˆ˜์˜ ์Šค๋ ˆ๋“œ์—์„œ ๋” ๋งŽ์€ ์ž‘์—…์„ ์‹คํ–‰ํ•  ์ˆ˜ " +"์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š”, ํ•œ ์ž‘์—…์„ ์œ ์ง€ํ•˜๊ณ  ์ˆ˜ํ–‰ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ (์Šค๋ ˆ๋“œ์— ๋น„" +"ํ•ด) ๋งค์šฐ ๋‚ฎ๊ณ  ์šด์˜์ฒด์ œ๊ฐ€ ์—ฌ๋Ÿฌ I/O๋“ค์—์„œ ํ˜„์žฌ ์ง„ํ–‰ ๊ฐ€๋Šฅํ•œ I/O๋“ค์„ ํšจ๊ณผ์ ์œผ๋กœ " +"์‹๋ณ„ํ•ด ์ฃผ๋Š” ํ”„๋ฆฌ๋ฏธํ‹ฐ๋ธŒ๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/async.md:10 +msgid "" +"Rust's asynchronous operation is based on \"futures\", which represent work " +"that may be completed in the future. Futures are \"polled\" until they " +"signal that they are complete." +msgstr "" +"Rust์˜ ๋น„๋™๊ธฐ ์ž‘์—…์€ \"futures\"๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋ฉฐ ์ด๋Š” ๋ฏธ๋ž˜์— ์™„๋ฃŒ๋  ์ˆ˜ ์žˆ๋Š” " +"์ž‘์—…์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Futures๋Š” ์™„๋ฃŒ๋˜์—ˆ๋‹ค๋Š” ์‹ ํ˜ธ๋ฅผ ๋ณด๋‚ผ ๋•Œ๊นŒ์ง€ \"ํด๋ง\"๋ฉ๋‹ˆ๋‹ค." + +#: src/async.md:14 +msgid "" +"Futures are polled by an async runtime, and several different runtimes are " +"available." +msgstr "" +"Futures๋Š” ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์— ์˜ํ•ด ํด๋ง๋˜๋ฉฐ, ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์—๋Š” ์—ฌ๋Ÿฌ ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜" +"๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async.md:17 +#, fuzzy +msgid "Comparisons" +msgstr "๋น„๊ต" + +#: src/async.md:19 +msgid "" +"Python has a similar model in its `asyncio`. However, its `Future` type is " +"callback-based, and not polled. Async Python programs require a \"loop\", " +"similar to a runtime in Rust." +msgstr "" +"ํŒŒ์ด์ฌ์—๋„ `asyncio`๋ผ๋Š” ์œ ์‚ฌํ•œ ๋ชจ๋ธ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ํŒŒ์ด์ฌ์˜ `Future` ํƒ€" +"์ž…์€ ์ฝœ๋ฐฑ ๊ธฐ๋ฐ˜์ด๋ฉฐ ํด๋ง๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํŒŒ์ด์ฌ์œผ๋กœ ๋น„๋™๊ธฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ•  ๋•Œ์—" +"๋Š”, Rust์—์„œ ๋Ÿฐํƒ€์ž„์ด ๋‚ด๋ถ€์ ์œผ๋กœ ํ•ด ์ฃผ๋Š” ๊ฒƒ๊ณผ ์œ ์‚ฌํ•œ, \"๋ฃจํ”„\"๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ " +"์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/async.md:23 +msgid "" +"JavaScript's `Promise` is similar, but again callback-based. The language " +"runtime implements the event loop, so many of the details of Promise " +"resolution are hidden." +msgstr "" +"์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ `Promise`๋„ ๋น„์Šทํ•˜์ง€๋งŒ ์—ญ์‹œ ์ฝœ๋ฐฑ ๊ธฐ๋ฐ˜์ž…๋‹ˆ๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ" +"๋Š” ์ด๋ฒคํŠธ ๋ฃจํ”„๊ฐ€๋Ÿฐํƒ€์ž„ ์—”์ง„์—์„œ ๊ตฌํ˜„๋˜๋ฏ€๋กœ `Promise`๊ฐ€ ์ฒ˜๋ฆฌ๋˜๋Š” ์„ธ๋ถ€ ๊ณผ์ •์ด " +"์ˆจ๊ฒจ์ง‘๋‹ˆ๋‹ค." + +#: src/async/async-await.md:1 +msgid "`async`/`await`" +msgstr "`async`/`await`" + +#: src/async/async-await.md:3 +msgid "" +"At a high level, async Rust code looks very much like \"normal\" sequential " +"code:" +msgstr "" +"๊ฒ‰์—์„œ ๋ณด์•˜์„ ๋•Œ, ๋น„๋™๊ธฐ Rust ์ฝ”๋“œ๋Š” ์ผ๋ฐ˜์ ์ธ ์ ˆ์ฐจ์  ์ฝ”๋“œ์™€ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/async-await.md:5 +msgid "" +"```rust,editable,compile_fail\n" +"use futures::executor::block_on;\n" +"\n" +"async fn count_to(count: i32) {\n" +" for i in 1..=count {\n" +" println!(\"Count is: {i}!\");\n" +" }\n" +"}\n" +"\n" +"async fn async_main(count: i32) {\n" +" count_to(count).await;\n" +"}\n" +"\n" +"fn main() {\n" +" block_on(async_main(10));\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use futures::executor::block_on;\n" +"\n" +"async fn count_to(count: i32) {\n" +" for i in 1..=count {\n" +" println!(\"Count is: {i}!\");\n" +" }\n" +"}\n" +"\n" +"async fn async_main(count: i32) {\n" +" count_to(count).await;\n" +"}\n" +"\n" +"fn main() {\n" +" block_on(async_main(10));\n" +"}\n" +"```" + +#: src/async/async-await.md:27 +msgid "" +"Note that this is a simplified example to show the syntax. There is no long " +"running operation or any real concurrency in it!" +msgstr "" +"Rust ๋น„๋™๊ธฐ ๋ฌธ๋ฒ•์„ ๋ณด์—ฌ์ฃผ๋Š” ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” ์˜ค๋ž˜ ์‹คํ–‰๋˜๋Š” ์ž‘์—…์ด" +"๋‚˜, ์‹ค์ œ๋กœ ๋™์‹œ์— ์ˆ˜ํ–‰๋˜๋Š” ๊ฒƒ๋“ค์€ ์—†์Šต๋‹ˆ๋‹ค." + +#: src/async/async-await.md:30 +msgid "What is the return type of an async call?" +msgstr "`async`ํ•จ์ˆ˜์˜ ๋ฆฌํ„ด ํƒ€์ž…์€ ๋ฌด์—‡์ธ๊ฐ€์š”?" + +#: src/async/async-await.md:31 +msgid "Use `let future: () = async_main(10);` in `main` to see the type." +msgstr "" +"`main`์—์„œ \\`let future: () = async_main(10);์„ ์‚ฌ์šฉํ•˜์—ฌ ํƒ€์ž…์„ ํ™•์ธํ•˜์„ธ์š”." + +#: src/async/async-await.md:33 +msgid "" +"The \"async\" keyword is syntactic sugar. The compiler replaces the return " +"type with a future. " +msgstr "" +"\"async\" ํ‚ค์›Œ๋“œ๋Š” ๋ฌธ๋ฒ• ์„คํƒ•(syntactic sugar)์ž…๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๋ฆฌํ„ด ํƒ€์ž…์„ " +"future๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค. " + +#: src/async/async-await.md:36 +msgid "" +"You cannot make `main` async, without additional instructions to the " +"compiler on how to use the returned future." +msgstr "" +"`main`์„ ๋น„๋™๊ธฐ ํ•จ์ˆ˜๋กœ ๋งŒ๋“ค์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๊ทธ๋ ‡๊ฒŒ ํ•  ๊ฒฝ์šฐ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ๋ฆฌ" +"ํ„ด ํƒ€์ž…์ธ future๋ฅผ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•  ์ง€ ๋ชจ๋ฅด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/async/async-await.md:39 +msgid "" +"You need an executor to run async code. `block_on` blocks the current thread " +"until the provided future has run to completion. " +msgstr "" +"๋น„๋™๊ธฐ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋ ค๋ฉด ์‹คํ–‰์ž(executor)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. `block_on` ์‹คํ–‰์ž๋Š” " +"์ œ๊ณต๋œ future๊ฐ€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ํ˜„์žฌ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กํ•ฉ๋‹ˆ๋‹ค. " + +#: src/async/async-await.md:42 +msgid "" +"`.await` asynchronously waits for the completion of another operation. " +"Unlike `block_on`, `.await` doesn't block the current thread." +msgstr "" +"`.await`๋Š” ๋‹ค๋ฅธ ์ž‘์—…์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๋น„๋™๊ธฐ์ ์œผ๋กœ ๋Œ€๊ธฐํ•ฉ๋‹ˆ๋‹ค. `block_on`๊ณผ ๋‹ฌ" +"๋ฆฌ `.await`๋Š” ํ˜„์žฌ ์Šค๋ ˆ๋“œ๋ฅผ ๋ธ”๋กํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/async/async-await.md:45 +msgid "" +"`.await` can only be used inside an `async` function (or block; these are " +"introduced later). " +msgstr "" +"`.await`๋Š” `async` ํ•จ์ˆ˜(๋˜๋Š” ๋‚˜์ค‘์— ์†Œ๊ฐœ๋  `async` ๋ธ”๋ก) ์•ˆ์—์„œ๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ " +"์žˆ์Šต๋‹ˆ๋‹ค. " + +#: src/async/futures.md:3 +msgid "" +"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) is a " +"trait, implemented by objects that represent an operation that may not be " +"complete yet. A future can be polled, and `poll` returns a [`Poll`](https://" +"doc.rust-lang.org/std/task/enum.Poll.html)." +msgstr "" +"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html)๋Š” ํŠธ๋ ˆ์ž‡์ž…" +"๋‹ˆ๋‹ค.์ด ํŠธ๋ ˆ์ž‡์€ ์•„์ง ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์„ ์ˆ˜๋„ ์žˆ๋Š” ์ž‘์—…์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. Future๋Š” " +"`poll` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ํด๋ง๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด ํ•จ์ˆ˜๋Š” [`Poll`](https://doc.rust-" +"lang.org/std/task/enum.Poll.html)์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/futures.md:8 +msgid "" +"```rust\n" +"use std::pin::Pin;\n" +"use std::task::Context;\n" +"\n" +"pub trait Future {\n" +" type Output;\n" +" fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll;\n" +"}\n" +"\n" +"pub enum Poll {\n" +" Ready(T),\n" +" Pending,\n" +"}\n" +"```" +msgstr "" +"```rust\n" +"use std::pin::Pin;\n" +"use std::task::Context;\n" +"\n" +"pub trait Future {\n" +" type Output;\n" +" fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll;\n" +"}\n" +"\n" +"pub enum Poll {\n" +" Ready(T),\n" +" Pending,\n" +"}\n" +"```" + +#: src/async/futures.md:23 +msgid "" +"An async function returns an `impl Future`. It's also possible (but " +"uncommon) to implement `Future` for your own types. For example, the " +"`JoinHandle` returned from `tokio::spawn` implements `Future` to allow " +"joining to it." +msgstr "" +"๋น„๋™๊ธฐ ํ•จ์ˆ˜๋Š” `impl Future`๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ํƒ€์ž…์„ ๋งŒ๋“ค๊ณ  ์ด ํƒ€์ž…์ด " +"`Future`๋ฅผ ๊ตฌํ˜„ํ•˜๊ฒŒ ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ์ผ๋ฐ˜์ ์ด์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `tokio::" +"spawn`๊ฐ€ ๋ฆฌํ„ดํ•˜๋Š” `JoinHandle`์€ `Future`๋ฅผ ๊ตฌํ˜„ํ•˜๋ฉฐ, ์ด๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ์Šค๋ ˆ๋“œ" +"์— joinํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/futures.md:27 +msgid "" +"The `.await` keyword, applied to a Future, causes the current async function " +"to pause until that Future is ready, and then evaluates to its output." +msgstr "" +"Future์— `.await`๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด, ํ•ด๋‹น Future๊ฐ€ ์ค€๋น„๋  ๋•Œ๊นŒ์ง€ ํ˜„์žฌ ๋น„๋™๊ธฐ ํ•จ์ˆ˜๊ฐ€ " +"์ผ์‹œ ์ค‘์ง€๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ Future๊ฐ€ ์ค€๋น„๊ฐ€ ๋˜๋ฉด, ๊ทธ ๊ฐ’์ด `.await` ๊ตฌ๋ฌธ์˜ ๊ฐ’" +"์ด ๋ฉ๋‹ˆ๋‹ค." + +#: src/async/futures.md:32 +msgid "" +"The `Future` and `Poll` types are implemented exactly as shown; click the " +"links to show the implementations in the docs." +msgstr "" +"`Future` ์™€ `Poll` ํƒ€์ž…์˜ ์‹ค์ œ ์ •์˜๋Š” ์œ„์— ๋ณด์ด๋Š” ๊ทธ๋Œ€๋กœ ์ž…๋‹ˆ๋‹ค. ๋งํฌ๋ฅผ ํด๋ฆญ" +"ํ•˜๋ฉด Rust ๋ฌธ์„œ์—์„œ ํ•œ ๋ฒˆ ๋” ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/futures.md:35 +msgid "" +"We will not get to `Pin` and `Context`, as we will focus on writing async " +"code, rather than building new async primitives. Briefly:" +msgstr "" +"๋ณธ ๊ฐ•์˜์˜ ๋ชฉ์ ์€ ๋น„๋™๊ธฐ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š”๋ฐ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ์ƒˆ๋กœ์šด ๋น„๋™๊ธฐ ํ”„๋ฆฌ๋ฏธํ‹ฐ" +"๋ธŒ๋ฅผ ๋งŒ๋“œ๋Š”๋ฐ ํ•„์š”ํ•œ `Pin`๊ณผ `Context`๋Š” ๋‹ค๋ฃจ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๋“ค์— ๋Œ€ํ•ด ๊ฐ„๋‹จ" +"ํžˆ ์„ค๋ช…ํ•˜์ž๋ฉด:" + +#: src/async/futures.md:38 +msgid "" +"`Context` allows a Future to schedule itself to be polled again when an " +"event occurs." +msgstr "" +"`Context`๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Future๊ฐ€ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•  ๋•Œ ๋‹ค์‹œ ํด๋ง๋˜๋„๋ก ์˜ˆ์•ฝํ•  ์ˆ˜ ์žˆ" +"์Šต๋‹ˆ๋‹ค." + +#: src/async/futures.md:41 +msgid "" +"`Pin` ensures that the Future isn't moved in memory, so that pointers into " +"that future remain valid. This is required to allow references to remain " +"valid after an `.await`." +msgstr "" +"'Pin'์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ”๋ชจ๋ฆฌ์—์„œ Future์˜ ์œ„์น˜๊ฐ€ ๊ณ ์ •๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น future์˜ ํฌ" +"์ธํ„ฐ๊ฐ€ ํ•ญ์ƒ ์œ ํšจํ•˜๊ฒŒ ์œ ์ง€๋ฉ๋‹ˆ๋‹ค. ์ด๋Š” `.await` ํ›„์— ์ฐธ์กฐ๋ฅผ ์œ ํšจํ•œ ์ƒํƒœ๋กœ ์œ ์ง€" +"ํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:3 +msgid "" +"A _runtime_ provides support for performing operations asynchronously (a " +"_reactor_) and is responsible for executing futures (an _executor_). Rust " +"does not have a \"built-in\" runtime, but several options are available:" +msgstr "" +"๋น„๋™๊ธฐ _๋Ÿฐํƒ€์ž„_์€ _๋ฆฌ์•กํ„ฐ_ (๋น„๋™๊ธฐ์‹ ์ž‘์—… ์‹คํ–‰์„ ์ง€์›)์™€ _์‹คํ–‰์ž_ (futures๋ฅผ " +"์‹คํ–‰)์˜ ๋‘ ๊ฐ€์ง€ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. Rust ์–ธ์–ด ์ž์ฒด์—์„œ ๊ธฐ๋ณธ ์ œ๊ณตํ•˜๋Š” ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„" +"์€ ์—†์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„ ํฌ๋ ˆ์ž‡๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:7 +#, fuzzy +msgid "" +"[Tokio](https://tokio.rs/): performant, with a well-developed ecosystem of " +"functionality like [Hyper](https://hyper.rs/) for HTTP or [Tonic](https://" +"github.com/hyperium/tonic) for gRPC." +msgstr "" +"[Tokio](https://tokio.rs/) - ์„ฑ๋Šฅ์ด ์šฐ์ˆ˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  HTTP๋ฅผ ์ง€์›ํ•˜๋Š” " +"[Hyper](https://hyper.rs/) ์™€ gRPC๋ฅผ ์ง€์›ํ•˜๋Š” [Tonic](https://github.com/" +"hyperium/tonic)๊ณผ ๊ฐ™์€ ์ž˜ ๋ฐœ๋‹ฌ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ƒํƒœ๊ณ„๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:10 +#, fuzzy +msgid "" +"[async-std](https://async.rs/): aims to be a \"std for async\", and includes " +"a basic runtime in `async::task`." +msgstr "" +"[async-std](https://async.rs/) - ๋น„๋™๊ธฐ์—์„œ์˜ `std`๋ฅผ ๋ชฉํ‘œ๋กœ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. " +"`async::task`์— ๊ธฐ๋ณธ ๋Ÿฐํƒ€์ž„์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:12 +#, fuzzy +msgid "[smol](https://docs.rs/smol/latest/smol/): simple and lightweight" +msgstr "[smol](https://docs.rs/smol/latest/smol/) - ๊ฐ„๋‹จํ•˜๊ณ  ๊ฐ€๋ณ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:14 +msgid "" +"Several larger applications have their own runtimes. For example, [Fuchsia]" +"(https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-" +"async/src/lib.rs) already has one." +msgstr "" +"์—ฌ๋Ÿฌ ๋Œ€๊ทœ๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—๋Š” ์ž์ฒด ๋Ÿฐํƒ€์ž„์ด ์žˆ๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋“ค ๋“ค์–ด " +"[Fuchsia](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/" +"fuchsia-async/src/lib.rs)๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:20 +msgid "" +"Note that of the listed runtimes, only Tokio is supported in the Rust " +"playground. The playground also does not permit any I/O, so most interesting " +"async things can't run in the playground." +msgstr "" +"Rust ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ์—์„œ๋Š” ์œ„์— ๋‚˜์—ด๋œ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„ ์ค‘์—์„œ Tokio๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ " +"์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ Rust ํ”Œ๋ ˆ์ด๊ทธ๋ผ์šด๋“œ๋Š” I/O๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š์œผ๋ฏ€๋กœ async๋ฅผ ๊ฐ€์ง€๊ณ  " +"ํ•  ์ˆ˜ ์žˆ๋Š” ๋งŽ์€ ํฅ๋ฏธ๋กœ์šด ์ž‘์—…๋“ค์ด ๋ถˆ๊ฐ€๋Šฅ ํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/runtimes.md:24 +msgid "" +"Futures are \"inert\" in that they do not do anything (not even start an I/O " +"operation) unless there is an executor polling them. This differs from JS " +"Promises, for example, which will run to completion even if they are never " +"used." +msgstr "" +"Futures๋Š” ์‹คํ–‰์ž๊ฐ€ ํด๋งํ•˜์ง€ ์•Š๋Š” ํ•œ ์•„๋ฌด๊ฒƒ๋„ ํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ์ ์—์„œ(I/O ์ž‘์—…์กฐ" +"์ฐจ ์‹œ์ž‘ํ•˜์ง€ ์•Š์Œ) \"๋น„ํ™œ์„ฑ\" ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ์—๋„ ์™„๋ฃŒ๋  " +"๋•Œ ๊นŒ์ง€ ์‹คํ–‰๋˜๋Š”, ์ž๋ฐ” ์Šคํฌ๋ฆฝํŠธ์˜ promise์™€ ๋‹ค๋ฆ…๋‹ˆ๋‹ค." + +#: src/async/runtimes/tokio.md:4 +msgid "Tokio provides: " +msgstr "Tokio๋Š” ๋‹ค์Œ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. " + +#: src/async/runtimes/tokio.md:6 +msgid "A multi-threaded runtime for executing asynchronous code." +msgstr "๋น„๋™๊ธฐ ์ฝ”๋“œ ์‹คํ–‰์„ ์œ„ํ•œ ๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋Ÿฐํƒ€์ž„" + +#: src/async/runtimes/tokio.md:7 +msgid "An asynchronous version of the standard library." +msgstr "ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋น„๋™๊ธฐ ๋ฒ„์ „" + +#: src/async/runtimes/tokio.md:8 +msgid "A large ecosystem of libraries." +msgstr "๋Œ€๊ทœ๋ชจ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ƒํƒœ๊ณ„" + +#: src/async/runtimes/tokio.md:10 +msgid "" +"```rust,editable,compile_fail\n" +"use tokio::time;\n" +"\n" +"async fn count_to(count: i32) {\n" +" for i in 1..=count {\n" +" println!(\"Count in task: {i}!\");\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" tokio::spawn(count_to(10));\n" +"\n" +" for i in 1..5 {\n" +" println!(\"Main task: {i}\");\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use tokio::time;\n" +"\n" +"async fn count_to(count: i32) {\n" +" for i in 1..=count {\n" +" println!(\"Count in task: {i}!\");\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" tokio::spawn(count_to(10));\n" +"\n" +" for i in 1..5 {\n" +" println!(\"Main task: {i}\");\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" }\n" +"}\n" +"```" + +#: src/async/runtimes/tokio.md:33 +msgid "With the `tokio::main` macro we can now make `main` async." +msgstr "" +"์ด์ œ `tokio::main` ๋งคํฌ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด `main`์„ ๋น„๋™๊ธฐ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/runtimes/tokio.md:35 +msgid "The `spawn` function creates a new, concurrent \"task\"." +msgstr "`spawn` ํ•จ์ˆ˜๋Š” ๋™์‹œ ์‹คํ–‰๋˜๋Š” ์ƒˆ๋กœ์šด \"์ž‘์—…\"์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค." + +#: src/async/runtimes/tokio.md:37 +msgid "Note: `spawn` takes a `Future`, you don't call `.await` on `count_to`." +msgstr "" +"์ฐธ๊ณ : `spawn`์€ `Future`๋ฅผ ์ธ์ž๋กœ ๋ฐ›์Šต๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— `count_to`์— `.await`๋ฅผ ํ˜ธ" +"์ถœํ•˜์ง€ ์•Š๋Š” ์ ์„ ์ฃผ๋ชฉํ•˜์„ธ์š”." + +#: src/async/runtimes/tokio.md:39 +msgid "**Further exploration:**" +msgstr "**์‹ฌํ™” ํ•™์Šต:**" + +#: src/async/runtimes/tokio.md:41 +msgid "" +"Why does `count_to` not (usually) get to 10? This is an example of async " +"cancellation. `tokio::spawn` returns a handle which can be awaited to wait " +"until it finishes." +msgstr "" +"`count_to`๊ฐ€ 10์— ๋„๋‹ฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์€๋ฐ ๊ทธ ์ด์œ ๋Š” ๋ฌด์—‡์ผ๊นŒ์š”? ์ด๋Š” ๋น„๋™" +"๊ธฐ์ ์ธ ์ทจ์†Œ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์˜ˆ์ž…๋‹ˆ๋‹ค. `tokio::spawn`์ด ๋ฆฌํ„ดํ•˜๋Š” ๊ฒƒ์€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ" +"์ง€ ๊ธฐ๋‹ค๋ฆฌ๋„๋ก ๋Œ€๊ธฐํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ํ•ธ๋“ค์ž…๋‹ˆ๋‹ค." + +#: src/async/runtimes/tokio.md:45 +msgid "Try `count_to(10).await` instead of spawning." +msgstr "`tokio::spawn` ๋Œ€์‹  `count_to(10).await`๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”." + +#: src/async/runtimes/tokio.md:47 +msgid "Try awaiting the task returned from `tokio::spawn`." +msgstr "`tokio::spawn`์—์„œ ๋ฐ˜ํ™˜๋œ ์ž‘์—…์„ `await` ํ•ด ๋ณด์„ธ์š”." + +#: src/async/tasks.md:3 +msgid "Rust has a task system, which is a form of lightweight threading." +msgstr "Rust์˜ ํƒœ์Šคํฌ(์ž‘์—…) ์‹œ์Šคํ…œ์€ ๊ฒฝ๋Ÿ‰ ์Šค๋ ˆ๋”ฉ์˜ ํ•œ ์ข…๋ฅ˜๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/tasks.md:5 +msgid "" +"A task has a single top-level future which the executor polls to make " +"progress. That future may have one or more nested futures that its `poll` " +"method polls, corresponding loosely to a call stack. Concurrency within a " +"task is possible by polling multiple child futures, such as racing a timer " +"and an I/O operation." +msgstr "" +"ํ•˜๋‚˜์˜ ์ž‘์—…์—๋Š”, ์‹คํ–‰์ž๊ฐ€ ์ด ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ๊ณ„์† ํด๋งํ•˜๋Š”, ์ตœ์ƒ์œ„ " +"future๊ฐ€ ํ•œ ๊ฐœ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด future์—๋Š” `poll` ๋ฉ”์„œ๋“œ๊ฐ€ ํด๋งํ•˜๋Š” ์ค‘์ฒฉ๋œ future" +"๊ฐ€ ํ•œ ๊ฐœ ์ด์ƒ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ค‘์ฒฉ๋œ future๋Š” ์ผ๋ฐ˜์ ์ธ ํ•จ์ˆ˜ ํ˜ธ์ถœ ์Šค" +"ํƒํ•˜๊ณ  ๋น„์Šทํ•œ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ํ•œ ์ž‘์—… ์•ˆ์—์„œ ์—ฌ๋Ÿฌ ์ž์‹ future๋“ค์„ ํด๋งํ•˜๋ฉด, ํƒ€" +"์ด๋จธ๋ฅผ ์ผœ๋Š” ๊ฒƒ๊ณผ ์–ด๋–ค I/O์ž‘์—…์„ ๋™์‹œ์— ์ˆ˜ํ–‰์‹œํ‚จ ํ›„ ํƒ€์ด๋จธ์™€ I/O ์ค‘ ๋จผ์ € ๋๋‚˜" +"๋Š” ๊ฒƒ์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€๋™์‹œ์„ฑ๋„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/tasks.md:10 +msgid "" +"```rust,compile_fail\n" +"use tokio::io::{self, AsyncReadExt, AsyncWriteExt};\n" +"use tokio::net::TcpListener;\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> io::Result<()> {\n" +" let listener = TcpListener::bind(\"127.0.0.1:6142\").await?;\n" +"\tprintln!(\"listening on port 6142\");\n" +"\n" +" loop {\n" +" let (mut socket, addr) = listener.accept().await?;\n" +"\n" +" println!(\"connection from {addr:?}\");\n" +"\n" +" tokio::spawn(async move {\n" +" if let Err(e) = socket.write_all(b\"Who are you?\\n\").await {\n" +" println!(\"socket error: {e:?}\");\n" +" return;\n" +" }\n" +"\n" +" let mut buf = vec![0; 1024];\n" +" let reply = match socket.read(&mut buf).await {\n" +" Ok(n) => {\n" +" let name = std::str::from_utf8(&buf[..n]).unwrap()." +"trim();\n" +" format!(\"Thanks for dialing in, {name}!\\n\")\n" +" }\n" +" Err(e) => {\n" +" println!(\"socket error: {e:?}\");\n" +" return;\n" +" }\n" +" };\n" +"\n" +" if let Err(e) = socket.write_all(reply.as_bytes()).await {\n" +" println!(\"socket error: {e:?}\");\n" +" }\n" +" });\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,compile_fail\n" +"use tokio::io::{self, AsyncReadExt, AsyncWriteExt};\n" +"use tokio::net::TcpListener;\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> io::Result<()> {\n" +" let listener = TcpListener::bind(\"127.0.0.1:6142\").await?;\n" +"\tprintln!(\"listening on port 6142\");\n" +"\n" +" loop {\n" +" let (mut socket, addr) = listener.accept().await?;\n" +"\n" +" println!(\"connection from {addr:?}\");\n" +"\n" +" tokio::spawn(async move {\n" +" if let Err(e) = socket.write_all(b\"Who are you?\\n\").await {\n" +" println!(\"socket error: {e:?}\");\n" +" return;\n" +" }\n" +"\n" +" let mut buf = vec![0; 1024];\n" +" let reply = match socket.read(&mut buf).await {\n" +" Ok(n) => {\n" +" let name = std::str::from_utf8(&buf[..n]).unwrap()." +"trim();\n" +" format!(\"Thanks for dialing in, {name}!\\n\")\n" +" }\n" +" Err(e) => {\n" +" println!(\"socket error: {e:?}\");\n" +" return;\n" +" }\n" +" };\n" +"\n" +" if let Err(e) = socket.write_all(reply.as_bytes()).await {\n" +" println!(\"socket error: {e:?}\");\n" +" }\n" +" });\n" +" }\n" +"}\n" +"```" + +#: src/async/tasks.md:52 src/async/control-flow/join.md:36 +msgid "" +"Copy this example into your prepared `src/main.rs` and run it from there." +msgstr "" +"์ด ์˜ˆ์ œ๋ฅผ, ๋กœ์ปฌ ์ปดํ“จํ„ฐ์— ๋งŒ๋“ค์–ด ๋‘” `src/main.rs`์— ๋ณต์‚ฌํ•˜๊ณ  ๊ฑฐ๊ธฐ์—์„œ ์‹คํ–‰ํ•˜์„ธ" +"์š”." + +#: src/async/tasks.md:54 +msgid "" +"Ask students to visualize what the state of the example server would be with " +"a few connected clients. What tasks exist? What are their Futures?" +msgstr "" +"์ˆ˜๊ฐ•์ƒ๋“ค์—๊ฒŒ ์ด ์„œ๋ฒ„์— ๋ช‡ ๊ฐœ์˜ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์—ฐ๊ฒฐ๋˜๋ฉด ์ด ์„œ๋ฒ„์˜ ์ƒํƒœ๊ฐ€ ์–ด๋–ป๊ฒŒ " +"๋ณ€ํ• ์ง€ ๊ทธ๋ฆผ์„ ๊ทธ๋ ค๋ณด๋„๋ก ํ•˜์„ธ์š”. ์–ด๋–ค ํƒœ์Šคํฌ๋“ค์ด ์žˆ๋Š”์ง€, ์ด ํƒœ์Šคํฌ๋“ค์˜ Future" +"๋Š” ์–ด๋–ค ์ƒํƒœ์— ์žˆ๋Š”์ง€ ๋ฌผ์–ด๋ด…๋‹ˆ๋‹ค." + +#: src/async/tasks.md:57 +msgid "" +"This is the first time we've seen an `async` block. This is similar to a " +"closure, but does not take any arguments. Its return value is a Future, " +"similar to an `async fn`. " +msgstr "" +"`async` ๋ธ”๋ก์„ ์ฒ˜์Œ ๋ณด๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ํด๋กœ์ €์™€ ๋น„์Šทํ•˜์ง€๋งŒ ์ธ์ž๋ฅผ ๋ฐ›์ง€ " +"์•Š์Šต๋‹ˆ๋‹ค. ๋ฆฌํ„ด ํƒ€์ž…์€ `async fn`๊ณผ ๋น„์Šทํ•œ Future์ž…๋‹ˆ๋‹ค. " + +#: src/async/tasks.md:61 +msgid "" +"Refactor the async block into a function, and improve the error handling " +"using `?`." +msgstr "" +"Async ๋ธ”๋ก์„ ํ•จ์ˆ˜๋กœ ๋ฆฌํŒฉํ„ฐ๋งํ•˜๊ณ  `?`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ๋ฅผ ๊ฐœ์„ ํ•ด ๋ด…์‹œ๋‹ค." + +#: src/async/channels.md:3 +msgid "" +"Several crates have support for asynchronous channels. For instance `tokio`:" +msgstr "" +"์—ฌ๋Ÿฌ ํฌ๋ ˆ์ดํŠธ์—์„œ ๋น„๋™๊ธฐ ์ฑ„๋„์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด `tokio`์—์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™" +"์ดํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/channels.md:5 +#, fuzzy +msgid "" +"```rust,editable,compile_fail\n" +"use tokio::sync::mpsc::{self, Receiver};\n" +"\n" +"async fn ping_handler(mut input: Receiver<()>) {\n" +" let mut count: usize = 0;\n" +"\n" +" while let Some(_) = input.recv().await {\n" +" count += 1;\n" +" println!(\"Received {count} pings so far.\");\n" +" }\n" +"\n" +" println!(\"ping_handler complete\");\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (sender, receiver) = mpsc::channel(32);\n" +" let ping_handler_task = tokio::spawn(ping_handler(receiver));\n" +" for i in 0..10 {\n" +" sender.send(()).await.expect(\"Failed to send ping.\");\n" +" println!(\"Sent {} pings so far.\", i + 1);\n" +" }\n" +"\n" +" drop(sender);\n" +" ping_handler_task.await.expect(\"Something went wrong in ping handler " +"task.\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use tokio::sync::mpsc::{self, Receiver};\n" +"\n" +"async fn ping_handler(mut input: Receiver<()>) {\n" +" let mut count: usize = 0;\n" +"\n" +" while let Some(_) = input.recv().await {\n" +" count += 1;\n" +" println!(\"Received {count} pings so far.\");\n" +" }\n" +"\n" +" println!(\"ping_handler complete\");\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (sender, receiver) = mpsc::channel(32);\n" +" let ping_handler_task = tokio::spawn(ping_handler(receiver));\n" +" for i in 0..10 {\n" +" sender.send(()).await.expect(\"Failed to send ping.\");\n" +" println!(\"Sent {} pings so far.\", i + 1);\n" +" }\n" +"\n" +" std::mem::drop(sender);\n" +" ping_handler_task.await.expect(\"Something went wrong in ping handler " +"task.\");\n" +"}\n" +"```" + +#: src/async/channels.md:35 +msgid "Change the channel size to `3` and see how it affects the execution." +msgstr "์ฑ„๋„ ํฌ๊ธฐ๋ฅผ `3`์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋™์ž‘์ด ์–ด๋–ป๊ฒŒ ๋ฐ”๋€Œ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”." + +#: src/async/channels.md:37 +msgid "" +"Overall, the interface is similar to the `sync` channels as seen in the " +"[morning class](concurrency/channels.md)." +msgstr "" +"๋น„๋™๊ธฐ ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋Š” [์˜ค์ „ ๊ณผ์ •](concurrency/channels.md)" +"์—์„œ ๋ฐฐ์šด `sync` ์ฑ„๋„๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/channels.md:40 +msgid "Try removing the `std::mem::drop` call. What happens? Why?" +msgstr "" +"`std::mem::drop` ํ˜ธ์ถœํ•˜๋Š” ์ค„์„ ์‚ญ์ œํ•ด ๋ณด์„ธ์š”. ์–ด๋–ค ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋‚˜์š”? ์ด์œ ๊ฐ€ " +"๋ฌด์—‡์ธ๊ฐ€์š”?" + +#: src/async/channels.md:42 +msgid "" +"The [Flume](https://docs.rs/flume/latest/flume/) crate has channels that " +"implement both `sync` and `async` `send` and `recv`. This can be convenient " +"for complex applications with both IO and heavy CPU processing tasks." +msgstr "" +"[Flume](https://docs.rs/flume/latest/flume/) ํฌ๋ ˆ์ดํŠธ์—๋Š” `sync`์™€ `async`, " +"`send`์™€ `recv`๋ฅผ ๋ชจ๋‘ ๊ตฌํ˜„ํ•˜๋Š” ์ฑ„๋„์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ IO์™€ CPU ์ฒ˜๋ฆฌ ์ž‘์—…์ด " +"๋งŽ์€ ๋ณต์žกํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌํ˜„ํ•  ๋•Œ ๋งค์šฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/channels.md:46 +msgid "" +"What makes working with `async` channels preferable is the ability to " +"combine them with other `future`s to combine them and create complex control " +"flow." +msgstr "" +"`async` ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ์ด์œ ๋Š” ์ด๋ฅผ ๋‹ค๋ฅธ `future`์™€ ๊ฒฐํ•ฉํ•˜์—ฌ ๋ณต" +"์žกํ•œ ์ œ์–ด ํ๋ฆ„์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/async/control-flow.md:1 +#, fuzzy +msgid "Futures Control Flow" +msgstr "ํ๋ฆ„ ์ œ์–ด" + +#: src/async/control-flow.md:3 +msgid "" +"Futures can be combined together to produce concurrent compute flow graphs. " +"We have already seen tasks, that function as independent threads of " +"execution." +msgstr "" +"Future๋“ค์„ ๊ฒฐํ•ฉํ•˜์—ฌ ๊ณ„์‚ฐ ๊ณผ์ •์„ ๋™์‹œ์„ฑ์ด ์žˆ๋Š” ํ”Œ๋กœ์šฐ ๊ทธ๋ž˜ํ”„ ํ˜•ํƒœ๋กœ ๋ชจ๋ธ๋ง ํ•  " +"์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ž์„œ ๋ฐฐ์šด, ๊ฐ ํƒœ์Šคํฌ๊ฐ€ ๋…๋ฆฝ์ ์œผ๋กœ ์ˆ˜ํ–‰๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ๋„ Future๋“ค" +"์„ ๊ฒฐํ•ฉํ•˜๋Š” ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/control-flow.md:6 +msgid "[Join](control-flow/join.md)" +msgstr "[Join](control-flow/join.md)" + +#: src/async/control-flow.md:7 +msgid "[Select](control-flow/select.md)" +msgstr "[Select](control-flow/select.md)" + +#: src/async/control-flow/join.md:3 +msgid "" +"A join operation waits until all of a set of futures are ready, and returns " +"a collection of their results. This is similar to `Promise.all` in " +"JavaScript or `asyncio.gather` in Python." +msgstr "" +"Join ์—ฐ์‚ฐ์€ ๋ชจ๋“  future๊ฐ€ ์ค€๋น„๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฐ ํ›„, ๊ฐ future์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋‹ด์€ " +"์ปฌ๋ ‰์…˜์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ `Promise.all`์ด๋‚˜ ํŒŒ์ด์ฌ์˜ `asyncio." +"gather`์™€ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/control-flow/join.md:7 +msgid "" +"```rust,editable,compile_fail\n" +"use anyhow::Result;\n" +"use futures::future;\n" +"use reqwest;\n" +"use std::collections::HashMap;\n" +"\n" +"async fn size_of_page(url: &str) -> Result {\n" +" let resp = reqwest::get(url).await?;\n" +" Ok(resp.text().await?.len())\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let urls: [&str; 4] = [\n" +" \"https://google.com\",\n" +" \"https://httpbin.org/ip\",\n" +" \"https://play.rust-lang.org/\",\n" +" \"BAD_URL\",\n" +" ];\n" +" let futures_iter = urls.into_iter().map(size_of_page);\n" +" let results = future::join_all(futures_iter).await;\n" +" let page_sizes_dict: HashMap<&str, Result> =\n" +" urls.into_iter().zip(results.into_iter()).collect();\n" +" println!(\"{:?}\", page_sizes_dict);\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use anyhow::Result;\n" +"use futures::future;\n" +"use reqwest;\n" +"use std::collections::HashMap;\n" +"\n" +"async fn size_of_page(url: &str) -> Result {\n" +" let resp = reqwest::get(url).await?;\n" +" Ok(resp.text().await?.len())\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let urls: [&str; 4] = [\n" +" \"https://google.com\",\n" +" \"https://httpbin.org/ip\",\n" +" \"https://play.rust-lang.org/\",\n" +" \"BAD_URL\",\n" +" ];\n" +" let futures_iter = urls.into_iter().map(size_of_page);\n" +" let results = future::join_all(futures_iter).await;\n" +" let page_sizes_dict: HashMap<&str, Result> =\n" +" urls.into_iter().zip(results.into_iter()).collect();\n" +" println!(\"{:?}\", page_sizes_dict);\n" +"}\n" +"```" + +#: src/async/control-flow/join.md:38 +msgid "" +"For multiple futures of disjoint types, you can use `std::future::join!` but " +"you must know how many futures you will have at compile time. This is " +"currently in the `futures` crate, soon to be stabilised in `std::future`." +msgstr "" +"์„œ๋กœ ๋‹ค๋ฅธ ํƒ€์ž…์„ ๊ฐ€์ง€๋Š” ์—ฌ๋Ÿฌ ์—ฌ๋Ÿฌ futures๋“ค์„ joinํ•˜๊ณ ์ž ํ•  ๊ฒฝ์šฐ `std::" +"future::join!`์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋งคํฌ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด futures๊ฐ€ ๋ช‡ ๊ฐœ" +"๋‚˜ ์žˆ์„์ง€ ์ปดํŒŒ์ผ ํ•  ๋•Œ ์•Œ์•„์•ผ ํ•œ๋‹ค๋Š” ์ ์„ ์ฃผ์˜ํ•˜์„ธ์š”. ์ด ๋งคํฌ๋กœ๋Š” ์ง€๊ธˆ์€ " +"'futures' ํฌ๋ ˆ์ดํŠธ์— ์žˆ์œผ๋ฉฐ ๊ณง ์•ˆ์ •ํ™” ๋˜์–ด `std::future`์— ํฌํ•จ๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค." + +#: src/async/control-flow/join.md:42 +msgid "" +"The risk of `join` is that one of the futures may never resolve, this would " +"cause your program to stall. " +msgstr "" +"'join'์˜ ์œ„ํ—˜์„ฑ์€ futures๋“ค ์ค‘ ํ•˜๋‚˜๊ฐ€ ์˜์˜ ๋๋‚˜์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. " +"๊ทธ๋Ÿฌ๋ฉด ํ”„๋กœ๊ทธ๋žจ์ด ๋”์ด์ƒ ์ง„ํ–‰์„ ๋ชปํ•˜๊ณ  ๋ฉˆ์ถฐ์žˆ์„(stall) ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " + +#: src/async/control-flow/join.md:45 +msgid "" +"You can also combine `join_all` with `join!` for instance to join all " +"requests to an http service as well as a database query. Try adding a " +"`tokio::time::sleep` to the future, using `futures::join!`. This is not a " +"timeout (that requires `select!`, explained in the next chapter), but " +"demonstrates `join!`." +msgstr "" +"`join_all`์„ `join!`๊ณผ ๊ฒฐํ•ฉํ•˜์—ฌ http ์„œ๋น„์Šค์™€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋Œ€ํ•œ ๋ชจ๋“  ์š”์ฒญ๋“ค" +"์„ ํ•œ๊บผ๋ฒˆ์— ์ง„ํ–‰์‹œํ‚ฌ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. `futures::join!`์„ ์‚ฌ์šฉํ•˜์—ฌ `tokio::" +"time::sleep`์„ future์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์ด๊ฑด ํƒ€์ž„์•„์›ƒ์„ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹˜์„ " +"์ฃผ์˜ํ•˜์„ธ์š”. ์‹ค์ œ๋กœ, ํƒ€์ž„์•„์›ƒ์€ ๋‹ค์Œ ์žฅ์—์„œ ์„ค๋ช…ํ•˜๋Š” `select!`๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ตฌ" +"ํ˜„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” `tokio::time::sleep`์„ ์‚ฌ์šฉํ•œ ๊ฒƒ์€ ๋‹จ์ˆœํžˆ `join!`์˜ " +"๋™์ž‘์„ ์„ค๋ช…ํ•˜๊ธฐ ์œ„ํ•จ์ž…๋‹ˆ๋‹ค." + +#: src/async/control-flow/select.md:3 +msgid "" +"A select operation waits until any of a set of futures is ready, and " +"responds to that future's result. In JavaScript, this is similar to `Promise." +"race`. In Python, it compares to `asyncio.wait(task_set, return_when=asyncio." +"FIRST_COMPLETED)`." +msgstr "" +"Select ์—ฐ์‚ฐ์€ ์—ฌ๋Ÿฌ future๋“ค ๋ชจ๋‘์— ๋Œ€ํ•ด์„œ ์ค€๋น„๋  ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€, ๊ทธ ์ค‘ ์–ด" +"๋–ค ํ•œ future๊ฐ€ ์ตœ์ดˆ๋กœ ์ค€๋น„ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด ํ•ด๋‹น future์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. ์ด" +"๊ฒƒ์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ์˜ `Promise.race`์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ด์ฌ์—์„œ๋ผ๋ฉด `asyncio." +"wait(task_set, return_when=asyncio.FIRST_COMPLETED)`๊ฐ€ ํ•˜๋Š” ๋™์ž‘๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ" +"๋‹ค." + +#: src/async/control-flow/select.md:8 +msgid "" +"Similar to a match statement, the body of `select!` has a number of arms, " +"each of the form `pattern = future => statement`. When the `future` is " +"ready, the `statement` is executed with the variables in `pattern` bound to " +"the `future`'s result." +msgstr "" +"`select!` ์•ˆ์—๋Š”, `match`๋ฌธ๊ณผ ๋น„์Šทํ•˜๊ฒŒ, `pattern = future => statement` ํ˜•ํƒœ" +"์˜ ๋ธŒ๋žœ์น˜(arm) ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์–ด๋–ค 'future'๊ฐ€ ์ง„ํ–‰ ๊ฐ€๋Šฅ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด '๊ทธ " +"`future`์˜ ๊ฒฐ๊ณผ๊ฐ’์ด `pattern`์œผ๋กœ ๋ฐ”์ธ๋”ฉ ๋˜๋ฉฐ, ๊ทธ ์ƒํƒœ์—์„œ \\`statement'๊ฐ€ ์ˆ˜" +"ํ–‰๋ฉ๋‹ˆ๋‹ค." + +#: src/async/control-flow/select.md:13 +msgid "" +"```rust,editable,compile_fail\n" +"use tokio::sync::mpsc::{self, Receiver};\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"#[derive(Debug, PartialEq)]\n" +"enum Animal {\n" +" Cat { name: String },\n" +" Dog { name: String },\n" +"}\n" +"\n" +"async fn first_animal_to_finish_race(\n" +" mut cat_rcv: Receiver,\n" +" mut dog_rcv: Receiver,\n" +") -> Option {\n" +" tokio::select! {\n" +" cat_name = cat_rcv.recv() => Some(Animal::Cat { name: cat_name? }),\n" +" dog_name = dog_rcv.recv() => Some(Animal::Dog { name: dog_name? })\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (cat_sender, cat_receiver) = mpsc::channel(32);\n" +" let (dog_sender, dog_receiver) = mpsc::channel(32);\n" +" tokio::spawn(async move {\n" +" sleep(Duration::from_millis(500)).await;\n" +" cat_sender\n" +" .send(String::from(\"Felix\"))\n" +" .await\n" +" .expect(\"Failed to send cat.\");\n" +" });\n" +" tokio::spawn(async move {\n" +" sleep(Duration::from_millis(50)).await;\n" +" dog_sender\n" +" .send(String::from(\"Rex\"))\n" +" .await\n" +" .expect(\"Failed to send dog.\");\n" +" });\n" +"\n" +" let winner = first_animal_to_finish_race(cat_receiver, dog_receiver)\n" +" .await\n" +" .expect(\"Failed to receive winner\");\n" +"\n" +" println!(\"Winner is {winner:?}\");\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use tokio::sync::mpsc::{self, Receiver};\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"#[derive(Debug, PartialEq)]\n" +"enum Animal {\n" +" Cat { name: String },\n" +" Dog { name: String },\n" +"}\n" +"\n" +"async fn first_animal_to_finish_race(\n" +" mut cat_rcv: Receiver,\n" +" mut dog_rcv: Receiver,\n" +") -> Option {\n" +" tokio::select! {\n" +" cat_name = cat_rcv.recv() => Some(Animal::Cat { name: cat_name? }),\n" +" dog_name = dog_rcv.recv() => Some(Animal::Dog { name: dog_name? })\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (cat_sender, cat_receiver) = mpsc::channel(32);\n" +" let (dog_sender, dog_receiver) = mpsc::channel(32);\n" +" tokio::spawn(async move {\n" +" sleep(Duration::from_millis(500)).await;\n" +" cat_sender\n" +" .send(String::from(\"Felix\"))\n" +" .await\n" +" .expect(\"Failed to send cat.\");\n" +" });\n" +" tokio::spawn(async move {\n" +" sleep(Duration::from_millis(50)).await;\n" +" dog_sender\n" +" .send(String::from(\"Rex\"))\n" +" .await\n" +" .expect(\"Failed to send dog.\");\n" +" });\n" +"\n" +" let winner = first_animal_to_finish_race(cat_receiver, dog_receiver)\n" +" .await\n" +" .expect(\"Failed to receive winner\");\n" +"\n" +" println!(\"Winner is {winner:?}\");\n" +"}\n" +"```" + +#: src/async/control-flow/select.md:62 +#, fuzzy +msgid "" +"In this example, we have a race between a cat and a dog. " +"`first_animal_to_finish_race` listens to both channels and will pick " +"whichever arrives first. Since the dog takes 50ms, it wins against the cat " +"that take 500ms seconds." +msgstr "" +"์ด ์˜ˆ์ œ์—์„œ๋Š” ๊ณ ์–‘์ด์™€ ๊ฐœ๋ฅผ ๊ฒฝ์ฃผ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค(๋™์‹œ์— ์‹œ์ž‘์‹œํ‚จ ํ›„, ๋‘˜ ์ค‘ ๋จผ์ € ๋" +"๋‚˜๋Š” ์ชฝ์ด ์ด๊น€). `first_animal_to_finish_race`ํ•จ์ˆ˜๋Š” ๋‘ ์ฑ„๋„ ๋ชจ๋‘์— ๊ท€๊ธฐ์šธ์ด" +"๊ณ (listenํ•˜๊ณ ) ์žˆ๋‹ค๊ฐ€, ๋ฉ”์‹œ์ง€๊ฐ€ ๋จผ์ € ๋„์ฐฉํ•œ ์ฑ„๋„์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ๊ฐœ๋Š” 50ms๋งŒ์— " +"์ž‘์—…์„ ๋๋‚ด๊ณ  ๊ณ ์–‘์ด๋Š” 500ms๊ฐ€ ๊ฑธ๋ฆฌ๊ธฐ ๋•Œ๋ฌธ์—, ๊ฐœ๊ฐ€ ์ด๊น๋‹ˆ๋‹ค." + +#: src/async/control-flow/select.md:67 +#, fuzzy +msgid "" +"You can use `oneshot` channels in this example as the channels are supposed " +"to receive only one `send`." +msgstr "" +"์ด ์˜ˆ์ œ์—์„œ๋Š” `oneshot` ์ฑ„๋„์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์€ ๋””์ž์ธ ์ž…๋‹ˆ๋‹ค. ๊ฐ ์ฑ„๋„" +"์ด ํ•œ ๋ฒˆ์˜ `send`๋งŒ ์ˆ˜์‹ ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค." + +#: src/async/control-flow/select.md:70 +#, fuzzy +msgid "" +"Try adding a deadline to the race, demonstrating selecting different sorts " +"of futures." +msgstr "" +"์ด ๊ฒฝ์ฃผ์— ํƒ€์ž„์•„์›ƒ์„ ์ถ”๊ฐ€ํ•ด์„œ, ์„œ๋กœ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ futures๋“ค์„ ๋™์‹œ์— `select`" +"ํ•  ์ˆ˜ ์žˆ์Œ์„ ํ™•์ธํ•ด ๋ณด์„ธ์š”." + +#: src/async/control-flow/select.md:73 +#, fuzzy +msgid "" +"Note that `select!` drops unmatched branches, which cancels their futures. " +"It is easiest to use when every execution of `select!` creates new futures." +msgstr "" +"`select!`๋Š” ๋งค์นญ๋˜์ง€ ์•Š์€ ๋‹ค๋ฅธ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์— ๋Œ€ํ•ด drop์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ " +"๊ฒฝ์Ÿ์—์„œ ์ง„ ๋ชจ๋“  future๋“ค์€ ์ทจ์†Œ(cancel) ๋ฉ๋‹ˆ๋‹ค. `select!`๋ฅผ ์‹คํ–‰ํ•  ๋•Œ๋งˆ๋‹ค " +"์ƒˆ๋กœ์šด futures๊ฐ€ ๋งŒ๋“ค์–ด์ง€๋Š” ๊ฒฝ์šฐ๋ผ๋ฉด, ์ด๋Ÿฌํ•œ ์ ์ด ๋งค์šฐ ํŽธํ•˜๊ฒŒ ๋А๊ปด์งˆ ๊ฒƒ์ž…๋‹ˆ" +"๋‹ค. Future๊ฐ€ ์ทจ์†Œ๋˜๋Š” ๊ฒƒ์„ ๋ง‰๊ธฐ ์œ„ํ•ด future๋ฅผ ์ง์ ‘ ์ „๋‹ฌํ•˜๋Š” ๋Œ€์‹  `&mut " +"future`๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต" +"๋‹ˆ๋‹ค (์™œ ๊ทธ๋Ÿฐ์ง€๋Š” `Pin`์„ค๋ช…ํ•  ๋•Œ ์ž์„ธํžˆ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค)." + +#: src/async/control-flow/select.md:76 +msgid "" +"An alternative is to pass `&mut future` instead of the future itself, but " +"this can lead to issues, further discussed in the pinning slide." +msgstr "" + +#: src/async/pitfalls.md:1 +msgid "Pitfalls of async/await" +msgstr "async/await์—์„œ ์ฃผ์˜ํ•ด์•ผํ•  ํ•จ์ •" + +#: src/async/pitfalls.md:3 +msgid "" +"Async / await provides convenient and efficient abstraction for concurrent " +"asynchronous programming. However, the async/await model in Rust also comes " +"with its share of pitfalls and footguns. We illustrate some of them in this " +"chapter:" +msgstr "" +"Async์™€ await๋Š” ๋™์‹œ ๋น„๋™๊ธฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์œ„ํ•œ ํŽธ๋ฆฌํ•˜๊ณ  ํšจ์œจ์ ์ธ ์ถ”์ƒํ™”๋ฅผ ์ œ๊ณต" +"ํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Rust์˜ async/await ๋ชจ๋ธ์—๋„ ๋ฌธ์ œ๋Š” ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์žฅ์—์„œ ๋ช‡ ๊ฐ€" +"์ง€ ์˜ˆ๋ฅผ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls.md:5 +#, fuzzy +msgid "[Blocking the Executor](pitfalls/blocking-executor.md)" +msgstr "[์‹คํ–‰์ž ์ฐจ๋‹จ](pitfalls/blocking-executor.md)" + +#: src/async/pitfalls.md:6 +#, fuzzy +msgid "[Pin](pitfalls/pin.md)" +msgstr "[๊ณ ์ •](pitfalls/pin.md)" + +#: src/async/pitfalls.md:7 +#, fuzzy +msgid "[Async Traits](pitfalls/async-traits.md)" +msgstr "[๋น„๋™๊ธฐ ํŠธ๋ ˆ์ž‡](pitfall/async-traits.md)" + +#: src/async/pitfalls.md:8 +msgid "[Cancellation](pitfalls/cancellation.md)" +msgstr "" + +#: src/async/pitfalls/blocking-executor.md:1 +msgid "Blocking the executor" +msgstr "์‹คํ–‰์ž(executor)๋ฅผ ๋ธ”๋ก์‹œํ‚ด" + +#: src/async/pitfalls/blocking-executor.md:3 +msgid "" +"Most async runtimes only allow IO tasks to run concurrently. This means that " +"CPU blocking tasks will block the executor and prevent other tasks from " +"being executed. An easy workaround is to use async equivalent methods where " +"possible." +msgstr "" +"๋Œ€๋ถ€๋ถ„์˜ ๋น„๋™๊ธฐ ๋Ÿฐํƒ€์ž„์€ IO ์ž‘์—…๋งŒ ๋™์‹œ์— ์‹คํ–‰๋˜๋„๋ก ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, CPU๋ฅผ ๋ธ”" +"๋Ÿญํ•˜๋Š” ํƒœ์Šคํฌ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ์ด๋Š” ์‹คํ–‰์ž(executor)๋ฅผ ๋ธ”๋Ÿญํ•˜๊ฒŒ ๋˜๋ฉฐ, ๊ทธ ๊ฒฐ๊ณผ๋กœ " +"๋‹ค๋ฅธ ํƒœ์Šคํฌ๊ฐ€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์€, ํ•ญ์ƒ async" +"๋ฅผ ์ง€์›ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." + +#: src/async/pitfalls/blocking-executor.md:7 +msgid "" +"```rust,editable,compile_fail\n" +"use futures::future::join_all;\n" +"use std::time::Instant;\n" +"\n" +"async fn sleep_ms(start: &Instant, id: u64, duration_ms: u64) {\n" +" std::thread::sleep(std::time::Duration::from_millis(duration_ms));\n" +" println!(\n" +" \"future {id} slept for {duration_ms}ms, finished after {}ms\",\n" +" start.elapsed().as_millis()\n" +" );\n" +"}\n" +"\n" +"#[tokio::main(flavor = \"current_thread\")]\n" +"async fn main() {\n" +" let start = Instant::now();\n" +" let sleep_futures = (1..=10).map(|t| sleep_ms(&start, t, t * 10));\n" +" join_all(sleep_futures).await;\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use futures::future::join_all;\n" +"use std::time::Instant;\n" +"\n" +"async fn sleep_ms(start: &Instant, id: u64, duration_ms: u64) {\n" +" std::thread::sleep(std::time::Duration::from_millis(duration_ms));\n" +" println!(\n" +" \"future {id} slept for {duration_ms}ms, finished after {}ms\",\n" +" start.elapsed().as_millis()\n" +" );\n" +"}\n" +"\n" +"#[tokio::main(flavor = \"current_thread\")]\n" +"async fn main() {\n" +" let start = Instant::now();\n" +" let sleep_futures = (1..=10).map(|t| sleep_ms(&start, t, t * 10));\n" +" join_all(sleep_futures).await;\n" +"}\n" +"```" + +#: src/async/pitfalls/blocking-executor.md:29 +msgid "" +"Run the code and see that the sleeps happen consecutively rather than " +"concurrently." +msgstr "" +"์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ sleep๋“ค์ด ๋™์‹œ์— ์ง„ํ–‰๋˜์ง€ ์•Š๊ณ  ์ˆœ์ฐจ์ ์œผ๋กœ์œผ๋กœ ์ง„ํ–‰๋˜๋Š”์ง€ ํ™•์ธ" +"ํ•˜์„ธ์š”." + +#: src/async/pitfalls/blocking-executor.md:32 +msgid "" +"The `\"current_thread\"` flavor puts all tasks on a single thread. This " +"makes the effect more obvious, but the bug is still present in the multi-" +"threaded flavor." +msgstr "" +"`flavor`๋ฅผ `\"current_thread\"` ๋กœ ์„ค์ •ํ•˜๋ฉด ๋ชจ๋“  ํƒœ์Šคํฌ๊ฐ€ ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ " +"์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฌธ์ œ ์ƒํ™ฉ์ด ๋” ๋ถ„๋ช…ํžˆ ๋“œ๋Ÿฌ๋‚ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ฒ„๊ทธ๋Š” ๋ฉ€" +"ํ‹ฐ์Šค๋ ˆ๋“œ์ธ ๊ฒฝ์šฐ์—๋„ ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/pitfalls/blocking-executor.md:36 +msgid "" +"Switch the `std::thread::sleep` to `tokio::time::sleep` and await its result." +msgstr "" +"`std::thread::sleep`์„ `tokio::time::sleep`์œผ๋กœ ๋ฐ”๊พธ๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋ฅผ `await`ํ•ด ๋ณด" +"์„ธ์š”." + +#: src/async/pitfalls/blocking-executor.md:38 +msgid "" +"Another fix would be to `tokio::task::spawn_blocking` which spawns an actual " +"thread and transforms its handle into a future without blocking the executor." +msgstr "" +"๋˜ ๋‹ค๋ฅธ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ `tokio::task::spawn_blocking`์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์‹ค์ œ ์Šค๋ ˆ๋“œ๋ฅผ " +"์ƒ์„ฑํ•˜๊ณ , ๊ทธ ์Šค๋ ˆ๋“œ์— ๋Œ€ํ•œ ํ•ธ๋“ค์„ future๋กœ ๋ณ€ํ™˜ํ•จ์œผ๋กœ์จ ์‹คํ–‰์ž๊ฐ€ ๋ธ”๋ก๋˜๋Š” ๊ฒƒ" +"์„ ๋ง‰์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/blocking-executor.md:41 +msgid "" +"You should not think of tasks as OS threads. They do not map 1 to 1 and most " +"executors will allow many tasks to run on a single OS thread. This is " +"particularly problematic when interacting with other libraries via FFI, " +"where that library might depend on thread-local storage or map to specific " +"OS threads (e.g., CUDA). Prefer `tokio::task::spawn_blocking` in such " +"situations." +msgstr "" +"ํƒœ์Šคํฌ๋ฅผ OS ์Šค๋ ˆ๋“œ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์•ˆ ๋ฉ๋‹ˆ๋‹ค. ํƒœ์Šคํฌ์™€ OS์Šค๋ ˆ๋“œ๋Š” ์ผ๋Œ€์ผ ๋งคํ•‘ ๊ด€" +"๊ณ„์— ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์‹คํ–‰์ž๋Š” ํ•˜๋‚˜์˜ OS ์Šค๋ ˆ๋“œ์—์„œ ์ตœ๋Œ€ํ•œ ๋งŽ์€ ํƒœ์Šคํฌ" +"๋ฅผ ์ˆ˜ํ–‰ํ•˜๋„๋ก ์„ค๊ณ„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์ ์€ FFI๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ์ƒํ˜ธ์ž‘์šฉ" +"ํ•  ๋•Œ ํŠนํžˆ ๋ฌธ์ œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์Šค๋ ˆ๋“œ ๋กœ์ปฌ ์ €์žฅ์†Œ๋ฅผ " +"์ด์šฉํ•˜๊ฑฐ๋‚˜ ํŠน์ • OS ์Šค๋ ˆ๋“œ์— ๋งคํ•‘๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(์˜ˆ: CUDA). ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์—์„œ๋Š” " +"`tokio::task::spawn_blocking`์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/blocking-executor.md:47 +msgid "" +"Use sync mutexes with care. Holding a mutex over an `.await` may cause " +"another task to block, and that task may be running on the same thread." +msgstr "" +"๋™๊ธฐํ™” ๋ฎคํ…์Šค๋ฅผ ์ฃผ์˜ํ•ด์„œ ์‚ฌ์šฉํ•˜์„ธ์š”. `.await` ์œ„์— ๋ฎคํ…์Šค๋ฅผ ์ ์šฉํ•˜๋ฉด ๋‹ค๋ฅธ ์ž‘" +"์—…์ด ์ฐจ๋‹จ๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ ํ•ด๋‹น ์ž‘์—…์€ ๋™์ผํ•œ ์Šค๋ ˆ๋“œ์—์„œ ์‹คํ–‰ ์ค‘์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/pin.md:3 +msgid "" +"When you await a future, all local variables (that would ordinarily be " +"stored on a stack frame) are instead stored in the Future for the current " +"async block. If your future has pointers to data on the stack, those " +"pointers might get invalidated. This is unsafe." +msgstr "" +"Future์— ๋Œ€ํ•ด `await`๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๊ทธ future๊ฐ€ ์ค€๋น„๋˜๊ธฐ๋ฅผ ๊ธฐ๋‹ค๋ฆด ๋•Œ, ๋ชจ๋“  ๋กœ์ปฌ " +"๋ณ€์ˆ˜(์ผ๋ฐ˜์ ์œผ๋กœ ์Šคํƒ ํ”„๋ ˆ์ž„์— ์ €์žฅ๋จ)๋Š” ๊ทธ future๊ฐ์ฒด ์•ˆ์— ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ " +"๊ทธ future์— ์Šคํƒ์— ์žˆ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๋กœ์˜ ํฌ์ธํ„ฐ๊ฐ€ ์žˆ์œผ๋ฉด ์ด๋Ÿฌํ•œ ํฌ์ธํ„ฐ๋Š” ์˜ฌ๋ฐ”" +"๋ฅด์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•ˆ์ „ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/pin.md:8 +msgid "" +"Therefore, you must guarantee that the addresses your future points to don't " +"change. That is why we need to `pin` futures. Using the same future " +"repeatedly in a `select!` often leads to issues with pinned values." +msgstr "" +"๋”ฐ๋ผ์„œ future๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ฃผ์†Œ๊ฐ€ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š๋„๋ก ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด future๋ฅผ " +"`pin`(๊ณ ์ •)ํ•ด์•ผ ํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค. `select!`์—์„œ ๋™์ผํ•œ future๋ฅผ ๋ฐ˜๋ณต์ ์œผ๋กœ ์‚ฌ" +"์šฉํ•˜๋ฉด ๊ณ ์ • ๊ฐ’ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/pin.md:12 +msgid "" +"```rust,editable,compile_fail\n" +"use tokio::sync::{mpsc, oneshot};\n" +"use tokio::task::spawn;\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"// A work item. In this case, just sleep for the given time and respond\n" +"// with a message on the `respond_on` channel.\n" +"#[derive(Debug)]\n" +"struct Work {\n" +" input: u32,\n" +" respond_on: oneshot::Sender,\n" +"}\n" +"\n" +"// A worker which listens for work on a queue and performs it.\n" +"async fn worker(mut work_queue: mpsc::Receiver) {\n" +" let mut iterations = 0;\n" +" loop {\n" +" tokio::select! {\n" +" Some(work) = work_queue.recv() => {\n" +" sleep(Duration::from_millis(10)).await; // Pretend to work.\n" +" work.respond_on\n" +" .send(work.input * 1000)\n" +" .expect(\"failed to send response\");\n" +" iterations += 1;\n" +" }\n" +" // TODO: report number of iterations every 100ms\n" +" }\n" +" }\n" +"}\n" +"\n" +"// A requester which requests work and waits for it to complete.\n" +"async fn do_work(work_queue: &mpsc::Sender, input: u32) -> u32 {\n" +" let (tx, rx) = oneshot::channel();\n" +" work_queue\n" +" .send(Work {\n" +" input,\n" +" respond_on: tx,\n" +" })\n" +" .await\n" +" .expect(\"failed to send on work queue\");\n" +" rx.await.expect(\"failed waiting for response\")\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (tx, rx) = mpsc::channel(10);\n" +" spawn(worker(rx));\n" +" for i in 0..100 {\n" +" let resp = do_work(&tx, i).await;\n" +" println!(\"work result for iteration {i}: {resp}\");\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use tokio::sync::{mpsc, oneshot};\n" +"use tokio::task::spawn;\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"// ์ž‘์—… ํ•ญ๋ชฉ. ์ด ๊ฒฝ์šฐ ์ง€์ •๋œ ์‹œ๊ฐ„ ๋™์•ˆ ์ ˆ์ „ ๋ชจ๋“œ๋กœ ์žˆ๋‹ค๊ฐ€\n" +"// `respond_on` ์ฑ„๋„์˜ ๋ฉ”์‹œ์ง€๋กœ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค.\n" +"#[derive(Debug)]\n" +"struct Work {\n" +" input: u32,\n" +" respond_on: oneshot::Sender,\n" +"}\n" +"\n" +"// ๋Œ€๊ธฐ์—ด์—์„œ ์ž‘์—…์„ ๋ฆฌ์Šจํ•˜๊ณ  ์‹คํ–‰ํ•˜๋Š” worker์ž…๋‹ˆ๋‹ค.\n" +"async fn worker(mut work_queue: mpsc::Receiver) {\n" +" let mut iterations = 0;\n" +" loop {\n" +" tokio::select! {\n" +" Some(work) = work_queue.recv() => {\n" +" sleep(Duration::from_millis(10)).await; // Pretend to work.\n" +" work.respond_on\n" +" .send(work.input * 1000)\n" +" .expect(\"failed to send response\");\n" +" iterations += 1;\n" +" }\n" +" // TODO: 100ms๋งˆ๋‹ค ๋ฐ˜๋ณต ํšŸ์ˆ˜๋ฅผ ๋ณด๊ณ ํ•ฉ๋‹ˆ๋‹ค.\n" +" }\n" +" }\n" +"}\n" +"\n" +"// ์ž‘์—…์„ ์š”์ฒญํ•˜๊ณ  ์ž‘์—…์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์š”์ฒญ์ž์ž…๋‹ˆ๋‹ค.\n" +"async fn do_work(work_queue: &mpsc::Sender, input: u32) -> u32 {\n" +" let (tx, rx) = oneshot::channel();\n" +" work_queue\n" +" .send(Work {\n" +" input,\n" +" respond_on: tx,\n" +" })\n" +" .await\n" +" .expect(\"failed to send on work queue\");\n" +" rx.await.expect(\"failed waiting for response\")\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let (tx, rx) = mpsc::channel(10);\n" +" spawn(worker(rx));\n" +" for i in 0..100 {\n" +" let resp = do_work(&tx, i).await;\n" +" println!(\"work result for iteration {i}: {resp}\");\n" +" }\n" +"}\n" +"```" + +#: src/async/pitfalls/pin.md:68 +msgid "" +"You may recognize this as an example of the actor pattern. Actors typically " +"call `select!` in a loop." +msgstr "" +"์œ„์—์„œ ์†Œ๊ฐœํ•œ ๊ฒƒ์€ ์•กํ„ฐ(actor) ํŒจํ„ด์˜ ํ•œ ์˜ˆ๋ผ๊ณ  ๋ด๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค. ์•กํ„ฐ๋Š” ์ผ๋ฐ˜" +"์ ์œผ๋กœ ๋ฃจํ”„ ์•ˆ์—์„œ `select!`๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/pitfalls/pin.md:71 +msgid "" +"This serves as a summation of a few of the previous lessons, so take your " +"time with it." +msgstr "์ด์ „ ๊ฐ•์˜ ๋ช‡ ๊ฐœ์˜ ๋‚ด์šฉ์„ ์š”์•ฝํ•œ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ฒœ์ฒœํžˆ ์‚ดํŽด๋ณด์„ธ์š”." + +#: src/async/pitfalls/pin.md:74 +msgid "" +"Naively add a `_ = sleep(Duration::from_millis(100)) => { println!(..) }` to " +"the `select!`. This will never execute. Why?" +msgstr "" +"`_ = sleep(Duration::from_millis(100)) => { println!(..) }`์„ `select!`์— ์ถ”" +"๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์ด ์ž‘์—…์€ ์‹คํ–‰๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์™œ ๊ทธ๋Ÿด๊นŒ์š”?" + +#: src/async/pitfalls/pin.md:77 +msgid "" +"Instead, add a `timeout_fut` containing that future outside of the `loop`:" +msgstr "" +"๋Œ€์‹ , ํ•ด๋‹น future๊ฐ€ ํฌํ•จ๋œ `timeout_fut`๋ฅผ `loop` ์™ธ๋ถ€์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”." + +#: src/async/pitfalls/pin.md:79 +msgid "" +"```rust,compile_fail\n" +"let mut timeout_fut = sleep(Duration::from_millis(100));\n" +"loop {\n" +" select! {\n" +" ..,\n" +" _ = timeout_fut => { println!(..); },\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,compile_fail\n" +"let mut timeout_fut = sleep(Duration::from_millis(100));\n" +"loop {\n" +" select! {\n" +" ..,\n" +" _ = timeout_fut => { println!(..); },\n" +" }\n" +"}\n" +"```" + +#: src/async/pitfalls/pin.md:88 +msgid "" +"This still doesn't work. Follow the compiler errors, adding `&mut` to the " +"`timeout_fut` in the `select!` to work around the move, then using `Box::" +"pin`:" +msgstr "" +"์—ฌ์ „ํžˆ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ ์˜ค๋ฅ˜๋ฅผ ๋”ฐ๋ผ `select!`์˜ `timeout_fut`์— " +"`&mut`๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ Move ์‹œ๋ฉ˜ํ‹ฑ ๊ด€๋ จํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  `Box::pin`์„ ์‚ฌ์šฉํ•˜์„ธ์š”." + +#: src/async/pitfalls/pin.md:92 +msgid "" +"```rust,compile_fail\n" +"let mut timeout_fut = Box::pin(sleep(Duration::from_millis(100)));\n" +"loop {\n" +" select! {\n" +" ..,\n" +" _ = &mut timeout_fut => { println!(..); },\n" +" }\n" +"}\n" +"```" +msgstr "" +"```rust,compile_fail\n" +"let mut timeout_fut = Box::pin(sleep(Duration::from_millis(100)));\n" +"loop {\n" +" select! {\n" +" ..,\n" +" _ = &mut timeout_fut => { println!(..); },\n" +" }\n" +"}\n" +"```" + +#: src/async/pitfalls/pin.md:102 +msgid "" +"This compiles, but once the timeout expires it is `Poll::Ready` on every " +"iteration (a fused future would help with this). Update to reset " +"`timeout_fut` every time it expires." +msgstr "" +"์ด๋Š” ์ปดํŒŒ์ผ์€ ๋˜์ง€๋งŒ ํƒ€์ž„ ์•„์›ƒ์ด ๋˜๋ฉด ๋งค๋ฒˆ ๋ฐ˜๋ณตํ•  ๋•Œ ๋งˆ๋‹ค `Poll::Ready`๊ฐ€ ๋ฉ" +"๋‹ˆ๋‹ค(์œตํ•ฉ๋œ future๊ฐ€ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Œ). ํƒ€์ž„ ์•„์›ƒ ๋  ๋•Œ๋งˆ๋‹ค `timeout_fut`๋ฅผ " +"๋ฆฌ์…‹ํ•˜๋„๋ก ์ˆ˜์ •ํ•˜์„ธ์š”." + +#: src/async/pitfalls/pin.md:106 +msgid "" +"Box allocates on the heap. In some cases, `std::pin::pin!` (only recently " +"stabilized, with older code often using `tokio::pin!`) is also an option, " +"but that is difficult to use for a future that is reassigned." +msgstr "" +"Box๋Š” ํž™์— ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค. ๊ฒฝ์šฐ์— ๋”ฐ๋ผ `std::pin::pin!`(์ตœ๊ทผ์—์•ผ ์•ˆ์ •ํ™”๋˜์—ˆ์œผ๋ฉฐ " +"์ด์ „ ์ฝ”๋“œ๋Š” `tokio::pin!`์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Œ)๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ด๋Š” ์žฌ" +"ํ• ๋‹น๋œ future์— ์‚ฌ์šฉํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/pin.md:110 +msgid "" +"Another alternative is to not use `pin` at all but spawn another task that " +"will send to a `oneshot` channel every 100ms." +msgstr "" +"๋˜ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์€ `pin`์„ ์•„์˜ˆ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  100ms๋งˆ๋‹ค `oneshot` ์ฑ„๋„์— ์ „์†กํ•  " +"๋‹ค๋ฅธ ์ž‘์—…์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค." + +#: src/async/pitfalls/async-traits.md:3 +msgid "" +"Async methods in traits are not yet supported in the stable channel ([An " +"experimental feature exists in nightly and should be stabilized in the mid " +"term.](https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-" +"nightly.html))" +msgstr "" +"ํŠธ๋ ˆ์ž‡์— async ๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์€ ์•„์ง ์•ˆ์ •ํ™” ๋ฒ„์ „ ์ฑ„๋„์—์„œ ์ง€์›๋˜์ง€ ์•Š์Šต" +"๋‹ˆ๋‹ค([์‹คํ—˜์šฉ ๊ธฐ๋Šฅ์€ nightly์— ์กด์žฌํ•˜๋ฉฐ ์กฐ๋งŒ๊ฐ„ ์•ˆ์ •ํ™” ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค](https://" +"blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-nightly.html))." + +#: src/async/pitfalls/async-traits.md:5 +msgid "" +"The crate [async_trait](https://docs.rs/async-trait/latest/async_trait/) " +"provides a workaround through a macro:" +msgstr "" +"ํฌ๋ ˆ์ดํŠธ [async_trait](https://docs.rs/async-trait/latest/async_trait/)์€ ๋งค" +"ํฌ๋กœ๋ฅผ ํ†ตํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค." + +#: src/async/pitfalls/async-traits.md:7 +msgid "" +"```rust,editable,compile_fail\n" +"use async_trait::async_trait;\n" +"use std::time::Instant;\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"#[async_trait]\n" +"trait Sleeper {\n" +" async fn sleep(&self);\n" +"}\n" +"\n" +"struct FixedSleeper {\n" +" sleep_ms: u64,\n" +"}\n" +"\n" +"#[async_trait]\n" +"impl Sleeper for FixedSleeper {\n" +" async fn sleep(&self) {\n" +" sleep(Duration::from_millis(self.sleep_ms)).await;\n" +" }\n" +"}\n" +"\n" +"async fn run_all_sleepers_multiple_times(sleepers: Vec>, " +"n_times: usize) {\n" +" for _ in 0..n_times {\n" +" println!(\"running all sleepers..\");\n" +" for sleeper in &sleepers {\n" +" let start = Instant::now();\n" +" sleeper.sleep().await;\n" +" println!(\"slept for {}ms\", start.elapsed().as_millis());\n" +" }\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let sleepers: Vec> = vec![\n" +" Box::new(FixedSleeper { sleep_ms: 50 }),\n" +" Box::new(FixedSleeper { sleep_ms: 100 }),\n" +" ];\n" +" run_all_sleepers_multiple_times(sleepers, 5).await;\n" +"}\n" +"```" +msgstr "" +"```rust,editable,compile_fail\n" +"use async_trait::async_trait;\n" +"use std::time::Instant;\n" +"use tokio::time::{sleep, Duration};\n" +"\n" +"#[async_trait]\n" +"trait Sleeper {\n" +" async fn sleep(&self);\n" +"}\n" +"\n" +"struct FixedSleeper {\n" +" sleep_ms: u64,\n" +"}\n" +"\n" +"#[async_trait]\n" +"impl Sleeper for FixedSleeper {\n" +" async fn sleep(&self) {\n" +" sleep(Duration::from_millis(self.sleep_ms)).await;\n" +" }\n" +"}\n" +"\n" +"async fn run_all_sleepers_multiple_times(sleepers: Vec>, " +"n_times: usize) {\n" +" for _ in 0..n_times {\n" +" println!(\"running all sleepers..\");\n" +" for sleeper in &sleepers {\n" +" let start = Instant::now();\n" +" sleeper.sleep().await;\n" +" println!(\"slept for {}ms\", start.elapsed().as_millis());\n" +" }\n" +" }\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" let sleepers: Vec> = vec![\n" +" Box::new(FixedSleeper { sleep_ms: 50 }),\n" +" Box::new(FixedSleeper { sleep_ms: 100 }),\n" +" ];\n" +" run_all_sleepers_multiple_times(sleepers, 5).await;\n" +"}\n" +"```" + +#: src/async/pitfalls/async-traits.md:51 +msgid "" +"`async_trait` is easy to use, but note that it's using heap allocations to " +"achieve this. This heap allocation has performance overhead." +msgstr "" +"`async_trait`์€ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฝ์ง€๋งŒ ์ด๋ฅผ ์œ„ํ•ด ํž™์— ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹นํ•œ๋‹ค๋Š” ์ ์— ์œ ์˜" +"ํ•˜์„ธ์š”. ์ด ํž™ ํ• ๋‹น์—๋Š” ์„ฑ๋Šฅ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." + +#: src/async/pitfalls/async-traits.md:54 +msgid "" +"The challenges in language support for `async trait` are deep Rust and " +"probably not worth describing in-depth. Niko Matsakis did a good job of " +"explaining them in [this post](https://smallcultfollowing.com/babysteps/" +"blog/2019/10/26/async-fn-in-traits-are-hard/) if you are interested in " +"digging deeper." +msgstr "" +"`async trait` ๋ฅผ ์–ธ์–ด ์ฐจ์›์—์„œ ์ง€์›ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ด€๋ จ๋œ ๋ฌธ์ œ๋Š” ๋งค์šฐ ์ „๋ฌธ์ ์ธ ํ† ํ”ฝ" +"์ด๋ฉฐ ๋”ฐ๋ผ์„œ ์ด ๊ฐ•์˜์—์„œ ๋‹ค๋ฃฐ ๋‚ด์šฉ์€ ์•„๋‹™๋‹ˆ๋‹ค. [์ด ๊ฒŒ์‹œ๋ฌผ](https://" +"smallcultfollowing.com/babysteps/blog/2019/10/26/async-fn-in-traits-are-" +"hard/)์— ์ด์— ๊ด€ํ•œ ๋‹ˆ์ฝ” ๋งˆ์‚ฌํ‚ค์Šค์˜ ์ข‹์€ ์„ค๋ช…์ด ์žˆ์œผ๋ฏ€๋กœ ๊ด€์‹ฌ์ด ์žˆ๋‹ค๋ฉด ์ฐธ๊ณ ํ•˜" +"์„ธ์š”." + +#: src/async/pitfalls/async-traits.md:60 +msgid "" +"Try creating a new sleeper struct that will sleep for a random amount of " +"time and adding it to the Vec." +msgstr "" +"์ž„์˜์˜ ์‹œ๊ฐ„ ๋™์•ˆ sleep ํ•˜๋Š” ์ƒˆ๋กœ์šด sleeper ๊ตฌ์กฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด Vec์— ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ" +"์š”." + +#: src/async/pitfalls/cancellation.md:3 +msgid "" +"Dropping a future implies it can never be polled again. This is called " +"_cancellation_ and it can occur at any `await` point. Care is needed to " +"ensure the system works correctly even when futures are cancelled. For " +"example, it shouldn't deadlock or lose data." +msgstr "" + +#: src/async/pitfalls/cancellation.md:8 +msgid "" +"```rust,editable,compile_fail\n" +"use std::io::{self, ErrorKind};\n" +"use std::time::Duration;\n" +"use tokio::io::{AsyncReadExt, AsyncWriteExt, DuplexStream};\n" +"\n" +"struct LinesReader {\n" +" stream: DuplexStream,\n" +"}\n" +"\n" +"impl LinesReader {\n" +" fn new(stream: DuplexStream) -> Self {\n" +" Self { stream }\n" +" }\n" +"\n" +" async fn next(&mut self) -> io::Result> {\n" +" let mut bytes = Vec::new();\n" +" let mut buf = [0];\n" +" while self.stream.read(&mut buf[..]).await? != 0 {\n" +" bytes.push(buf[0]);\n" +" if buf[0] == b'\\n' {\n" +" break;\n" +" }\n" +" }\n" +" if bytes.is_empty() {\n" +" return Ok(None)\n" +" }\n" +" let s = String::from_utf8(bytes)\n" +" .map_err(|_| io::Error::new(ErrorKind::InvalidData, \"not " +"UTF-8\"))?;\n" +" Ok(Some(s))\n" +" }\n" +"}\n" +"\n" +"async fn slow_copy(source: String, mut dest: DuplexStream) -> std::io::" +"Result<()> {\n" +" for b in source.bytes() {\n" +" dest.write_u8(b).await?;\n" +" tokio::time::sleep(Duration::from_millis(10)).await\n" +" }\n" +" Ok(())\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> std::io::Result<()> {\n" +" let (client, server) = tokio::io::duplex(5);\n" +" let handle = tokio::spawn(slow_copy(\"hi\\nthere\\n\".to_owned(), " +"client));\n" +"\n" +" let mut lines = LinesReader::new(server);\n" +" let mut interval = tokio::time::interval(Duration::from_millis(60));\n" +" loop {\n" +" tokio::select! {\n" +" _ = interval.tick() => println!(\"tick!\"),\n" +" line = lines.next() => if let Some(l) = line? {\n" +" print!(\"{}\", l)\n" +" } else {\n" +" break\n" +" },\n" +" }\n" +" }\n" +" handle.await.unwrap()?;\n" +" Ok(())\n" +"}\n" +"```" +msgstr "" + +#: src/async/pitfalls/cancellation.md:72 +msgid "" +"The compiler doesn't help with cancellation-safety. You need to read API " +"documentation and consider what state your `async fn` holds." +msgstr "" + +#: src/async/pitfalls/cancellation.md:75 +msgid "" +"Unlike `panic` and `?`, cancellation is part of normal control flow (vs " +"error-handling)." +msgstr "" + +#: src/async/pitfalls/cancellation.md:78 +msgid "The example loses parts of the string." +msgstr "" + +#: src/async/pitfalls/cancellation.md:80 +msgid "" +"Whenever the `tick()` branch finishes first, `next()` and its `buf` are " +"dropped." +msgstr "" + +#: src/async/pitfalls/cancellation.md:82 +msgid "" +"`LinesReader` can be made cancellation-safe by makeing `buf` part of the " +"struct:" +msgstr "" + +#: src/async/pitfalls/cancellation.md:83 +msgid "" +"```rust,compile_fail\n" +"struct LinesReader {\n" +" stream: DuplexStream,\n" +" bytes: Vec,\n" +" buf: [u8; 1],\n" +"}\n" +"\n" +"impl LinesReader {\n" +" fn new(stream: DuplexStream) -> Self {\n" +" Self { stream, bytes: Vec::new(), buf: [0] }\n" +" }\n" +" async fn next(&mut self) -> io::Result> {\n" +" // prefix buf and bytes with self.\n" +" // ...\n" +" let raw = std::mem::take(&mut self.bytes);\n" +" let s = String::from_utf8(raw)\n" +" // ...\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/async/pitfalls/cancellation.md:104 +msgid "" +"[`Interval::tick`](https://docs.rs/tokio/latest/tokio/time/struct.Interval." +"html#method.tick) is cancellation-safe because it keeps track of whether a " +"tick has been 'delivered'." +msgstr "" + +#: src/async/pitfalls/cancellation.md:107 +msgid "" +"[`AsyncReadExt::read`](https://docs.rs/tokio/latest/tokio/io/trait." +"AsyncReadExt.html#method.read) is cancellation-safe because it either " +"returns or doesn't read data." +msgstr "" + +#: src/async/pitfalls/cancellation.md:110 +msgid "" +"[`AsyncBufReadExt::read_line`](https://docs.rs/tokio/latest/tokio/io/trait." +"AsyncBufReadExt.html#method.read_line) is similar to the example and _isn't_ " +"cancellation-safe. See its documentation for details and alternatives." +msgstr "" + +#: src/exercises/concurrency/afternoon.md:3 +msgid "" +"To practice your Async Rust skills, we have again two exercises for you:" +msgstr "" + +#: src/exercises/concurrency/afternoon.md:5 +msgid "" +"Dining philosophers: we already saw this problem in the morning. This time " +"you are going to implement it with Async Rust." +msgstr "" + +#: src/exercises/concurrency/afternoon.md:8 +msgid "" +"A Broadcast Chat Application: this is a larger project that allows you " +"experiment with more advanced Async Rust features." +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:1 +#: src/exercises/concurrency/solutions-afternoon.md:3 +#, fuzzy +msgid "Dining Philosophers - Async" +msgstr "์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž๋“ค" + +#: src/exercises/concurrency/dining-philosophers-async.md:3 +msgid "" +"See [dining philosophers](dining-philosophers.md) for a description of the " +"problem." +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:6 +#, fuzzy +msgid "" +"As before, you will need a local [Cargo installation](../../cargo/running-" +"locally.md) for this exercise. Copy the code below to a file called `src/" +"main.rs`, fill out the blanks, and test that `cargo run` does not deadlock:" +msgstr "" +"์ด๋ฒˆ ํ›ˆ๋ จ์—์„œ๋Š” [์นด๊ณ  ์„ค์น˜ํ•˜๊ธฐ](../../cargo/running-locally.md)๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ" +"๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ๋ณต์‚ฌํ•ด์„œ `src/main.rs`์— ๋ถ™์—ฌ๋†“๊ณ  ๋นˆ ๋ถ€๋ถ„์„ ์ฑ„์šฐ๊ณ , `cargo " +"run` ์ปค๋งจ๋“œ๋กœ ํ…Œ์ŠคํŠธ ํ•ด์„œ ๊ต์ฐฉ์ƒํƒœ(๋ฐ๋“œ๋ฝ)๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค:" + +#: src/exercises/concurrency/dining-philosophers-async.md:13 +msgid "" +"```rust,compile_fail\n" +"use std::sync::Arc;\n" +"use tokio::time;\n" +"use tokio::sync::mpsc::{self, Sender};\n" +"use tokio::sync::Mutex;\n" +"\n" +"struct Fork;\n" +"\n" +"struct Philosopher {\n" +" name: String,\n" +" // left_fork: ...\n" +" // right_fork: ...\n" +" // thoughts: ...\n" +"}\n" +"\n" +"impl Philosopher {\n" +" async fn think(&self) {\n" +" self.thoughts\n" +" .send(format!(\"Eureka! {} has a new idea!\", &self.name))." +"await\n" +" .unwrap();\n" +" }\n" +"\n" +" async fn eat(&self) {\n" +" // Pick up forks...\n" +" println!(\"{} is eating...\", &self.name);\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" }\n" +"}\n" +"\n" +"static PHILOSOPHERS: &[&str] =\n" +" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" // Create forks\n" +"\n" +" // Create philosophers\n" +"\n" +" // Make them think and eat\n" +"\n" +" // Output their thoughts\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:57 +msgid "" +"Since this time you are using Async Rust, you'll need a `tokio` dependency. " +"You can use the following `Cargo.toml`:" +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:62 +msgid "" +"```toml\n" +"[package]\n" +"name = \"dining-philosophers-async-dine\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"\n" +"[dependencies]\n" +"tokio = {version = \"1.26.0\", features = [\"sync\", \"time\", \"macros\", " +"\"rt-multi-thread\"]}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:72 +msgid "" +"Also note that this time you have to use the `Mutex` and the `mpsc` module " +"from the `tokio` crate." +msgstr "" + +#: src/exercises/concurrency/dining-philosophers-async.md:77 +msgid "Can you make your implementation single-threaded? " +msgstr "" + +#: src/exercises/concurrency/chat-app.md:3 +msgid "" +"In this exercise, we want to use our new knowledge to implement a broadcast " +"chat application. We have a chat server that the clients connect to and " +"publish their messages. The client reads user messages from the standard " +"input, and sends them to the server. The chat server broadcasts each message " +"that it receives to all the clients." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:9 +msgid "" +"For this, we use [a broadcast channel](https://docs.rs/tokio/latest/tokio/" +"sync/broadcast/fn.channel.html) on the server, and [`tokio_websockets`]" +"(https://docs.rs/tokio-websockets/0.3.2/tokio_websockets/) for the " +"communication between the client and the server." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:13 +msgid "Create a new Cargo project and add the following dependencies:" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:15 +msgid "`Cargo.toml`:" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:19 +msgid "" +"```toml\n" +"[package]\n" +"name = \"chat-async\"\n" +"version = \"0.1.0\"\n" +"edition = \"2021\"\n" +"\n" +"[dependencies]\n" +"futures-util = \"0.3.28\"\n" +"http = \"0.2.9\"\n" +"tokio = { version = \"1.28.1\", features = [\"full\"] }\n" +"tokio-websockets = \"0.3.2\"\n" +"```" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:32 +msgid "The required APIs" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:33 +msgid "" +"You are going to need the following functions from `tokio` and " +"[`tokio_websockets`](https://docs.rs/tokio-websockets/0.3.2/" +"tokio_websockets/). Spend a few minutes to familiarize yourself with the " +"API. " +msgstr "" + +#: src/exercises/concurrency/chat-app.md:37 +msgid "" +"[WebsocketStream::next()](https://docs.rs/tokio-websockets/0.3.2/" +"tokio_websockets/proto/struct.WebsocketStream.html#method.next): for " +"asynchronously reading messages from a Websocket Stream." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:39 +msgid "" +"[SinkExt::send()](https://docs.rs/futures-util/0.3.28/futures_util/sink/" +"trait.SinkExt.html#method.send) implemented by `WebsocketStream`: for " +"asynchronously sending messages on a Websocket Stream." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:41 +msgid "" +"[Lines::next_line()](https://docs.rs/tokio/latest/tokio/io/struct.Lines." +"html#method.next_line): for asynchronously reading user messages from the " +"standard input." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:43 +msgid "" +"[Sender::subscribe()](https://docs.rs/tokio/latest/tokio/sync/broadcast/" +"struct.Sender.html#method.subscribe): for subscribing to a broadcast channel." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:46 +#, fuzzy +msgid "Two binaries" +msgstr "๋Ÿฌ์ŠคํŠธ ๋ฐ”์ด๋„ˆ๋ฆฌ" + +#: src/exercises/concurrency/chat-app.md:48 +msgid "" +"Normally in a Cargo project, you can have only one binary, and one `src/main." +"rs` file. In this project, we need two binaries. One for the client, and one " +"for the server. You could potentially make them two separate Cargo projects, " +"but we are going to put them in a single Cargo project with two binaries. " +"For this to work, the client and the server code should go under `src/bin` " +"(see the [documentation](https://doc.rust-lang.org/cargo/reference/cargo-" +"targets.html#binaries)). " +msgstr "" + +#: src/exercises/concurrency/chat-app.md:55 +msgid "" +"Copy the following server and client code into `src/bin/server.rs` and `src/" +"bin/client.rs`, respectively. Your task is to complete these files as " +"described below. " +msgstr "" + +#: src/exercises/concurrency/chat-app.md:59 +#: src/exercises/concurrency/solutions-afternoon.md:123 +msgid "`src/bin/server.rs`:" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:63 +msgid "" +"```rust,compile_fail\n" +"use futures_util::sink::SinkExt;\n" +"use std::error::Error;\n" +"use std::net::SocketAddr;\n" +"use tokio::net::{TcpListener, TcpStream};\n" +"use tokio::sync::broadcast::{channel, Sender};\n" +"use tokio_websockets::{Message, ServerBuilder, WebsocketStream};\n" +"\n" +"async fn handle_connection(\n" +" addr: SocketAddr,\n" +" mut ws_stream: WebsocketStream,\n" +" bcast_tx: Sender,\n" +") -> Result<(), Box> {\n" +"\n" +" // TODO: For a hint, see the description of the task below.\n" +"\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> Result<(), Box> {\n" +" let (bcast_tx, _) = channel(16);\n" +"\n" +" let listener = TcpListener::bind(\"127.0.0.1:2000\").await?;\n" +" println!(\"listening on port 2000\");\n" +"\n" +" loop {\n" +" let (socket, addr) = listener.accept().await?;\n" +" println!(\"New connection from {addr:?}\");\n" +" let bcast_tx = bcast_tx.clone();\n" +" tokio::spawn(async move {\n" +" // Wrap the raw TCP stream into a websocket.\n" +" let ws_stream = ServerBuilder::new().accept(socket).await?;\n" +"\n" +" handle_connection(addr, ws_stream, bcast_tx).await\n" +" });\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:102 +#: src/exercises/concurrency/solutions-afternoon.md:208 +msgid "`src/bin/client.rs`:" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:106 +msgid "" +"```rust,compile_fail\n" +"use futures_util::SinkExt;\n" +"use http::Uri;\n" +"use tokio::io::{AsyncBufReadExt, BufReader};\n" +"use tokio_websockets::{ClientBuilder, Message};\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> Result<(), tokio_websockets::Error> {\n" +" let mut ws_stream = ClientBuilder::from_uri(Uri::" +"from_static(\"ws://127.0.0.1:2000\"))\n" +" .connect()\n" +" .await?;\n" +"\n" +" let stdin = tokio::io::stdin();\n" +" let mut stdin = BufReader::new(stdin).lines();\n" +"\n" +"\n" +" // TODO: For a hint, see the description of the task below.\n" +"\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/chat-app.md:127 +#, fuzzy +msgid "Running the binaries" +msgstr "๊ฐ•์˜ ์ง„ํ–‰ ๋ฐฉ์‹" + +#: src/exercises/concurrency/chat-app.md:128 +#, fuzzy +msgid "Run the server with:" +msgstr "์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์„ธ์š”." + +#: src/exercises/concurrency/chat-app.md:130 +#, fuzzy +msgid "" +"```shell\n" +"cargo run --bin server\n" +"```" +msgstr "" +"```sh\n" +"cargo embed --bin pac\n" +"```" + +#: src/exercises/concurrency/chat-app.md:134 +#, fuzzy +msgid "and the client with:" +msgstr "์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์„ธ์š”." + +#: src/exercises/concurrency/chat-app.md:136 +#, fuzzy +msgid "" +"```shell\n" +"cargo run --bin client\n" +"```" +msgstr "" +"```sh\n" +"cargo embed --bin pac\n" +"```" + +#: src/exercises/concurrency/chat-app.md:142 +msgid "Implement the `handle_connection` function in `src/bin/server.rs`." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:143 +msgid "" +"Hint: Use `tokio::select!` for concurrently performing two tasks in a " +"continuous loop. One task receives messages from the client and broadcasts " +"them. The other sends messages received by the server to the client." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:146 +msgid "Complete the main function in `src/bin/client.rs`." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:147 +msgid "" +"Hint: As before, use `tokio::select!` in a continuous loop for concurrently " +"performing two tasks: (1) reading user messages from standard input and " +"sending them to the server, and (2) receiving messages from the server, and " +"displaying them for the user." +msgstr "" + +#: src/exercises/concurrency/chat-app.md:151 +msgid "" +"Optional: Once you are done, change the code to broadcast messages to all " +"clients, but the sender of the message." +msgstr "" + #: src/thanks.md:3 msgid "" "_Thank you for taking Comprehensive Rust ๐Ÿฆ€!_ We hope you enjoyed it and " @@ -21084,18 +25404,20 @@ msgstr "" "์˜ ์ „์ฒด ๋ชฉ๋ก์€ [other resources](other-resources.md)์—์„œ ์‚ดํŽด๋ณด์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." #: src/credits.md:7 +#, fuzzy msgid "" "The material of Comprehensive Rust is licensed under the terms of the Apache " -"2.0 license, please see [`LICENSE`](../LICENSE) for details." +"2.0 license, please see [`LICENSE`](https://github.com/google/comprehensive-" +"rust/blob/main/LICENSE) for details." msgstr "" "Comprehensive Rust์˜ ์ž๋ฃŒ๋Š” Apache 2.0 ๋ผ์ด์„ ์Šค๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค. ์ž์„ธํ•œ๊ฑด " "[`LICENSE`](../LICENSE) ํ™•์ธํ•ด ๋ณด์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." -#: src/credits.md:10 +#: src/credits.md:12 msgid "Rust by Example" msgstr "Rust by Example" -#: src/credits.md:12 +#: src/credits.md:14 msgid "" "Some examples and exercises have been copied and adapted from [Rust by " "Example](https://doc.rust-lang.org/rust-by-example/). Please see the " @@ -21106,11 +25428,11 @@ msgstr "" "example/)์„ ์ฐธ์กฐํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋ผ์ด์„ ์Šค ์กฐํ•ญ์„ ํฌํ•จํ•˜์—ฌ ์ €์žฅ์†Œ์˜ `third_party/" "rust-by-example/` ํด๋”๋ฅผ ์ฐธ์กฐํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." -#: src/credits.md:17 +#: src/credits.md:19 msgid "Rust on Exercism" msgstr "Rust on Exercism" -#: src/credits.md:19 +#: src/credits.md:21 msgid "" "Some exercises have been copied and adapted from [Rust on Exercism](https://" "exercism.org/tracks/rust). Please see the `third_party/rust-on-exercism/` " @@ -21120,11 +25442,11 @@ msgstr "" "์˜€์Šต๋‹ˆ๋‹ค. ๋ผ์ด์„ ์Šค ์กฐํ•ญ์„ ํฌํ•จํ•˜์—ฌ ์ €์žฅ์†Œ์˜ `third_party/rust-on-exercism/`ํด" "๋”๋ฅผ ์ฐธ์กฐํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค." -#: src/credits.md:24 +#: src/credits.md:26 msgid "CXX" msgstr "CXX" -#: src/credits.md:26 +#: src/credits.md:28 msgid "" "The [Interoperability with C++](android/interoperability/cpp.md) section " "uses an image from [CXX](https://cxx.rs/). Please see the `third_party/cxx/` " @@ -21318,6 +25640,10 @@ msgstr "" msgid "Day 1 Afternoon Exercises" msgstr "1์ผ์ฐจ ์˜คํ›„ ์—ฐ์Šต๋ฌธ์ œ" +#: src/exercises/day-1/solutions-afternoon.md:3 +msgid "Designing a Library" +msgstr "๋„์„œ๊ด€ ์„ค๊ณ„" + #: src/exercises/day-1/solutions-afternoon.md:5 msgid "([back to exercise](book-library.md))" msgstr "" @@ -21359,16 +25685,16 @@ msgid "" " }\n" "}\n" "\n" -"// This makes it possible to print Book values with {}.\n" -"impl std::fmt::Display for Book {\n" -" fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n" -" write!(f, \"{} ({})\", self.title, self.year)\n" -" }\n" -"}\n" -"// ANCHOR_END: setup\n" -"\n" -"// ANCHOR: Library_new\n" +"// Implement the methods below. Update the `self` parameter to\n" +"// indicate the method's required level of ownership over the object:\n" +"//\n" +"// - `&self` for shared read-only access,\n" +"// - `&mut self` for unique and mutable access,\n" +"// - `self` for unique access by value.\n" "impl Library {\n" +" // ANCHOR_END: setup\n" +"\n" +" // ANCHOR: Library_new\n" " fn new() -> Library {\n" " // ANCHOR_END: Library_new\n" " Library { books: Vec::new() }\n" @@ -21376,7 +25702,7 @@ msgid "" "\n" " // ANCHOR: Library_len\n" " //fn len(self) -> usize {\n" -" // unimplemented!()\n" +" // todo!(\"Return the length of `self.books`\")\n" " //}\n" " // ANCHOR_END: Library_len\n" " fn len(&self) -> usize {\n" @@ -21385,7 +25711,7 @@ msgid "" "\n" " // ANCHOR: Library_is_empty\n" " //fn is_empty(self) -> bool {\n" -" // unimplemented!()\n" +" // todo!(\"Return `true` if `self.books` is empty\")\n" " //}\n" " // ANCHOR_END: Library_is_empty\n" " fn is_empty(&self) -> bool {\n" @@ -21394,7 +25720,7 @@ msgid "" "\n" " // ANCHOR: Library_add_book\n" " //fn add_book(self, book: Book) {\n" -" // unimplemented!()\n" +" // todo!(\"Add a new book to `self.books`\")\n" " //}\n" " // ANCHOR_END: Library_add_book\n" " fn add_book(&mut self, book: Book) {\n" @@ -21403,22 +25729,34 @@ msgid "" "\n" " // ANCHOR: Library_print_books\n" " //fn print_books(self) {\n" -" // unimplemented!()\n" +" // todo!(\"Iterate over `self.books` and each book's title and " +"year\")\n" " //}\n" " // ANCHOR_END: Library_print_books\n" " fn print_books(&self) {\n" " for book in &self.books {\n" -" println!(\"{}\", book);\n" +" println!(\"{}, published in {}\", book.title, book.year);\n" " }\n" " }\n" "\n" " // ANCHOR: Library_oldest_book\n" " //fn oldest_book(self) -> Option<&Book> {\n" -" // unimplemented!()\n" +" // todo!(\"Return a reference to the oldest book (if any)\")\n" " //}\n" " // ANCHOR_END: Library_oldest_book\n" " fn oldest_book(&self) -> Option<&Book> {\n" -" self.books.iter().min_by_key(|book| book.year)\n" +" // Using a closure and a built-in method:\n" +" // self.books.iter().min_by_key(|book| book.year)\n" +"\n" +" // Longer hand-written solution:\n" +" let mut oldest: Option<&Book> = None;\n" +" for book in self.books.iter() {\n" +" if oldest.is_none() || book.year < oldest.unwrap().year {\n" +" oldest = Some(book);\n" +" }\n" +" }\n" +"\n" +" oldest\n" " }\n" "}\n" "\n" @@ -21430,26 +25768,26 @@ msgid "" "fn main() {\n" " let library = Library::new();\n" "\n" -" //println!(\"Our library is empty: {}\", library.is_empty());\n" -"\n" -" let favorite_book = Book::new(\"Lord of the Rings\", 1954);\n" -" println!(\"Our favorite book {favorite_book} should go in the " -"library\");\n" -" //library.add_book(favorite_book);\n" +" //println!(\"The library is empty: library.is_empty() -> {}\", library." +"is_empty());\n" +" //\n" +" //library.add_book(Book::new(\"Lord of the Rings\", 1954));\n" " //library.add_book(Book::new(\"Alice's Adventures in Wonderland\", " "1865));\n" " //\n" +" //println!(\"The library is no longer empty: library.is_empty() -> {}\", " +"library.is_empty());\n" +" //\n" +" //\n" " //library.print_books();\n" " //\n" " //match library.oldest_book() {\n" -" // Some(book) => println!(\"My oldest book is {book}\"),\n" -" // None => println!(\"My library is empty!\"),\n" +" // Some(book) => println!(\"The oldest book is {}\", book.title),\n" +" // None => println!(\"The library is empty!\"),\n" " //}\n" " //\n" -" //println!(\"Our library has {} books\", library.len());\n" -" for book in library.books {\n" -" println!(\"{book}\");\n" -" }\n" +" //println!(\"The library has {} books\", library.len());\n" +" //library.print_books();\n" "}\n" "// ANCHOR_END: main\n" "\n" @@ -21616,6 +25954,17 @@ msgid "" " }\n" " result += last_point.dist(self.points[0]);\n" " result\n" +" // Alternatively, Iterator::zip() lets us iterate over the points as " +"pairs\n" +" // but we need to pair each point with the next one, and the last " +"point\n" +" // with the first point. The zip() iterator is finished as soon as " +"one of \n" +" // the source iterators is finished, a neat trick is to combine " +"Iterator::cycle\n" +" // with Iterator::skip to create the second iterator for the zip and " +"using map \n" +" // and sum to calculate the total length.\n" " }\n" "}\n" "\n" @@ -21803,8 +26152,7 @@ msgid "" "fn main() {\n" " let cc_number = \"1234 5678 1234 5670\";\n" " println!(\n" -" \"Is {} a valid credit card number? {}\",\n" -" cc_number,\n" +" \"Is {cc_number} a valid credit card number? {}\",\n" " if luhn(cc_number) { \"yes\" } else { \"no\" }\n" " );\n" "}\n" @@ -21850,11 +26198,11 @@ msgid "" "```" msgstr "" -#: src/exercises/day-2/solutions-afternoon.md:100 +#: src/exercises/day-2/solutions-afternoon.md:99 msgid "([back to exercise](strings-iterators.md))" msgstr "" -#: src/exercises/day-2/solutions-afternoon.md:102 +#: src/exercises/day-2/solutions-afternoon.md:101 msgid "" "```rust\n" "// Copyright 2022 Google LLC\n" @@ -21874,23 +26222,30 @@ msgid "" "// ANCHOR: prefix_matches\n" "pub fn prefix_matches(prefix: &str, request_path: &str) -> bool {\n" " // ANCHOR_END: prefix_matches\n" -" let prefixes = prefix.split('/');\n" -" let request_paths = request_path\n" -" .split('/')\n" -" .map(|p| Some(p))\n" -" .chain(std::iter::once(None));\n" "\n" -" for (prefix, request_path) in prefixes.zip(request_paths) {\n" -" match request_path {\n" -" Some(request_path) => {\n" -" if (prefix != \"*\") && (prefix != request_path) {\n" -" return false;\n" -" }\n" -" }\n" -" None => return false,\n" +" let mut request_segments = request_path.split('/');\n" +"\n" +" for prefix_segment in prefix.split('/') {\n" +" let Some(request_segment) = request_segments.next() else {\n" +" return false;\n" +" };\n" +" if request_segment != prefix_segment && prefix_segment != \"*\" {\n" +" return false;\n" " }\n" " }\n" " true\n" +"\n" +" // Alternatively, Iterator::zip() lets us iterate simultaneously over " +"prefix\n" +" // and request segments. The zip() iterator is finished as soon as one " +"of\n" +" // the source iterators is finished, but we need to iterate over all " +"request\n" +" // segments. A neat trick that makes zip() work is to use map() and " +"chain()\n" +" // to produce an iterator that returns Some(str) for each pattern " +"segments,\n" +" // and then returns None indefinitely.\n" "}\n" "\n" "// ANCHOR: unit-tests\n" @@ -22019,6 +26374,13 @@ msgid "" " fn add_widget(&mut self, widget: Box) {\n" " self.widgets.push(widget);\n" " }\n" +"\n" +" fn inner_width(&self) -> usize {\n" +" std::cmp::max(\n" +" self.title.chars().count(),\n" +" self.widgets.iter().map(|w| w.width()).max().unwrap_or(0),\n" +" )\n" +" }\n" "}\n" "\n" "// ANCHOR_END: setup\n" @@ -22027,10 +26389,8 @@ msgid "" "impl Widget for Window {\n" " fn width(&self) -> usize {\n" " // ANCHOR_END: Window-width\n" -" std::cmp::max(\n" -" self.title.chars().count(),\n" -" self.widgets.iter().map(|w| w.width()).max().unwrap_or(0),\n" -" )\n" +" // Add 4 paddings for borders\n" +" self.inner_width() + 4\n" " }\n" "\n" " // ANCHOR: Window-draw_into\n" @@ -22041,18 +26401,18 @@ msgid "" " widget.draw_into(&mut inner);\n" " }\n" "\n" -" let window_width = self.width();\n" +" let inner_width = self.inner_width();\n" "\n" " // TODO: after learning about error handling, you can change\n" " // draw_into to return Result<(), std::fmt::Error>. Then use\n" " // the ?-operator here instead of .unwrap().\n" -" writeln!(buffer, \"+-{:-,\n" " }\n" "\n" -" // Layout as per readdir(3) and definitions in /usr/include/x86_64-linux-" -"gnu.\n" +" // Layout according to the Linux man page for readdir(3), where ino_t " +"and\n" +" // off_t are resolved according to the definitions in\n" +" // /usr/include/x86_64-linux-gnu/{sys/types.h, bits/typesizes.h}.\n" +" #[cfg(not(target_os = \"macos\"))]\n" " #[repr(C)]\n" " pub struct dirent {\n" -" pub d_ino: c_long,\n" -" pub d_off: c_ulong,\n" +" pub d_ino: c_ulong,\n" +" pub d_off: c_long,\n" " pub d_reclen: c_ushort,\n" -" pub d_type: c_char,\n" +" pub d_type: c_uchar,\n" " pub d_name: [c_char; 256],\n" " }\n" "\n" +" // Layout according to the macOS man page for dir(5).\n" +" #[cfg(all(target_os = \"macos\"))]\n" +" #[repr(C)]\n" +" pub struct dirent {\n" +" pub d_fileno: u64,\n" +" pub d_seekoff: u64,\n" +" pub d_reclen: u16,\n" +" pub d_namlen: u16,\n" +" pub d_type: u8,\n" +" pub d_name: [c_char; 1024],\n" +" }\n" +"\n" " extern \"C\" {\n" " pub fn opendir(s: *const c_char) -> *mut DIR;\n" +"\n" +" #[cfg(not(all(target_os = \"macos\", target_arch = \"x86_64\")))]\n" " pub fn readdir(s: *mut DIR) -> *const dirent;\n" +"\n" +" // See https://github.com/rust-lang/libc/issues/414 and the section " +"on\n" +" // _DARWIN_FEATURE_64_BIT_INODE in the macOS man page for stat(2).\n" +" //\n" +" // \"Platforms that existed before these updates were available\" " +"refers\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and " +"PowerPC.\n" +" #[cfg(all(target_os = \"macos\", target_arch = \"x86_64\"))]\n" +" #[link_name = \"readdir$INODE64\"]\n" +" pub fn readdir(s: *mut DIR) -> *const dirent;\n" +"\n" " pub fn closedir(s: *mut DIR) -> c_int;\n" " }\n" "}\n" @@ -22235,18 +26627,529 @@ msgid "" " Ok(())\n" "}\n" "// ANCHOR_END: main\n" +"\n" +"#[cfg(test)]\n" +"mod tests {\n" +" use super::*;\n" +" use std::error::Error;\n" +"\n" +" #[test]\n" +" fn test_nonexisting_directory() {\n" +" let iter = DirectoryIterator::new(\"no-such-directory\");\n" +" assert!(iter.is_err());\n" +" }\n" +"\n" +" #[test]\n" +" fn test_empty_directory() -> Result<(), Box> {\n" +" let tmp = tempfile::TempDir::new()?;\n" +" let iter = DirectoryIterator::new(\n" +" tmp.path().to_str().ok_or(\"Non UTF-8 character in path\")?,\n" +" )?;\n" +" let mut entries = iter.collect::>();\n" +" entries.sort();\n" +" assert_eq!(entries, &[\".\", \"..\"]);\n" +" Ok(())\n" +" }\n" +"\n" +" #[test]\n" +" fn test_nonempty_directory() -> Result<(), Box> {\n" +" let tmp = tempfile::TempDir::new()?;\n" +" std::fs::write(tmp.path().join(\"foo.txt\"), \"The Foo " +"Diaries\\n\")?;\n" +" std::fs::write(tmp.path().join(\"bar.png\"), \"\\n\")?;\n" +" std::fs::write(tmp.path().join(\"crab.rs\"), \"//! Crab\\n\")?;\n" +" let iter = DirectoryIterator::new(\n" +" tmp.path().to_str().ok_or(\"Non UTF-8 character in path\")?,\n" +" )?;\n" +" let mut entries = iter.collect::>();\n" +" entries.sort();\n" +" assert_eq!(entries, &[\".\", \"..\", \"bar.png\", \"crab.rs\", \"foo." +"txt\"]);\n" +" Ok(())\n" +" }\n" +"}\n" "```" msgstr "" -#: src/exercises/day-4/solutions-morning.md:1 -msgid "Day 4 Morning Exercise" -msgstr "4์ผ์ฐจ ์˜ค์ „ ์—ฐ์Šต๋ฌธ์ œ" +#: src/exercises/bare-metal/solutions-morning.md:1 +#, fuzzy +msgid "Bare Metal Rust Morning Exercise" +msgstr "Bare Metal Rust ์˜ค์ „ ์—ฐ์Šต" -#: src/exercises/day-4/solutions-morning.md:5 +#: src/exercises/bare-metal/solutions-morning.md:5 +msgid "([back to exercise](compass.md))" +msgstr "" + +#: src/exercises/bare-metal/solutions-morning.md:7 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: top\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"extern crate panic_halt as _;\n" +"\n" +"use core::fmt::Write;\n" +"use cortex_m_rt::entry;\n" +"// ANCHOR_END: top\n" +"use core::cmp::{max, min};\n" +"use lsm303agr::{AccelOutputDataRate, Lsm303agr, MagOutputDataRate};\n" +"use microbit::display::blocking::Display;\n" +"use microbit::hal::prelude::*;\n" +"use microbit::hal::twim::Twim;\n" +"use microbit::hal::uarte::{Baudrate, Parity, Uarte};\n" +"use microbit::hal::Timer;\n" +"use microbit::pac::twim0::frequency::FREQUENCY_A;\n" +"use microbit::Board;\n" +"\n" +"const COMPASS_SCALE: i32 = 30000;\n" +"const ACCELEROMETER_SCALE: i32 = 700;\n" +"\n" +"// ANCHOR: main\n" +"#[entry]\n" +"fn main() -> ! {\n" +" let board = Board::take().unwrap();\n" +"\n" +" // Configure serial port.\n" +" let mut serial = Uarte::new(\n" +" board.UARTE0,\n" +" board.uart.into(),\n" +" Parity::EXCLUDED,\n" +" Baudrate::BAUD115200,\n" +" );\n" +"\n" +" // Set up the I2C controller and Inertial Measurement Unit.\n" +" // ANCHOR_END: main\n" +" writeln!(serial, \"Setting up IMU...\").unwrap();\n" +" let i2c = Twim::new(board.TWIM0, board.i2c_internal.into(), FREQUENCY_A::" +"K100);\n" +" let mut imu = Lsm303agr::new_with_i2c(i2c);\n" +" imu.init().unwrap();\n" +" imu.set_mag_odr(MagOutputDataRate::Hz50).unwrap();\n" +" imu.set_accel_odr(AccelOutputDataRate::Hz50).unwrap();\n" +" let mut imu = imu.into_mag_continuous().ok().unwrap();\n" +"\n" +" // Set up display and timer.\n" +" let mut timer = Timer::new(board.TIMER0);\n" +" let mut display = Display::new(board.display_pins);\n" +"\n" +" let mut mode = Mode::Compass;\n" +" let mut button_pressed = false;\n" +"\n" +" // ANCHOR: loop\n" +" writeln!(serial, \"Ready.\").unwrap();\n" +"\n" +" loop {\n" +" // Read compass data and log it to the serial port.\n" +" // ANCHOR_END: loop\n" +" while !(imu.mag_status().unwrap().xyz_new_data\n" +" && imu.accel_status().unwrap().xyz_new_data)\n" +" {}\n" +" let compass_reading = imu.mag_data().unwrap();\n" +" let accelerometer_reading = imu.accel_data().unwrap();\n" +" writeln!(\n" +" serial,\n" +" \"{},{},{}\\t{},{},{}\",\n" +" compass_reading.x,\n" +" compass_reading.y,\n" +" compass_reading.z,\n" +" accelerometer_reading.x,\n" +" accelerometer_reading.y,\n" +" accelerometer_reading.z,\n" +" )\n" +" .unwrap();\n" +"\n" +" let mut image = [[0; 5]; 5];\n" +" let (x, y) = match mode {\n" +" Mode::Compass => (\n" +" scale(-compass_reading.x, -COMPASS_SCALE, COMPASS_SCALE, 0, " +"4) as usize,\n" +" scale(compass_reading.y, -COMPASS_SCALE, COMPASS_SCALE, 0, " +"4) as usize,\n" +" ),\n" +" Mode::Accelerometer => (\n" +" scale(\n" +" accelerometer_reading.x,\n" +" -ACCELEROMETER_SCALE,\n" +" ACCELEROMETER_SCALE,\n" +" 0,\n" +" 4,\n" +" ) as usize,\n" +" scale(\n" +" -accelerometer_reading.y,\n" +" -ACCELEROMETER_SCALE,\n" +" ACCELEROMETER_SCALE,\n" +" 0,\n" +" 4,\n" +" ) as usize,\n" +" ),\n" +" };\n" +" image[y][x] = 255;\n" +" display.show(&mut timer, image, 100);\n" +"\n" +" // If button A is pressed, switch to the next mode and briefly blink " +"all LEDs on.\n" +" if board.buttons.button_a.is_low().unwrap() {\n" +" if !button_pressed {\n" +" mode = mode.next();\n" +" display.show(&mut timer, [[255; 5]; 5], 200);\n" +" }\n" +" button_pressed = true;\n" +" } else {\n" +" button_pressed = false;\n" +" }\n" +" }\n" +"}\n" +"\n" +"#[derive(Copy, Clone, Debug, Eq, PartialEq)]\n" +"enum Mode {\n" +" Compass,\n" +" Accelerometer,\n" +"}\n" +"\n" +"impl Mode {\n" +" fn next(self) -> Self {\n" +" match self {\n" +" Self::Compass => Self::Accelerometer,\n" +" Self::Accelerometer => Self::Compass,\n" +" }\n" +" }\n" +"}\n" +"\n" +"fn scale(value: i32, min_in: i32, max_in: i32, min_out: i32, max_out: i32) -" +"> i32 {\n" +" let range_in = max_in - min_in;\n" +" let range_out = max_out - min_out;\n" +" cap(\n" +" min_out + range_out * (value - min_in) / range_in,\n" +" min_out,\n" +" max_out,\n" +" )\n" +"}\n" +"\n" +"fn cap(value: i32, min_value: i32, max_value: i32) -> i32 {\n" +" max(min_value, min(value, max_value))\n" +"}\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/solutions-afternoon.md:5 +msgid "([back to exercise](rtc.md))" +msgstr "" + +#: src/exercises/bare-metal/solutions-afternoon.md:7 +msgid "`main.rs`:" +msgstr "" + +#: src/exercises/bare-metal/solutions-afternoon.md:9 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: top\n" +"#![no_main]\n" +"#![no_std]\n" +"\n" +"mod exceptions;\n" +"mod logger;\n" +"mod pl011;\n" +"// ANCHOR_END: top\n" +"mod pl031;\n" +"\n" +"use crate::pl031::Rtc;\n" +"use arm_gic::gicv3::{IntId, Trigger};\n" +"use arm_gic::{irq_enable, wfi};\n" +"use chrono::{TimeZone, Utc};\n" +"use core::hint::spin_loop;\n" +"// ANCHOR: imports\n" +"use crate::pl011::Uart;\n" +"use arm_gic::gicv3::GicV3;\n" +"use core::panic::PanicInfo;\n" +"use log::{error, info, trace, LevelFilter};\n" +"use smccc::psci::system_off;\n" +"use smccc::Hvc;\n" +"\n" +"/// Base addresses of the GICv3.\n" +"const GICD_BASE_ADDRESS: *mut u64 = 0x800_0000 as _;\n" +"const GICR_BASE_ADDRESS: *mut u64 = 0x80A_0000 as _;\n" +"\n" +"/// Base address of the primary PL011 UART.\n" +"const PL011_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;\n" +"// ANCHOR_END: imports\n" +"\n" +"/// Base address of the PL031 RTC.\n" +"const PL031_BASE_ADDRESS: *mut u32 = 0x901_0000 as _;\n" +"/// The IRQ used by the PL031 RTC.\n" +"const PL031_IRQ: IntId = IntId::spi(2);\n" +"\n" +"// ANCHOR: main\n" +"#[no_mangle]\n" +"extern \"C\" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {\n" +" // Safe because `PL011_BASE_ADDRESS` is the base address of a PL011 " +"device,\n" +" // and nothing else accesses that address range.\n" +" let uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };\n" +" logger::init(uart, LevelFilter::Trace).unwrap();\n" +"\n" +" info!(\"main({:#x}, {:#x}, {:#x}, {:#x})\", x0, x1, x2, x3);\n" +"\n" +" // Safe because `GICD_BASE_ADDRESS` and `GICR_BASE_ADDRESS` are the " +"base\n" +" // addresses of a GICv3 distributor and redistributor respectively, and\n" +" // nothing else accesses those address ranges.\n" +" let mut gic = unsafe { GicV3::new(GICD_BASE_ADDRESS, " +"GICR_BASE_ADDRESS) };\n" +" gic.setup();\n" +" // ANCHOR_END: main\n" +"\n" +" // Safe because `PL031_BASE_ADDRESS` is the base address of a PL031 " +"device,\n" +" // and nothing else accesses that address range.\n" +" let mut rtc = unsafe { Rtc::new(PL031_BASE_ADDRESS) };\n" +" let timestamp = rtc.read();\n" +" let time = Utc.timestamp_opt(timestamp.into(), 0).unwrap();\n" +" info!(\"RTC: {time}\");\n" +"\n" +" GicV3::set_priority_mask(0xff);\n" +" gic.set_interrupt_priority(PL031_IRQ, 0x80);\n" +" gic.set_trigger(PL031_IRQ, Trigger::Level);\n" +" irq_enable();\n" +" gic.enable_interrupt(PL031_IRQ, true);\n" +"\n" +" // Wait for 3 seconds, without interrupts.\n" +" let target = timestamp + 3;\n" +" rtc.set_match(target);\n" +" info!(\n" +" \"Waiting for {}\",\n" +" Utc.timestamp_opt(target.into(), 0).unwrap()\n" +" );\n" +" trace!(\n" +" \"matched={}, interrupt_pending={}\",\n" +" rtc.matched(),\n" +" rtc.interrupt_pending()\n" +" );\n" +" while !rtc.matched() {\n" +" spin_loop();\n" +" }\n" +" trace!(\n" +" \"matched={}, interrupt_pending={}\",\n" +" rtc.matched(),\n" +" rtc.interrupt_pending()\n" +" );\n" +" info!(\"Finished waiting\");\n" +"\n" +" // Wait another 3 seconds for an interrupt.\n" +" let target = timestamp + 6;\n" +" info!(\n" +" \"Waiting for {}\",\n" +" Utc.timestamp_opt(target.into(), 0).unwrap()\n" +" );\n" +" rtc.set_match(target);\n" +" rtc.clear_interrupt();\n" +" rtc.enable_interrupt(true);\n" +" trace!(\n" +" \"matched={}, interrupt_pending={}\",\n" +" rtc.matched(),\n" +" rtc.interrupt_pending()\n" +" );\n" +" while !rtc.interrupt_pending() {\n" +" wfi();\n" +" }\n" +" trace!(\n" +" \"matched={}, interrupt_pending={}\",\n" +" rtc.matched(),\n" +" rtc.interrupt_pending()\n" +" );\n" +" info!(\"Finished waiting\");\n" +"\n" +" // ANCHOR: main_end\n" +" system_off::().unwrap();\n" +"}\n" +"\n" +"#[panic_handler]\n" +"fn panic(info: &PanicInfo) -> ! {\n" +" error!(\"{info}\");\n" +" system_off::().unwrap();\n" +" loop {}\n" +"}\n" +"// ANCHOR_END: main_end\n" +"```" +msgstr "" + +#: src/exercises/bare-metal/solutions-afternoon.md:149 +msgid "`pl031.rs`:" +msgstr "" + +#: src/exercises/bare-metal/solutions-afternoon.md:151 +msgid "" +"```rust\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"use core::ptr::{addr_of, addr_of_mut};\n" +"\n" +"#[repr(C, align(4))]\n" +"struct Registers {\n" +" /// Data register\n" +" dr: u32,\n" +" /// Match register\n" +" mr: u32,\n" +" /// Load register\n" +" lr: u32,\n" +" /// Control register\n" +" cr: u8,\n" +" _reserved0: [u8; 3],\n" +" /// Interrupt Mask Set or Clear register\n" +" imsc: u8,\n" +" _reserved1: [u8; 3],\n" +" /// Raw Interrupt Status\n" +" ris: u8,\n" +" _reserved2: [u8; 3],\n" +" /// Masked Interrupt Status\n" +" mis: u8,\n" +" _reserved3: [u8; 3],\n" +" /// Interrupt Clear Register\n" +" icr: u8,\n" +" _reserved4: [u8; 3],\n" +"}\n" +"\n" +"/// Driver for a PL031 real-time clock.\n" +"#[derive(Debug)]\n" +"pub struct Rtc {\n" +" registers: *mut Registers,\n" +"}\n" +"\n" +"impl Rtc {\n" +" /// Constructs a new instance of the RTC driver for a PL031 device at " +"the\n" +" /// given base address.\n" +" ///\n" +" /// # Safety\n" +" ///\n" +" /// The given base address must point to the MMIO control registers of " +"a\n" +" /// PL031 device, which must be mapped into the address space of the " +"process\n" +" /// as device memory and not have any other aliases.\n" +" pub unsafe fn new(base_address: *mut u32) -> Self {\n" +" Self {\n" +" registers: base_address as *mut Registers,\n" +" }\n" +" }\n" +"\n" +" /// Reads the current RTC value.\n" +" pub fn read(&self) -> u32 {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" unsafe { addr_of!((*self.registers).dr).read_volatile() }\n" +" }\n" +"\n" +" /// Writes a match value. When the RTC value matches this then an " +"interrupt\n" +" /// will be generated (if it is enabled).\n" +" pub fn set_match(&mut self, value: u32) {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" unsafe { addr_of_mut!((*self.registers).mr).write_volatile(value) }\n" +" }\n" +"\n" +" /// Returns whether the match register matches the RTC value, whether or " +"not\n" +" /// the interrupt is enabled.\n" +" pub fn matched(&self) -> bool {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" let ris = unsafe { addr_of!((*self.registers).ris)." +"read_volatile() };\n" +" (ris & 0x01) != 0\n" +" }\n" +"\n" +" /// Returns whether there is currently an interrupt pending.\n" +" ///\n" +" /// This should be true if and only if `matched` returns true and the\n" +" /// interrupt is masked.\n" +" pub fn interrupt_pending(&self) -> bool {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" let ris = unsafe { addr_of!((*self.registers).mis)." +"read_volatile() };\n" +" (ris & 0x01) != 0\n" +" }\n" +"\n" +" /// Sets or clears the interrupt mask.\n" +" ///\n" +" /// When the mask is true the interrupt is enabled; when it is false " +"the\n" +" /// interrupt is disabled.\n" +" pub fn enable_interrupt(&mut self, mask: bool) {\n" +" let imsc = if mask { 0x01 } else { 0x00 };\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" unsafe { addr_of_mut!((*self.registers).imsc)." +"write_volatile(imsc) }\n" +" }\n" +"\n" +" /// Clears a pending interrupt, if any.\n" +" pub fn clear_interrupt(&mut self) {\n" +" // Safe because we know that self.registers points to the control\n" +" // registers of a PL031 device which is appropriately mapped.\n" +" unsafe { addr_of_mut!((*self.registers).icr).write_volatile(0x01) }\n" +" }\n" +"}\n" +"\n" +"// Safe because it just contains a pointer to device memory, which can be\n" +"// accessed from any context.\n" +"unsafe impl Send for Rtc {}\n" +"```" +msgstr "" + +#: src/exercises/concurrency/solutions-morning.md:1 +#, fuzzy +msgid "Concurrency Morning Exercise" +msgstr "3์ผ์ฐจ ์˜ค์ „ ์—ฐ์Šต๋ฌธ์ œ" + +#: src/exercises/concurrency/solutions-morning.md:5 msgid "([back to exercise](dining-philosophers.md))" msgstr "" -#: src/exercises/day-4/solutions-morning.md:7 +#: src/exercises/concurrency/solutions-morning.md:7 msgid "" "```rust\n" "// Copyright 2022 Google LLC\n" @@ -22264,8 +27167,7 @@ msgid "" "// limitations under the License.\n" "\n" "// ANCHOR: Philosopher\n" -"use std::sync::mpsc;\n" -"use std::sync::{Arc, Mutex};\n" +"use std::sync::{mpsc, Arc, Mutex};\n" "use std::thread;\n" "use std::time::Duration;\n" "\n" @@ -22314,8 +27216,8 @@ msgid "" "\n" " for i in 0..forks.len() {\n" " let tx = tx.clone();\n" -" let mut left_fork = forks[i].clone();\n" -" let mut right_fork = forks[(i + 1) % forks.len()].clone();\n" +" let mut left_fork = Arc::clone(&forks[i]);\n" +" let mut right_fork = Arc::clone(&forks[(i + 1) % forks.len()]);\n" "\n" " // To avoid a deadlock, we have to break the symmetry\n" " // somewhere. This will swap the forks without deinitializing\n" @@ -22347,470 +27249,485 @@ msgid "" "```" msgstr "" -#: src/basic-syntax/scalar-types.md:21 -msgid "There are a few syntaxes which are not shown above:" -msgstr "์œ„์— ํ‘œ์‹œ๋˜์ง€ ์•Š์€ ๋ช‡ ๊ฐ€์ง€ ๋ฌธ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค." +#: src/exercises/concurrency/solutions-morning.md:104 +#, fuzzy +msgid "Link Checker" +msgstr "๋ฉ€ํ‹ฐ์Šค๋ ˆ๋“œ ๋งํฌ ๊ฒ€์‚ฌ๊ธฐ" -#: src/basic-syntax/scalar-types.md:23 -msgid "" -"Raw strings allow you to create a `&str` value with escapes disabled: " -"`r\"\\n\" == \"\\\\n\"`. You can embed double-quotes by using an equal " -"amount of `#` on either side of the quotes:" +#: src/exercises/concurrency/solutions-morning.md:106 +msgid "([back to exercise](link-checker.md))" msgstr "" -"์›์‹œ ๋ฌธ์ž์—ด์„ ์‚ฌ์šฉํ•˜๋ฉด ์ด์Šค์ผ€์ดํ”„๋˜์ง€ ์•Š๋Š” `&str` ๊ฐ’์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. " -"`r\"\\n\" == \"\\\\n\"` ๋”ฐ์˜ดํ‘œ์˜ ์–‘์ชฝ์— ๊ฐ™์€ ์–‘์˜ `#`์„ ์‚ฌ์šฉํ•˜์—ฌ ํฐ๋”ฐ์˜ดํ‘œ๋ฅผ " -"์‚ฝ์ž…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." -#: src/basic-syntax/scalar-types.md:27 +#: src/exercises/concurrency/solutions-morning.md:108 msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(r#\"link\"#);\n" -" println!(\"link\");\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"fn main() {\n" -" println!(r#\"link\"#);\n" -" println!(\"link\");\n" -"}\n" -"```" - -#: src/basic-syntax/scalar-types.md:34 -msgid "Byte strings allow you to create a `&[u8]` value directly:" -msgstr "Byte strings allow you to create a `&[u8]` value directly:" - -#: src/basic-syntax/scalar-types.md:36 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", b\"abc\");\n" -" println!(\"{:?}\", &[97, 98, 99]);\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", b\"abc\");\n" -" println!(\"{:?}\", &[97, 98, 99]);\n" -"}\n" -"```" - -#: src/welcome.md:18 -msgid "" -"The first three days show you the fundamentals of Rust. Following this, " -"you're invited to dive into one or more specialized topics:" -msgstr "" -"์ฒ˜์Œ 3์ผ ๋™์•ˆ์€ Rust์˜ ๊ธฐ๋ณธ์‚ฌํ•ญ์„ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค. ๊ทธ๋‹ค์Œ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ•˜๋‚˜ ์ด" -"์ƒ์˜ ์ „๋ฌธ ์ฃผ์ œ๋ฅผ ์ž์„ธํžˆ ์•Œ์•„๋ด…๋‹ˆ๋‹ค." - -#: src/welcome.md:21 -msgid "" -"[Android](android.md): a half-day course on using Rust for Android platform " -"development (AOSP). This includes interoperability with C, C++, and Java." -msgstr "" -"[Android](android.md): Android ํ”Œ๋žซํผ ๊ฐœ๋ฐœ(AOSP) ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ ๋ฐ˜๋‚˜์ ˆ " -"๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” C, C++, Java์™€์˜ ์ƒํ˜ธ ์šด์šฉ์„ฑ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค." - -#: src/welcome.md:23 -msgid "" -"[Bare-metal](bare-metal.md): a full day class on using Rust for bare-metal " -"(embedded) development. Both microcontrollers and application processors are " -"covered." -msgstr "" -"[Bare-metal](bare-metal.md): bare-metal(์ž„๋ฒ ๋””๋“œ) ๊ฐœ๋ฐœ ์‹œ Rust ์‚ฌ์šฉ์— ๊ด€ํ•œ ์ข…" -"์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์ปจํŠธ๋กค๋Ÿฌ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ๋ฅผ ๋ชจ๋‘ ๋‹ค๋ฃน๋‹ˆ๋‹ค." - -#: src/welcome.md:26 -msgid "" -"[Concurrency](concurrency.md): a full day class on concurrency in Rust. We " -"cover both classical concurrency (preemptively scheduling using threads and " -"mutexes) and async/await concurrency (cooperative multitasking using " -"futures)." -msgstr "" -"[๋™์‹œ์„ฑ](concurrency.md): Rust์˜ ๋™์‹œ์„ฑ์— ๊ด€ํ•œ ์ข…์ผ ๊ณผ์ •์ž…๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” ๊ณ ์ „" -"์ ์ธ ๋™์‹œ์„ฑ(์Šค๋ ˆ๋“œ์™€ ๋ฎคํ…์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„ ์ ํ˜• ์Šค์ผ€์ค„๋ง์„ ํ•˜๋Š” ๊ฒƒ)๊ณผ async/" -"await ๋™์‹œ์„ฑ(future๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ˜‘๋ ฅ์ ์ธ ๋ฉ€ํ‹ฐํƒœ์Šคํ‚น)์„ ๋ชจ๋‘ ๋‹ค๋ฃน๋‹ˆ๋‹ค." - -#: src/control-flow/if-expressions.md:3 -msgid "" -"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/" -"if-expr.html#if-expressions) exactly like `if` statements in other languages:" -msgstr "" -"๋‹ค๋ฅธ ์–ธ์–ด์˜ `if` ๋ฌธ๊ณผ ๋˜‘๊ฐ™์ด [`if` ํ‘œํ˜„์‹](https://doc.rust-lang.org/" -"reference/expressions/if-expr.html#if-expressions)์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/control-flow/if-let-expressions.md:3 -msgid "" -"The [`if let` expression](https://doc.rust-lang.org/reference/expressions/if-" -"expr.html#if-let-expressions) lets you execute different code depending on " -"whether a value matches a pattern:" -msgstr "" -"[`if let` ํ‘œํ˜„์‹](https://doc.rust-lang.org/reference/expressions/if-expr." -"html#if-let-expressions)์„ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ’์ด ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š”์ง€์— ๋”ฐ๋ผ ๋‹ค๋ฅธ ์ฝ”๋“œ" -"๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/control-flow/if-let-expressions.md:26 -msgid "" -"Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" -"flow_control/let_else.html) construct allows to do a destructuring " -"assignment, or if it fails, have a non-returning block branch (panic/return/" -"break/continue):" -msgstr "" -"1.65๋ถ€ํ„ฐ ์œ ์‚ฌํ•œ [let-else](https://doc.rust-lang.org/rust-by-example/" -"flow_control/let_else.html) ๊ตฌ์„ฑ์€ ๋””์ŠคํŠธ๋Ÿญ์ฒ˜๋ง ํ• ๋‹น์„ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ ์‹คํŒจํ•  ๊ฒฝ" -"์šฐ ๋ฐ˜ํ™˜๋˜์ง€ ์•Š๋Š” ๋ธ”๋ก ๋ธŒ๋žœ์น˜(panic/return/break/continue)๋ฅผ ๋ณด์œ ํ•˜๋„๋ก ํ—ˆ์šฉํ•ฉ" -"๋‹ˆ๋‹ค." - -#: src/control-flow/if-let-expressions.md:28 -msgid "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" -"}\n" -" \n" -"fn second_word_to_upper(s: &str) -> Option {\n" -" let mut it = s.split(' ');\n" -" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" -" return None;\n" -" };\n" -" Some(item.to_uppercase())\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"fn main() {\n" -" println!(\"{:?}\", second_word_to_upper(\"foo bar\"));\n" -"}\n" -" \n" -"fn second_word_to_upper(s: &str) -> Option {\n" -" let mut it = s.split(' ');\n" -" let (Some(_), Some(item)) = (it.next(), it.next()) else {\n" -" return None;\n" -" };\n" -" Some(item.to_uppercase())\n" -"}\n" -"```" - -#: src/control-flow/while-expressions.md:3 -msgid "" -"The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" -"expr.html#predicate-loops) works very similar to other languages:" -msgstr "" -"[`while` ํ‚ค์›Œ๋“œ](https://doc.rust-lang.org/reference/expressions/loop-expr." -"html#predicate-loops)๋Š” ๋‹ค๋ฅธ ์–ธ์–ด์™€ ๋งค์šฐ ๋น„์Šทํ•˜๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค." - -#: src/control-flow/loop-expressions.md:3 -msgid "" -"Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#infinite-loops) which creates an endless loop." -msgstr "" -"๋งˆ์ง€๋ง‰์œผ๋กœ, ๋ฌดํ•œ ๋ฃจํ”„๋ฅผ ๋งŒ๋“œ๋Š” [`loop` ํ‚ค์›Œ๋“œ](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#infinite-loops)๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/control-flow/loop-expressions.md:28 -msgid "" -"Note that `loop` is the only looping construct which returns a non-trivial " -"value. This is because it's guaranteed to be entered at least once (unlike " -"`while` and `for` loops)." -msgstr "" -"`loop`๋Š” non-trivial ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ์œ ์ผํ•œ ๋ฐ˜๋ณต๋ฌธ์ž…๋‹ˆ๋‹ค. ์ด๋Š” `while` ๋ฐ " -"`for` ๋ฐ˜๋ณต๋ฌธ๊ณผ ๋‹ฌ๋ฆฌ ์ตœ์†Œํ•œ ํ•œ ๋ฒˆ์€ ๋ฃจํ”„๋ฌธ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ" -"๋‹ค." - -#: src/control-flow/break-continue.md:3 -msgid "" -"If you want to exit a loop early, use [`break`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#break-expressions)," -msgstr "" -"๋ฃจํ”„๋ฅผ ์กฐ๊ธฐ์— ์ข…๋ฃŒํ•˜๋ ค๋ฉด [`break`](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#break-expressions)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/control-flow/break-continue.md:4 -msgid "" -"If you want to immediately start the next iteration use [`continue`](https://" -"doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)." -msgstr "" -"๋‹ค์Œ ๋ฐ˜๋ณต์„ ์ฆ‰์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด [`continue`](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#continue-expressions)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค." - -#: src/SUMMARY.md:34 -msgid "Rustdoc" -msgstr "Rustdoc" - -#: src/SUMMARY.md:147 -msgid "Closures: Fn, FnMut, FnOnce" -msgstr "ํด๋กœ์ €: Fn, FnMut, FnOnce" - -#: src/SUMMARY.md:212 -msgid "no_std" -msgstr "no_std" - -#: src/SUMMARY.md:214 -msgid "alloc" -msgstr "alloc" - -#: src/SUMMARY.md:217 -msgid "PACs" -msgstr "PAC" - -#: src/SUMMARY.md:218 -msgid "HAL Crates" -msgstr "HAL ํฌ๋ ˆ์ดํŠธ" - -#: src/SUMMARY.md:219 -msgid "Board Support Crates" -msgstr "๋ณด๋“œ ์ง€์› ํฌ๋ ˆ์ดํŠธ" - -#: src/SUMMARY.md:220 -msgid "The Type State Pattern" -msgstr "Type State ํŒจํ„ด" - -#: src/SUMMARY.md:221 -msgid "embedded-hal" -msgstr "embedded-hal" - -#: src/SUMMARY.md:222 -msgid "probe-rs, cargo-embed" -msgstr "progo-rs, cargo-embed" - -#: src/SUMMARY.md:230 -msgid "Application Processors" -msgstr "์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœ์„ธ์„œ" - -#: src/SUMMARY.md:231 -msgid "Inline Assembly" -msgstr "์ธ๋ผ์ธ ์–ด์…ˆ๋ธ”๋ฆฌ" - -#: src/SUMMARY.md:232 -msgid "MMIO" -msgstr "MMIO" - -#: src/SUMMARY.md:233 -msgid "Let's Write a UART Driver" -msgstr "UART ๋“œ๋ผ์ด๋ฒ„ ์ž‘์„ฑ" - -#: src/SUMMARY.md:235 -msgid "A Better UART Driver" -msgstr "๋” ๋‚˜์€ UART ๋“œ๋ผ์ด๋ฒ„" - -#: src/SUMMARY.md:236 -msgid "Bitflags" -msgstr "๋น„ํŠธํ”Œ๋ž˜๊ทธ" - -#: src/SUMMARY.md:237 -msgid "Multiple Registers" -msgstr "๋” ๋งŽ์€ ๋ ˆ์ง€์Šคํ„ฐ" - -#: src/SUMMARY.md:238 -msgid "Driver" -msgstr "๋“œ๋ผ์ด๋ฒ„" - -#: src/SUMMARY.md:243 -msgid "Useful Crates" -msgstr "์œ ์šฉํ•œ ํฌ๋ ˆ์ดํŠธ" - -#: src/SUMMARY.md:244 -msgid "zerocopy" -msgstr "zerocopy" - -#: src/SUMMARY.md:245 -msgid "aarch64-paging" -msgstr "aarch64-paging" - -#: src/SUMMARY.md:246 -msgid "buddy_system_allocator" -msgstr "buddy_system_allocator" - -#: src/SUMMARY.md:247 -msgid "tinyvec" -msgstr "tinyvec" - -#: src/SUMMARY.md:248 -msgid "spin" -msgstr "ํšŒ์ „" - -#: src/SUMMARY.md:252 -msgid "RTC Driver" -msgstr "RTC ๋“œ๋ผ์ด๋ฒ„" - -#: src/SUMMARY.md:279 -msgid "Async Basics" -msgstr "๋น„๋™๊ธฐ ๊ด€๋ จ ๊ธฐ๋ณธ์‚ฌํ•ญ" - -#: src/SUMMARY.md:280 -msgid "async/await" -msgstr "async/await" - -#: src/SUMMARY.md:281 -msgid "Futures" -msgstr "Future" - -#: src/SUMMARY.md:288 -msgid "Select" -msgstr "Select" - -#: src/SUMMARY.md:289 -msgid "Pitfalls" -msgstr "ํ•จ์ •" - -#: src/SUMMARY.md:290 -msgid "Blocking the Executor" -msgstr "Executor ๋ธ”๋กœํ‚น ํ•˜๊ธฐ" - -#: src/SUMMARY.md:295 -msgid "Broadcast Chat Application" -msgstr "์ฑ„ํŒ… ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜" - -#: src/SUMMARY.md:318 -msgid "Bare Metal Rust Morning" -msgstr "Bare Metal Rust ์˜ค์ „ ์—ฐ์Šต" - -#: src/enums.md:6 -msgid "" -"```rust,editable\n" -"fn generate_random_number() -> i32 {\n" -" // Implementation based on https://xkcd.com/221/\n" -" 4 // Chosen by fair dice roll. Guaranteed to be random.\n" -"}\n" +"```rust,compile_fail\n" +"// Copyright 2022 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" "\n" +"use std::{sync::Arc, sync::Mutex, sync::mpsc, thread};\n" +"\n" +"// ANCHOR: setup\n" +"use reqwest::{blocking::Client, Url};\n" +"use scraper::{Html, Selector};\n" +"use thiserror::Error;\n" +"\n" +"#[derive(Error, Debug)]\n" +"enum Error {\n" +" #[error(\"request error: {0}\")]\n" +" ReqwestError(#[from] reqwest::Error),\n" +" #[error(\"bad http response: {0}\")]\n" +" BadResponse(String),\n" +"}\n" +"// ANCHOR_END: setup\n" +"\n" +"// ANCHOR: visit_page\n" "#[derive(Debug)]\n" -"enum CoinFlip {\n" -" Heads,\n" -" Tails,\n" +"struct CrawlCommand {\n" +" url: Url,\n" +" extract_links: bool,\n" "}\n" "\n" -"fn flip_coin() -> CoinFlip {\n" -" let random_number = generate_random_number();\n" -" if random_number % 2 == 0 {\n" -" return CoinFlip::Heads;\n" -" } else {\n" -" return CoinFlip::Tails;\n" +"fn visit_page(client: &Client, command: &CrawlCommand) -> Result, " +"Error> {\n" +" println!(\"Checking {:#}\", command.url);\n" +" let response = client.get(command.url.clone()).send()?;\n" +" if !response.status().is_success() {\n" +" return Err(Error::BadResponse(response.status().to_string()));\n" " }\n" +"\n" +" let mut link_urls = Vec::new();\n" +" if !command.extract_links {\n" +" return Ok(link_urls);\n" +" }\n" +"\n" +" let base_url = response.url().to_owned();\n" +" let body_text = response.text()?;\n" +" let document = Html::parse_document(&body_text);\n" +"\n" +" let selector = Selector::parse(\"a\").unwrap();\n" +" let href_values = document\n" +" .select(&selector)\n" +" .filter_map(|element| element.value().attr(\"href\"));\n" +" for href in href_values {\n" +" match base_url.join(href) {\n" +" Ok(link_url) => {\n" +" link_urls.push(link_url);\n" +" }\n" +" Err(err) => {\n" +" println!(\"On {base_url:#}: ignored unparsable {href:?}: " +"{err}\");\n" +" }\n" +" }\n" +" }\n" +" Ok(link_urls)\n" +"}\n" +"// ANCHOR_END: visit_page\n" +"\n" +"struct CrawlState {\n" +" domain: String,\n" +" visited_pages: std::collections::HashSet,\n" +"}\n" +"\n" +"impl CrawlState {\n" +" fn new(start_url: &Url) -> CrawlState {\n" +" let mut visited_pages = std::collections::HashSet::new();\n" +" visited_pages.insert(start_url.as_str().to_string());\n" +" CrawlState {\n" +" domain: start_url.domain().unwrap().to_string(),\n" +" visited_pages,\n" +" }\n" +" }\n" +"\n" +" /// Determine whether links within the given page should be extracted.\n" +" fn should_extract_links(&self, url: &Url) -> bool {\n" +" let Some(url_domain) = url.domain() else {\n" +" return false;\n" +" };\n" +" url_domain == self.domain\n" +" }\n" +"\n" +" /// Mark the given page as visited, returning true if it had already\n" +" /// been visited.\n" +" fn mark_visited(&mut self, url: &Url) -> bool {\n" +" self.visited_pages.insert(url.as_str().to_string())\n" +" }\n" +"}\n" +"\n" +"type CrawlResult = Result, (Url, Error)>;\n" +"fn spawn_crawler_threads(\n" +" command_receiver: mpsc::Receiver,\n" +" result_sender: mpsc::Sender,\n" +" thread_count: u32,\n" +") {\n" +" let command_receiver = Arc::new(Mutex::new(command_receiver));\n" +"\n" +" for _ in 0..thread_count {\n" +" let result_sender = result_sender.clone();\n" +" let command_receiver = command_receiver.clone();\n" +" thread::spawn(move || {\n" +" let client = Client::new();\n" +" loop {\n" +" let command_result = {\n" +" let receiver_guard = command_receiver.lock().unwrap();\n" +" receiver_guard.recv()\n" +" };\n" +" let Ok(crawl_command) = command_result else {\n" +" // The sender got dropped. No more commands coming in.\n" +" break;\n" +" };\n" +" let crawl_result = match visit_page(&client, &crawl_command) " +"{\n" +" Ok(link_urls) => Ok(link_urls),\n" +" Err(error) => Err((crawl_command.url, error)),\n" +" };\n" +" result_sender.send(crawl_result).unwrap();\n" +" }\n" +" });\n" +" }\n" +"}\n" +"\n" +"fn control_crawl(\n" +" start_url: Url,\n" +" command_sender: mpsc::Sender,\n" +" result_receiver: mpsc::Receiver,\n" +") -> Vec {\n" +" let mut crawl_state = CrawlState::new(&start_url);\n" +" let start_command = CrawlCommand { url: start_url, extract_links: " +"true };\n" +" command_sender.send(start_command).unwrap();\n" +" let mut pending_urls = 1;\n" +"\n" +" let mut bad_urls = Vec::new();\n" +" while pending_urls > 0 {\n" +" let crawl_result = result_receiver.recv().unwrap();\n" +" pending_urls -= 1;\n" +"\n" +" match crawl_result {\n" +" Ok(link_urls) => {\n" +" for url in link_urls {\n" +" if crawl_state.mark_visited(&url) {\n" +" let extract_links = crawl_state." +"should_extract_links(&url);\n" +" let crawl_command = CrawlCommand { url, " +"extract_links };\n" +" command_sender.send(crawl_command).unwrap();\n" +" pending_urls += 1;\n" +" }\n" +" }\n" +" }\n" +" Err((url, error)) => {\n" +" bad_urls.push(url);\n" +" println!(\"Got crawling error: {:#}\", error);\n" +" continue;\n" +" }\n" +" }\n" +" }\n" +" bad_urls\n" +"}\n" +"\n" +"fn check_links(start_url: Url) -> Vec {\n" +" let (result_sender, result_receiver) = mpsc::channel::();\n" +" let (command_sender, command_receiver) = mpsc::channel::" +"();\n" +" spawn_crawler_threads(command_receiver, result_sender, 16);\n" +" control_crawl(start_url, command_sender, result_receiver)\n" "}\n" "\n" "fn main() {\n" -" println!(\"You got: {:?}\", flip_coin());\n" +" let start_url = reqwest::Url::parse(\"https://www.google.org\")." +"unwrap();\n" +" let bad_urls = check_links(start_url);\n" +" println!(\"Bad URLs: {:#?}\", bad_urls);\n" "}\n" "```" msgstr "" -"```rust,editable\n" -"fn generate_random_number() -> i32 {\n" -" // Implementation based on https://xkcd.com/221/\n" -" 4 // Chosen by fair dice roll. Guaranteed to be random.\n" + +#: src/exercises/concurrency/solutions-afternoon.md:1 +#, fuzzy +msgid "Concurrency Afternoon Exercise" +msgstr "1์ผ์ฐจ ์˜คํ›„ ์—ฐ์Šต๋ฌธ์ œ" + +#: src/exercises/concurrency/solutions-afternoon.md:5 +msgid "([back to exercise](dining-philosophers-async.md))" +msgstr "" + +#: src/exercises/concurrency/solutions-afternoon.md:7 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: Philosopher\n" +"use std::sync::Arc;\n" +"use tokio::time;\n" +"use tokio::sync::mpsc::{self, Sender};\n" +"use tokio::sync::Mutex;\n" +"\n" +"struct Fork;\n" +"\n" +"struct Philosopher {\n" +" name: String,\n" +" // ANCHOR_END: Philosopher\n" +" left_fork: Arc>,\n" +" right_fork: Arc>,\n" +" thoughts: Sender,\n" "}\n" "\n" -"#[derive(Debug)]\n" -"enum CoinFlip {\n" -" Heads,\n" -" Tails,\n" -"}\n" +"// ANCHOR: Philosopher-think\n" +"impl Philosopher {\n" +" async fn think(&self) {\n" +" self.thoughts\n" +" .send(format!(\"Eureka! {} has a new idea!\", &self.name))." +"await\n" +" .unwrap();\n" +" }\n" +" // ANCHOR_END: Philosopher-think\n" "\n" -"fn flip_coin() -> CoinFlip {\n" -" let random_number = generate_random_number();\n" -" if random_number % 2 == 0 {\n" -" return CoinFlip::Heads;\n" -" } else {\n" -" return CoinFlip::Tails;\n" +" // ANCHOR: Philosopher-eat\n" +" async fn eat(&self) {\n" +" // Pick up forks...\n" +" // ANCHOR_END: Philosopher-eat\n" +" let _first_lock = self.left_fork.lock().await;\n" +" // Add a delay before picking the second fork to allow the " +"execution\n" +" // to transfer to another task\n" +" time::sleep(time::Duration::from_millis(1)).await;\n" +" let _second_lock = self.right_fork.lock().await;\n" +"\n" +" // ANCHOR: Philosopher-eat-body\n" +" println!(\"{} is eating...\", &self.name);\n" +" time::sleep(time::Duration::from_millis(5)).await;\n" +" // ANCHOR_END: Philosopher-eat-body\n" +"\n" +" // The locks are dropped here\n" +" // ANCHOR: Philosopher-eat-end\n" " }\n" "}\n" "\n" -"fn main() {\n" -" println!(\"You got: {:?}\", flip_coin());\n" -"}\n" -"```" - -#: src/basic-syntax/rustdoc.md:3 -msgid "" -"All language items in Rust can be documented using special `///` syntax." -msgstr "Rust์˜ ์•„์ดํ…œ(item)์€ `///` ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค." - -#: src/basic-syntax/rustdoc.md:5 -msgid "" -"```rust,editable\n" -"/// Determine whether the first argument is divisible by the second " -"argument.\n" -"///\n" -"/// If the second argument is zero, the result is false.\n" -"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" -" if rhs == 0 {\n" -" return false; // Corner case, early return\n" +"static PHILOSOPHERS: &[&str] =\n" +" &[\"Socrates\", \"Plato\", \"Aristotle\", \"Thales\", \"Pythagoras\"];\n" +"\n" +"#[tokio::main]\n" +"async fn main() {\n" +" // ANCHOR_END: Philosopher-eat-end\n" +" // Create forks\n" +" let mut forks = vec![];\n" +" (0..PHILOSOPHERS.len()).for_each(|_| forks.push(Arc::new(Mutex::" +"new(Fork))));\n" +"\n" +" // Create philosophers\n" +" let (philosophers, mut rx) = {\n" +" let mut philosophers = vec![];\n" +" let (tx, rx) = mpsc::channel(10);\n" +" for (i, name) in PHILOSOPHERS.iter().enumerate() {\n" +" let left_fork = Arc::clone(&forks[i]);\n" +" let right_fork = Arc::clone(&forks[(i + 1) % PHILOSOPHERS." +"len()]);\n" +" // To avoid a deadlock, we have to break the symmetry\n" +" // somewhere. This will swap the forks without deinitializing\n" +" // either of them.\n" +" if i == 0 {\n" +" std::mem::swap(&mut left_fork, &mut right_fork);\n" +" }\n" +" philosophers.push(Philosopher {\n" +" name: name.to_string(),\n" +" left_fork,\n" +" right_fork,\n" +" thoughts: tx.clone(),\n" +" });\n" +" }\n" +" (philosophers, rx)\n" +" // tx is dropped here, so we don't need to explicitly drop it later\n" +" };\n" +"\n" +" // Make them think and eat\n" +" for phil in philosophers {\n" +" tokio::spawn(async move {\n" +" for _ in 0..100 {\n" +" phil.think().await;\n" +" phil.eat().await;\n" +" }\n" +" });\n" +"\n" " }\n" -" lhs % rhs == 0 // The last expression in a block is the return " -"value\n" -"}\n" -"```" -msgstr "" -"```rust,editable\n" -"/// ์ฒซ ๋ฒˆ์งธ ์ธ์ˆ˜๊ฐ€ ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๋กœ ๋‚˜๋ˆ ์งˆ ์ˆ˜ ์žˆ๋Š”์ง€ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.\n" -"///\n" -"/// ๋‘ ๋ฒˆ์งธ ์ธ์ˆ˜๊ฐ€ 0์ด๋ฉด ๊ฒฐ๊ณผ๋Š” false์ž…๋‹ˆ๋‹ค.\n" -"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" -" if rhs == 0 {\n" -" return false; // Corner case, early return\n" +"\n" +" // Output their thoughts\n" +" while let Some(thought) = rx.recv().await {\n" +" println!(\"Here is a thought: {thought}\");\n" " }\n" -" lhs % rhs == 0 // ๋ธ”๋ก ์•ˆ์˜ ๋งˆ์ง€๋ง‰ ํ‘œํ˜„์‹์€ ๋ฐ˜ํ™˜๊ฐ’์ž…๋‹ˆ๋‹ค\n" -"}\n" -"```" - -#: src/basic-syntax/rustdoc.md:17 -msgid "" -"The contents are treated as Markdown. All published Rust library crates are " -"automatically documented at [`docs.rs`](https://docs.rs) using the [rustdoc]" -"(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It is " -"idiomatic to document all public items in an API using this pattern." -msgstr "" -"์ฝ˜ํ…์ธ ๋Š” ๋งˆํฌ๋‹ค์šด์œผ๋กœ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค. ๊ฒŒ์‹œ๋œ ๋ชจ๋“  Rust ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํฌ๋ ˆ์ดํŠธ๋Š” " -"[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉ" -"ํ•˜์—ฌ [`docs.rs`](https://docs.rs)์— ์ž๋™์œผ๋กœ ๋ฌธ์„œํ™”๋ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ API์˜ " -"๋ชจ๋“  ๊ณต๊ฐœ ํ•ญ๋ชฉ์€ ์ด ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œํ™”๋ฉ๋‹ˆ๋‹ค." - -#: src/basic-syntax/rustdoc.md:24 -msgid "" -"Show students the generated docs for the `rand` crate at [`docs.rs/rand`]" -"(https://docs.rs/rand)." -msgstr "" -"[`docs.rs/rand`](https://docs.rs/rand)์—์„œ `rand` ํฌ๋ ˆ์ดํŠธ์šฉ์œผ๋กœ ์ƒ์„ฑ๋œ ๋ฌธ์„œ" -"๋ฅผ ํ•™์ƒ์—๊ฒŒ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค." - -#: src/basic-syntax/rustdoc.md:27 -msgid "" -"This course does not include rustdoc on slides, just to save space, but in " -"real code they should be present." -msgstr "" -"์ด ๊ณผ์ •์—์„œ๋Š” ๊ณต๊ฐ„ ์ ˆ์•ฝ์„ ์œ„ํ•ด ์Šฌ๋ผ์ด๋“œ์— rustdoc์„ ํฌํ•จํ•˜์ง€ ์•Š์ง€๋งŒ ์‹ค์ œ ์ฝ”๋“œ" -"์—๋Š” ์กด์žฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค." - -#: src/basic-syntax/rustdoc.md:30 -msgid "" -"Inner doc comments are discussed later (in the page on modules) and need not " -"be addressed here." -msgstr "" -"๋‚ด๋ถ€ ๋ฌธ์„œ ์ฃผ์„์€ ๋ชจ๋“ˆ ํŽ˜์ด์ง€ ๋’ท๋ถ€๋ถ„์—์„œ ๋‹ค๋ฃจ๋ฉฐ ์—ฌ๊ธฐ์„œ ๋‹ค๋ฃจ์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค." - -#: src/basic-syntax/methods.md:34 -msgid "Add a `Rectangle::new` constructor and call this from `main`:" -msgstr "`Rectangle::new` ์ƒ์„ฑ์ž๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์ด๋ฅผ `main`์—์„œ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค." - -#: src/basic-syntax/methods.md:36 -msgid "" -"```rust,editable,compile_fail\n" -"fn new(width: u32, height: u32) -> Rectangle {\n" -" Rectangle { width, height }\n" "}\n" "```" msgstr "" -"```rust,editable,compile_fail\n" -"fn new(width: u32, height: u32) -> Rectangle {\n" -" Rectangle { width, height }\n" + +#: src/exercises/concurrency/solutions-afternoon.md:121 +msgid "([back to exercise](chat-app.md))" +msgstr "" + +#: src/exercises/concurrency/solutions-afternoon.md:125 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: setup\n" +"use futures_util::sink::SinkExt;\n" +"use std::error::Error;\n" +"use std::net::SocketAddr;\n" +"use tokio::net::{TcpListener, TcpStream};\n" +"use tokio::sync::broadcast::{channel, Sender};\n" +"use tokio_websockets::{Message, ServerBuilder, WebsocketStream};\n" +"// ANCHOR_END: setup\n" +"\n" +"// ANCHOR: handle_connection\n" +"async fn handle_connection(\n" +" addr: SocketAddr,\n" +" mut ws_stream: WebsocketStream,\n" +" bcast_tx: Sender,\n" +") -> Result<(), Box> {\n" +" // ANCHOR_END: handle_connection\n" +"\n" +" ws_stream\n" +" .send(Message::text(\"Welcome to chat! Type a message\".into()))\n" +" .await?;\n" +" let mut bcast_rx = bcast_tx.subscribe();\n" +"\n" +" // A continuous loop for concurrently performing two tasks: (1) " +"receiving\n" +" // messages from `ws_stream` and broadcasting them, and (2) receiving\n" +" // messages on `bcast_rx` and sending them to the client.\n" +" loop {\n" +" tokio::select! {\n" +" incoming = ws_stream.next() => {\n" +" match incoming {\n" +" Some(Ok(msg)) => {\n" +" let msg = msg.as_text()?;\n" +" println!(\"From client {addr:?} {msg:?}\");\n" +" bcast_tx.send(msg.into())?;\n" +" }\n" +" Some(Err(err)) => return Err(err.into()),\n" +" None => return Ok(()),\n" +" }\n" +" }\n" +" msg = bcast_rx.recv() => {\n" +" ws_stream.send(Message::text(msg?)).await?;\n" +" }\n" +" }\n" +" }\n" +" // ANCHOR: main\n" +"}\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> Result<(), Box> {\n" +" let (bcast_tx, _) = channel(16);\n" +"\n" +" let listener = TcpListener::bind(\"127.0.0.1:2000\").await?;\n" +" println!(\"listening on port 2000\");\n" +"\n" +" loop {\n" +" let (socket, addr) = listener.accept().await?;\n" +" println!(\"New connection from {addr:?}\");\n" +" let bcast_tx = bcast_tx.clone();\n" +" tokio::spawn(async move {\n" +" // Wrap the raw TCP stream into a websocket.\n" +" let ws_stream = ServerBuilder::new().accept(socket).await?;\n" +"\n" +" handle_connection(addr, ws_stream, bcast_tx).await\n" +" });\n" +" }\n" +"}\n" +"// ANCHOR_END: main\n" +"```" +msgstr "" + +#: src/exercises/concurrency/solutions-afternoon.md:210 +msgid "" +"```rust,compile_fail\n" +"// Copyright 2023 Google LLC\n" +"//\n" +"// Licensed under the Apache License, Version 2.0 (the \"License\");\n" +"// you may not use this file except in compliance with the License.\n" +"// You may obtain a copy of the License at\n" +"//\n" +"// http://www.apache.org/licenses/LICENSE-2.0\n" +"//\n" +"// Unless required by applicable law or agreed to in writing, software\n" +"// distributed under the License is distributed on an \"AS IS\" BASIS,\n" +"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +"// See the License for the specific language governing permissions and\n" +"// limitations under the License.\n" +"\n" +"// ANCHOR: setup\n" +"use futures_util::SinkExt;\n" +"use http::Uri;\n" +"use tokio::io::{AsyncBufReadExt, BufReader};\n" +"use tokio_websockets::{ClientBuilder, Message};\n" +"\n" +"#[tokio::main]\n" +"async fn main() -> Result<(), tokio_websockets::Error> {\n" +" let mut ws_stream = ClientBuilder::from_uri(Uri::" +"from_static(\"ws://127.0.0.1:2000\"))\n" +" .connect()\n" +" .await?;\n" +"\n" +" let stdin = tokio::io::stdin();\n" +" let mut stdin = BufReader::new(stdin).lines();\n" +"\n" +" // ANCHOR_END: setup\n" +" // Continuous loop for concurrently sending and receiving messages.\n" +" loop {\n" +" tokio::select! {\n" +" incoming = ws_stream.next() => {\n" +" match incoming {\n" +" Some(Ok(msg)) => println!(\"From server: {}\", msg." +"as_text()?),\n" +" Some(Err(err)) => return Err(err.into()),\n" +" None => return Ok(()),\n" +" }\n" +" }\n" +" res = stdin.next_line() => {\n" +" match res {\n" +" Ok(None) => return Ok(()),\n" +" Ok(Some(line)) => ws_stream.send(Message::text(line." +"to_string())).await?,\n" +" Err(err) => return Err(err.into()),\n" +" }\n" +" }\n" +"\n" +" }\n" +" }\n" "}\n" "```" - -#: src/basic-syntax/methods.md:42 -msgid "" -"Add a `Rectangle::new_square(width: u32)` constructor to illustrate that " -"constructors can take arbitrary parameters." msgstr "" -"`Rectangle::new_square(width: u32)` ์ƒ์„ฑ์ž๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ƒ์„ฑ์ž๊ฐ€ ์ž„์˜์˜ ๋งค๊ฐœ๋ณ€" -"์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค."