diff --git a/po/zh-CN.po b/po/zh-CN.po index f11a3221cbc..ebf32bc8e58 100644 --- a/po/zh-CN.po +++ b/po/zh-CN.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" -"POT-Creation-Date: 2024-01-05T12:50:57-08:00\n" -"PO-Revision-Date: 2023-10-21 15:02+0800\n" +"POT-Creation-Date: 2024-01-05T13:41:15-08:00\n" +"PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: Language zh-Hans\n" "Language: zh_CN\n" @@ -10,7 +10,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4\n" +"X-Generator: Poedit 3.4.2\n" #: src/SUMMARY.md:3 src/index.md:1 msgid "Welcome to Comprehensive Rust 🦀" @@ -70,15 +70,15 @@ msgstr "什么是 Rust?" #: src/SUMMARY.md:22 src/hello-world/benefits.md:1 msgid "Benefits of Rust" -msgstr "" +msgstr "Rust 的优势" #: src/SUMMARY.md:23 src/hello-world/playground.md:1 msgid "Playground" -msgstr "" +msgstr "Playground" #: src/SUMMARY.md:24 src/types-and-values.md:1 msgid "Types and Values" -msgstr "" +msgstr "类型和值" #: src/SUMMARY.md:25 src/types-and-values/variables.md:1 msgid "Variables" @@ -86,11 +86,11 @@ msgstr "变量" #: src/SUMMARY.md:26 src/types-and-values/values.md:1 msgid "Values" -msgstr "" +msgstr "值" #: src/SUMMARY.md:27 src/types-and-values/arithmetic.md:1 msgid "Arithmetic" -msgstr "" +msgstr "算术" #: src/SUMMARY.md:28 src/types-and-values/strings.md:1 msgid "Strings" @@ -101,8 +101,9 @@ msgid "Type Inference" msgstr "类型推导" #: src/SUMMARY.md:30 src/types-and-values/exercise.md:1 +#, fuzzy msgid "Exercise: Fibonacci" -msgstr "" +msgstr "练习:Fibonacci" #: src/SUMMARY.md:31 src/SUMMARY.md:40 src/SUMMARY.md:51 src/SUMMARY.md:56 #: src/SUMMARY.md:64 src/SUMMARY.md:75 src/SUMMARY.md:82 src/SUMMARY.md:89 @@ -130,7 +131,7 @@ msgstr "控制流" #: src/SUMMARY.md:33 src/control-flow-basics/conditionals.md:1 msgid "Conditionals" -msgstr "" +msgstr "条件语句" #: src/SUMMARY.md:34 src/control-flow-basics/loops.md:1 #, fuzzy @@ -143,7 +144,7 @@ msgstr "`break` 和 `continue`" #: src/SUMMARY.md:36 src/control-flow-basics/blocks-and-scopes.md:1 msgid "Blocks and Scopes" -msgstr "" +msgstr "代码块和作用域" #: src/SUMMARY.md:37 src/control-flow-basics/functions.md:1 msgid "Functions" @@ -151,11 +152,12 @@ msgstr "函数" #: src/SUMMARY.md:38 src/control-flow-basics/macros.md:1 msgid "Macros" -msgstr "" +msgstr "宏" #: src/SUMMARY.md:39 src/control-flow-basics/exercise.md:1 +#, fuzzy msgid "Exercise: Collatz Sequence" -msgstr "" +msgstr "练习:考拉兹序列" #: src/SUMMARY.md:42 msgid "Day 1: Afternoon" @@ -164,7 +166,7 @@ msgstr "第一天:下午" #: src/SUMMARY.md:45 src/SUMMARY.md:46 src/tuples-and-arrays.md:1 #: src/tuples-and-arrays/tuples-and-arrays.md:1 msgid "Tuples and Arrays" -msgstr "" +msgstr "元组和数组" #: src/SUMMARY.md:47 src/tuples-and-arrays/iteration.md:1 #, fuzzy @@ -183,8 +185,9 @@ msgid "Destructuring" msgstr "解构枚举" #: src/SUMMARY.md:50 src/tuples-and-arrays/exercise.md:1 +#, fuzzy msgid "Exercise: Nested Arrays" -msgstr "" +msgstr "练习:嵌套数组" #: src/SUMMARY.md:52 src/references.md:1 msgid "References" @@ -193,7 +196,7 @@ msgstr "引用" #: src/SUMMARY.md:53 src/references/shared.md:1 #, fuzzy msgid "Shared References" -msgstr "引用" +msgstr "共享引用" #: src/SUMMARY.md:54 src/references/exclusive.md:1 #, fuzzy @@ -201,12 +204,14 @@ msgid "Exclusive References" msgstr "悬垂引用" #: src/SUMMARY.md:55 src/references/exercise.md:1 +#, fuzzy msgid "Exercise: Geometry" -msgstr "" +msgstr "练习:几何图形" #: src/SUMMARY.md:57 src/user-defined-types.md:1 +#, fuzzy msgid "User-Defined Types" -msgstr "" +msgstr "用户定义的类型" #: src/SUMMARY.md:58 src/user-defined-types/named-structs.md:1 #, fuzzy @@ -230,11 +235,12 @@ msgstr "静态变量与常量" #: src/SUMMARY.md:62 src/user-defined-types/aliases.md:1 msgid "Type Aliases" -msgstr "" +msgstr "类型别名" #: src/SUMMARY.md:63 src/user-defined-types/exercise.md:1 +#, fuzzy msgid "Exercise: Elevator Events" -msgstr "" +msgstr "练习:电梯事件" #: src/SUMMARY.md:68 msgid "Day 2: Morning" @@ -247,12 +253,12 @@ msgstr "控制流" #: src/SUMMARY.md:74 src/pattern-matching/exercise.md:1 msgid "Exercise: Expression Evaluation" -msgstr "" +msgstr "练习:表达式求值" #: src/SUMMARY.md:76 src/methods-and-traits.md:1 #, fuzzy msgid "Methods and Traits" -msgstr "读取和写入" +msgstr "方法和特征" #: src/SUMMARY.md:77 src/methods-and-traits/methods.md:1 msgid "Methods" @@ -274,7 +280,7 @@ msgstr "特征对象" #: src/SUMMARY.md:81 src/methods-and-traits/exercise.md:1 #, fuzzy msgid "Exercise: GUI Library" -msgstr "一个简单的 GUI 库" +msgstr "练习:面向 GUI 库的模块" #: src/SUMMARY.md:83 src/generics.md:1 msgid "Generics" @@ -298,8 +304,9 @@ msgid "`impl Trait`" msgstr "`impl Trait`" #: src/SUMMARY.md:88 src/generics/exercise.md:1 +#, fuzzy msgid "Exercise: Generic `min`" -msgstr "" +msgstr "练习:通用 `min` 函数" #: src/SUMMARY.md:91 msgid "Day 2: Afternoon" @@ -320,12 +327,13 @@ msgid "Documentation" msgstr "文档测试" #: src/SUMMARY.md:97 +#, fuzzy msgid "`Option`" -msgstr "" +msgstr "`Option`" #: src/SUMMARY.md:98 msgid "`Result`" -msgstr "" +msgstr "`Result`" #: src/SUMMARY.md:99 src/android/interoperability/cpp/type-mapping.md:5 #, fuzzy @@ -343,7 +351,7 @@ msgstr "`HashMap`" #: src/SUMMARY.md:102 src/std-types/exercise.md:1 #, fuzzy msgid "Exercise: Counter" -msgstr "习题" +msgstr "练习:计数器" #: src/SUMMARY.md:104 src/std-traits.md:1 #, fuzzy @@ -352,7 +360,7 @@ msgstr "标准库" #: src/SUMMARY.md:105 src/std-traits/comparisons.md:1 src/async.md:17 msgid "Comparisons" -msgstr "" +msgstr "对比项" #: src/SUMMARY.md:106 src/std-traits/operators.md:1 #, fuzzy @@ -374,7 +382,7 @@ msgstr "`Read` 和 `Write`" #: src/SUMMARY.md:110 msgid "`Default`, struct update syntax" -msgstr "" +msgstr "`Default`,结构体更新语法" #: src/SUMMARY.md:111 src/std-traits/closures.md:1 msgid "Closures" @@ -383,7 +391,7 @@ msgstr "闭包" #: src/SUMMARY.md:112 src/std-traits/exercise.md:1 #, fuzzy msgid "Exercise: ROT13" -msgstr "习题" +msgstr "练习:ROT13" #: src/SUMMARY.md:117 msgid "Day 3: Morning" @@ -395,7 +403,7 @@ msgstr "内存管理" #: src/SUMMARY.md:121 src/memory-management/review.md:1 msgid "Review of Program Memory" -msgstr "" +msgstr "对程序内存进行审查" #: src/SUMMARY.md:122 src/memory-management/approaches.md:1 #, fuzzy @@ -412,7 +420,7 @@ msgstr "移动语义" #: src/SUMMARY.md:125 msgid "`Clone`" -msgstr "" +msgstr "`Clone`" #: src/SUMMARY.md:126 src/memory-management/copy-types.md:5 #, fuzzy @@ -425,12 +433,13 @@ msgid "`Drop`" msgstr "Drop" #: src/SUMMARY.md:128 src/memory-management/exercise.md:1 +#, fuzzy msgid "Exercise: Builder Type" -msgstr "" +msgstr "练习:构建器类型" #: src/SUMMARY.md:130 src/smart-pointers.md:1 msgid "Smart Pointers" -msgstr "" +msgstr "智能指针" #: src/SUMMARY.md:131 src/smart-pointers/box.md:1 #: src/android/interoperability/cpp/type-mapping.md:9 @@ -443,8 +452,9 @@ msgid "`Rc`" msgstr "`Rc`" #: src/SUMMARY.md:133 src/smart-pointers/exercise.md:1 +#, fuzzy msgid "Exercise: Binary Tree" -msgstr "" +msgstr "练习:二进制文件树" #: src/SUMMARY.md:136 msgid "Day 3: Afternoon" @@ -472,7 +482,7 @@ msgstr "互操作性" #: src/SUMMARY.md:143 src/borrowing/exercise.md:1 #, fuzzy msgid "Exercise: Health Statistics" -msgstr "健康统计" +msgstr "练习:健康统计" #: src/SUMMARY.md:145 src/slices-and-lifetimes.md:1 #, fuzzy @@ -505,8 +515,9 @@ msgid "Struct Lifetimes" msgstr "生命周期" #: src/SUMMARY.md:151 src/slices-and-lifetimes/exercise.md:1 +#, fuzzy msgid "Exercise: Protobuf Parsing" -msgstr "" +msgstr "练习:Protobuf 解析" #: src/SUMMARY.md:156 #, fuzzy @@ -531,8 +542,9 @@ msgid "`FromIterator`" msgstr "FromIterator" #: src/SUMMARY.md:163 src/iterators/exercise.md:1 +#, fuzzy msgid "Exercise: Iterator Method Chaining" -msgstr "" +msgstr "练习:迭代器方法链接" #: src/SUMMARY.md:165 src/SUMMARY.md:166 src/modules.md:1 #: src/modules/modules.md:1 @@ -549,11 +561,12 @@ msgstr "可见性" #: src/SUMMARY.md:169 msgid "`use`, `super`, `self`" -msgstr "" +msgstr "`use`、`super`、`self`" #: src/SUMMARY.md:170 src/modules/exercise.md:1 +#, fuzzy msgid "Exercise: Modules for the GUI Library" -msgstr "" +msgstr "练习:面向 GUI 库的模块" #: src/SUMMARY.md:172 src/SUMMARY.md:253 src/testing.md:1 #: src/chromium/testing.md:1 @@ -575,15 +588,16 @@ msgstr "实用 crate" #: src/SUMMARY.md:176 src/testing/googletest.md:1 msgid "GoogleTest" -msgstr "" +msgstr "GoogleTest" #: src/SUMMARY.md:177 src/testing/mocking.md:1 msgid "Mocking" -msgstr "" +msgstr "模拟" #: src/SUMMARY.md:178 src/testing/lints.md:1 +#, fuzzy msgid "Compiler Lints and Clippy" -msgstr "" +msgstr "编译器 lint 和 Clippy" #: src/SUMMARY.md:179 src/testing/exercise.md:1 #, fuzzy @@ -662,7 +676,7 @@ msgstr "实现 Unsafe Trait" #: src/SUMMARY.md:200 #, fuzzy msgid "Exercise: FFI Wrapper" -msgstr "安全 FFI 封装容器" +msgstr "练习:FFI 封装容器" #: src/SUMMARY.md:203 src/SUMMARY.md:327 src/bare-metal/android.md:1 msgid "Android" @@ -747,24 +761,27 @@ msgstr "测试模块" #: src/SUMMARY.md:226 #, fuzzy msgid "Rust Bridge" -msgstr "Rust 二进制文件" +msgstr "Rust 桥接" #: src/SUMMARY.md:227 src/android/interoperability/cpp/generated-cpp.md:1 +#, fuzzy msgid "Generated C++" -msgstr "" +msgstr "生成的 C++" #: src/SUMMARY.md:228 +#, fuzzy msgid "C++ Bridge" -msgstr "" +msgstr "C++ 桥接" #: src/SUMMARY.md:229 src/android/interoperability/cpp/shared-types.md:1 #, fuzzy msgid "Shared Types" -msgstr "标量类型" +msgstr "共享类型" #: src/SUMMARY.md:230 src/android/interoperability/cpp/shared-enums.md:1 +#, fuzzy msgid "Shared Enums" -msgstr "" +msgstr "共享枚举" #: src/SUMMARY.md:231 src/android/interoperability/cpp/rust-result.md:1 #, fuzzy @@ -778,19 +795,22 @@ msgstr "错误处理" #: src/SUMMARY.md:233 src/android/interoperability/cpp/type-mapping.md:1 msgid "Additional Types" -msgstr "" +msgstr "其他类型" #: src/SUMMARY.md:234 +#, fuzzy msgid "Building for Android: C++" -msgstr "" +msgstr "针对 Android 进行构建:C++" #: src/SUMMARY.md:235 +#, fuzzy msgid "Building for Android: Genrules" -msgstr "" +msgstr "针对 Android 进行构建:Genrule" #: src/SUMMARY.md:236 +#, fuzzy msgid "Building for Android: Rust" -msgstr "" +msgstr "针对 Android 进行构建:Rust" #: src/SUMMARY.md:237 msgid "With Java" @@ -806,16 +826,18 @@ msgid "Exercises" msgstr "习题" #: src/SUMMARY.md:240 +#, fuzzy msgid "Chromium" -msgstr "" +msgstr "Chromium" #: src/SUMMARY.md:246 src/chromium/cargo.md:1 +#, fuzzy msgid "Comparing Chromium and Cargo Ecosystems" -msgstr "" +msgstr "比较 Chromium 和 Cargo 生态系统" #: src/SUMMARY.md:247 msgid "Policy" -msgstr "" +msgstr "政策" #: src/SUMMARY.md:249 #, fuzzy @@ -823,18 +845,20 @@ msgid "Unsafe Code" msgstr "不安全 Rust" #: src/SUMMARY.md:250 src/chromium/build-rules/depending.md:1 +#, fuzzy msgid "Depending on Rust Code from Chromium C++" -msgstr "" +msgstr "根据 Chromium C++ 中的 Rust 代码" #: src/SUMMARY.md:251 src/chromium/build-rules/vscode.md:1 +#, fuzzy msgid "Visual Studio Code" -msgstr "" +msgstr "Visual Studio Code" #: src/SUMMARY.md:252 src/SUMMARY.md:257 src/SUMMARY.md:265 src/SUMMARY.md:278 #: src/exercises/chromium/third-party.md:1 #, fuzzy msgid "Exercise" -msgstr "习题" +msgstr "练习" #: src/SUMMARY.md:254 src/chromium/testing/rust-gtest-interop.md:1 msgid "`rust_gtest_interop` Library" @@ -862,7 +886,7 @@ msgstr "示例" #: src/SUMMARY.md:260 #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md:1 msgid "Limitations of CXX" -msgstr "" +msgstr "CXX 的局限性" #: src/SUMMARY.md:261 #: src/chromium/interoperability-with-cpp/error-handling.md:1 @@ -881,73 +905,86 @@ msgid "Error Handling: PNG Example" msgstr "错误处理" #: src/SUMMARY.md:264 +#, fuzzy msgid "Using CXX in Chromium" -msgstr "" +msgstr "在 Chromium 中使用 CXX" #: src/SUMMARY.md:266 src/chromium/adding-third-party-crates.md:1 +#, fuzzy msgid "Adding Third Party Crates" -msgstr "" +msgstr "添加第三方 crate" #: src/SUMMARY.md:267 msgid "Configuring Cargo.toml" -msgstr "" +msgstr "配置 Cargo.toml" #: src/SUMMARY.md:268 #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:1 +#, fuzzy msgid "Configuring `gnrt_config.toml`" -msgstr "" +msgstr "配置 gnrt_config.toml" #: src/SUMMARY.md:269 #: src/chromium/adding-third-party-crates/downloading-crates.md:1 +#, fuzzy msgid "Downloading Crates" -msgstr "" +msgstr "下载 crate" #: src/SUMMARY.md:270 #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:1 +#, fuzzy msgid "Generating `gn` Build Rules" -msgstr "" +msgstr "生成 gn 构建规则" #: src/SUMMARY.md:271 #: src/chromium/adding-third-party-crates/resolving-problems.md:1 +#, fuzzy msgid "Resolving Problems" -msgstr "" +msgstr "解决问题" #: src/SUMMARY.md:272 #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md:1 +#, fuzzy msgid "Build Scripts Which Generate Code" -msgstr "" +msgstr "用于生成代码的构建脚本" #: src/SUMMARY.md:273 #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md:1 +#, fuzzy msgid "Build Scripts Which Build C++ or Take Arbitrary Actions" -msgstr "" +msgstr "用于构建 C++ 或执行任意操作的构建脚本" #: src/SUMMARY.md:274 #: src/chromium/adding-third-party-crates/depending-on-a-crate.md:1 +#, fuzzy msgid "Depending on a Crate" -msgstr "" +msgstr "依赖于 crate" #: src/SUMMARY.md:275 +#, fuzzy msgid "Reviews and Audits" -msgstr "" +msgstr "审查和审核" #: src/SUMMARY.md:276 +#, fuzzy msgid "Checking into Chromium Source Code" -msgstr "" +msgstr "签入 Chromium 源代码" #: src/SUMMARY.md:277 #: src/chromium/adding-third-party-crates/keeping-up-to-date.md:1 +#, fuzzy msgid "Keeping Crates Up to Date" -msgstr "" +msgstr "始终使用最新版 crate" #: src/SUMMARY.md:279 +#, fuzzy msgid "Bringing It Together - Exercise" -msgstr "" +msgstr "综合应用练习" #: src/SUMMARY.md:280 src/exercises/chromium/solutions.md:1 #, fuzzy msgid "Exercise Solutions" -msgstr "解答" +msgstr "练习题解答" #: src/SUMMARY.md:282 msgid "Bare Metal: Morning" @@ -955,7 +992,7 @@ msgstr "裸金属:上午" #: src/SUMMARY.md:287 src/bare-metal/no_std.md:1 msgid "`no_std`" -msgstr "" +msgstr "`no_std`" #: src/SUMMARY.md:288 msgid "A Minimal Example" @@ -963,7 +1000,7 @@ msgstr "最小示例" #: src/SUMMARY.md:289 src/bare-metal/no_std.md:12 src/bare-metal/alloc.md:1 msgid "`alloc`" -msgstr "" +msgstr "`alloc`" #: src/SUMMARY.md:290 src/bare-metal/microcontrollers.md:1 msgid "Microcontrollers" @@ -991,7 +1028,7 @@ msgstr "类型状态模式" #: src/SUMMARY.md:296 src/bare-metal/microcontrollers/embedded-hal.md:1 msgid "`embedded-hal`" -msgstr "" +msgstr "`embedded-hal`" #: src/SUMMARY.md:297 src/bare-metal/microcontrollers/probe-rs.md:1 #, fuzzy @@ -1009,6 +1046,7 @@ msgstr "其他项目" #: src/SUMMARY.md:301 src/exercises/bare-metal/compass.md:1 #: src/exercises/bare-metal/solutions-morning.md:3 +#, fuzzy msgid "Compass" msgstr "罗盘" @@ -1070,23 +1108,24 @@ msgstr "异常" #: src/SUMMARY.md:322 src/bare-metal/useful-crates/zerocopy.md:1 msgid "`zerocopy`" -msgstr "" +msgstr "`zerocopy`" #: src/SUMMARY.md:323 src/bare-metal/useful-crates/aarch64-paging.md:1 +#, fuzzy msgid "`aarch64-paging`" -msgstr "" +msgstr "`aarch64-paging`" #: src/SUMMARY.md:324 src/bare-metal/useful-crates/buddy_system_allocator.md:1 msgid "`buddy_system_allocator`" -msgstr "" +msgstr "`buddy_system_allocator`" #: src/SUMMARY.md:325 src/bare-metal/useful-crates/tinyvec.md:1 msgid "`tinyvec`" -msgstr "" +msgstr "`tinyvec`" #: src/SUMMARY.md:326 src/bare-metal/useful-crates/spin.md:1 msgid "`spin`" -msgstr "" +msgstr "`spin`" #: src/SUMMARY.md:328 #, fuzzy @@ -1175,7 +1214,7 @@ msgstr "异步基础" #: src/SUMMARY.md:359 src/async/async-await.md:1 msgid "`async`/`await`" -msgstr "" +msgstr "`async`/`await`" #: src/SUMMARY.md:360 src/async/futures.md:1 msgid "Futures" @@ -1220,7 +1259,7 @@ msgstr "屏蔽执行器" #: src/SUMMARY.md:370 src/async/pitfalls/pin.md:1 msgid "`Pin`" -msgstr "" +msgstr "`Pin`" #: src/SUMMARY.md:371 src/async/pitfalls/async-traits.md:1 msgid "Async Traits" @@ -1335,8 +1374,9 @@ msgid "" "based browsers. This includes interoperability with C++ and how to include " "third-party crates in Chromium." msgstr "" -"[Android](android.md):为期半天的课程,介绍如何在 Android 平台开发中使用 Rust" -"(AOSP)。课程内容包括与 C、C++ 和 Java 的互操作性。" +"[Rust 在 Chromium 中的用法](../chromium.md) 深析是一个为期半天的课程,主要介" +"绍了如何在 Chromium 浏览器中使用 Rust。课程内容包括如何在 Chromium 的 `gn` 构" +"建系统中使用 Rust,引入第三方库 (\"crates\"),以及 C++ 的互操作性。" #: src/index.md:31 msgid "" @@ -1592,15 +1632,19 @@ msgstr "" #: src/running-the-course/course-structure.md:35 #, fuzzy msgid "Rust in Chromium" -msgstr "Android 中的 Rust" +msgstr "在 Chromium 中使用 CXX" #: src/running-the-course/course-structure.md:37 +#, fuzzy msgid "" "The [Rust in Chromium](../chromium.md) deep dive is a half-day course on " "using Rust as part of the Chromium browser. It includes using Rust in " "Chromium's `gn` build system, bringing in third-party libraries (\"crates\") " "and C++ interoperability." msgstr "" +"[Rust 在 Chromium 中的用法](../chromium.md) 深析是一个为期半天的课程,主要介" +"绍了如何在 Chromium 浏览器中使用 Rust。课程内容包括如何在 Chromium 的 `gn` 构" +"建系统中使用 Rust,引入第三方库 (\"crates\"),以及 C++ 的互操作性。" #: src/running-the-course/course-structure.md:42 msgid "" @@ -1608,6 +1652,9 @@ msgid "" "[recommended](../chromium/setup.md) for speed but any build will work. " "Ensure that you can run the Chromium browser that you've built." msgstr "" +"您需要具备构建 Chromium 的能力。为了提高速度,[建议使用] 调试组件 build (../" +"chromium/setup.md),但任何类型的 build 均可使用。请确保可以运行您所构建的 " +"Chromium 浏览器。" #: src/running-the-course/course-structure.md:46 msgid "Bare-Metal Rust" @@ -2069,7 +2116,7 @@ msgstr "本课程中的代码块是完全交互式的:" #: src/cargo/code-samples.md:15 src/cargo/running-locally.md:46 msgid "\"Edit me!\"" -msgstr "" +msgstr "\"Edit me!\"" #: src/cargo/code-samples.md:19 msgid "You can use " @@ -2215,11 +2262,11 @@ msgstr "类型推导" #: src/welcome-day-1.md:8 msgid "Control flow constructs: loops, conditionals, and so on." -msgstr "" +msgstr "控制流结构:循环、条件语句等。" #: src/welcome-day-1.md:9 msgid "User-defined types: structs and enums." -msgstr "" +msgstr "用户定义的类型:结构体和枚举。" #: src/welcome-day-1.md:10 msgid "Pattern matching: destructuring enums, structs, and arrays." @@ -2228,14 +2275,14 @@ msgstr "模式匹配:解构枚举、结构体和数组(array)。" #: src/welcome-day-1.md:12 src/welcome-day-2.md:12 src/welcome-day-3.md:9 #: src/welcome-day-4.md:11 msgid "Schedule" -msgstr "" +msgstr "时间表" #: src/welcome-day-1.md:14 src/welcome-day-1-afternoon.md:3 #: src/welcome-day-2.md:14 src/welcome-day-2-afternoon.md:3 #: src/welcome-day-3.md:11 src/welcome-day-3-afternoon.md:3 #: src/welcome-day-4.md:13 src/welcome-day-4-afternoon.md:3 msgid "{{%session outline}}" -msgstr "" +msgstr "{{%s课程大纲}}" #: src/welcome-day-1.md:18 msgid "Please remind the students that:" @@ -2284,6 +2331,8 @@ msgid "" "should have immediate parallels in other languages. The more advanced parts " "of Rust come on the subsequent days." msgstr "" +"第一天的目标是展示 Rust 中与其他编程语言有明显相似之处的 “基础”内容。Rust 中" +"更高级复杂的内容将在后续几天中逐步介绍。" #: src/welcome-day-1.md:35 msgid "" @@ -2293,6 +2342,9 @@ msgid "" "The times listed here are a suggestion in order to keep the course on " "schedule. Feel free to be flexible and adjust as necessary!" msgstr "" +"如果您是在教室里授课,则这是一个好时机,可对课程时间表进行讲解。请注意,每节" +"课结束之后会有练习内容,然后是休息时间。安排在休息结束后讲解练习内容的解答。" +"为了确保课程按时间表进行,此处所列时间仅供参考。请按需进行灵活调整!" #: src/hello-world.md:3 src/types-and-values.md:3 src/control-flow-basics.md:3 #: src/tuples-and-arrays.md:3 src/references.md:3 src/user-defined-types.md:3 @@ -2302,7 +2354,7 @@ msgstr "" #: src/iterators.md:3 src/modules.md:3 src/testing.md:3 src/error-handling.md:3 #: src/unsafe-rust.md:3 msgid "{{%segment outline}}" -msgstr "" +msgstr "{{%s小节大纲}}" #: src/hello-world/what-is-rust.md:3 msgid "" @@ -2392,8 +2444,9 @@ msgid "" msgstr "让我们进入最简单的 Rust 程序,一个经典的 Hello World 程序:" #: src/hello-world/hello-world.md:8 +#, fuzzy msgid "\"Hello 🌍!\"" -msgstr "" +msgstr "\"Hello 🌍!\"" #: src/hello-world/hello-world.md:12 msgid "What you see:" @@ -2481,7 +2534,7 @@ msgstr "Rust 有一些独特的卖点:" msgid "" "_Compile time memory safety_ - whole classes of memory bugs are prevented at " "compile time" -msgstr "" +msgstr "_编译时内存安全_:在编译时可防止所有类内存 bug" #: src/hello-world/benefits.md:7 msgid "No uninitialized variables." @@ -2515,7 +2568,7 @@ msgstr "不存在迭代器失效。" msgid "" "_No undefined runtime behavior_ - what a Rust statement does is never left " "unspecified" -msgstr "" +msgstr "_没有未定义的运行时行为_:每个 Rust 语句的行为都有明确定义" #: src/hello-world/benefits.md:17 msgid "Array access is bounds checked." @@ -2529,7 +2582,7 @@ msgstr "整数溢出有明确定义(panic 或回绕)。" msgid "" "_Modern language features_ - as expressive and ergonomic as higher-level " "languages" -msgstr "" +msgstr "_现代语言功能_:具有与高级语言一样丰富且人性化的表达能力" #: src/hello-world/benefits.md:22 msgid "Enums and pattern matching." @@ -2567,7 +2620,7 @@ msgstr "优秀的语言服务协议(Language Server Protocol)支持。" msgid "" "Do not spend much time here. All of these points will be covered in more " "depth later." -msgstr "" +msgstr "不用在这里占用过多时间。所有这些要点均会在后面进行详细讲解。" #: src/hello-world/benefits.md:36 msgid "" @@ -2598,18 +2651,22 @@ msgstr "" "预测的执行性能(无垃圾回收机制),以及在需要时对底层硬件的访问。" #: src/hello-world/playground.md:3 +#, fuzzy msgid "" "The [Rust Playground](https://play.rust-lang.org/) provides an easy way to " "run short Rust programs, and is the basis for the examples and exercises in " "this course. Try running the \"hello-world\" program it starts with. It " "comes with a few handy features:" msgstr "" +"[Rust Playground](https://play.rust-lang.org/) 提供了一种运行简短 Rust 程序的" +"简便方法,也是本课程所有示例和练习的依据所在。请尝试运行它初始提供的 \"hello-" +"world\" 程序。该程序提供了一些便捷功能:" #: src/hello-world/playground.md:8 msgid "" "Under \"Tools\", use the `rustfmt` option to format your code in the " "\"standard\" way." -msgstr "" +msgstr "在 \"Tools\" 下,使用 `rustfmt` 选项以 \"standard\" 方式设置代码格式。" #: src/hello-world/playground.md:11 msgid "" @@ -2617,14 +2674,18 @@ msgid "" "checks, less optimization) and Release (fewer runtime checks, lots of " "optimization). These are accessible under \"Debug\" at the top." msgstr "" +"Rust 具有两个用于生成代码的主要 “配置文件”:调试(进行额外运行时检查、较少优" +"化)和发布(较少运行时检查,进行大量优化)。可以在顶部的 \"Debug\" 下访问这些" +"内容。" #: src/hello-world/playground.md:15 msgid "" "If you're interested, use \"ASM\" under \"...\" to see the generated " "assembly code." -msgstr "" +msgstr "如果感兴趣,您可以使用 \"...\" 下的 \"ASM\" 查看生成的汇编代码。" #: src/hello-world/playground.md:20 +#, fuzzy msgid "" "As students head into the break, encourage them to open up the playground " "and experiment a little. Encourage them to keep the tab open and try things " @@ -2632,6 +2693,9 @@ msgid "" "students who want to know more about Rust's optimizations or generated " "assembly." msgstr "" +"当学生开始休息时,鼓励他们打开 Playground 并进行一些实验。鼓励他们让该标签页" +"保持打开状态,并在课余时间里进行一些尝试。对于具有较高水平并且希望深入了解 " +"Rust 优化技巧或生成的汇编代码的学生,这尤其有益。" #: src/types-and-values/variables.md:3 #, fuzzy @@ -2644,19 +2708,23 @@ msgstr "Rust 通过静态类型实现了类型安全。变量绑定默认是不 #: src/control-flow-basics/break-continue.md:34 #: src/control-flow-basics/blocks-and-scopes.md:16 msgid "\"x: {x}\"" -msgstr "" +msgstr "\"x: {x}\"" #: src/types-and-values/variables.md:10 msgid "" "// x = 20;\n" " // println!(\"x: {x}\");\n" msgstr "" +"// x = 20;\n" +" // println!(\"x: {x}\");\n" #: src/types-and-values/variables.md:17 msgid "" "Uncomment the `x = 20` to demonstrate that variables are immutable by " "default. Add the `mut` keyword to allow changes." msgstr "" +"取消备注 `x = 20`,以证明变量默认是不可变的。添加 `mut` 关键字以允许进行更" +"改。" #: src/types-and-values/variables.md:20 msgid "" @@ -2664,12 +2732,14 @@ msgid "" "time, but type inference (covered later) allows the programmer to omit it in " "many cases." msgstr "" +"这里的 `i32` 是变量的类型。编译时必须已知类型,但在很多情况下,由于具有类型推" +"理功能(稍后介绍),程序员可以忽略这一点。" #: src/types-and-values/values.md:3 msgid "" "Here are some basic built-in types, and the syntax for literal values of " "each type." -msgstr "" +msgstr "以下是一些基本的内置类型以及每种类型的字面量值的语法。" #: src/types-and-values/values.md:6 #: src/tuples-and-arrays/tuples-and-arrays.md:7 src/unsafe-rust/exercise.md:16 @@ -2776,7 +2846,7 @@ msgstr "" #: src/types-and-values/arithmetic.md:9 msgid "\"result: {}\"" -msgstr "" +msgstr "\"result: {}\"" #: src/types-and-values/arithmetic.md:15 msgid "" @@ -2784,10 +2854,12 @@ msgid "" "meaning should be clear: it takes three integers, and returns an integer. " "Functions will be covered in more detail later." msgstr "" +"这是我们第一次看到除 `main` 之外的函数,不过其含义应该很明确:它接受三个整" +"数,然后返回一个整数。稍后会对这些函数进行详细介绍。" #: src/types-and-values/arithmetic.md:19 msgid "Arithmetic is very similar to other languages, with similar precedence." -msgstr "" +msgstr "算术和优先级均与其他语言极为相似。" #: src/types-and-values/arithmetic.md:21 msgid "" @@ -2795,8 +2867,11 @@ msgid "" "actually undefined, and might do different things on different platforms or " "compilers. In Rust, it's defined." msgstr "" +"整数溢出是什么样的?在 C 和 C++ 中,_有符号_ 整数溢出实际上是未定义的,可能会" +"在不同平台或编译器上执行不同的操作。在 Rust 中,整数溢出具有明确定义。" #: src/types-and-values/arithmetic.md:25 +#, fuzzy msgid "" "Change the `i32`'s to `i16` to see an integer overflow, which panics " "(checked) in a debug build and wraps in a release build. There are other " @@ -2804,18 +2879,26 @@ msgid "" "with method syntax, e.g., `(a * b).saturating_add(b * c).saturating_add(c * " "a)`." msgstr "" +"将 `i32` 更改为 `i16` 即可看到整数溢出,在调试 build 中,这会触发 panic(已检" +"查),而在发布 build 中,则会发生封装。还有其他选项,例如溢出、饱和和进位等。" +"可以通过方法语法访问这些选项,例如`(a * b).saturating_add(b * c)." +"saturating_add(c * a)`。" #: src/types-and-values/arithmetic.md:30 msgid "" "In fact, the compiler will detect overflow of constant expressions, which is " "why the example requires a separate function." msgstr "" +"事实上,编译器会检测常量表达式的溢出情况,这便是为何该示例需要单独的函数。" #: src/types-and-values/strings.md:3 +#, fuzzy msgid "" "Rust has two types to represent strings, both of which will be covered in " "more depth later. Both _always_ store UTF-8 encoded strings." msgstr "" +"Rust 有两种用于表示字符串的类型,稍后会对它们进行更详细的介绍。两种类型都 _始" +"终_ 存储UTF-8 编码的字符串。" #: src/types-and-values/strings.md:6 #, fuzzy @@ -2824,47 +2907,51 @@ msgstr "`String` 是一个可变字符串缓冲区。" #: src/types-and-values/strings.md:7 msgid "`&str` - a read-only string. String literals have this type." -msgstr "" +msgstr "`&str` 为只读字符串。字符串字面量属于此类型。" #: src/types-and-values/strings.md:11 msgid "\"Greetings\"" -msgstr "" +msgstr "\"Greetings\"" #: src/types-and-values/strings.md:12 msgid "\"🪐\"" -msgstr "" +msgstr "\"🪐\"" #: src/types-and-values/strings.md:15 msgid "\", \"" -msgstr "" +msgstr "\", \"" #: src/types-and-values/strings.md:17 msgid "\"final sentence: {}\"" -msgstr "" +msgstr "\"final sentence: {}\"" #: src/types-and-values/strings.md:18 src/async/control-flow/join.md:30 msgid "\"{:?}\"" -msgstr "" +msgstr "\"{:?}\"" #: src/types-and-values/strings.md:19 msgid "//println!(\"{:?}\", &sentence[12..13]);\n" -msgstr "" +msgstr "//println!(\"{:?}\", &sentence[12..13]);\n" #: src/types-and-values/strings.md:25 msgid "" "This slide introduces strings. Everything here will be covered in more depth " "later, but this is enough for subsequent slides and exercises to use strings." msgstr "" +"此幻灯片介绍了字符串。此处所有内容均会在稍后进行更详细的介绍,但对于后续幻灯" +"片和练习而言,当前介绍足以支撑使用字符串了。" #: src/types-and-values/strings.md:28 msgid "Invalid UTF-8 in a string is UB, and this not allowed in safe Rust." -msgstr "" +msgstr "字符串中的无效 UTF-8 是未定义行为 (UB),这在安全的 Rust 中是不允许的。" #: src/types-and-values/strings.md:30 msgid "" "`String` is a user-defined type with a constructor (`::new()`) and methods " "like `s.push_str(..)`." msgstr "" +"`String` 是一种用户定义的类型,具有构造函数 (`::new()`) 和类似 `s." +"push_str(..)` 的方法。" #: src/types-and-values/strings.md:33 msgid "" @@ -2872,6 +2959,8 @@ msgid "" "references later, so for now just think of `&str` as a unit meaning \"a read-" "only string\"." msgstr "" +"`&str` 中的 `&` 表示这是一个引用。我们稍后将介绍引用,现在只需将 `&str` 视为" +"一个单位,表示 “只读字符”。" #: src/types-and-values/strings.md:36 msgid "" @@ -2879,6 +2968,8 @@ msgid "" "`12..13` does not end on a character boundary, so the program panics. Adjust " "it to a range that does, based on the error message." msgstr "" +"注释掉的行会按字节位置编入字符串的索引。`12..13` 不是以字符边界结尾,因此会导" +"致程序 panic。根据错误消息,将其调整至以字符边界结尾的范围。" #: src/types-and-values/strings.md:40 msgid "" @@ -2917,27 +3008,33 @@ msgid "" "`i32`. This sometimes appears as `{integer}` in error messages. Similarly, " "floating-point literals default to `f64`." msgstr "" +"当整数字面量的类型不受限制时,Rust 默认为 `i32`。这在错误消息中有时显示为 " +"`{integer}`。同样,浮点字面量默认为 `f64`。" #: src/types-and-values/inference.md:45 msgid "// ERROR: no implementation for `{float} == {integer}`\n" -msgstr "" +msgstr "// ERROR: no implementation for `{float} == {integer}`\n" #: src/types-and-values/exercise.md:3 +#, fuzzy msgid "" "The first and second Fibonacci numbers are both `1`. For n>2, the n'th " "Fibonacci number is calculated recursively as the sum of the n-1'th and " "n-2'th Fibonacci numbers." msgstr "" +"第一个和第二个斐波那契数都是 `1`。如果 n>2,则第 n 个斐波那契数以递归方式计算" +"为第 n-1 个和第 n-2 个斐波那契数之和。" #: src/types-and-values/exercise.md:7 +#, fuzzy msgid "" "Write a function `fib(n)` that calculates the n'th Fibonacci number. When " "will this function panic?" -msgstr "" +msgstr "编写一个函数 `fib(n)`,用于计算第 n 个斐波那契数。何时该函数会 panic?" #: src/types-and-values/exercise.md:13 msgid "// The base case.\n" -msgstr "" +msgstr "// The base case.\n" #: src/types-and-values/exercise.md:14 src/types-and-values/exercise.md:17 #: src/control-flow-basics/exercise.md:27 @@ -2948,11 +3045,11 @@ msgstr "实现" #: src/types-and-values/exercise.md:16 msgid "// The recursive case.\n" -msgstr "" +msgstr "// The recursive case.\n" #: src/types-and-values/exercise.md:23 src/types-and-values/solution.md:14 msgid "\"fib(n) = {}\"" -msgstr "" +msgstr "\"fib(n) = {}\"" #: src/control-flow-basics/conditionals.md:3 msgid "Much of the Rust syntax will be familiar to you from C, C++ or Java:" @@ -2992,15 +3089,15 @@ msgstr "" #: src/control-flow-basics/conditionals.md:21 #: src/control-flow-basics/conditionals.md:36 msgid "\"small\"" -msgstr "" +msgstr "\"small\"" #: src/control-flow-basics/conditionals.md:23 msgid "\"biggish\"" -msgstr "" +msgstr "\"biggish\"" #: src/control-flow-basics/conditionals.md:25 msgid "\"huge\"" -msgstr "" +msgstr "\"huge\"" #: src/control-flow-basics/conditionals.md:30 msgid "" @@ -3012,11 +3109,11 @@ msgstr "" #: src/control-flow-basics/conditionals.md:36 msgid "\"large\"" -msgstr "" +msgstr "\"large\"" #: src/control-flow-basics/conditionals.md:37 msgid "\"number size: {}\"" -msgstr "" +msgstr "\"number size: {}\"" #: src/control-flow-basics/conditionals.md:43 #, fuzzy @@ -3034,10 +3131,12 @@ msgid "" "separate it from the next statement. Remove the `;` before `println!` to see " "the compiler error." msgstr "" +"如果在表达式中使用 `if`,则表达式中必须包含 `;` 来将其与下一个语句分隔开。移" +"除 `println!` 前面的 `;` 即可查看编译器错误。" #: src/control-flow-basics/loops.md:3 msgid "There are three looping keywords in Rust: `while`, `loop`, and `for`:" -msgstr "" +msgstr "Rust 中有三个循环关键字:`while`、`loop` 和 `for`:" #: src/control-flow-basics/loops.md:5 #, fuzzy @@ -3056,7 +3155,7 @@ msgstr "" #: src/control-flow-basics/loops.md:18 msgid "\"Final x: {x}\"" -msgstr "" +msgstr "\"Final x: {x}\"" #: src/control-flow-basics/loops.md:22 #, fuzzy @@ -3074,7 +3173,7 @@ msgstr "" #: src/control-flow-basics/loops.md:35 msgid "`loop`" -msgstr "" +msgstr "`loop`" #: src/control-flow-basics/loops.md:37 #, fuzzy @@ -3087,18 +3186,20 @@ msgstr "" #: src/control-flow-basics/loops.md:45 msgid "\"{i}\"" -msgstr "" +msgstr "\"{i}\"" #: src/control-flow-basics/loops.md:55 msgid "" "We will discuss iteration later; for now, just stick to range expressions." -msgstr "" +msgstr "我们稍后会讨论迭代;暂时只使用范围表达式。" #: src/control-flow-basics/loops.md:56 msgid "" "Note that the `for` loop only iterates to `4`. Show the `1..=5` syntax for " "an inclusive range." msgstr "" +"请注意,`for` 循环只迭代到 `4`。现在展示使用 `1..=5` 语法表示一个包含边界的范" +"围。" #: src/control-flow-basics/break-continue.md:3 #, fuzzy @@ -3121,7 +3222,7 @@ msgstr "" #: src/control-flow-basics/break-continue.md:24 msgid "\"{result}\"" -msgstr "" +msgstr "\"{result}\"" #: src/control-flow-basics/break-continue.md:28 msgid "" @@ -3131,7 +3232,7 @@ msgstr "`continue` 和 `break` 都可以选择接受一个标签参数,用来 #: src/control-flow-basics/break-continue.md:37 msgid "\"x: {x}, i: {i}\"" -msgstr "" +msgstr "\"x: {x}, i: {i}\"" #: src/control-flow-basics/break-continue.md:47 msgid "" @@ -3160,7 +3261,7 @@ msgstr "Rust 中的块包含值和类型:值是 块的最后一个表达式: #: src/control-flow-basics/blocks-and-scopes.md:13 msgid "\"y: {y}\"" -msgstr "" +msgstr "\"y: {y}\"" #: src/control-flow-basics/blocks-and-scopes.md:20 #, fuzzy @@ -3175,7 +3276,7 @@ msgstr "作用域和遮蔽(Shadowing)" #: src/control-flow-basics/blocks-and-scopes.md:24 msgid "A variable's scope is limited to the enclosing block." -msgstr "" +msgstr "变量的作用域仅限于封闭代码块内。" #: src/control-flow-basics/blocks-and-scopes.md:26 msgid "" @@ -3185,25 +3286,26 @@ msgstr "你可以隐藏变量,位于外部作用域的变量和 相同作用 #: src/control-flow-basics/blocks-and-scopes.md:32 msgid "\"before: {a}\"" -msgstr "" +msgstr "\"before: {a}\"" #: src/control-flow-basics/blocks-and-scopes.md:34 #: src/std-traits/from-and-into.md:7 src/std-traits/from-and-into.md:19 #: src/slices-and-lifetimes/solution.md:225 +#, fuzzy msgid "\"hello\"" -msgstr "" +msgstr "\"hello\"" #: src/control-flow-basics/blocks-and-scopes.md:35 msgid "\"inner scope: {a}\"" -msgstr "" +msgstr "\"inner scope: {a}\"" #: src/control-flow-basics/blocks-and-scopes.md:38 msgid "\"shadowed in inner scope: {a}\"" -msgstr "" +msgstr "\"shadowed in inner scope: {a}\"" #: src/control-flow-basics/blocks-and-scopes.md:41 msgid "\"after: {a}\"" -msgstr "" +msgstr "\"after: {a}\"" #: src/control-flow-basics/blocks-and-scopes.md:47 msgid "" @@ -3214,10 +3316,13 @@ msgstr "" "`return`。" #: src/control-flow-basics/blocks-and-scopes.md:49 +#, fuzzy msgid "" "Show that a variable's scope is limited by adding a `b` in the inner block " "in the last example, and then trying to access it outside that block." msgstr "" +"通过在上一个示例的内部代码块中添加 `b`,并尝试在该代码块之外访问它,表明变量" +"的作用域是受限的。" #: src/control-flow-basics/blocks-and-scopes.md:51 #, fuzzy @@ -3276,7 +3381,7 @@ msgstr "每一个函数都只有一种实现:" msgid "" "Always takes a fixed number of parameters. Default arguments are not " "supported. Macros can be used to support variadic functions." -msgstr "" +msgstr "始终采用固定数量的参数。不支持默认参数。宏可用于支持可变函数。" #: src/control-flow-basics/functions.md:32 #, fuzzy @@ -3291,6 +3396,8 @@ msgid "" "variable number of arguments. They are distinguished by a `!` at the end. " "The Rust standard library includes an assortment of useful macros." msgstr "" +"宏在编译过程中会扩展为 Rust 代码,并且可以接受可变数量的参数。它们以 `!` 结尾" +"来进行区分。Rust 标准库包含各种有用的宏。" #: src/control-flow-basics/macros.md:7 #, fuzzy @@ -3306,26 +3413,28 @@ msgid "" "`format!(format, ..)` works just like `println!` but returns the result as a " "string." msgstr "" +"`format!(format, ..)` 的用法与 `println!` 类似,但它以字符串形式返回结果。" #: src/control-flow-basics/macros.md:11 msgid "`dbg!(expression)` logs the value of the expression and returns it." -msgstr "" +msgstr "`dbg!(expression)` 会记录表达式的值并返回该值。" #: src/control-flow-basics/macros.md:12 msgid "" "`todo!()` marks a bit of code as not-yet-implemented. If executed, it will " "panic." -msgstr "" +msgstr "`todo!()` 用于标记尚未实现的代码段。如果执行该代码段,则会触发 panic。" #: src/control-flow-basics/macros.md:14 msgid "" "`unreachable!()` marks a bit of code as unreachable. If executed, it will " "panic." msgstr "" +"`unreachable!()` 用于标记无法访问的代码段。如果执行该代码段,则会触发 panic。" #: src/control-flow-basics/macros.md:32 msgid "\"{n}! = {}\"" -msgstr "" +msgstr "\"{n}! = {}\"" #: src/control-flow-basics/macros.md:38 msgid "" @@ -3333,185 +3442,199 @@ msgid "" "how to use them. Why they are defined as macros, and what they expand to, is " "not especially critical." msgstr "" +"这一节的要点是介绍这些常见的便捷功能以及如何使用它们。而为何将它们定义为宏以" +"及它们可以扩展为什么内容,并不是特别关键。" #: src/control-flow-basics/macros.md:42 msgid "" "The course does not cover defining macros, but a later section will describe " "use of derive macros." -msgstr "" +msgstr "本课程不会介绍如何定义宏,但在后续部分会介绍派生宏的用法。" #: src/control-flow-basics/exercise.md:3 msgid "" "The [Collatz Sequence](https://en.wikipedia.org/wiki/Collatz_conjecture) is " "defined as follows, for an arbitrary n" msgstr "" +"[考拉兹序列](https://en.wikipedia.org/wiki/Collatz_conjecture) 的定义如下,其" +"中任意 n" #: src/control-flow-basics/exercise.md:4 src/control-flow-basics/exercise.md:10 msgid "1" -msgstr "" +msgstr "1" #: src/control-flow-basics/exercise.md:4 msgid " greater than zero:" -msgstr "" +msgstr " 大于零:" #: src/control-flow-basics/exercise.md:6 src/control-flow-basics/exercise.md:7 #: src/control-flow-basics/exercise.md:8 msgid "If _n" -msgstr "" +msgstr "如果 _n" #: src/control-flow-basics/exercise.md:6 src/control-flow-basics/exercise.md:7 #: src/control-flow-basics/exercise.md:8 msgid "i" -msgstr "" +msgstr "i" #: src/control-flow-basics/exercise.md:6 msgid "_ is 1, then the sequence terminates at _n" -msgstr "" +msgstr "_ 为 1,则序列在 _n 处终止" #: src/control-flow-basics/exercise.md:6 msgid "_." -msgstr "" +msgstr "_." #: src/control-flow-basics/exercise.md:7 msgid "_ is even, then _n" -msgstr "" +msgstr "_ 为偶数,则 _n" #: src/control-flow-basics/exercise.md:7 src/control-flow-basics/exercise.md:8 msgid "i+1" -msgstr "" +msgstr "i+1" #: src/control-flow-basics/exercise.md:7 msgid " = n" -msgstr "" +msgstr " = n" #: src/control-flow-basics/exercise.md:7 msgid " / 2_." -msgstr "" +msgstr " / 2_。" #: src/control-flow-basics/exercise.md:8 msgid "_ is odd, then _n" -msgstr "" +msgstr "_ 为奇数,则 _n" #: src/control-flow-basics/exercise.md:8 msgid " = 3 * n" -msgstr "" +msgstr " = 3 * n" #: src/control-flow-basics/exercise.md:8 msgid " + 1_." -msgstr "" +msgstr " + 1_。" #: src/control-flow-basics/exercise.md:10 msgid "For example, beginning with _n" -msgstr "" +msgstr "例如,以 _n" #: src/control-flow-basics/exercise.md:10 msgid "_ = 3:" -msgstr "" +msgstr "_ = 3 开头:" #: src/control-flow-basics/exercise.md:12 +#, fuzzy msgid "3 is odd, so _n" -msgstr "" +msgstr "3 是奇数,因此 _n" #: src/control-flow-basics/exercise.md:12 msgid "2" -msgstr "" +msgstr "2" #: src/control-flow-basics/exercise.md:12 msgid "_ = 3 * 3 + 1 = 10;" -msgstr "" +msgstr "_ = 3 * 3 + 1 = 10;" #: src/control-flow-basics/exercise.md:13 +#, fuzzy msgid "10 is even, so _n" -msgstr "" +msgstr "10 是偶数,因此 _n" #: src/control-flow-basics/exercise.md:13 src/bare-metal/aps/better-uart.md:22 msgid "3" -msgstr "" +msgstr "3" #: src/control-flow-basics/exercise.md:13 msgid "_ = 10 / 2 = 5;" -msgstr "" +msgstr "_ = 10 / 2 = 5;" #: src/control-flow-basics/exercise.md:14 +#, fuzzy msgid "5 is odd, so _n" -msgstr "" +msgstr "5 是奇数,因此 _n" #: src/control-flow-basics/exercise.md:14 src/bare-metal/aps/better-uart.md:10 msgid "4" -msgstr "" +msgstr "4" #: src/control-flow-basics/exercise.md:14 msgid "_ = 3 * 15 + 1 = 16;" -msgstr "" +msgstr "_ = 3 * 15 + 1 = 16;" #: src/control-flow-basics/exercise.md:15 +#, fuzzy msgid "16 is even, so _n" -msgstr "" +msgstr "16 是偶数,因此 _n" #: src/control-flow-basics/exercise.md:15 msgid "5" -msgstr "" +msgstr "5" #: src/control-flow-basics/exercise.md:15 +#, fuzzy msgid "_ = 16 / 2 = 8;" -msgstr "" +msgstr "_ = 16 / 2 = 8;" #: src/control-flow-basics/exercise.md:16 +#, fuzzy msgid "8 is even, so _n" -msgstr "" +msgstr "8 是偶数,因此 _n" #: src/control-flow-basics/exercise.md:16 src/bare-metal/aps/better-uart.md:14 #: src/bare-metal/aps/better-uart.md:17 msgid "6" -msgstr "" +msgstr "6" #: src/control-flow-basics/exercise.md:16 +#, fuzzy msgid "_ = 8 / 2 = 4;" -msgstr "" +msgstr "_ = 8 / 2 = 4;" #: src/control-flow-basics/exercise.md:17 +#, fuzzy msgid "4 is even, so _n" -msgstr "" +msgstr "4 是偶数,因此 _n" #: src/control-flow-basics/exercise.md:17 msgid "7" -msgstr "" +msgstr "7" #: src/control-flow-basics/exercise.md:17 +#, fuzzy msgid "_ = 4 / 2 = 2;" -msgstr "" +msgstr "_ = 4 / 2 = 2;" #: src/control-flow-basics/exercise.md:18 +#, fuzzy msgid "2 is even, so _n" -msgstr "" +msgstr "2 是偶数,因此 _n" #: src/control-flow-basics/exercise.md:18 src/bare-metal/aps/better-uart.md:12 #: src/bare-metal/aps/better-uart.md:15 msgid "8" -msgstr "" +msgstr "8" #: src/control-flow-basics/exercise.md:18 msgid "_ = 1; and" -msgstr "" +msgstr "_ = 1;并且" #: src/control-flow-basics/exercise.md:19 msgid "the sequence terminates." -msgstr "" +msgstr "序列终止。" #: src/control-flow-basics/exercise.md:21 msgid "" "Write a function to calculate the length of the collatz sequence for a given " "initial `n`." -msgstr "" +msgstr "编写一个函数,用于计算给定初始 `n` 的考拉兹序列的长度。" #: src/control-flow-basics/exercise.md:25 src/control-flow-basics/solution.md:4 msgid "/// Determine the length of the collatz sequence beginning at `n`.\n" -msgstr "" +msgstr "/// Determine the length of the collatz sequence beginning at `n`.\n" #: src/control-flow-basics/solution.md:20 src/concurrency/scoped-threads.md:11 #: src/concurrency/scoped-threads.md:30 msgid "\"Length: {}\"" -msgstr "" +msgstr "\"Length: {}\"" #: src/welcome-day-1-afternoon.md:1 src/welcome-day-2-afternoon.md:1 #: src/welcome-day-3-afternoon.md:1 src/welcome-day-4-afternoon.md:1 @@ -3525,6 +3648,8 @@ msgid "" "elements of an array have the same type, while tuples can accommodate " "different types. Both types have a size fixed at compile time." msgstr "" +"元组和数组是我们见过的第一个 “复合”类型。数组的所有元素具有相同的类型,而元组" +"可以适应不同的类型。这两种类型的大小在编译时是固定的。" #: src/tuples-and-arrays/tuples-and-arrays.md:9 #: src/tuples-and-arrays/destructuring.md:27 @@ -3583,6 +3708,8 @@ msgid "" "runtime. Rust can usually optimize these checks away, and they can be " "avoided using unsafe Rust." msgstr "" +"请尝试访问出界数组元素。系统会在运行时检查数组访问。Rust 通常会通过优化消除这" +"些检查,以及使用不安全的 Rust 来避免这些检查。" #: src/tuples-and-arrays/tuples-and-arrays.md:52 msgid "We can use literals to assign values to arrays." @@ -3648,13 +3775,13 @@ msgstr "你可以将其理解为你可能在其他编程语言中比较熟悉的 #: src/tuples-and-arrays/iteration.md:3 msgid "The `for` statement supports iterating over arrays (but not tuples)." -msgstr "" +msgstr "`for` 语句支持对数组进行迭代(但不支持元组)。" #: src/tuples-and-arrays/iteration.md:18 msgid "" "This functionality uses the `IntoIterator` trait, but we haven't covered " "that yet." -msgstr "" +msgstr "此功能使用了 `IntoIterator` trait,但我们还没有讲到它。" #: src/tuples-and-arrays/iteration.md:21 msgid "" @@ -3662,6 +3789,9 @@ msgid "" "` macros. These are always checked while, debug-only variants like " "`debug_assert!` compile to nothing in release builds." msgstr "" +"这里新增了 `assert_ne!` 宏。此外,还有 `assert_eq!` 和 `assert!` 宏。系统始终" +"会对这些宏进行检查,而像 `debug_assert!` 这样的仅调试变体在发布 build 中不会" +"编译成任何代码。" #: src/tuples-and-arrays/match.md:3 #, fuzzy @@ -3678,63 +3808,64 @@ msgstr "模式(pattern)可以是简单的值,其用法类似于 C 与 C++ #: src/tuples-and-arrays/match.md:11 msgid "'x'" -msgstr "" +msgstr "'x'" #: src/tuples-and-arrays/match.md:13 msgid "'q'" -msgstr "" +msgstr "'q'" #: src/tuples-and-arrays/match.md:13 +#, fuzzy msgid "\"Quitting\"" -msgstr "" +msgstr "\"Quitting\"" #: src/tuples-and-arrays/match.md:14 src/std-traits/solution.md:16 #: src/error-handling/exercise.md:62 src/error-handling/exercise.md:64 #: src/error-handling/solution.md:62 src/error-handling/solution.md:64 msgid "'a'" -msgstr "" +msgstr "'a'" #: src/tuples-and-arrays/match.md:14 msgid "'s'" -msgstr "" +msgstr "'s'" #: src/tuples-and-arrays/match.md:14 msgid "'w'" -msgstr "" +msgstr "'w'" #: src/tuples-and-arrays/match.md:14 msgid "'d'" -msgstr "" +msgstr "'d'" #: src/tuples-and-arrays/match.md:14 msgid "\"Moving around\"" -msgstr "" +msgstr "\"Moving around\"" #: src/tuples-and-arrays/match.md:15 src/error-handling/exercise.md:54 #: src/error-handling/exercise.md:56 src/error-handling/exercise.md:64 #: src/error-handling/solution.md:54 src/error-handling/solution.md:56 #: src/error-handling/solution.md:64 msgid "'0'" -msgstr "" +msgstr "'0'" #: src/tuples-and-arrays/match.md:15 src/error-handling/exercise.md:54 #: src/error-handling/exercise.md:56 src/error-handling/exercise.md:64 #: src/error-handling/solution.md:54 src/error-handling/solution.md:56 #: src/error-handling/solution.md:64 msgid "'9'" -msgstr "" +msgstr "'9'" #: src/tuples-and-arrays/match.md:15 msgid "\"Number input\"" -msgstr "" +msgstr "\"Number input\"" #: src/tuples-and-arrays/match.md:16 msgid "\"Lowercase: {key}\"" -msgstr "" +msgstr "\"Lowercase: {key}\"" #: src/tuples-and-arrays/match.md:17 msgid "\"Something else\"" -msgstr "" +msgstr "\"Something else\"" #: src/tuples-and-arrays/match.md:22 msgid "" @@ -3742,6 +3873,8 @@ msgid "" "expressions _must_ be irrefutable, meaning that it covers every possibility, " "so `_` is often used as the final catch-all case." msgstr "" +"`_` 模式是与任何值匹配的通配符模式。表达式 _必须_ 不可反驳,即其涵盖了所有可" +"能性,因此通常将 `_` 用作最终的万能符。" #: src/tuples-and-arrays/match.md:26 #, fuzzy @@ -3757,11 +3890,11 @@ msgstr "" msgid "" "A variable in the pattern (`key` in this example) will create a binding that " "can be used within the match arm." -msgstr "" +msgstr "模式中的变量(本例中为 `key`)将创建一个可在匹配分支内使用的绑定。" #: src/tuples-and-arrays/match.md:33 msgid "A match guard causes the arm to match only if the condition is true." -msgstr "" +msgstr "只有当条件为真时,保护语句才能使分支匹配成功。" #: src/tuples-and-arrays/match.md:37 src/user-defined-types/named-structs.md:34 #: src/user-defined-types/enums.md:28 src/methods-and-traits/methods.md:68 @@ -3832,6 +3965,8 @@ msgid "" "pattern that is matched up to the data structure, binding variables to " "subcomponents of the data structure." msgstr "" +"解构是一种从数据结构中提取数据的方法,具体方法是编写与数据结构匹配的模式,将" +"变量绑定到数据结构的子组件。" #: src/tuples-and-arrays/destructuring.md:7 #, fuzzy @@ -3840,39 +3975,39 @@ msgstr "你可以通过元素匹配来解构数组、元组和切片:" #: src/tuples-and-arrays/destructuring.md:18 msgid "\"on Y axis\"" -msgstr "" +msgstr "\"on Y axis\"" #: src/tuples-and-arrays/destructuring.md:19 msgid "\"on X axis\"" -msgstr "" +msgstr "\"on X axis\"" #: src/tuples-and-arrays/destructuring.md:20 msgid "\"left of Y axis\"" -msgstr "" +msgstr "\"left of Y axis\"" #: src/tuples-and-arrays/destructuring.md:21 msgid "\"below X axis\"" -msgstr "" +msgstr "\"below X axis\"" #: src/tuples-and-arrays/destructuring.md:22 msgid "\"first quadrant\"" -msgstr "" +msgstr "\"first quadrant\"" #: src/tuples-and-arrays/destructuring.md:33 msgid "\"Tell me about {triple:?}\"" -msgstr "" +msgstr "\"Tell me about {triple:?}\"" #: src/tuples-and-arrays/destructuring.md:35 msgid "\"First is 0, y = {y}, and z = {z}\"" -msgstr "" +msgstr "\"First is 0, y = {y}, and z = {z}\"" #: src/tuples-and-arrays/destructuring.md:36 msgid "\"First is 1 and the rest were ignored\"" -msgstr "" +msgstr "\"First is 1 and the rest were ignored\"" #: src/tuples-and-arrays/destructuring.md:37 msgid "\"All elements were ignored\"" -msgstr "" +msgstr "\"All elements were ignored\"" #: src/tuples-and-arrays/destructuring.md:44 #, fuzzy @@ -3895,7 +4030,7 @@ msgstr "展示使用模式 `[.., b]` 和 `[a@..,b]` 来匹配切片的尾部。" #: src/tuples-and-arrays/exercise.md:3 msgid "Arrays can contain other arrays:" -msgstr "" +msgstr "数组可以包含其他数组:" #: src/tuples-and-arrays/exercise.md:9 #, fuzzy @@ -3924,23 +4059,23 @@ msgstr "将下面的代码复制到 并实现上 #: src/tuples-and-arrays/exercise.md:28 src/methods-and-traits/exercise.md:20 #: src/borrowing/exercise.md:14 src/unsafe-rust/exercise.md:51 msgid "// TODO: remove this when you're done with your implementation.\n" -msgstr "" +msgstr "// TODO: remove this when you're done with your implementation.\n" #: src/tuples-and-arrays/exercise.md:37 src/tuples-and-arrays/solution.md:34 msgid "// <-- the comment makes rustfmt add a newline\n" -msgstr "" +msgstr "// <-- the comment makes rustfmt add a newline\n" #: src/tuples-and-arrays/exercise.md:42 src/tuples-and-arrays/solution.md:39 msgid "\"matrix: {:#?}\"" -msgstr "" +msgstr "\"matrix: {:#?}\"" #: src/tuples-and-arrays/exercise.md:44 src/tuples-and-arrays/solution.md:41 msgid "\"transposed: {:#?}\"" -msgstr "" +msgstr "\"transposed: {:#?}\"" #: src/tuples-and-arrays/solution.md:17 src/tuples-and-arrays/solution.md:25 msgid "//\n" -msgstr "" +msgstr "//\n" #: src/references/shared.md:3 msgid "" @@ -3948,6 +4083,8 @@ msgid "" "responsibility for the value, and is also called \"borrowing\". Shared " "references are read-only, and the referenced data cannot change." msgstr "" +"引用提供了一种可以访问另一个值但无需对该值负责的方式,也被称为 “借用”。共享引" +"用处于只读状态,且引用的数据无法更改。" #: src/references/shared.md:20 msgid "" @@ -3955,6 +4092,8 @@ msgid "" "with the `&` operator. The `*` operator \"dereferences\" a reference, " "yielding its value." msgstr "" +"对类型 `T` 的共享引用表示为 `&T`。可以使用 `&` 运算符创建引用值。`*` 运算符" +"会 “解引用”某个引用,并得到该引用值。" #: src/references/shared.md:24 msgid "Rust will statically forbid dangling references:" @@ -3967,6 +4106,9 @@ msgid "" "access the value, but is still \"owned\" by the original variable. The " "course will get into more detail on ownership in day 3." msgstr "" +"引用被称为 “借用”了其所引用的值,这对于不熟悉指针的学生来说是一个很好的模型:" +"代码可以通过引用来访问值,但原始变量仍然保有对该值的 “所有权”。本课程会在第 " +"3 天详细介绍所有权。" #: src/references/shared.md:42 msgid "" @@ -3976,12 +4118,15 @@ msgid "" "cover how Rust prevents the memory-safety bugs that come from using raw " "pointers." msgstr "" +"引用是以指针的形式实现的,其关键优势在于它们可以比其所指的内容小得多。熟悉 C " +"或 C++ 的学生会将引用视为指针。本课程的后续部分将介绍 Rust 如何防止因使用原始" +"指针而导致的内存安全 bug。" #: src/references/shared.md:47 msgid "" "Rust does not automatically create references for you - the `&` is always " "required." -msgstr "" +msgstr "Rust 不会自动为您创建引用,必须始终使用 `&` 符号。" #: src/references/shared.md:50 #, fuzzy @@ -4000,12 +4145,14 @@ msgid "" "different from C++, where assignment to a reference changes the referenced " "value." msgstr "" +"在本例中,`r` 是可变的,因此可以为其重新赋值 (`r = &b`)。请注意,这会重新绑" +"定 `r`,使其引用其他内容。这与 C++ 不同,在 C++ 中为引用赋值会更改引用的值。" #: src/references/shared.md:57 msgid "" "A shared reference does not allow modifying the value it refers to, even if " "that value was mutable. Try `*r = 'X'`." -msgstr "" +msgstr "共享引用不允许修改其所引用的值,即使该值是可变的。请尝试 `*r = 'X'`。" #: src/references/shared.md:60 msgid "" @@ -4014,6 +4161,9 @@ msgid "" "a reference to `point`, but `point` will be deallocated when the function " "returns, so this will not compile." msgstr "" +"Rust 会跟踪所有引用的生命周期,以确保它们存在足够长的时间。在安全的 Rust 中不" +"会出现悬空引用。`x_axis` 会返回对 `point` 的引用,但 `point` 会在该函数返回时" +"取消分配,因此不会进行编译。" #: src/references/shared.md:65 msgid "We will talk more about borrowing when we get to ownership." @@ -4024,6 +4174,7 @@ msgid "" "Exclusive references, also known as mutable references, allow changing the " "value they refer to. They have type `&mut T`." msgstr "" +"独占引用(也称为可变引用)允许更改其所引用的值。它们的类型为 `&mut T`。" #: src/references/exclusive.md:21 msgid "" @@ -4033,6 +4184,9 @@ msgid "" "exists. Try making an `&point.0` or changing `point.0` while `x_coord` is " "alive." msgstr "" +"“独占模式”表示只有此引用可用于访问该值。在独占引用存在期间,不允许同时存在其" +"他引用(无论是共享引用还是独占引用),并且无法访问引用的值。请尝试在 " +"`x_coord` 处于活动状态时创建 `&point.0` 或更改 `point.0`。" #: src/references/exclusive.md:26 #, fuzzy @@ -4052,6 +4206,8 @@ msgid "" "representing a point as `[f64;3]`. It is up to you to determine the function " "signatures." msgstr "" +"我们将为三维几何图形创建几个实用函数,将点表示为 `[f64;3]`。函数签名由您自行" +"确定。" #: src/references/exercise.md:7 msgid "" @@ -4061,38 +4217,47 @@ msgid "" "square\n" "// root, like `v.sqrt()`.\n" msgstr "" +"// Calculate the magnitude of a vector by summing the squares of its " +"coordinates\n" +"// and taking the square root. Use the `sqrt()` method to calculate the " +"square\n" +"// root, like `v.sqrt()`.\n" #: src/references/exercise.md:15 msgid "" "// Normalize a vector by calculating its magnitude and dividing all of its\n" "// coordinates by that magnitude.\n" msgstr "" +"// Normalize a vector by calculating its magnitude and dividing all of its\n" +"// coordinates by that magnitude.\n" #: src/references/exercise.md:23 msgid "// Use the following `main` to test your work.\n" -msgstr "" +msgstr "// Use the following `main` to test your work.\n" #: src/references/exercise.md:27 src/references/solution.md:22 msgid "\"Magnitude of a unit vector: {}\"" -msgstr "" +msgstr "\"Magnitude of a unit vector: {}\"" #: src/references/exercise.md:30 src/references/solution.md:25 msgid "\"Magnitude of {v:?}: {}\"" -msgstr "" +msgstr "\"Magnitude of {v:?}: {}\"" #: src/references/exercise.md:32 src/references/solution.md:27 msgid "\"Magnitude of {v:?} after normalization: {}\"" -msgstr "" +msgstr "\"Magnitude of {v:?} after normalization: {}\"" #: src/references/solution.md:4 msgid "/// Calculate the magnitude of the given vector.\n" -msgstr "" +msgstr "/// Calculate the magnitude of the given vector.\n" #: src/references/solution.md:12 msgid "" "/// Change the magnitude of the vector to 1.0 without changing its " "direction.\n" msgstr "" +"/// Change the magnitude of the vector to 1.0 without changing its " +"direction.\n" #: src/user-defined-types/named-structs.md:3 msgid "Like C and C++, Rust has support for custom structs:" @@ -4100,20 +4265,20 @@ msgstr "与 C 和 C++ 一样,Rust 支持自定义结构体:" #: src/user-defined-types/named-structs.md:12 msgid "\"{} is {} years old\"" -msgstr "" +msgstr "\"{} is {} years old\"" #: src/user-defined-types/named-structs.md:16 #: src/android/interoperability/with-c/bindgen.md:87 msgid "\"Peter\"" -msgstr "" +msgstr "\"Peter\"" #: src/user-defined-types/named-structs.md:22 msgid "\"Avery\"" -msgstr "" +msgstr "\"Avery\"" #: src/user-defined-types/named-structs.md:27 msgid "\"Jackie\"" -msgstr "" +msgstr "\"Jackie\"" #: src/user-defined-types/named-structs.md:36 msgid "Structs work like in C or C++." @@ -4173,7 +4338,7 @@ msgstr "如果字段名称不重要,您可以使用元组结构体:" #: src/user-defined-types/tuple-structs.md:14 msgid "\"({}, {})\"" -msgstr "" +msgstr "\"({}, {})\"" #: src/user-defined-types/tuple-structs.md:18 msgid "This is often used for single-field wrappers (called newtypes):" @@ -4181,14 +4346,14 @@ msgstr "这通常用于单字段封装容器(称为 newtype):" #: src/user-defined-types/tuple-structs.md:25 msgid "\"Ask a rocket scientist at NASA\"" -msgstr "" +msgstr "\"Ask a rocket scientist at NASA\"" #: src/user-defined-types/tuple-structs.md:29 #: src/android/interoperability/cpp/cpp-bridge.md:50 #: src/bare-metal/microcontrollers/type-state.md:14 #: src/async/pitfalls/cancellation.md:98 src/async/pitfalls/cancellation.md:101 msgid "// ...\n" -msgstr "" +msgstr "// ...\n" #: src/user-defined-types/tuple-structs.md:40 msgid "" @@ -4245,19 +4410,19 @@ msgstr "`enum` 关键字允许创建具有几个 不同变体的类型:" #: src/user-defined-types/enums.md:15 msgid "// Simple variant\n" -msgstr "" +msgstr "// Simple variant\n" #: src/user-defined-types/enums.md:16 msgid "// Tuple variant\n" -msgstr "" +msgstr "// Tuple variant\n" #: src/user-defined-types/enums.md:17 msgid "// Struct variant\n" -msgstr "" +msgstr "// Struct variant\n" #: src/user-defined-types/enums.md:22 msgid "\"On this turn: {:?}\"" -msgstr "" +msgstr "\"On this turn: {:?}\"" #: src/user-defined-types/enums.md:30 #, fuzzy @@ -4271,11 +4436,14 @@ msgid "" msgstr "" #: src/user-defined-types/enums.md:33 +#, fuzzy msgid "" "`PlayerMove` is a type with three variants. In addition to the payloads, " "Rust will store a discriminant so that it knows at runtime which variant is " "in a `PlayerMove` value." msgstr "" +"PlayerMove 会显示三种类型的变体。Rust 还会存储判别标识,以便在运行时确定值中" +"包含哪个变体。" #: src/user-defined-types/enums.md:36 #, fuzzy @@ -4303,11 +4471,11 @@ msgstr "" #: src/user-defined-types/enums.md:42 msgid "Rust uses minimal space to store the discriminant." -msgstr "" +msgstr "Rust 使用最小的空间来存储判标识。" #: src/user-defined-types/enums.md:43 msgid "If necessary, it stores an integer of the smallest required size" -msgstr "" +msgstr "如有必要,它会存储所需最小大小的整数" #: src/user-defined-types/enums.md:44 msgid "" @@ -4316,6 +4484,9 @@ msgid "" "optimization\"). For example, `Option<&u8>` stores either a pointer to an " "integer or `NULL` for the `None` variant." msgstr "" +"如果允许的变体值未涵盖所有位模式,则它将使用无效的位模式对判别标识进行编码" +"(“小众优化”)。例如,`Option<&u8>` 存储的要么是指向整数的指针,要么是 " +"`None` 变体的 `NULL` 值。" #: src/user-defined-types/enums.md:48 #, fuzzy @@ -4337,13 +4508,13 @@ msgstr "" #: src/memory-management/review.md:50 src/memory-management/move.md:99 #: src/smart-pointers/box.md:83 src/borrowing/shared.md:32 msgid "More to Explore" -msgstr "" +msgstr "探索更多" #: src/user-defined-types/enums.md:71 msgid "" "Rust has several optimizations it can employ to make enums take up less " "space." -msgstr "" +msgstr "Rust 具有多种优化措施,可以减少枚举占用的空间。" #: src/user-defined-types/enums.md:73 #, fuzzy @@ -4419,7 +4590,7 @@ msgstr "欢迎来到第一天" #: src/user-defined-types/static-and-const.md:45 msgid "\"{BANNER}\"" -msgstr "" +msgstr "\"{BANNER}\"" #: src/user-defined-types/static-and-const.md:49 #, fuzzy @@ -4555,15 +4726,15 @@ msgstr "可以使用宏“std::thread_local”创建“thread_local”数据。" msgid "" "A type alias creates a name for another type. The two types can be used " "interchangeably." -msgstr "" +msgstr "类型别名为另一种类型创建名称。这两种类型可以互换使用。" #: src/user-defined-types/aliases.md:13 msgid "// Aliases are more useful with long, complex types:\n" -msgstr "" +msgstr "// Aliases are more useful with long, complex types:\n" #: src/user-defined-types/aliases.md:22 msgid "C programmers will recognize this as similar to a `typedef`." -msgstr "" +msgstr "C 语言程序员会认为这类似于 `typedef`。" #: src/user-defined-types/exercise.md:3 msgid "" @@ -4572,104 +4743,112 @@ msgid "" "various events. Use `#[derive(Debug)]` to allow the types to be formatted " "with `{:?}`." msgstr "" +"我们将创建一个数据结构来表示电梯控制系统中的事件。您可以自行定义用于构造各种" +"事件的类型和函数。使用 `#[derive(Debug)]` 以允许通过 `{:?}` 设置类型格式。" #: src/user-defined-types/exercise.md:7 +#, fuzzy msgid "" "This exercise only requires creating and populating data structures so that " "`main` runs without errors. The next part of the course will cover getting " "data out of these structures." msgstr "" +"此次练习只需创建数据结构。本课程的下一部分将介绍如何从这些结构中获取数据。" #: src/user-defined-types/exercise.md:12 src/user-defined-types/solution.md:4 msgid "" "/// An event in the elevator system that the controller must react to.\n" msgstr "" +"/// An event in the elevator system that the controller must react to.\n" #: src/user-defined-types/exercise.md:15 +#, fuzzy msgid "// TODO: add required variants\n" -msgstr "" +msgstr "// Tuple variant\n" #: src/user-defined-types/exercise.md:17 src/user-defined-types/solution.md:22 msgid "/// A direction of travel.\n" -msgstr "" +msgstr "/// A direction of travel.\n" #: src/user-defined-types/exercise.md:24 src/user-defined-types/solution.md:39 msgid "/// The car has arrived on the given floor.\n" -msgstr "" +msgstr "/// The car has arrived on the given floor.\n" #: src/user-defined-types/exercise.md:29 src/user-defined-types/solution.md:44 msgid "/// The car doors have opened.\n" -msgstr "" +msgstr "/// The car doors have opened.\n" #: src/user-defined-types/exercise.md:34 src/user-defined-types/solution.md:49 msgid "/// The car doors have closed.\n" -msgstr "" +msgstr "/// The car doors have closed.\n" #: src/user-defined-types/exercise.md:39 src/user-defined-types/solution.md:54 msgid "" "/// A directional button was pressed in an elevator lobby on the given " "floor.\n" msgstr "" +"/// A directional button was pressed in an elevator lobby on the given " +"floor.\n" #: src/user-defined-types/exercise.md:44 src/user-defined-types/solution.md:59 msgid "/// A floor button was pressed in the elevator car.\n" -msgstr "" +msgstr "/// A floor button was pressed in the elevator car.\n" #: src/user-defined-types/exercise.md:52 src/user-defined-types/solution.md:67 msgid "\"A ground floor passenger has pressed the up button: {:?}\"" -msgstr "" +msgstr "\"A ground floor passenger has pressed the up button: {:?}\"" #: src/user-defined-types/exercise.md:55 src/user-defined-types/solution.md:70 msgid "\"The car has arrived on the ground floor: {:?}\"" -msgstr "" +msgstr "\"The car has arrived on the ground floor: {:?}\"" #: src/user-defined-types/exercise.md:56 src/user-defined-types/solution.md:71 msgid "\"The car door opened: {:?}\"" -msgstr "" +msgstr "\"The car door opened: {:?}\"" #: src/user-defined-types/exercise.md:58 src/user-defined-types/solution.md:73 msgid "\"A passenger has pressed the 3rd floor button: {:?}\"" -msgstr "" +msgstr "\"A passenger has pressed the 3rd floor button: {:?}\"" #: src/user-defined-types/exercise.md:61 src/user-defined-types/solution.md:76 msgid "\"The car door closed: {:?}\"" -msgstr "" +msgstr "\"The car door closed: {:?}\"" #: src/user-defined-types/exercise.md:62 src/user-defined-types/solution.md:77 msgid "\"The car has arrived on the 3rd floor: {:?}\"" -msgstr "" +msgstr "\"The car has arrived on the 3rd floor: {:?}\"" #: src/user-defined-types/solution.md:7 msgid "/// A button was pressed.\n" -msgstr "" +msgstr "/// A button was pressed.\n" #: src/user-defined-types/solution.md:10 msgid "/// The car has arrived at the given floor.\n" -msgstr "" +msgstr "/// The car has arrived at the given floor.\n" #: src/user-defined-types/solution.md:13 msgid "/// The car's doors have opened.\n" -msgstr "" +msgstr "/// The car's doors have opened.\n" #: src/user-defined-types/solution.md:16 msgid "/// The car's doors have closed.\n" -msgstr "" +msgstr "/// The car's doors have closed.\n" #: src/user-defined-types/solution.md:19 msgid "/// A floor is represented as an integer.\n" -msgstr "" +msgstr "/// A floor is represented as an integer.\n" #: src/user-defined-types/solution.md:29 msgid "/// A user-accessible button.\n" -msgstr "" +msgstr "/// A user-accessible button.\n" #: src/user-defined-types/solution.md:33 msgid "/// A button in the elevator lobby on the given floor.\n" -msgstr "" +msgstr "/// A button in the elevator lobby on the given floor.\n" #: src/user-defined-types/solution.md:36 msgid "/// A floor button within the car.\n" -msgstr "" +msgstr "/// A floor button within the car.\n" #: src/welcome-day-2.md:1 msgid "Welcome to Day 2"