diff --git a/po/zh-CN.po b/po/zh-CN.po index a1e1f0af83f5..c15f62671642 100644 --- a/po/zh-CN.po +++ b/po/zh-CN.po @@ -136,7 +136,7 @@ msgstr "`break` 和 `continue`" #: src/SUMMARY.md src/control-flow-basics/break-continue/labels.md msgid "Labels" -msgstr "" +msgstr "标签" #: src/SUMMARY.md src/control-flow-basics/blocks-and-scopes.md msgid "Blocks and Scopes" @@ -179,9 +179,8 @@ msgid "Array Iteration" msgstr "数组迭代" #: src/SUMMARY.md src/tuples-and-arrays/destructuring.md -#, fuzzy msgid "Patterns and Destructuring" -msgstr "解构" +msgstr "模式与解构" #: src/SUMMARY.md src/tuples-and-arrays/exercise.md msgid "Exercise: Nested Arrays" @@ -256,7 +255,7 @@ msgstr "模式匹配" #: src/SUMMARY.md src/pattern-matching/match.md msgid "Matching Values" -msgstr "" +msgstr "匹配值" #: src/SUMMARY.md src/pattern-matching/destructuring.md msgid "Destructuring" @@ -283,19 +282,16 @@ msgid "Traits" msgstr "特征(Trait)" #: src/SUMMARY.md src/methods-and-traits/traits/implementing.md -#, fuzzy msgid "Implementing Traits" -msgstr "实现 Unsafe Trait" +msgstr "实现特征" #: src/SUMMARY.md src/methods-and-traits/traits/supertraits.md -#, fuzzy msgid "Supertraits" -msgstr "更多 trait" +msgstr "超特征" #: src/SUMMARY.md src/methods-and-traits/traits/associated-types.md -#, fuzzy msgid "Associated Types" -msgstr "共享类型" +msgstr "关联类型" #: src/SUMMARY.md src/methods-and-traits/deriving.md msgid "Deriving" @@ -318,9 +314,8 @@ msgid "Generic Data Types" msgstr "泛型类型" #: src/SUMMARY.md src/generics/generic-traits.md -#, fuzzy msgid "Generic Traits" -msgstr "泛型" +msgstr "泛型特征" #: src/SUMMARY.md src/generics/trait-bounds.md msgid "Trait Bounds" @@ -441,7 +436,7 @@ msgstr "`Clone`" #: src/SUMMARY.md src/memory-management/copy-types.md msgid "Copy Types" -msgstr "复合类型" +msgstr "Copy 类型" #: src/SUMMARY.md msgid "`Drop`" @@ -497,9 +492,8 @@ msgid "Exercise: Health Statistics" msgstr "练习:健康统计" #: src/SUMMARY.md src/lifetimes.md -#, fuzzy msgid "Lifetimes" -msgstr "结构体生命周期" +msgstr "生命周期" #: src/SUMMARY.md src/lifetimes/lifetime-annotations.md msgid "Lifetime Annotations" @@ -1297,7 +1291,7 @@ msgid "" "for updates." msgstr "" "如需查看课程的最新版本,请访问 。如果您在其他地方阅读,请在那里查看更新。" +">。如果你在其他地方阅读,请在那里查看更新。" #: src/index.md msgid "The course is also available [as a PDF](comprehensive-rust.pdf)." @@ -1556,19 +1550,16 @@ msgid "[Welcome](../welcome-day-1.md) (5 minutes)" msgstr "[欢迎](../welcome-day-1.md)(5 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Hello, World](../hello-world.md) (15 minutes)" -msgstr "[Hello, World](../hello-world.md)(20 分钟)" +msgstr "[Hello, World](../hello-world.md)(15 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Types and Values](../types-and-values.md) (40 minutes)" -msgstr "[类型和值](../types-and-values.md)(55 分钟)" +msgstr "[类型和值](../types-and-values.md)(40 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Control Flow Basics](../control-flow-basics.md) (40 minutes)" -msgstr "[控制流](../control-flow-basics.md)(55 分钟)" +msgstr "[控制流基础](../control-flow-basics.md)(40 分钟)" #: src/running-the-course/course-structure.md #, fuzzy @@ -1576,14 +1567,12 @@ msgid "Day 1 Afternoon (2 hours and 35 minutes, including breaks)" msgstr "第一天下午(2 小时 55 分钟,含休息时间)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Tuples and Arrays](../tuples-and-arrays.md) (35 minutes)" -msgstr "[元组和数组](../tuples-and-arrays.md)(1 小时)" +msgstr "[元组和数组](../tuples-and-arrays.md)(35 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[References](../references.md) (55 minutes)" -msgstr "[引用](../references.md)(50 分钟)" +msgstr "[引用](../references.md)(55 分钟)" #: src/running-the-course/course-structure.md msgid "[User-Defined Types](../user-defined-types.md) (50 minutes)" @@ -1599,14 +1588,12 @@ msgid "[Welcome](../welcome-day-2.md) (3 minutes)" msgstr "[欢迎](../welcome-day-2.md)(3 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Pattern Matching](../pattern-matching.md) (1 hour)" -msgstr "[模式匹配](../pattern-matching.md)(50 分钟)" +msgstr "[模式匹配](../pattern-matching.md)(1 小时)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Methods and Traits](../methods-and-traits.md) (50 minutes)" -msgstr "[方法和特征](../methods-and-traits.md)(45 分钟)" +msgstr "[方法和特征](../methods-and-traits.md)(50 分钟)" #: src/running-the-course/course-structure.md msgid "[Generics](../generics.md) (40 minutes)" @@ -1618,9 +1605,8 @@ msgid "Day 2 Afternoon (3 hours and 10 minutes, including breaks)" msgstr "第三天下午(2 小时 20 分钟,含休息时间)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Standard Library Types](../std-types.md) (1 hour and 20 minutes)" -msgstr "[标准库类型](../std-types.md)(1 小时 10 分钟)" +msgstr "[标准库类型](../std-types.md)(1 小时 20 分钟)" #: src/running-the-course/course-structure.md msgid "[Standard Library Traits](../std-traits.md) (1 hour and 40 minutes)" @@ -1648,14 +1634,12 @@ msgid "Day 3 Afternoon (1 hour and 50 minutes, including breaks)" msgstr "第三天下午(2 小时 20 分钟,含休息时间)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Borrowing](../borrowing.md) (50 minutes)" -msgstr "[借用](../borrowing.md)(1 小时)" +msgstr "[借用](../borrowing.md)(50 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Lifetimes](../lifetimes.md) (50 minutes)" -msgstr "[引用](../references.md)(50 分钟)" +msgstr "[生命周期](../lifetimes.md)(50 分钟)" #: src/running-the-course/course-structure.md #, fuzzy @@ -1675,9 +1659,8 @@ msgid "[Modules](../modules.md) (40 minutes)" msgstr "[模块](../modules.md)(40 分钟)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Testing](../testing.md) (45 minutes)" -msgstr "[测试](../testing.md)(1 小时)" +msgstr "[测试](../testing.md)(45 分钟)" #: src/running-the-course/course-structure.md #, fuzzy @@ -1685,9 +1668,8 @@ msgid "Day 4 Afternoon (2 hours and 10 minutes, including breaks)" msgstr "第三天下午(2 小时 20 分钟,含休息时间)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "[Error Handling](../error-handling.md) (55 minutes)" -msgstr "[错误处理](../error-handling.md)(45 分钟)" +msgstr "[错误处理](../error-handling.md)(55 分钟)" #: src/running-the-course/course-structure.md msgid "[Unsafe Rust](../unsafe-rust.md) (1 hour and 5 minutes)" @@ -1760,7 +1742,7 @@ 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。为了提高速度,建议使用调试、组件 [构建方式](../" +"你需要能够构建 Chromium。为了提高速度,建议使用调试、组件 [构建方式](../" "chromium/setup.md),其他构建方式也可以使用。确保所构建的 Chromium 浏览器可以" "正常运行。" @@ -2373,9 +2355,8 @@ msgstr "" "体(struct)、引用、函数和方法。" #: src/welcome-day-1.md -#, fuzzy msgid "Types and type inference." -msgstr "类型推导" +msgstr "类型与类型推导。" #: src/welcome-day-1.md msgid "Control flow constructs: loops, conditionals, and so on." @@ -2399,32 +2380,29 @@ msgstr "时间表" #: src/welcome-day-3-afternoon.md src/welcome-day-4.md #: src/welcome-day-4-afternoon.md msgid "In this session:" -msgstr "" +msgstr "本场内容:" #: src/welcome-day-1.md msgid "[Welcome](./welcome-day-1.md) (5 minutes)" -msgstr "" +msgstr "[欢迎](./welcome-day-1.md)(5 分钟)" #: src/welcome-day-1.md -#, fuzzy msgid "[Hello, World](./hello-world.md) (15 minutes)" -msgstr "[Hello, World](../hello-world.md)(20 分钟)" +msgstr "[Hello, World](./hello-world.md)(15 分钟)" #: src/welcome-day-1.md -#, fuzzy msgid "[Types and Values](./types-and-values.md) (40 minutes)" -msgstr "[类型和值](../types-and-values.md)(55 分钟)" +msgstr "[类型和值](./types-and-values.md)(40 分钟)" #: src/welcome-day-1.md -#, fuzzy msgid "[Control Flow Basics](./control-flow-basics.md) (40 minutes)" -msgstr "[控制流](../control-flow-basics.md)(55 分钟)" +msgstr "[控制流基础](./control-flow-basics.md)(40 分钟)" #: src/welcome-day-1.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 5 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 5 分钟" #: src/welcome-day-1.md msgid "Please remind the students that:" @@ -2442,16 +2420,15 @@ msgid "" msgstr "这个课程本应该是互动的,我们鼓励大家积极讨论。" #: src/welcome-day-1.md -#, fuzzy msgid "" "As an instructor, you should try to keep the discussions relevant, i.e., " "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 "" -"作为讲师,你应该尽量保证讨论话题的相关性,例如,讨论围绕Rust是如何做某些事" -"情,而不是其他的语言如何如何。 这个平衡点不容易找到,但是尽量倾向于允许讨论," -"因为讨论比起单方面的灌输更有利于让大家投入。" +"作为讲师,你应该尽量让讨论保持在相关的范围内,也就是围绕 Rust 是怎么做的、与" +"其他语言有何不同。这个平衡点不容易把握,但宁可多允许一些讨论,因为讨论比单向" +"灌输更能调动大家的参与。" #: src/welcome-day-1.md msgid "" @@ -2484,7 +2461,7 @@ 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 "" -"如果您是在教室里授课,则这是一个好时机,可对课程时间表进行讲解。请注意,每节" +"如果你是在教室里授课,则这是一个好时机,可对课程时间表进行讲解。请注意,每节" "课结束之后会有练习内容,然后是休息时间。安排在休息结束后讲解练习内容的解答。" "为了确保课程按时间表进行,此处所列时间仅供参考。请按需进行灵活调整!" @@ -2495,23 +2472,23 @@ msgstr "" #: src/smart-pointers.md src/borrowing.md src/lifetimes.md src/iterators.md #: src/modules.md src/testing.md src/error-handling.md src/unsafe-rust.md msgid "In this segment:" -msgstr "" +msgstr "本节内容:" #: src/hello-world.md msgid "[What is Rust?](./hello-world/what-is-rust.md) (10 minutes)" -msgstr "" +msgstr "[什么是 Rust?](./hello-world/what-is-rust.md)(10 分钟)" #: src/hello-world.md msgid "[Benefits of Rust](./hello-world/benefits.md) (3 minutes)" -msgstr "" +msgstr "[Rust 的优势](./hello-world/benefits.md)(3 分钟)" #: src/hello-world.md msgid "[Playground](./hello-world/playground.md) (2 minutes)" -msgstr "" +msgstr "[Playground](./hello-world/playground.md)(2 分钟)" #: src/hello-world.md msgid "This segment should take about 15 minutes" -msgstr "" +msgstr "本节大约需要 15 分钟" #: src/hello-world/what-is-rust.md msgid "" @@ -2719,16 +2696,15 @@ msgstr "" "预测的执行性能(无垃圾回收机制),以及在需要时对底层硬件的访问。" #: src/hello-world/playground.md -#, 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\" 程序。该程序提供了一些便捷功能:" +"[Rust Playground](https://play.rust-lang.org/) 提供了一种运行简短 Rust 程序" +"的简便方法,也是本课程示例和练习的基础。试着运行它默认给出的“hello-world”程" +"序。它带有一些方便的功能:" #: src/hello-world/playground.md msgid "" @@ -2750,10 +2726,9 @@ msgstr "" msgid "" "If you're interested, use \"ASM\" under \"...\" to see the generated " "assembly code." -msgstr "如果感兴趣,您可以使用 \"...\" 下的 \"ASM\" 查看生成的汇编代码。" +msgstr "如果感兴趣,你可以使用 \"...\" 下的 \"ASM\" 查看生成的汇编代码。" #: src/hello-world/playground.md -#, 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 " @@ -2761,41 +2736,38 @@ msgid "" "students who want to know more about Rust's optimizations or generated " "assembly." msgstr "" -"当学生开始休息时,鼓励他们打开 Playground 并进行一些实验。鼓励他们让该标签页" -"保持打开状态,并在课余时间里进行一些尝试。对于具有较高水平并且希望深入了解 " -"Rust 优化技巧或生成的汇编代码的学生,这尤其有益。" +"学员休息时,鼓励他们打开 Playground 做一些实验,并让这个标签页一直开着,在课" +"程接下来的时间里随手试试。对于想深入了解 Rust 优化或生成的汇编代码的进阶学员" +",这尤其有帮助。" #: src/types-and-values.md -#, fuzzy msgid "[Hello, World](./types-and-values/hello-world.md) (5 minutes)" -msgstr "[Hello, World](../hello-world.md)(20 分钟)" +msgstr "[Hello, World](./types-and-values/hello-world.md)(5 分钟)" #: src/types-and-values.md msgid "[Variables](./types-and-values/variables.md) (5 minutes)" -msgstr "" +msgstr "[变量](./types-and-values/variables.md)(5 分钟)" #: src/types-and-values.md msgid "[Values](./types-and-values/values.md) (5 minutes)" -msgstr "" +msgstr "[值](./types-and-values/values.md)(5 分钟)" #: src/types-and-values.md msgid "[Arithmetic](./types-and-values/arithmetic.md) (3 minutes)" -msgstr "" +msgstr "[算术](./types-and-values/arithmetic.md)(3 分钟)" #: src/types-and-values.md msgid "[Type Inference](./types-and-values/inference.md) (3 minutes)" -msgstr "" +msgstr "[类型推导](./types-and-values/inference.md)(3 分钟)" #: src/types-and-values.md -#, fuzzy msgid "[Exercise: Fibonacci](./types-and-values/exercise.md) (15 minutes)" -msgstr "" -"如需详细了解 Rust 中 的模式,请参阅 [模式匹配](../pattern-matching.md)。" +msgstr "[练习:Fibonacci](./types-and-values/exercise.md)(15 分钟)" #: src/types-and-values.md src/control-flow-basics.md src/generics.md #: src/modules.md msgid "This segment should take about 40 minutes" -msgstr "" +msgstr "本节大约需要 40 分钟" #: src/types-and-values/hello-world.md msgid "" @@ -2804,7 +2776,6 @@ msgid "" msgstr "让我们进入最简单的 Rust 程序,一个经典的 Hello World 程序:" #: src/types-and-values/hello-world.md -#, fuzzy msgid "\"Hello 🌍!\"" msgstr "\"Hello 🌍!\"" @@ -2833,36 +2804,33 @@ msgid "Rust strings are UTF-8 encoded and can contain any Unicode character." msgstr "Rust 字符串是 UTF-8 编码的,可以包含任何 Unicode 字符。" #: src/types-and-values/hello-world.md -#, fuzzy 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 " "familiar." msgstr "" -"这张幻灯片试图让学生们熟悉 Rust 代码。在接下来的四天里,他们会看到很多 Rust " -"代码, 所以我们从一些熟悉的东西开始。" +"这张幻灯片试图让学员熟悉 Rust 代码。接下来四天里他们会看到大量代码,所以我们" +"从熟悉的东西开始,由小处入手。" #: src/types-and-values/hello-world.md -#, fuzzy msgid "" "Rust is very much like other languages in the C/C++/Java tradition. It is " "imperative and it doesn't try to reinvent things unless absolutely necessary." msgstr "" -"Rust 非常像 C/C++/Java 等其他传统语言。它是指令式语言(而非函数式),而且除非" -"绝对必要,它不会尝试重新发明新的概念。" +"Rust 与 C/C++/Java 一脉相承的那些语言非常相似。它是命令式的,而且除非绝对必" +"要,不会试图重新发明轮子。" #: src/types-and-values/hello-world.md msgid "Rust is modern with full support for things like Unicode." msgstr "Rust 是一门现代编程语言,它完全支持 Unicode 等特性。" #: src/types-and-values/hello-world.md -#, fuzzy msgid "" "Rust uses macros for situations where you want to have a variable number of " "arguments (no function [overloading](../control-flow-basics/functions.md))." msgstr "" -"在需要处理可变数量的参数的情况下,Rust 使用宏(没有函数[重载](basic-syntax/" -"functions-interlude.md))。" +"在需要可变数量参数的场合,Rust 使用宏(没有函数[重载" +"](../control-flow-basics/functions.md))。" #: src/types-and-values/hello-world.md msgid "" @@ -2887,11 +2855,10 @@ msgstr "" "数概念](https://doc.rust-lang.org/book/ch13-00-functional-features.html)。" #: src/types-and-values/variables.md -#, fuzzy msgid "" "Rust provides type safety via static typing. Variable bindings are made with " "`let`:" -msgstr "Rust 通过静态类型实现了类型安全。变量绑定默认是不可变的:" +msgstr "Rust 通过静态类型提供类型安全。变量绑定用 `let` 完成:" #: src/types-and-values/variables.md src/control-flow-basics/loops/for.md #: src/control-flow-basics/blocks-and-scopes.md @@ -2900,12 +2867,11 @@ msgstr "\"x: {x}\"" #: src/types-and-values/variables.md msgid "// x = 20;" -msgstr "" +msgstr "// x = 20;" #: src/types-and-values/variables.md -#, fuzzy msgid "// println!(\"x: {x}\");" -msgstr "// println!(\"s1: {s1}\");\n" +msgstr "// println!(\"x: {x}\");" #: src/types-and-values/variables.md msgid "" @@ -3058,7 +3024,6 @@ msgstr "" "在不同平台或编译器上执行不同的操作。在 Rust 中,整数溢出具有明确定义。" #: src/types-and-values/arithmetic.md -#, 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 " @@ -3066,10 +3031,10 @@ 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)`。" +"把 `i32` 改成 `i16` 就能看到整数溢出:在 debug 构建中会 panic(有检查),在 " +"release 构建中则会回绕。此外还有别的处理方式,例如 overflowing、saturating " +"和 carrying,它们通过方法语法来使用,例如 `(a * b).saturating_add(b * " +"c).saturating_add(c * a)`。" #: src/types-and-values/arithmetic.md msgid "" @@ -3110,12 +3075,10 @@ msgstr "" "`{integer}`。同样,浮点字面量默认为 `f64`。" #: src/types-and-values/inference.md -#, fuzzy msgid "// ERROR: no implementation for `{float} == {integer}`" -msgstr "// ERROR: no implementation for `{float} == {integer}`\n" +msgstr "// ERROR: no implementation for `{float} == {integer}`" #: src/types-and-values/exercise.md -#, 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 " @@ -3125,64 +3088,57 @@ msgstr "" "为第 n-1 个和第 n-2 个斐波那契数之和。" #: src/types-and-values/exercise.md -#, fuzzy msgid "" "Write a function `fib(n)` that calculates the n'th Fibonacci number. When " "will this function panic?" msgstr "编写一个函数 `fib(n)`,用于计算第 n 个斐波那契数。何时该函数会 panic?" #: src/types-and-values/exercise.md -#, fuzzy msgid "// The base case." -msgstr "// The base case.\n" +msgstr "// The base case." #: src/types-and-values/exercise.md src/control-flow-basics/exercise.md -#, fuzzy msgid "\"Implement this\"" -msgstr "实现" +msgstr "\"Implement this\"" #: src/types-and-values/exercise.md -#, fuzzy msgid "// The recursive case." -msgstr "// The recursive case.\n" +msgstr "// The recursive case." #: src/types-and-values/exercise.md src/types-and-values/solution.md -#, fuzzy msgid "\"fib({n}) = {}\"" -msgstr "\"fib(n) = {}\"" +msgstr "\"fib({n}) = {}\"" #: src/control-flow-basics.md -#, fuzzy msgid "[if Expressions](./control-flow-basics/if.md) (4 minutes)" -msgstr "[控制流](../control-flow-basics.md)(55 分钟)" +msgstr "[if 表达式](./control-flow-basics/if.md)(4 分钟)" #: src/control-flow-basics.md msgid "[Loops](./control-flow-basics/loops.md) (5 minutes)" -msgstr "" +msgstr "[循环控制](./control-flow-basics/loops.md)(5 分钟)" #: src/control-flow-basics.md msgid "" "[break and continue](./control-flow-basics/break-continue.md) (4 minutes)" -msgstr "" +msgstr "[break 和 continue](./control-flow-basics/break-continue.md)(4 分钟)" #: src/control-flow-basics.md msgid "" "[Blocks and Scopes](./control-flow-basics/blocks-and-scopes.md) (5 minutes)" -msgstr "" +msgstr "[代码块和作用域](./control-flow-basics/blocks-and-scopes.md)(5 分钟)" #: src/control-flow-basics.md msgid "[Functions](./control-flow-basics/functions.md) (3 minutes)" -msgstr "" +msgstr "[函数](./control-flow-basics/functions.md)(3 分钟)" #: src/control-flow-basics.md msgid "[Macros](./control-flow-basics/macros.md) (2 minutes)" -msgstr "" +msgstr "[宏](./control-flow-basics/macros.md)(2 分钟)" #: src/control-flow-basics.md -#, fuzzy msgid "" "[Exercise: Collatz Sequence](./control-flow-basics/exercise.md) (15 minutes)" -msgstr "[控制流](../control-flow-basics.md)(55 分钟)" +msgstr "[练习:考拉兹序列](./control-flow-basics/exercise.md)(15 分钟)" #: src/control-flow-basics/if.md msgid "`if` expressions" @@ -3198,7 +3154,7 @@ msgstr "" #: src/control-flow-basics/if.md msgid "\"zero!\"" -msgstr "" +msgstr "\"zero!\"" #: src/control-flow-basics/if.md msgid "\"biggish\"" @@ -3229,14 +3185,13 @@ msgid "\"number size: {}\"" msgstr "\"number size: {}\"" #: src/control-flow-basics/if.md -#, fuzzy msgid "" "Because `if` is an expression and must have a particular type, both of its " "branch blocks must have the same type. Show what happens if you add `;` " "after `\"small\"` in the second example." msgstr "" -"由于 `if` 是一个表达式且必须有一个特定的类型,因此它的两个分支块必须有相同的" -"类型。考虑在第二个示例中将 `;` 添加到 `x / 2` 的后面,看看会出现什么情况。" +"由于 `if` 是表达式且必须有确定的类型,它的两个分支代码块必须具有相同的类型。" +"可以在第二个示例中的 `\"small\"` 后面加上 `;`,看看会发生什么。" #: src/control-flow-basics/if.md msgid "" @@ -3252,36 +3207,34 @@ msgid "There are three looping keywords in Rust: `while`, `loop`, and `for`:" msgstr "Rust 中有三个循环关键字:`while`、`loop` 和 `for`:" #: src/control-flow-basics/loops.md -#, fuzzy msgid "`while`" -msgstr "`while` 循环" +msgstr "`while`" #: src/control-flow-basics/loops.md -#, fuzzy msgid "" "The [`while` keyword](https://doc.rust-lang.org/reference/expressions/loop-" "expr.html#predicate-loops) works much like in other languages, executing the " "loop body as long as the condition is true." msgstr "" -"[`while` 关键字](https://doc.rust-lang.org/reference/expressions/loop-expr." -"html#predicate-loops) 的工作方式与其他语言非常相似:" +"[`while` 关键字" +"](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops)" +"的用法与其他语言非常相似:只要条件为真,就一直执行循环体。" #: src/control-flow-basics/loops.md msgid "\"Final x: {x}\"" msgstr "\"Final x: {x}\"" #: src/control-flow-basics/loops/for.md -#, fuzzy msgid "" "The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) iterates " "over ranges of values or the items in a collection:" msgstr "" -"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) 用于定义析构函" -"数。" +"[`for` 循环](https://doc.rust-lang.org/std/keyword.for.html)会遍历一段值的范" +"围,或者集合中的元素:" #: src/control-flow-basics/loops/for.md msgid "\"elem: {elem}\"" -msgstr "" +msgstr "\"elem: {elem}\"" #: src/control-flow-basics/loops/for.md msgid "" @@ -3289,6 +3242,8 @@ msgid "" "iterating over different kinds of ranges/collections. Iterators will be " "discussed in more detail later." msgstr "" +"`for` 循环在底层使用一个叫“迭代器”的概念来处理各种范围和集合的遍历。迭代器会" +"在后面详细介绍。" #: src/control-flow-basics/loops/for.md msgid "" @@ -3299,13 +3254,12 @@ msgstr "" "围。" #: src/control-flow-basics/loops/loop.md -#, fuzzy msgid "" "The [`loop` statement](https://doc.rust-lang.org/std/keyword.loop.html) just " "loops forever, until a `break`." msgstr "" -"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) 用于定义析构函" -"数。" +"[`loop` 语句](https://doc.rust-lang.org/std/keyword.loop.html)会一直循环下去" +",直到遇到 `break`。" #: src/control-flow-basics/loops/loop.md msgid "\"{i}\"" @@ -3320,15 +3274,16 @@ msgstr "" "reference/expressions/loop-expr.html#continue-expressions)。" #: src/control-flow-basics/break-continue.md -#, fuzzy msgid "" "If you want to exit any kind of loop early, use [`break`](https://doc.rust-" "lang.org/reference/expressions/loop-expr.html#break-expressions). For " "`loop`, this can take an optional expression that becomes the value of the " "`loop` expression." msgstr "" -"如果你想提前退出循环,请使用 [`break`](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#break-expressions)," +"如果想提前退出任何一种循环,请使用 " +"[`break`](https://doc.rust-lang.org/reference/expressions/loop-expr.html#break-expressions)" +"。对 `loop` 而言,它还可以带一个可选的表达式,该表达式的值会成为整个 `loop` " +"表达式的值。" #: src/control-flow-basics/break-continue.md src/std-traits/exercise.md #: src/std-traits/solution.md src/smart-pointers/trait-objects.md @@ -3347,7 +3302,7 @@ msgstr "`continue` 和 `break` 都可以选择接受一个标签参数,用来 #: src/control-flow-basics/break-continue/labels.md msgid "\"elements searched: {elements_searched}\"" -msgstr "" +msgstr "\"elements searched: {elements_searched}\"" #: src/control-flow-basics/break-continue/labels.md msgid "" @@ -3363,23 +3318,23 @@ msgid "Blocks" msgstr "块" #: src/control-flow-basics/blocks-and-scopes.md -#, fuzzy msgid "" "A block in Rust contains a sequence of expressions, enclosed by braces `{}`. " "Each block has a value and a type, which are those of the last expression of " "the block:" -msgstr "Rust 中的块包含值和类型:值是 块的最后一个表达式:" +msgstr "" +"Rust 中的代码块包含一系列表达式,用花括号 `{}` 括起来。每个代码块都有一个值" +"和一个类型,也就是块中最后一个表达式的值和类型:" #: src/control-flow-basics/blocks-and-scopes.md msgid "\"y: {y}\"" msgstr "\"y: {y}\"" #: src/control-flow-basics/blocks-and-scopes.md -#, fuzzy msgid "" "If the last expression ends with `;`, then the resulting value and type is " "`()`." -msgstr "不过,如果最后一个表达式以 `;` 结尾,那么生成的值和类型为 `()`。" +msgstr "如果最后一个表达式以 `;` 结尾,那么得到的值和类型就是 `()`。" #: src/control-flow-basics/blocks-and-scopes.md msgid "" @@ -3406,7 +3361,6 @@ msgstr "\"before: {a}\"" #: src/control-flow-basics/blocks-and-scopes/scopes.md src/generics/exercise.md #: src/generics/solution.md src/std-traits/from-and-into.md #: src/lifetimes/solution.md -#, fuzzy msgid "\"hello\"" msgstr "\"hello\"" @@ -3423,7 +3377,6 @@ msgid "\"after: {a}\"" msgstr "\"after: {a}\"" #: src/control-flow-basics/blocks-and-scopes/scopes.md -#, 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." @@ -3432,18 +3385,15 @@ msgstr "" "的作用域是受限的。" #: src/control-flow-basics/blocks-and-scopes/scopes.md -#, fuzzy msgid "" "Shadowing is different from mutation, because after shadowing both " "variable's memory locations exist at the same time. Both are available under " "the same name, depending where you use it in the code." msgstr "" -"定义: 遮蔽和变更(mutation)不同,因为在遮蔽之后,两个变量都会同时存在于内存" -"的不同位置中。在同一个名字下的两个变量都是可以被使用的,但是你在代码的哪里使" -"用会最终决定你使用哪一个变量。" +"遮蔽与修改不同:遮蔽之后,两个变量的内存位置同时存在。它们在同一个名字下都可" +"以访问,具体用到哪一个取决于你在代码中的什么位置使用它。" #: src/control-flow-basics/blocks-and-scopes/scopes.md -#, fuzzy msgid "A shadowing variable can have a different type." msgstr "一个遮蔽变量可以具有不同的类型。" @@ -3460,15 +3410,15 @@ msgid "" msgstr "类型跟随在声明的参数后(与某些编程语言相反),然后是返回类型。" #: src/control-flow-basics/functions.md -#, fuzzy msgid "" "The last expression in a function body (or any block) becomes the return " "value. Simply omit the `;` at the end of the expression. The `return` " "keyword can be used for early return, but the \"bare value\" form is " "idiomatic at the end of a function (refactor `gcd` to use a `return`)." msgstr "" -"函数体(或任何块)中的最后一个表达式将成为返回值。只需省略表达式末尾的 `;` 即" -"可。" +"函数体(或任何代码块)中的最后一个表达式会成为返回值,只需省略表达式末尾的 " +"`;`。`return` 关键字可以用于提前返回,但在函数末尾,“裸值”写法才是惯用做法(" +"可以把 `gcd` 改写成使用 `return` 试试)。" #: src/control-flow-basics/functions.md msgid "" @@ -3479,10 +3429,9 @@ msgstr "" "回类型,编译器将会自动推断。" #: src/control-flow-basics/functions.md -#, fuzzy msgid "" "Overloading is not supported -- each function has a single implementation." -msgstr "每一个函数都只有一种实现:" +msgstr "不支持重载——每个函数只有一种实现。" #: src/control-flow-basics/functions.md msgid "" @@ -3491,11 +3440,10 @@ msgid "" msgstr "始终采用固定数量的参数。不支持默认参数。宏可用于支持可变函数。" #: src/control-flow-basics/functions.md -#, fuzzy msgid "" "Always takes a single set of parameter types. These types can be generic, " "which will be covered later." -msgstr "始终接受一组形参类型。" +msgstr "始终只接受一组形参类型。这些类型可以是泛型的,后面会介绍。" #: src/control-flow-basics/macros.md msgid "" @@ -3507,13 +3455,13 @@ msgstr "" "来进行区分。Rust 标准库包含各种有用的宏。" #: src/control-flow-basics/macros.md -#, fuzzy msgid "" "`println!(format, ..)` prints a line to standard output, applying formatting " "described in [`std::fmt`](https://doc.rust-lang.org/std/fmt/index.html)." msgstr "" -"运算符重载是通过 [`std::ops`](https://doc.rust-lang.org/std/ops/index.html) " -"中的特征实现的:" +"`println!(format, ..)` 会向标准输出打印一行,并应用 " +"[`std::fmt`](https://doc.rust-lang.org/std/fmt/index.html) 中描述的格式化规" +"则。" #: src/control-flow-basics/macros.md msgid "" @@ -3627,7 +3575,6 @@ msgid "_ = 3:" msgstr "_ = 3 开头:" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "3 is odd, so _n" msgstr "3 是奇数,因此 _n" @@ -3640,7 +3587,6 @@ msgid "_ = 3 * 3 + 1 = 10;" msgstr "_ = 3 * 3 + 1 = 10;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "10 is even, so _n" msgstr "10 是偶数,因此 _n" @@ -3653,7 +3599,6 @@ msgid "_ = 10 / 2 = 5;" msgstr "_ = 10 / 2 = 5;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "5 is odd, so _n" msgstr "5 是奇数,因此 _n" @@ -3662,12 +3607,10 @@ msgid "4" msgstr "4" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "_ = 3 * 5 + 1 = 16;" -msgstr "_ = 3 * 15 + 1 = 16;" +msgstr "_ = 3 * 5 + 1 = 16;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "16 is even, so _n" msgstr "16 是偶数,因此 _n" @@ -3676,12 +3619,10 @@ msgid "5" msgstr "5" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "_ = 16 / 2 = 8;" -msgstr "_ = 16 / 2 = 8;" +msgstr "_ = 16 / 2 = 8;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "8 is even, so _n" msgstr "8 是偶数,因此 _n" @@ -3690,12 +3631,10 @@ msgid "6" msgstr "6" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "_ = 8 / 2 = 4;" -msgstr "_ = 8 / 2 = 4;" +msgstr "_ = 8 / 2 = 4;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "4 is even, so _n" msgstr "4 是偶数,因此 _n" @@ -3704,12 +3643,10 @@ msgid "7" msgstr "7" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "_ = 4 / 2 = 2;" -msgstr "_ = 4 / 2 = 2;" +msgstr "_ = 4 / 2 = 2;" #: src/control-flow-basics/exercise.md -#, fuzzy msgid "2 is even, so _n" msgstr "2 是偶数,因此 _n" @@ -3741,63 +3678,54 @@ msgstr "\"Length: {}\"" #: src/welcome-day-1-afternoon.md src/welcome-day-2-afternoon.md #: src/welcome-day-3-afternoon.md src/welcome-day-4-afternoon.md -#, fuzzy msgid "Welcome Back" -msgstr "欢迎" +msgstr "欢迎回来" #: src/welcome-day-1-afternoon.md -#, fuzzy msgid "[Tuples and Arrays](./tuples-and-arrays.md) (35 minutes)" -msgstr "[元组和数组](../tuples-and-arrays.md)(1 小时)" +msgstr "[元组和数组](./tuples-and-arrays.md)(35 分钟)" #: src/welcome-day-1-afternoon.md -#, fuzzy msgid "[References](./references.md) (55 minutes)" -msgstr "[引用](../references.md)(50 分钟)" +msgstr "[引用](./references.md)(55 分钟)" #: src/welcome-day-1-afternoon.md msgid "[User-Defined Types](./user-defined-types.md) (50 minutes)" -msgstr "" +msgstr "[用户定义的类型](./user-defined-types.md)(50 分钟)" #: src/welcome-day-1-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 35 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 35 分钟" #: src/tuples-and-arrays.md -#, fuzzy msgid "[Arrays](./tuples-and-arrays/arrays.md) (5 minutes)" -msgstr "" -"如需详细了解 Rust 中 的模式,请参阅 [模式匹配](../pattern-matching.md)。" +msgstr "[数组(Arrays)](./tuples-and-arrays/arrays.md)(5 分钟)" #: src/tuples-and-arrays.md -#, fuzzy msgid "[Tuples](./tuples-and-arrays/tuples.md) (5 minutes)" -msgstr "[类型和值](../types-and-values.md)(55 分钟)" +msgstr "[元组(Tuples)](./tuples-and-arrays/tuples.md)(5 分钟)" #: src/tuples-and-arrays.md msgid "[Array Iteration](./tuples-and-arrays/iteration.md) (3 minutes)" -msgstr "" +msgstr "[数组迭代](./tuples-and-arrays/iteration.md)(3 分钟)" #: src/tuples-and-arrays.md -#, fuzzy msgid "" "[Patterns and Destructuring](./tuples-and-arrays/destructuring.md) (5 " "minutes)" -msgstr "如需详细了解 Rust 中的模式,请参阅[模式匹配](../pattern-matching.md)。" +msgstr "[模式与解构](./tuples-and-arrays/destructuring.md)(5 分钟)" #: src/tuples-and-arrays.md -#, fuzzy msgid "[Exercise: Nested Arrays](./tuples-and-arrays/exercise.md) (15 minutes)" -msgstr "练习:面向 GUI 库的模块" +msgstr "[练习:嵌套数组](./tuples-and-arrays/exercise.md)(15 分钟)" #: src/tuples-and-arrays.md msgid "This segment should take about 35 minutes" -msgstr "" +msgstr "本节大约需要 35 分钟" #: src/tuples-and-arrays/arrays.md -#, fuzzy msgid "" "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 " @@ -3805,9 +3733,9 @@ msgid "" "different types. Slices, which have a size determined at runtime, are " "covered later." msgstr "" -"数组中的元素具有相同的类型 `T`,数组的长度为 `N`,`N` 是一个编译期常量。 需要" -"注意的是数组的长度是它_类型的一部分\\_, 这意味着 `[u8; 3]` 和 `[u8; 4]` 在 " -"Rust 中被认为是不同的类型。" +"数组类型 `[T; N]` 的值持有 `N` 个(`N` 是编译期常量)相同类型 `T` 的元素。请" +"注意,数组的长度是 _其类型的一部分_,这意味着 `[u8; 3]` 和 `[u8; 4]` 被视为" +"两种不同的类型。大小在运行时才确定的切片会在后面介绍。" #: src/tuples-and-arrays/arrays.md msgid "" @@ -3823,7 +3751,6 @@ msgid "We can use literals to assign values to arrays." msgstr "我们可以使用字面量来为数组赋值。" #: src/tuples-and-arrays/arrays.md -#, fuzzy msgid "" "The `println!` macro asks for the debug implementation with the `?` format " "parameter: `{}` gives the default output, `{:?}` gives the debug output. " @@ -3831,9 +3758,9 @@ msgid "" "only implement the debug output. This means that we must use debug output " "here." msgstr "" -"在主函数中,打印(print)语句使用 `?` 格式请求调试实现。 使用参数 `{}` 打印默" -"认输出,`{:?}` 表示以调试格式输出。 我们也可以不在格式化字符串后面指定变量" -"值,直接使用 `{a}` 和 `{a:?}` 进行输出。" +"`println!` 宏通过 `?` 格式参数来请求 debug 实现:`{}` 给出默认输出,`{:?}` " +"给出 debug 输出。整数和字符串这类类型实现了默认输出,而数组只实现了 debug 输" +"出,因此这里必须使用 debug 输出。" #: src/tuples-and-arrays/arrays.md msgid "" @@ -3862,6 +3789,7 @@ msgid "" "The empty tuple `()` is referred to as the \"unit type\" and signifies " "absence of a return value, akin to `void` in other languages." msgstr "" +"空元组 `()` 被称为“单元类型”,表示没有返回值,类似于其他语言中的 `void`。" #: src/tuples-and-arrays/iteration.md msgid "The `for` statement supports iterating over arrays (but not tuples)." @@ -3889,16 +3817,18 @@ msgid "" "extract the inner values into local variables. This can be done manually by " "directly accessing the inner values:" msgstr "" +"处理元组和其他结构化的值时,常常需要把内部的值提取到局部变量里。这可以通过直" +"接访问内部的值手动完成:" #: src/tuples-and-arrays/destructuring.md msgid "\"left: {left}, right: {right}\"" -msgstr "" +msgstr "\"left: {left}, right: {right}\"" #: src/tuples-and-arrays/destructuring.md msgid "" "However, Rust also supports using pattern matching to destructure a larger " "value into its constituent parts:" -msgstr "" +msgstr "不过,Rust 也支持用模式匹配把一个较大的值解构成它的各个组成部分:" #: src/tuples-and-arrays/destructuring.md msgid "" @@ -3906,12 +3836,16 @@ msgid "" "statically verify that the value on the right of `=` has the same structure " "as the pattern." msgstr "" +"这里用到的模式是“不可反驳的”,也就是说编译器可以静态地验证 `=` 右边的值与模" +"式具有相同的结构。" #: src/tuples-and-arrays/destructuring.md msgid "" "A variable name is an irrefutable pattern that always matches any value, " "hence why we can also use `let` to declare a single variable." msgstr "" +"变量名就是一种不可反驳的模式,它总能匹配任何值,这也是我们可以用 `let` 声明" +"单个变量的原因。" #: src/tuples-and-arrays/destructuring.md msgid "" @@ -3919,30 +3853,29 @@ msgid "" "comparison and destructuring to happen at the same time. This form of " "pattern matching will be discussed in more detail later." msgstr "" +"Rust 还支持在条件语句中使用模式,让相等比较和解构同时发生。这种形式的模式匹" +"配会在后面详细介绍。" #: src/tuples-and-arrays/destructuring.md msgid "" "Edit the examples above to show the compiler error when the pattern doesn't " "match the value being matched on." -msgstr "" +msgstr "修改上面的例子,展示模式与被匹配的值不符时编译器报出的错误。" #: src/tuples-and-arrays/exercise.md msgid "Arrays can contain other arrays:" msgstr "数组可以包含其他数组:" #: src/tuples-and-arrays/exercise.md -#, fuzzy msgid "What is the type of this variable?" -msgstr "每个循环中的“word”是什么类型?" +msgstr "这个变量的类型是什么?" #: src/tuples-and-arrays/exercise.md -#, fuzzy msgid "" "Use an array such as the above to write a function `transpose` which will " "transpose a matrix (turn rows into columns):" msgstr "" -"使用以上知识,写一个用易读的格式输出矩阵的 `pretty_print` 函数,以及一个对矩" -"阵进行转置(将行和列互换)的 `transpose` 函数:" +"用上面这样的数组编写一个 `transpose` 函数,对矩阵进行转置(把行变成列):" #: src/tuples-and-arrays/exercise.md msgid "Hard-code both functions to operate on 3 × 3 matrices." @@ -3956,9 +3889,8 @@ msgstr "将下面的代码复制到 并实现上 #: src/tuples-and-arrays/exercise.md src/borrowing/exercise.md #: src/unsafe-rust/exercise.md -#, fuzzy msgid "// TODO: remove this when you're done with your implementation." -msgstr "// TODO: remove this when you're done with your implementation.\n" +msgstr "// TODO: remove this when you're done with your implementation." #: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md msgid "//\n" @@ -3978,31 +3910,27 @@ msgstr "\"transposed: {:#?}\"" #: src/references.md msgid "[Shared References](./references/shared.md) (10 minutes)" -msgstr "" +msgstr "[共享引用](./references/shared.md)(10 分钟)" #: src/references.md msgid "[Exclusive References](./references/exclusive.md) (10 minutes)" -msgstr "" +msgstr "[独占引用](./references/exclusive.md)(10 分钟)" #: src/references.md -#, fuzzy msgid "[Slices: &\\[T\\]](./references/slices.md) (10 minutes)" -msgstr "[引用](../references.md)(50 分钟)" +msgstr "[切片:&\\[T\\]](./references/slices.md)(10 分钟)" #: src/references.md -#, fuzzy msgid "[Strings](./references/strings.md) (10 minutes)" -msgstr "" -"如需详细了解 Rust 中 的模式,请参阅 [模式匹配](../pattern-matching.md)。" +msgstr "[字符串](./references/strings.md)(10 分钟)" #: src/references.md -#, fuzzy msgid "[Exercise: Geometry](./references/exercise.md) (15 minutes)" -msgstr "练习:面向 GUI 库的模块" +msgstr "[练习:几何图形](./references/exercise.md)(15 分钟)" #: src/references.md src/smart-pointers.md src/error-handling.md msgid "This segment should take about 55 minutes" -msgstr "" +msgstr "本节大约需要 55 分钟" #: src/references/shared.md msgid "" @@ -4053,17 +3981,16 @@ msgstr "" msgid "" "Rust does not automatically create references for you - the `&` is always " "required." -msgstr "Rust 不会自动为您创建引用,必须始终使用 `&` 符号。" +msgstr "Rust 不会自动为你创建引用,必须始终使用 `&` 符号。" #: src/references/shared.md -#, fuzzy msgid "" "Rust will auto-dereference in some cases, in particular when invoking " "methods (try `r.is_ascii()`). There is no need for an `->` operator like in " "C++." msgstr "" -"Rust 有时会进行自动解引用。比如调用方法 `ref_x.count_ones()` 时,ref_x 会被解" -"引用。" +"在某些情况下 Rust 会自动解引用,尤其是在调用方法时(试试 `r.is_ascii()`)。" +"不需要像 C++ 那样的 `->` 运算符。" #: src/references/shared.md msgid "" @@ -4116,16 +4043,14 @@ msgstr "" "`x_coord` 处于活动状态时创建 `&point.0` 或更改 `point.0`。" #: src/references/exclusive.md -#, fuzzy msgid "" "Be sure to note the difference between `let mut x_coord: &i32` and `let " "x_coord: &mut i32`. The first one represents a shared reference which can be " "bound to different values, while the second represents an exclusive " "reference to a mutable value." msgstr "" -"注意 `let mut ref_x: &i32` 与 `let ref_x: &mut i32` 之间的区别。第一条语句声" -"明了一个可变引用,所以我们可以修改这个引用所绑定的值;第二条语句声明了一个指" -"向可变变量的引用。" +"请务必注意 `let mut x_coord: &i32` 与 `let x_coord: &mut i32` 的区别。前者是" +"一个共享引用,它本身可以被重新绑定到不同的值;后者则是指向可变值的独占引用。" #: src/references/slices.md msgid "Slices" @@ -4140,63 +4065,53 @@ msgid "Slices borrow data from the sliced type." msgstr "切片从被切片的类型中借用 (borrow) 数据。" #: src/references/slices.md -#, fuzzy msgid "Question: What happens if you modify `a[3]` right before printing `s`?" -msgstr "请思考:如果我们改变 `a[3]`,将会产生怎样的后果?" +msgstr "思考题:如果在打印 `s` 之前修改 `a[3]`,会发生什么?" #: src/references/slices.md -#, fuzzy msgid "" "We create a slice by borrowing `a` and specifying the starting and ending " "indexes in brackets." -msgstr "创建切片时,我们借用了 `a` ,并在方括号中标明了起始和结尾下标。" +msgstr "我们通过借用 `a` 并在方括号中指定起始和结束下标来创建切片。" #: src/references/slices.md -#, fuzzy 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 " "identical." msgstr "" -"如果切片的起始下标为 0, Rust 语法允许我们省略起始下标。比如说 `&a[0..a." -"len()]` 与 `&a[..a.len()]` 是等价的。" +"如果切片从下标 0 开始,Rust 的区间语法允许我们省略起始下标,也就是说 " +"`&a[0..a.len()]` 和 `&a[..a.len()]` 是等价的。" #: src/references/slices.md -#, fuzzy msgid "" "The same is true for the last index, so `&a[2..a.len()]` and `&a[2..]` are " "identical." -msgstr "" -"结尾下标也可以用相同方式省略。比如说 `&a[2..a.len()]` 和 `&a[2..]` 是等价的。" +msgstr "结束下标同理,所以 `&a[2..a.len()]` 和 `&a[2..]` 是等价的。" #: src/references/slices.md -#, fuzzy msgid "" "To easily create a slice of the full array, we can therefore use `&a[..]`." -msgstr "因此,我们可以用 `&a[..]` 来创建包含整个数组的切片。" +msgstr "因此,要方便地创建覆盖整个数组的切片,可以用 `&a[..]`。" #: src/references/slices.md -#, fuzzy 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 " "computation on slices of different sizes." msgstr "" -"切片会从另外一个对象中借用数据。在这个例子中, `a` 必须在其切片存活时保持存活" -"(处于作用域中)。" +"`s` 是一个指向 `i32` 切片的引用。请注意,`s` 的类型(`&[i32]`)里不再提到数" +"组长度,这让我们可以对不同大小的切片做运算。" #: src/references/slices.md -#, fuzzy 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[3]` 的问题可能会引发精彩的讨论。正确答案是:为了保证内存安全,在" -"创建切片后,我们不能通过 `a` 来修改数据。不过我们可以通过 `a` 或者 `s` 来读取" -"数据。我们将会在“借用”章节着重介绍这个内容。" +"切片总是从另一个对象借用数据。在这个例子中,`a` 至少要在切片存活期间保持“存" +"活”(处于作用域中)。" #: src/references/slices.md -#, fuzzy 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` at " @@ -4204,10 +4119,9 @@ msgid "" "safely. It works before you created the slice, and again after the " "`println`, when the slice is no longer used." msgstr "" -"关于修改“a\\[3\\]”的问题可能会引发一些有趣的讨论,但正解是,出于内存安全方面" -"的原因,您无法在执行作业的这个时间点通过“a”来进行此修改,但可以从“a”和“s”安全" -"地读取数据。它会在您创建 Slice 之前运作,在“println”之后(不再使用 Slice 时)" -"再次运作。更多详情会在“借用检查器”部分中加以说明。" +"关于修改 `a[3]` 的问题可以引出一场有趣的讨论。答案是:出于内存安全的原因,执" +"行到这里时你不能通过 `a` 修改它,但可以安全地从 `a` 和 `s` 读取数据。在创建" +"切片之前可以修改,在 `println` 之后(切片不再被使用时)也可以。" #: src/references/strings.md msgid "We can now understand the two string types in Rust:" @@ -4215,14 +4129,13 @@ msgstr "现在我们就可以理解 Rust 中的两种字符串类型:" #: src/references/strings.md msgid "`&str` is a slice of UTF-8 encoded bytes, similar to `&[u8]`." -msgstr "" +msgstr "`&str` 是一段 UTF-8 编码字节的切片,类似于 `&[u8]`。" #: src/references/strings.md msgid "`String` is an owned, heap-allocated buffer of UTF-8 bytes." -msgstr "" +msgstr "`String` 是一个拥有所有权的、在堆上分配的 UTF-8 字节缓冲区。" #: src/references/strings.md src/std-traits/read-and-write.md -#, fuzzy msgid "\"World\"" msgstr "\"World\"" @@ -4231,9 +4144,8 @@ msgid "\"s1: {s1}\"" msgstr "\"s1: {s1}\"" #: src/references/strings.md -#, fuzzy msgid "\"Hello \"" -msgstr "b\"hello\"" +msgstr "\"Hello \"" #: src/references/strings.md src/memory-management/move.md msgid "\"s2: {s2}\"" @@ -4244,17 +4156,15 @@ msgid "\"s3: {s3}\"" msgstr "\"s3: {s3}\"" #: src/references/strings.md -#, fuzzy msgid "" "`&str` introduces a string slice, which is an immutable reference to UTF-8 " "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/references/strings.md -#, fuzzy msgid "" "Rust's `String` type is a wrapper around a vector of bytes. As with a " "`Vec`, it is owned." @@ -4263,18 +4173,16 @@ msgstr "" "权的。" #: src/references/strings.md -#, fuzzy msgid "" "As with many other types `String::from()` creates a string from a string " "literal; `String::new()` creates a new empty string, to which string data " "can be added using the `push()` and `push_str()` methods." msgstr "" -"和其他类型一样,`String::from()` 会从字符串字面量创建一个字符串;`String::" -"new()` 会创建一个新的空字符串, 之后可以使用 `push()` 和 `push_str()` 方法" -"向其中添加字符串数据。" +"和许多其他类型一样,`String::from()` 会从字符串字面量创建一个字符串;" +"`String::new()` 会创建一个新的空字符串,之后可以用 `push()` 和 `push_str()` " +"方法向其中添加字符串数据。" #: src/references/strings.md -#, fuzzy msgid "" "The `format!()` macro is a convenient way to generate an owned string from " "dynamic values. It accepts the same format specification as `println!()`." @@ -4283,34 +4191,30 @@ msgstr "" "同的格式规范。" #: src/references/strings.md -#, fuzzy msgid "" "You can borrow `&str` slices from `String` via `&` and optionally range " "selection. If you select a byte range that is not aligned to character " "boundaries, the expression will panic. The `chars` iterator iterates over " "characters and is preferred over trying to get character boundaries right." msgstr "" -"您可以通过 `&` 和范围选择(可选)来从 `String` 借用 `&str` slice。如果选择的" -"字节范围未与字符边界对齐,则表达式会 panic。`chars` 迭代器会迭代字符,比尝试" -"正确获取字符边界更为推荐。" +"你可以通过 `&`(以及可选的范围选择)从 `String` 借用 `&str` 切片。如果所选的" +"字节范围没有对齐到字符边界,表达式会 panic。`chars` 迭代器按字符迭代,比自己" +"去算准字符边界更值得推荐。" #: src/references/strings.md -#, fuzzy msgid "" "For C++ programmers: think of `&str` as `std::string_view` from C++, but the " "one that always points to a valid string in memory. Rust `String` is a rough " "equivalent of `std::string` from C++ (main difference: it can only contain " "UTF-8 encoded bytes and will never use a small-string optimization)." msgstr "" -"对于 C++ 程序员:可以把 `&str` 当作 C++ 中的 `const char*`,但是它总是指向内" -"存中的一个有效字符串。 Rust 的 `String` 大致相当于 C++ 中 `std::string` " -"(主要区别:它只能包含 UTF-8 编码的字节, 并且永远不会使用小字符串优化" -"(small-string optimization))。" +"对 C++ 程序员:可以把 `&str` 想成 C++ 的 `std::string_view`,只不过它总是指" +"向内存中一个有效的字符串。Rust 的 `String` 大致相当于 C++ 的 `std::string`(" +"主要区别:它只能包含 UTF-8 编码的字节,而且永远不会使用小字符串优化)。" #: src/references/strings.md -#, fuzzy msgid "Byte strings literals allow you to create a `&[u8]` value directly:" -msgstr "字节串可以用于直接创建 `&[u8]` 类型的值:" +msgstr "字节字符串字面量让你可以直接创建 `&[u8]` 类型的值:" #: src/references/strings.md msgid "" @@ -4327,42 +4231,42 @@ msgid "" "representing a point as `[f64;3]`. It is up to you to determine the function " "signatures." msgstr "" -"我们将为三维几何图形创建几个实用函数,将点表示为 `[f64;3]`。函数签名由您自行" +"我们将为三维几何图形创建几个实用函数,将点表示为 `[f64;3]`。函数签名由你自行" "确定。" #: src/references/exercise.md -#, fuzzy msgid "" "// Calculate the magnitude of a vector by summing the squares of its " "coordinates" -msgstr "/// Calculate the magnitude of the given vector.\n" +msgstr "" +"// Calculate the magnitude of a vector by summing the squares of its " +"coordinates" #: src/references/exercise.md msgid "" "// and taking the square root. Use the `sqrt()` method to calculate the " "square" msgstr "" +"// and taking the square root. Use the `sqrt()` method to calculate the " +"square" #: src/references/exercise.md msgid "// root, like `v.sqrt()`." -msgstr "" +msgstr "// root, like `v.sqrt()`." #: src/references/exercise.md -#, fuzzy msgid "" "// Normalize a vector by calculating its magnitude and dividing all of its" msgstr "" -"// Normalize a vector by calculating its magnitude and dividing all of its\n" -"// coordinates by that magnitude.\n" +"// Normalize a vector by calculating its magnitude and dividing all of its" #: src/references/exercise.md msgid "// coordinates by that magnitude." -msgstr "" +msgstr "// coordinates by that magnitude." #: src/references/exercise.md -#, fuzzy msgid "// Use the following `main` to test your work." -msgstr "// Use the following `main` to test your work.\n" +msgstr "// Use the following `main` to test your work." #: src/references/exercise.md src/references/solution.md msgid "\"Magnitude of a unit vector: {}\"" @@ -4390,34 +4294,33 @@ msgstr "" #: src/user-defined-types.md msgid "[Named Structs](./user-defined-types/named-structs.md) (10 minutes)" -msgstr "" +msgstr "[结构体](./user-defined-types/named-structs.md)(10 分钟)" #: src/user-defined-types.md msgid "[Tuple Structs](./user-defined-types/tuple-structs.md) (10 minutes)" -msgstr "" +msgstr "[元组结构体](./user-defined-types/tuple-structs.md)(10 分钟)" #: src/user-defined-types.md msgid "[Enums](./user-defined-types/enums.md) (5 minutes)" -msgstr "" +msgstr "[枚举](./user-defined-types/enums.md)(5 分钟)" #: src/user-defined-types.md -#, fuzzy msgid "[Static](./user-defined-types/static.md) (5 minutes)" -msgstr "[用户定义的类型](../user-defined-types.md)(50 分钟)" +msgstr "[静态变量](./user-defined-types/static.md)(5 分钟)" #: src/user-defined-types.md msgid "[Type Aliases](./user-defined-types/aliases.md) (2 minutes)" -msgstr "" +msgstr "[类型别名](./user-defined-types/aliases.md)(2 分钟)" #: src/user-defined-types.md msgid "" "[Exercise: Elevator Events](./user-defined-types/exercise.md) (15 minutes)" -msgstr "" +msgstr "[练习:电梯事件](./user-defined-types/exercise.md)(15 分钟)" #: src/user-defined-types.md src/methods-and-traits.md src/borrowing.md #: src/lifetimes.md msgid "This segment should take about 50 minutes" -msgstr "" +msgstr "本节大约需要 50 分钟" #: src/user-defined-types/named-structs.md msgid "Like C and C++, Rust has support for custom structs:" @@ -4458,21 +4361,19 @@ msgid "Unlike in C++, there is no inheritance between structs." msgstr "与使用 C++ 不同的是,结构体之间没有继承关系。" #: src/user-defined-types/named-structs.md -#, fuzzy msgid "" "This may be a good time to let people know there are different types of " "structs." msgstr "这时可能很适合告诉学员存在不同类型的结构体。" #: src/user-defined-types/named-structs.md -#, fuzzy 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 "" -"针对某类型实现 trait 时,可能会使用大小为零的结构体 `e.g., struct Foo;`,但其" -"中没有任何您要储存在值本身中的数据。" +"当你要为某个类型实现特征、但又没有任何数据需要存进值本身时,可以使用零大小的" +"结构体(例如 `struct Foo;`)。" #: src/user-defined-types/named-structs.md msgid "" @@ -4481,25 +4382,23 @@ msgid "" msgstr "下一张幻灯片将介绍元组结构体,当字段名称不重要时使用。" #: src/user-defined-types/named-structs.md -#, fuzzy msgid "" "If you already have variables with the right names, then you can create the " "struct using a shorthand." -msgstr "如果您已有名称正确的变量,则可以使用简写形式创建结构体:" +msgstr "如果你已经有了名字正好对应的变量,就可以用简写形式创建结构体。" #: src/user-defined-types/named-structs.md -#, fuzzy msgid "" "The syntax `..avery` 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 " "the last element." msgstr "" -"通过语法“..peter”,我们可以从旧结构体复制大部分字段,而无需明确地输入所有字" -"段。它必须始终是最后一个元素。" +"`..avery` 语法让我们可以从旧结构体复制大部分字段,而不必把它们全部显式写出来" +"。它必须始终是最后一个元素。" #: src/user-defined-types/tuple-structs.md msgid "If the field names are unimportant, you can use a tuple struct:" -msgstr "如果字段名称不重要,您可以使用元组结构体:" +msgstr "如果字段名称不重要,你可以使用元组结构体:" #: src/user-defined-types/tuple-structs.md msgid "\"({}, {})\"" @@ -4516,9 +4415,8 @@ msgstr "\"Ask a rocket scientist at NASA\"" #: src/user-defined-types/tuple-structs.md #: src/android/interoperability/cpp/cpp-bridge.md #: src/async/pitfalls/cancellation.md -#, fuzzy msgid "// ..." -msgstr "// ...\n" +msgstr "// ..." #: src/user-defined-types/tuple-structs.md msgid "" @@ -4533,12 +4431,11 @@ msgid "The number is measured in some units: `Newtons` in the example above." msgstr "数字会以某些单位来衡量:上方示例中为 `Newtons`。" #: src/user-defined-types/tuple-structs.md -#, fuzzy 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)`。" #: src/user-defined-types/tuple-structs.md @@ -4574,52 +4471,47 @@ msgid "" msgstr "`enum` 关键字允许创建具有几个 不同变体的类型:" #: src/user-defined-types/enums.md -#, fuzzy msgid "// Simple variant" -msgstr "// Simple variant\n" +msgstr "// Simple variant" #: src/user-defined-types/enums.md -#, fuzzy msgid "// Tuple variant" -msgstr "// Tuple variant\n" +msgstr "// Tuple variant" #: src/user-defined-types/enums.md -#, fuzzy msgid "// Struct variant" -msgstr "// Struct variant\n" +msgstr "// Struct variant" #: src/user-defined-types/enums.md msgid "\"On this turn: {:?}\"" msgstr "\"On this turn: {:?}\"" #: src/user-defined-types/enums.md -#, fuzzy msgid "Enumerations allow you to collect a set of values under one type." -msgstr "枚举允许你从一种类型下收集一组值" +msgstr "枚举让你可以把一组值归拢到同一个类型之下。" #: src/user-defined-types/enums.md msgid "" "`Direction` is a type with variants. There are two values of `Direction`: " "`Direction::Left` and `Direction::Right`." msgstr "" +"`Direction` 是一个带变体的类型。`Direction` 有两个值:`Direction::Left` 和 " +"`Direction::Right`。" #: src/user-defined-types/enums.md -#, 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 还会存储判别标识,以便在运行时确定值中" -"包含哪个变体。" +"`PlayerMove` 是一个有三个变体的类型。除了载荷之外,Rust 还会存储一个判别值," +"以便在运行时知道某个 `PlayerMove` 值里装的是哪个变体。" #: src/user-defined-types/enums.md -#, fuzzy msgid "This might be a good time to compare structs and enums:" msgstr "这可能是比较结构体和枚举的好时机:" #: src/user-defined-types/enums.md -#, fuzzy msgid "" "In both, you can have a simple version without fields (unit struct) or one " "with different types of fields (variant payloads)." @@ -4628,14 +4520,13 @@ msgstr "" "型字段的版本(变体载荷)。" #: src/user-defined-types/enums.md -#, fuzzy 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 "" -"你甚至可以使用单独的结构体实现枚举的不同变体,但这样一来,如果它们都已在枚举" -"中定义,类型与之前也不一样。" +"你甚至可以用一个个独立的结构体来实现枚举的各个变体,但那样它们就不会像全部定" +"义在一个枚举里时那样属于同一个类型。" #: src/user-defined-types/enums.md msgid "Rust uses minimal space to store the discriminant." @@ -4657,19 +4548,16 @@ msgstr "" "`None` 变体的 `NULL` 值。" #: src/user-defined-types/enums.md -#, fuzzy msgid "" "You can control the discriminant if needed (e.g., for compatibility with C):" -msgstr "你可以根据需要控制判别(例如,与 C 的兼容性):" +msgstr "如果需要,你可以控制判别值(例如为了与 C 兼容):" #: src/user-defined-types/enums.md -#, fuzzy msgid "" "Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " "bytes." msgstr "" -"如果不使用 `repr`,判别类型会占用 2 个字节,因为 10001 是一个 2 个字节的数" -"值。" +"不使用 `repr` 时,判别值的类型占 2 个字节,因为 10001 正好放得进 2 个字节。" #: src/user-defined-types/enums.md src/user-defined-types/static.md #: src/memory-management/review.md src/memory-management/move.md @@ -4684,25 +4572,23 @@ msgid "" msgstr "Rust 具有多种优化措施,可以减少枚举占用的空间。" #: src/user-defined-types/enums.md -#, fuzzy msgid "" "Null pointer optimization: For [some types](https://doc.rust-lang.org/std/" "option/#representation), Rust guarantees that `size_of::()` equals " "`size_of::>()`." msgstr "" -"Null 指针优化:对于[某些 类型](https://doc.rust-lang.org/std/option/" -"#representation),Rust 保证 `size_of::()` 等效于 `size_of::" -">()`。" +"空指针优化:对于[某些类型" +"](https://doc.rust-lang.org/std/option/#representation),Rust 保证 " +"`size_of::()` 等于 `size_of::>()`。" #: src/user-defined-types/enums.md -#, fuzzy 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 "" -"如果你想展示位表示方式在实践中“可能”会是什么样子,请参考示例代码。 请务必注" -"意,编译器对此表示法不提供任何保证,因此这是完全不安全的。" +"如果你想展示位表示在实践中 _可能_ 是什么样子,可以参考这段示例代码。请务必注" +"意,编译器对这种表示不提供任何保证,因此这样做完全是不安全的。" #: src/user-defined-types/static.md msgid "`static`" @@ -4715,16 +4601,14 @@ msgid "" msgstr "静态变量在程序的整个执行过程中始终有效,因此不会移动:" #: src/user-defined-types/static.md -#, fuzzy msgid "\"Welcome to RustOS 3.14\"" -msgstr "欢迎来到第一天" +msgstr "\"Welcome to RustOS 3.14\"" #: src/user-defined-types/static.md msgid "\"{BANNER}\"" msgstr "\"{BANNER}\"" #: src/user-defined-types/static.md -#, fuzzy 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 " @@ -4733,53 +4617,47 @@ msgid "" "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) 中所述,这些变量在使用时并不是内联的,而且还具有实际相关联的内存位置。" -"这对于不安全的嵌入式代码是有用的,并且这些变量存在于整个程序的执行过程之中。" +"正如 [Rust RFC " +"Book](https://rust-lang.github.io/rfcs/0246-const-vs-static.html) 所述,这类" +"变量在使用时不会被内联,而且有一个实际关联的内存位置。这对不安全代码和嵌入式" +"代码很有用,并且该变量在整个程序执行期间都存在。当一个全局作用域的值并没有理" +"由需要对象标识时,通常更推荐使用 `const`。" #: src/user-defined-types/static.md -#, fuzzy msgid "`static` is similar to mutable global variables in C++." -msgstr "另一方面,`static` 远远更类似于C++中的 `const` 或可改变的全局变量。" +msgstr "`static` 类似于 C++ 中的可变全局变量。" #: src/user-defined-types/static.md -#, fuzzy msgid "" "`static` provides object identity: an address in memory and state as " "required by types with interior mutability such as `Mutex`." msgstr "" -"“static”提供对象标识:内存中的一个地址及具有内部可变性的类型(如“Mutex\n" -"\n" -"”)所需的状态。" +"`static` 提供对象标识:一个内存地址,以及 `Mutex` 这类具有内部可变性的类" +"型所需要的状态。" #: src/user-defined-types/static.md -#, fuzzy 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." msgstr "" -"由于“static”变量可从任何线程访问,因此它们必须是“Sync”。内部可变性可通过[“互" -"斥量”](https://doc.rust-lang.org/std/sync/struct.Mutex.html)、原子性或类似对" -"象实现。也可能具有可变静态项,但它们需要手动同步,因此对它们的任何访问都需" -"要“unsafe”代码。我们将在“不安全 Rust”章节中探讨[可变静态项](../unsafe/" -"mutable-static-variables.md)。" +"由于 `static` 变量可以从任何线程访问,它们必须是 `Sync` 的。内部可变性可以通" +"过 [`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)、原子类型" +"或类似机制实现。" #: src/user-defined-types/static.md -#, fuzzy msgid "Thread-local data can be created with the macro `std::thread_local`." -msgstr "可以使用宏“std::thread_local”创建“thread_local”数据。" +msgstr "线程局部数据可以用宏 `std::thread_local` 创建。" #: src/user-defined-types/const.md msgid "`const`" msgstr "`const`" #: src/user-defined-types/const.md -#, fuzzy msgid "" "Constants are evaluated at compile time and their values are inlined " "wherever they are used:" -msgstr "系统会在编译时对常量变量进行求值;无论在何处使用,其值都会被内嵌:" +msgstr "常量在编译期求值,其值会在所有使用处被内联:" #: src/user-defined-types/const.md msgid "" @@ -4794,13 +4672,12 @@ 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”函数。" +"在编译时只能调用标记为`const`的函数以生成`const`值。不过,可在运行时调用" +"`const`函数。" #: src/user-defined-types/const.md -#, fuzzy msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`" -msgstr "值得一提的是,`const` 在语义上与C++的 `constexpr` 类似。" +msgstr "可以提一下,`const` 在语义上类似于 C++ 的 `constexpr`" #: src/user-defined-types/const.md msgid "" @@ -4817,9 +4694,8 @@ msgid "" msgstr "类型别名为另一种类型创建名称。这两种类型可以互换使用。" #: src/user-defined-types/aliases.md -#, fuzzy msgid "// Aliases are more useful with long, complex types:" -msgstr "// Aliases are more useful with long, complex types:\n" +msgstr "// Aliases are more useful with long, complex types:" #: src/user-defined-types/aliases.md msgid "C programmers will recognize this as similar to a `typedef`." @@ -4832,17 +4708,17 @@ msgid "" "various events. Use `#[derive(Debug)]` to allow the types to be formatted " "with `{:?}`." msgstr "" -"我们将创建一个数据结构来表示电梯控制系统中的事件。您可以自行定义用于构造各种" +"我们将创建一个数据结构来表示电梯控制系统中的事件。你可以自行定义用于构造各种" "事件的类型和函数。使用 `#[derive(Debug)]` 以允许通过 `{:?}` 设置类型格式。" #: src/user-defined-types/exercise.md -#, 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 "" -"此次练习只需创建数据结构。本课程的下一部分将介绍如何从这些结构中获取数据。" +"本练习只需要创建并填充数据结构,让 `main` 能够无错运行。课程的下一部分会介绍" +"如何从这些结构中取出数据。" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "" @@ -4851,9 +4727,8 @@ msgstr "" "/// An event in the elevator system that the controller must react to.\n" #: src/user-defined-types/exercise.md -#, fuzzy msgid "// TODO: add required variants" -msgstr "// Tuple variant\n" +msgstr "// TODO: add required variants" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// A direction of travel.\n" @@ -4944,16 +4819,14 @@ msgid "Welcome to Day 2" msgstr "欢迎来到第二天" #: src/welcome-day-2.md -#, fuzzy msgid "" "Now that we have seen a fair amount of Rust, today will focus on Rust's type " "system:" -msgstr "现在我们已经了解了相当多的Rust,接下来我们将学习:" +msgstr "我们已经见识了相当多的 Rust,今天将聚焦于 Rust 的类型系统:" #: src/welcome-day-2.md -#, fuzzy msgid "Pattern matching: extracting data from structures." -msgstr "模式匹配:解构枚举、结构体和数组(array)。" +msgstr "模式匹配:从结构中提取数据。" #: src/welcome-day-2.md msgid "Methods: associating functions with types." @@ -4974,59 +4847,55 @@ msgstr "标准库类型和特征:探索 Rust 丰富的标准库。" #: src/welcome-day-2.md msgid "[Welcome](./welcome-day-2.md) (3 minutes)" -msgstr "" +msgstr "[欢迎](./welcome-day-2.md)(3 分钟)" #: src/welcome-day-2.md -#, fuzzy msgid "[Pattern Matching](./pattern-matching.md) (1 hour)" -msgstr "如需详细了解 Rust 中的模式,请参阅[模式匹配](../pattern-matching.md)。" +msgstr "[模式匹配](./pattern-matching.md)(1 小时)" #: src/welcome-day-2.md -#, fuzzy msgid "[Methods and Traits](./methods-and-traits.md) (50 minutes)" -msgstr "[方法和特征](../methods-and-traits.md)(45 分钟)" +msgstr "[方法和特征](./methods-and-traits.md)(50 分钟)" #: src/welcome-day-2.md msgid "[Generics](./generics.md) (40 minutes)" -msgstr "" +msgstr "[泛型](./generics.md)(40 分钟)" #: src/welcome-day-2.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 55 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 55 分钟" #: src/pattern-matching.md -#, fuzzy msgid "[Matching Values](./pattern-matching/match.md) (10 minutes)" -msgstr "如需详细了解 Rust 中的模式,请参阅[模式匹配](../pattern-matching.md)。" +msgstr "[匹配值](./pattern-matching/match.md)(10 分钟)" #: src/pattern-matching.md msgid "[Destructuring](./pattern-matching/destructuring.md) (10 minutes)" -msgstr "" +msgstr "[解构](./pattern-matching/destructuring.md)(10 分钟)" #: src/pattern-matching.md msgid "[Let Control Flow](./pattern-matching/let-control-flow.md) (10 minutes)" -msgstr "" +msgstr "[`let` 控制流](./pattern-matching/let-control-flow.md)(10 分钟)" #: src/pattern-matching.md msgid "" "[Exercise: Expression Evaluation](./pattern-matching/exercise.md) (30 " "minutes)" -msgstr "" +msgstr "[练习:表达式求值](./pattern-matching/exercise.md)(30 分钟)" #: src/pattern-matching.md src/memory-management.md msgid "This segment should take about 1 hour" -msgstr "" +msgstr "本节大约需要 1 小时" #: src/pattern-matching/match.md -#, fuzzy msgid "" "The `match` keyword lets you match a value against one or more _patterns_. " "The comparisons are done from top to bottom and the first match wins." msgstr "" -"使用关键词 `match` 对一个值进行模式匹配。进行匹配时,会从上至下依次进行比较," -"并选定第一个匹配成功的结果。" +"`match` 关键字让你可以把一个值与一个或多个 _模式_ 进行匹配。比较从上到下依次" +"进行,第一个匹配成功的胜出。" #: src/pattern-matching/match.md msgid "The patterns can be simple values, similarly to `switch` in C and C++:" @@ -5041,7 +4910,6 @@ msgid "'q'" msgstr "'q'" #: src/pattern-matching/match.md -#, fuzzy msgid "\"Quitting\"" msgstr "\"Quitting\"" @@ -5090,24 +4958,23 @@ msgid "\"Something else\"" msgstr "\"Something else\"" #: src/pattern-matching/match.md -#, fuzzy msgid "" "The `_` pattern is a wildcard pattern which matches any value. The " "expressions _must_ be exhaustive, meaning that it covers every possibility, " "so `_` is often used as the final catch-all case." msgstr "" -"`_` 模式是与任何值匹配的通配符模式。表达式 _必须_ 不可反驳,即其涵盖了所有可" -"能性,因此通常将 `_` 用作最终的万能符。" +"`_` 模式是能匹配任何值的通配符模式。表达式 _必须_ 是穷尽的,也就是要覆盖所有" +"可能,因此 `_` 常被用作最后的兜底分支。" #: src/pattern-matching/match.md -#, fuzzy msgid "" "Match can be used as an expression. Just like `if`, 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 `()`." msgstr "" -"与 `if let` 类似,每个匹配分支必须有相同的类型。该类型是块的最后一个 表达式" -"(如有)。在上例中,类型是 `()`。" +"`match` 可以当作表达式使用。和 `if` 一样,每个匹配分支必须具有相同的类型。该" +"类型是代码块中最后一个表达式的类型(如果有的话)。在上面的例子中,类型是 " +"`()`。" #: src/pattern-matching/match.md msgid "" @@ -5120,32 +4987,22 @@ msgid "A match guard causes the arm to match only if the condition is true." msgstr "只有当条件为真时,保护语句才能使分支匹配成功。" #: src/pattern-matching/match.md -#, fuzzy msgid "" "You might point out how some specific characters are being used when in a " "pattern" -msgstr "" -"你可以解释一些用于表达模式的特殊字符的用法 \\*`|` 表示或 (or) \\*`..` 可以展" -"开为任意一个或多个值 \\*`1..=5` 代表了一个闭区间范围" +msgstr "你可以指出模式中一些特殊字符的用法" #: src/pattern-matching/match.md -#, fuzzy msgid "`|` as an `or`" -msgstr "" -"解释模式匹配中的绑定的原理可能会很有帮助。比如可以用一个变量替代外卡,或者去" -"除 `q` 外面的引号。" +msgstr "`|` 表示“或”" #: src/pattern-matching/match.md -#, fuzzy msgid "`..` can expand as much as it needs to be" -msgstr "你可以展示如何匹配一个引用。" +msgstr "`..` 可以按需展开任意多的内容" #: src/pattern-matching/match.md -#, fuzzy msgid "`1..=5` represents an inclusive range" -msgstr "" -"现在是一个讲解不可反驳 (irrefutable) 模式的好时机。因为这个术语可能会出现在错" -"误信息中。" +msgstr "`1..=5` 表示一个闭区间" #: src/pattern-matching/match.md msgid "`_` is a wild card" @@ -5167,15 +5024,15 @@ msgid "" "match arm is selected. Failing the `if` condition inside of that block won't " "result in other arms of the original `match` expression being considered." msgstr "" -"它们与匹配分支中的单独“if”表达式不同。选择匹配分支后,分支块内(在“=>”之后)" -"会出现“if”表达式。如果该分支块内的“if”条件失败,系统不会考虑原始“match”表达式" -"的其他分支。" +"它们与匹配分支中的单独`if`表达式不同。选择匹配分支后,分支块内(在`=>`之后)" +"会出现`if`表达式。如果该分支块内的`if`条件失败,系统不会考虑原始`match`表达" +"式的其他分支。" #: src/pattern-matching/match.md msgid "" "The condition defined in the guard applies to every expression in a pattern " "with an `|`." -msgstr "只要表达式在包含“|”的模式中,就会适用守卫定义的条件。" +msgstr "只要表达式在包含`|`的模式中,就会适用守卫定义的条件。" #: src/pattern-matching/destructuring.md msgid "Like tuples, structs and enums can also be destructured by matching:" @@ -5203,8 +5060,8 @@ msgid "" "how you inspect the structure of your types. Let us start with a simple " "`enum` type:" msgstr "" -"模式还可用于将变量绑定到值的某些部分。这是您检查类型结构的方式。我们先从简单" -"的“enum”类型开始:" +"模式还可用于将变量绑定到值的某些部分。这是你检查类型结构的方式。我们先从简单" +"的`enum`类型开始:" #: src/pattern-matching/destructuring.md msgid "\"cannot divide {n} into two equal parts\"" @@ -5224,16 +5081,16 @@ msgid "" "arm, `half` is bound to the value inside the `Ok` variant. In the second " "arm, `msg` is bound to the error message." msgstr "" -"在这里,我们使用了分支来解构“Result”值。在第一个分支中,“half”被绑定到“Ok”变" -"体中的值。在第二个分支中,“msg”被绑定到错误消息。" +"在这里,我们使用了分支来解构`Result`值。在第一个分支中,`half`被绑定到`Ok`变" +"体中的值。在第二个分支中,`msg`被绑定到错误消息。" #: src/pattern-matching/destructuring.md msgid "Change the literal values in `foo` to match with the other patterns." -msgstr "更改“foo”中的字面量值以与其他模式相匹配。" +msgstr "更改`foo`中的字面量值以与其他模式相匹配。" #: src/pattern-matching/destructuring.md msgid "Add a new field to `Foo` and make changes to the pattern as needed." -msgstr "向“Foo”添加一个新字段,并根据需要更改模式。" +msgstr "向`Foo`添加一个新字段,并根据需要更改模式。" #: src/pattern-matching/destructuring.md msgid "" @@ -5241,14 +5098,14 @@ msgid "" "spot. Try changing the `2` in the second arm to a variable, and see that it " "subtly doesn't work. Change it to a `const` and see it working again." msgstr "" -"捕获和常量表达式之间的区别可能很难发现。尝试将第二个分支中的“2”更改为一个变" -"量,可以看到它几乎无法运作了。将它更改为“const”,可以看到它又正常运作了。" +"捕获和常量表达式之间的区别可能很难发现。尝试将第二个分支中的`2`更改为一个变" +"量,可以看到它几乎无法运作了。将它更改为`const`,可以看到它又正常运作了。" #: src/pattern-matching/destructuring.md msgid "" "The `if`/`else` expression is returning an enum that is later unpacked with " "a `match`." -msgstr "“if”/“else”表达式将返回一个枚举,该枚举之后会使用“match”进行解封装。" +msgstr "`if`/`else`表达式将返回一个枚举,该枚举之后会使用`match`进行解封装。" #: src/pattern-matching/destructuring.md msgid "" @@ -5256,26 +5113,22 @@ msgid "" "errors when running the code. Point out the places where your code is now " "inexhaustive and how the compiler tries to give you hints." msgstr "" -"您可以尝试在枚举定义中添加第三个变体,并在运行代码时显示错误。指出代码现在有" +"你可以尝试在枚举定义中添加第三个变体,并在运行代码时显示错误。指出代码现在有" "哪些地方还不详尽,并说明编译器会如何尝试给予提示。" #: src/pattern-matching/destructuring.md -#, fuzzy msgid "" "The values in the enum variants can only be accessed after being pattern " "matched." -msgstr "" -"枚举变体中的值只有在被模式匹配后,才可访问。模式将引用绑定到 `=>` 之后" -"的“match 分支”中的字段。" +msgstr "枚举变体中的值只有在经过模式匹配之后才能访问。" #: src/pattern-matching/destructuring.md -#, fuzzy msgid "" "Demonstrate what happens when the search is inexhaustive. Note the advantage " "the Rust compiler provides by confirming when all cases are handled." msgstr "" -"展示搜索不详尽时会发生的情况。请注意 Rust 编译器的优势,即确认所有情况何时都" -"得到了处理。" +"演示匹配不穷尽时会发生什么。请留意 Rust 编译器带来的好处:它会确认所有情况都" +"已被处理。" #: src/pattern-matching/destructuring.md msgid "" @@ -5286,6 +5139,11 @@ msgid "" "io/rfcs/2005-match-ergonomics.html) appeared in Rust 2018. If you want to " "support older Rust, replace `msg` with `ref msg` in the pattern." msgstr "" +"把 `divide_in_two` 的结果保存到 `result` 变量里,然后在循环中对它做 `match`" +"。这样无法编译,因为 `msg` 在匹配时被消耗了。要修复它,就对 `&result` 而不是" +" `result` 做匹配,这样 `msg` 会变成引用,就不会被消耗。这种[“匹配人体工学”" +"](https://rust-lang.github.io/rfcs/2005-match-ergonomics.html)出现在 Rust " +"2018 中。如果你想支持更老的 Rust,可以在模式中把 `msg` 换成 `ref msg`。" #: src/pattern-matching/let-control-flow.md msgid "" @@ -5298,9 +5156,8 @@ msgid "`if let` expressions" msgstr "`if let` 表达式" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "`while let` expressions" -msgstr "while let 表达式" +msgstr "`while let` 表达式" #: src/pattern-matching/let-control-flow.md msgid "`match` expressions" @@ -5320,9 +5177,8 @@ msgid "\"slept for {:?}\"" msgstr "\"slept for {:?}\"" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "`let else` expressions" -msgstr "while let 表达式" +msgstr "`let else` 表达式" #: src/pattern-matching/let-control-flow.md msgid "" @@ -5341,7 +5197,6 @@ msgid "\"got None\"" msgstr "\"got None\"" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "\"got empty string\"" msgstr "\"got empty string\"" @@ -5370,28 +5225,27 @@ msgstr "" "试一个值:" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "" "Here [`String::pop`](https://doc.rust-lang.org/stable/std/string/struct." "String.html#method.pop) returns `Some(c)` until the string is empty, after " "which it will return `None`. The `while let` lets us keep iterating through " "all items." msgstr "" -"在这里,每次 调用 `next()` 时,`v.iter()` 返回的迭代器都会返回一个 " -"`Option`。它将一直返回 `Some(x)`,直到完成。 之后它将返回 `None`。" -"`while let`能让我们持续迭代所有项。" +"这里的 " +"[`String::pop`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.pop) " +"会一直返回 `Some(c)`,直到字符串为空,之后返回 `None`。`while let` 让我们可" +"以持续迭代所有元素。" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "if-let" msgstr "if-let" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "" "Unlike `match`, `if let` does not have to cover all branches. This can make " "it more concise than `match`." -msgstr "与 `match` 不同的是,`if let` 不支持模式匹配的 guard 子句。" +msgstr "" +"与 `match` 不同,`if let` 不必覆盖所有分支。这可以让它比 `match` 更简洁。" #: src/pattern-matching/let-control-flow.md msgid "A common usage is handling `Some` values when working with `Option`." @@ -5407,21 +5261,19 @@ msgid "let-else" msgstr "let-else" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "" "`if-let`s can pile up, as shown. The `let-else` construct supports " "flattening this nested code. Rewrite the awkward version for students, so " "they can see the transformation." msgstr "" -"`if-let` 可以堆叠使用,如下所示。`let-else` 结构支持展平此嵌套代码。将不通顺" -"的版本重写,以便学生们能够理解其中的变化。" +"`if-let` 可以像这样层层堆叠。`let-else` 结构可以把这种嵌套代码展平。请当着学" +"员的面把别扭的那版改写一遍,让他们看到转换过程。" #: src/pattern-matching/let-control-flow.md msgid "The rewritten version is:" msgstr "重写后的版本为:" #: src/pattern-matching/let-control-flow.md -#, fuzzy msgid "while-let" msgstr "while-let" @@ -5432,34 +5284,30 @@ msgid "" msgstr "指出只要值与模式匹配,`while let` 循环就会一直进行下去。" #: src/pattern-matching/let-control-flow.md -#, fuzzy 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 `name.pop()`. The " "`while let` provides syntactic sugar for the above scenario." msgstr "" -"你可以使用 if 语句将 `while let` 循环重写为无限循环,当 `iter.next()` 没有值" -"可以解封时中断。`while let` 为上述情况提供了语法糖。" +"你可以把 `while let` 循环改写成一个无限循环,在其中用 if 语句判断 " +"`name.pop()` 没有值可解包时就 break。`while let` 为上述场景提供了语法糖。" #: src/pattern-matching/exercise.md -#, fuzzy msgid "Let's write a simple recursive evaluator for arithmetic expressions." -msgstr "为算术表达式编写一个简单的递归评估器。先从定义二进制操作的枚举开始:" +msgstr "我们来为算术表达式写一个简单的递归求值器。" #: src/pattern-matching/exercise.md -#, fuzzy msgid "" "The `Box` type here is a smart pointer, and will be covered in detail later " "in the course. An expression can be \"boxed\" with `Box::new` as seen in the " "tests. To evaluate a boxed expression, use the deref operator (`*`) to " "\"unbox\" it: `eval(*boxed_expr)`." msgstr "" -"这里的 `Box` 类型是智能指针,本课程稍后会详细介绍。可以使用 `Box::new` 对表达" -"式进行 “封装”操作,如测试中所示。如需对已封装的表达式求值,请使用 deref 运算" -"符将其 “解封装”:`eval(*boxed_expr)`。" +"这里的 `Box` 类型是智能指针,本课程稍后会详细介绍。如测试中所示,可以用 " +"`Box::new` 把表达式“装箱”。要对装箱后的表达式求值,请用解引用运算符(`*`)把" +"它“拆箱”:`eval(*boxed_expr)`。" #: src/pattern-matching/exercise.md -#, fuzzy msgid "" "Some expressions cannot be evaluated and will return an error. The standard " "[`Result`](https://doc.rust-lang.org/std/result/enum.Result." @@ -5467,8 +5315,10 @@ msgid "" "(`Ok(Value)`) or an error (`Err(String)`). We will cover this type in detail " "later." msgstr "" -"部分表达式无法求值,将返回错误。`Res` 类型表示有效值或错误消息。这与我们后面" -"将看到的标准库的“Result”非常类似。" +"有些表达式无法求值,会返回错误。标准的 [`Result`](https://doc.rust-lang.org/std/result/enum.Result.html) 类型是一个" +"枚举,表示要么是成功的值(`Ok(Value)`),要么是一个错误(`Err(String)`)。我" +"们稍后会详细介绍这个类型。" #: src/pattern-matching/exercise.md msgid "" @@ -5478,17 +5328,16 @@ msgid "" "temporarily with `#[ignore]`:" msgstr "" "将代码复制粘贴到 Rust Playground,然后开始实现 `eval`。最终结果应能通过测试。" -"使用 `todo!()` 并使测试逐个通过可能会很有帮助。您还可以使用 `#[ignore]` 暂时" +"使用 `todo!()` 并使测试逐个通过可能会很有帮助。你还可以使用 `#[ignore]` 暂时" "跳过测试:" #: src/pattern-matching/exercise.md -#, fuzzy msgid "" "If you finish early, try writing a test that results in division by zero or " "integer overflow. How could you handle this with `Result` instead of a panic?" msgstr "" -"如果提前完成测试,请尝试编写一项可导致被零除或整数溢出的测试。如何使用 `Res::" -"Err` 而非 panic 来应对这种情况?" +"如果你提前完成了,可以试着写一个会导致除以零或整数溢出的测试。要怎样用 " +"`Result` 而不是 panic 来处理这种情况?" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "/// An operation to perform on two subexpressions.\n" @@ -5516,45 +5365,38 @@ msgstr "\"expr: {:?}\"" #: src/methods-and-traits.md msgid "[Methods](./methods-and-traits/methods.md) (10 minutes)" -msgstr "" +msgstr "[方法](./methods-and-traits/methods.md)(10 分钟)" #: src/methods-and-traits.md -#, fuzzy msgid "[Traits](./methods-and-traits/traits.md) (15 minutes)" -msgstr "" -"如需详细了解 Rust 中 的模式,请参阅[模式匹配](../pattern-matching.md)。" +msgstr "[特征(Trait)](./methods-and-traits/traits.md)(15 分钟)" #: src/methods-and-traits.md -#, fuzzy msgid "[Deriving](./methods-and-traits/deriving.md) (3 minutes)" -msgstr "" -"如需详细了解 Rust 中 的模式,请参阅[模式匹配](../pattern-matching.md)。" +msgstr "[派生特征](./methods-and-traits/deriving.md)(3 分钟)" #: src/methods-and-traits.md msgid "" "[Exercise: Generic Logger](./methods-and-traits/exercise.md) (20 minutes)" -msgstr "" +msgstr "[练习:通用日志](./methods-and-traits/exercise.md)(20 分钟)" #: src/methods-and-traits/methods.md msgid "" "Rust allows you to associate functions with your new types. You do this with " "an `impl` block:" -msgstr "Rust 允许您将函数与新类型相关联。您可以使用“impl”块来执行此操作:" +msgstr "Rust 允许你将函数与新类型相关联。你可以使用`impl`块来执行此操作:" #: src/methods-and-traits/methods.md -#, fuzzy msgid "// No receiver, a static method" -msgstr "// No receiver, a static method\n" +msgstr "// No receiver, a static method" #: src/methods-and-traits/methods.md -#, fuzzy msgid "// Exclusive borrowed read-write access to self" -msgstr "// Exclusive borrowed read-write access to self\n" +msgstr "// Exclusive borrowed read-write access to self" #: src/methods-and-traits/methods.md -#, fuzzy msgid "// Shared and read-only borrowed access to self" -msgstr "// Shared and read-only borrowed access to self\n" +msgstr "// Shared and read-only borrowed access to self" #: src/methods-and-traits/methods.md msgid "\"Recorded {} laps for {}:\"" @@ -5565,9 +5407,8 @@ msgid "\"Lap {idx}: {lap} sec\"" msgstr "\"Lap {idx}: {lap} sec\"" #: src/methods-and-traits/methods.md -#, fuzzy msgid "// Exclusive ownership of self" -msgstr "// Exclusive ownership of self\n" +msgstr "// Exclusive ownership of self" #: src/methods-and-traits/methods.md msgid "\"Race {} is finished, total lap time: {}\"" @@ -5578,31 +5419,29 @@ msgid "\"Monaco Grand Prix\"" msgstr "\"Monaco Grand Prix\"" #: src/methods-and-traits/methods.md -#, fuzzy msgid "// race.add_lap(42);" -msgstr "// race.add_lap(42);\n" +msgstr "// race.add_lap(42);" #: src/methods-and-traits/methods.md -#, fuzzy msgid "" "The `self` arguments specify the \"receiver\" - the object the method acts " "on. There are several common receivers for a method:" msgstr "" -"上面的“&self”表明该方法以不可变的方式借用了对象。还有其他可能的方法接收器:" +"`self` 参数指定了“接收者”,也就是方法作用的对象。方法有几种常见的接收者:" #: src/methods-and-traits/methods.md msgid "" "`&self`: borrows the object from the caller using a shared and immutable " "reference. The object can be used again afterwards." msgstr "" -"“&self”:使用不可变的共享引用从调用方借用对象。之后可以再次使用该对象。" +"`&self`:使用不可变的共享引用从调用方借用对象。之后可以再次使用该对象。" #: src/methods-and-traits/methods.md msgid "" "`&mut self`: borrows the object from the caller using a unique and mutable " "reference. The object can be used again afterwards." msgstr "" -"“&mut self”:使用唯一的可变引用从调用方借用对象。之后可以再次使用该对象。" +"`&mut self`:使用唯一的可变引用从调用方借用对象。之后可以再次使用该对象。" #: src/methods-and-traits/methods.md msgid "" @@ -5611,12 +5450,11 @@ msgid "" "(deallocated) when the method returns, unless its ownership is explicitly " "transmitted. Complete ownership does not automatically mean mutability." msgstr "" -"“self”:获取对象的所有权并将其从调用方移出。该方法会成为对象的所有者。除非明" +"`self`:获取对象的所有权并将其从调用方移出。该方法会成为对象的所有者。除非明" "确转移对象的所有权,否则在该方法返回时,对象将被丢弃(取消分配)。具备完全所" "有权,不自动等同于具备可变性。" #: src/methods-and-traits/methods.md -#, fuzzy msgid "`mut self`: same as above, but the method can mutate the object." msgstr "`mut self`:同上,但该方法可以改变对象。" @@ -5625,8 +5463,8 @@ msgid "" "No receiver: this becomes a static method on the struct. Typically used to " "create constructors which are called `new` by convention." msgstr "" -"无接收器:这将变为结构体上的静态方法。通常用于创建构造函数,按惯例被称" -"为“new”。" +"无接收器:这将变为结构体上的静态方法。通常用于创建构造函数,按惯例被称为" +"`new`。" #: src/methods-and-traits/methods.md msgid "It can be helpful to introduce methods by comparing them to functions." @@ -5637,8 +5475,8 @@ msgid "" "Methods are called on an instance of a type (such as a struct or enum), the " "first parameter represents the instance as `self`." msgstr "" -"在某种类型(例如结构体或枚举)的实例上调用方法,第一个参数将该实例表示" -"为“self”。" +"在某种类型(例如结构体或枚举)的实例上调用方法,第一个参数将该实例表示为" +"`self`。" #: src/methods-and-traits/methods.md msgid "" @@ -5651,62 +5489,55 @@ msgstr "" #: src/methods-and-traits/methods.md msgid "Point out the use of the keyword `self`, a method receiver." -msgstr "指出关键字“self”的用法,它是一种方法接收器。" +msgstr "指出关键字`self`的用法,它是一种方法接收器。" #: src/methods-and-traits/methods.md msgid "" "Show that it is an abbreviated term for `self: Self` and perhaps show how " "the struct name could also be used." -msgstr "显示它是“self: Self”的缩写术语,或许要显示结构体名称的可能用法。" +msgstr "显示它是`self: Self`的缩写术语,或许要显示结构体名称的可能用法。" #: src/methods-and-traits/methods.md msgid "" "Explain that `Self` is a type alias for the type the `impl` block is in and " "can be used elsewhere in the block." -msgstr "说明“Self”是“impl”块所属类型的类型别名,可以在块中的其他位置使用。" +msgstr "说明`Self`是`impl`块所属类型的类型别名,可以在块中的其他位置使用。" #: src/methods-and-traits/methods.md msgid "" "Note how `self` is used like other structs and dot notation can be used to " "refer to individual fields." msgstr "" -"指出“self”的使用方式与其他结构体一样,并且可以使用点表示法来指代各个字段。" +"指出`self`的使用方式与其他结构体一样,并且可以使用点表示法来指代各个字段。" #: src/methods-and-traits/methods.md -#, fuzzy msgid "" "This might be a good time to demonstrate how the `&self` differs from `self` " "by trying to run `finish` twice." -msgstr "" -"这可能是演示“&self”和“self”差别的好时机,您只要修改代码并尝试执行 say_hello " -"两次即可。" +msgstr "现在正好可以演示 `&self` 与 `self` 的区别:试着调用两次 `finish`。" #: src/methods-and-traits/methods.md -#, fuzzy 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 " "receiver types, such as `Box`." msgstr "" -"除“self”的变体外,还可以将[特殊封装容器类型](https://doc.rust-lang.org/" -"reference/special-types-and-traits.html)作为接收器类型,例如“Box\n" -"\n" -"”。" +"除了 `self` 的各种变体,还有一些[特殊的封装类型" +"](https://doc.rust-lang.org/reference/special-types-and-traits.html)也可以作" +"为接收者类型,例如 `Box`。" #: src/methods-and-traits/traits.md msgid "" "Rust lets you abstract over types with traits. They're similar to interfaces:" -msgstr "Rust 让您可以依据特征对类型进行抽象化处理。特征与接口类似:" +msgstr "Rust 让你可以依据特征对类型进行抽象化处理。特征与接口类似:" #: src/methods-and-traits/traits.md -#, fuzzy msgid "/// Return a sentence from this pet." -msgstr "// Re-export types from this module.\n" +msgstr "/// Return a sentence from this pet." #: src/methods-and-traits/traits.md -#, fuzzy msgid "/// Print a string to the terminal greeting this pet." -msgstr "/// The car has arrived on the given floor.\n" +msgstr "/// Print a string to the terminal greeting this pet." #: src/methods-and-traits/traits.md msgid "" @@ -5719,6 +5550,8 @@ msgid "" "In the \"Generics\" segment, next, we will see how to build functionality " "that is generic over all types implementing a trait." msgstr "" +"在接下来的“泛型”一节中,我们会看到如何构建对所有实现了某个特征的类型都通用的" +"功能。" #: src/methods-and-traits/traits/implementing.md msgid "\"Oh you're a cutie! What's your name? {}\"" @@ -5735,11 +5568,11 @@ msgid "\"Fido\"" msgstr "\"Fido\"" #: src/methods-and-traits/traits/implementing.md -#, fuzzy msgid "" "To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` " "block." -msgstr "trait 在 ` { .. } 的 impl ` 代码块中实现。" +msgstr "" +"要为 `Type` 实现 `Trait`,需要使用 `impl Trait for Type { .. }` 代码块。" #: src/methods-and-traits/traits/implementing.md msgid "" @@ -5747,16 +5580,17 @@ msgid "" "type with a `talk()` method would not automatically satisfy `Pet` unless it " "is in an `impl Pet` block." msgstr "" +"与 Go 的接口不同,光有签名匹配的方法还不够:带有 `talk()` 方法的 `Cat` 类型" +"并不会自动满足 `Pet`,除非该方法写在 `impl Pet` 代码块里。" #: src/methods-and-traits/traits/implementing.md -#, fuzzy msgid "" "Traits may provide default implementations of some methods. Default " "implementations can rely on all the methods of the trait. In this case, " "`greet` is provided, and relies on `talk`." msgstr "" -"trait 或许可指定预实现(默认)方法,以及用户需要自行实现的方法。具有默认实现" -"的方法可以依赖于必需的方法。" +"特征可以为部分方法提供默认实现。默认实现可以依赖该特征的所有方法。在这个例子" +"里,`greet` 有默认实现,并依赖 `talk`。" #: src/methods-and-traits/traits/supertraits.md msgid "" @@ -5764,6 +5598,8 @@ msgid "" "called _supertraits_. Here, any type implementing `Pet` must implement " "`Animal`." msgstr "" +"一个特征可以要求实现它的类型同时实现其他特征,这些特征称为 _超特征_。这里," +"任何实现 `Pet` 的类型都必须实现 `Animal`。" #: src/methods-and-traits/traits/supertraits.md #: src/async/control-flow/select.md @@ -5771,9 +5607,8 @@ msgid "\"Rex\"" msgstr "\"Rex\"" #: src/methods-and-traits/traits/supertraits.md -#, fuzzy msgid "\"{} has {} legs\"" -msgstr "\"{} is {} years old\"" +msgstr "\"{} has {} legs\"" #: src/methods-and-traits/traits/supertraits.md msgid "" @@ -5781,12 +5616,14 @@ msgid "" "expect this to behave like OO inheritance. It just specifies an additional " "requirement on implementations of a trait." msgstr "" +"这有时被称为“特征继承”,但学员不应指望它的行为像面向对象的继承。它只是对特征" +"的实现附加了一项额外要求。" #: src/methods-and-traits/traits/associated-types.md msgid "" "Associated types are placeholder types which are supplied by the trait " "implementation." -msgstr "" +msgstr "关联类型是由特征的实现来提供的占位类型。" #: src/methods-and-traits/traits/associated-types.md #: src/async/control-flow/join.md @@ -5798,37 +5635,36 @@ msgid "" "Associated types are sometimes also called \"output types\". The key " "observation is that the implementer, not the caller, chooses this type." msgstr "" +"关联类型有时也被称为“输出类型”。关键在于:选择这个类型的是实现方,而不是调用" +"方。" #: src/methods-and-traits/traits/associated-types.md msgid "" "Many standard library traits have associated types, including arithmetic " "operators and `Iterator`." -msgstr "" +msgstr "标准库中的许多特征都带有关联类型,包括算术运算符和 `Iterator`。" #: src/methods-and-traits/deriving.md msgid "" "Supported traits can be automatically implemented for your custom types, as " "follows:" -msgstr "系统可以自动为您的自定义类型实现支持的 trait,如下所示:" +msgstr "系统可以自动为你的自定义类型实现支持的 trait,如下所示:" #: src/methods-and-traits/deriving.md -#, fuzzy msgid "// Default trait adds `default` constructor." -msgstr "// Default trait adds `default` constructor.\n" +msgstr "// Default trait adds `default` constructor." #: src/methods-and-traits/deriving.md -#, fuzzy msgid "// Clone trait adds `clone` method." -msgstr "// Clone trait adds `clone` method.\n" +msgstr "// Clone trait adds `clone` method." #: src/methods-and-traits/deriving.md msgid "\"EldurScrollz\"" msgstr "\"EldurScrollz\"" #: src/methods-and-traits/deriving.md -#, fuzzy msgid "// Debug trait adds support for printing with `{:?}`." -msgstr "// Debug trait adds support for printing with `{:?}`.\n" +msgstr "// Debug trait adds support for printing with `{:?}`." #: src/methods-and-traits/deriving.md msgid "\"{:?} vs. {:?}\"" @@ -5844,9 +5680,8 @@ msgstr "" "如,`serde` 可以使用 `#[derive(Serialize)]` 为结构体派生序列化支持。" #: src/methods-and-traits/exercise.md -#, fuzzy msgid "Exercise: Logger Trait" -msgstr "练习:通用日志" +msgstr "练习:Logger 特征" #: src/methods-and-traits/exercise.md msgid "" @@ -5855,6 +5690,9 @@ msgid "" "In testing, this might put messages in the test logfile, while in a " "production build it would send messages to a log server." msgstr "" +"我们来设计一个简单的日志工具:用一个带 `log` 方法的 `Logger` 特征。需要记录" +"自身进度的代码就可以接收 `&impl Logger`。在测试中,它可以把消息写进测试日志" +"文件;而在正式构建中,它会把消息发送到日志服务器。" #: src/methods-and-traits/exercise.md msgid "" @@ -5862,6 +5700,8 @@ msgid "" "verbosity. Your task is to write a `VerbosityFilter` type that will ignore " "messages above a maximum verbosity." msgstr "" +"不过,下面给出的 `StderrLogger` 会记录所有消息,不管详细程度如何。你的任务是" +"编写一个 `VerbosityFilter` 类型,忽略超过某个最大详细程度的消息。" #: src/methods-and-traits/exercise.md msgid "" @@ -5869,64 +5709,64 @@ msgid "" "implementing that same trait, adding behavior in the process. What other " "kinds of wrappers might be useful in a logging utility?" msgstr "" +"这是一种常见的模式:一个结构体包装某个特征的实现,同时自己也实现该特征,并在" +"这个过程中添加行为。在日志工具里还有哪些包装器可能有用?" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "/// Log a message at the given verbosity level.\n" -msgstr "" +msgstr "/// Log a message at the given verbosity level.\n" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "\"verbosity={verbosity}: {message}\"" -msgstr "" +msgstr "\"verbosity={verbosity}: {message}\"" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "\"FYI\"" -msgstr "" +msgstr "\"FYI\"" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md -#, fuzzy msgid "\"Uhoh\"" -msgstr "\"uhoh\"" +msgstr "\"Uhoh\"" #: src/methods-and-traits/exercise.md msgid "// TODO: Define and implement `VerbosityFilter`." -msgstr "" +msgstr "// TODO: Define and implement `VerbosityFilter`." #: src/methods-and-traits/solution.md msgid "/// Only log messages up to the given verbosity level.\n" -msgstr "" +msgstr "/// Only log messages up to the given verbosity level.\n" #: src/generics.md msgid "[Generic Functions](./generics/generic-functions.md) (5 minutes)" -msgstr "" +msgstr "[泛型函数](./generics/generic-functions.md)(5 分钟)" #: src/generics.md msgid "[Generic Data Types](./generics/generic-data.md) (10 minutes)" -msgstr "" +msgstr "[泛型类型](./generics/generic-data.md)(10 分钟)" #: src/generics.md msgid "[Trait Bounds](./generics/trait-bounds.md) (10 minutes)" -msgstr "" +msgstr "[特征边界](./generics/trait-bounds.md)(10 分钟)" #: src/generics.md msgid "[impl Trait](./generics/impl-trait.md) (5 minutes)" -msgstr "" +msgstr "[impl Trait](./generics/impl-trait.md)(5 分钟)" #: src/generics.md msgid "[Exercise: Generic min](./generics/exercise.md) (10 minutes)" -msgstr "" +msgstr "[练习:泛型 min](./generics/exercise.md)(10 分钟)" #: src/generics/generic-functions.md -#, fuzzy msgid "" "Rust supports generics, which lets you abstract algorithms or data " "structures (such as sorting or a binary tree) over the types used or stored." msgstr "" -"Rust 支持泛型,允许您根据算法(例如排序)中使用的类型对算法进行抽象化处理。" +"Rust 支持泛型,让你可以针对所使用或存储的类型,对算法或数据结构(例如排序或" +"二叉树)进行抽象。" #: src/generics/generic-functions.md -#, fuzzy msgid "/// Pick `even` or `odd` depending on the value of `n`." -msgstr "/// Pick `even` or `odd` depending on the value of `n`.\n" +msgstr "/// Pick `even` or `odd` depending on the value of `n`." #: src/generics/generic-functions.md msgid "\"picked a number: {:?}\"" @@ -5958,24 +5798,23 @@ msgid "" "`n == 0`. Even if only the `pick` instantiation with integers is used, Rust " "still considers it invalid. C++ would let you do this." msgstr "" -"这与 C++ 模板类似,但 Rust 会立即编译部分通用函数,因此该函数必须对所有符合约" -"束条件的类型都有效。例如,请尝试修改 `pick` 函数,如果 `n == 0`,则返回 " -"`even + odd`。即使仅使用带有整数的“pick”实例化,Rust 仍会将其视为无效。C++ 可" -"让您做到这一点。" +"这与 C++ 模板类似,但 Rust 会立即编译部分通用函数,因此该函数必须对所有符合" +"约束条件的类型都有效。例如,请尝试修改 `pick` 函数,如果 `n == 0`,则返回 " +"`even + odd`。即使仅使用带有整数的`pick`实例化,Rust 仍会将其视为无效。C++ " +"可让你做到这一点。" #: src/generics/generic-functions.md -#, fuzzy msgid "" "Generic code is turned into non-generic code based on the call sites. 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 "" -"这是零成本的抽象化处理:您得到的结果不会受到影响,也就是说,与在没有进行抽象" -"化处理的情况下,对数据结构进行手动编码时的结果一样。" +"泛型代码会根据调用处被转换成非泛型代码。这是一种零成本抽象:你得到的结果与不" +"使用抽象、手写这些数据结构时完全相同。" #: src/generics/generic-data.md msgid "You can use generics to abstract over the concrete field type:" -msgstr "您可以使用泛型对具体字段类型进行抽象化处理:" +msgstr "你可以使用泛型对具体字段类型进行抽象化处理:" #: src/generics/generic-data.md msgid "\"{integer:?} and {float:?}\"" @@ -6003,7 +5842,6 @@ msgid "It means these methods are defined for any `T`." msgstr "这意味着这些方法是针对所有 `T` 定义的。" #: src/generics/generic-data.md -#, fuzzy msgid "It is possible to write `impl Point { .. }`." msgstr "可以编写 `impl Point { .. }`。" @@ -6012,7 +5850,7 @@ 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` 依然是一个泛型,并且你可以使用 `Point`,但此块中的方法将仅适用" "于 `Point`。" #: src/generics/generic-data.md @@ -6029,18 +5867,19 @@ msgid "" "Traits can also be generic, just like types and functions. A trait's " "parameters get concrete types when it is used." msgstr "" +"和类型、函数一样,特征也可以是泛型的。特征的参数会在使用时得到具体类型。" #: src/generics/generic-traits.md msgid "\"Converted from integer: {from}\"" -msgstr "" +msgstr "\"Converted from integer: {from}\"" #: src/generics/generic-traits.md msgid "\"Converted from bool: {from}\"" -msgstr "" +msgstr "\"Converted from bool: {from}\"" #: src/generics/generic-traits.md msgid "\"{from_int:?}, {from_bool:?}\"" -msgstr "" +msgstr "\"{from_int:?}, {from_bool:?}\"" #: src/generics/generic-traits.md msgid "" @@ -6048,6 +5887,8 @@ msgid "" "the `std` docs](https://doc.rust-lang.org/std/convert/trait.From.html) is " "simple." msgstr "" +"`From` 特征会在课程后面介绍,不过它在 [`std` 文档中的定义" +"](https://doc.rust-lang.org/std/convert/trait.From.html)很简单。" #: src/generics/generic-traits.md msgid "" @@ -6055,6 +5896,8 @@ msgid "" "parameters. Here, `Foo::From(\"hello\")` would not compile because there is " "no `From<&str>` implementation for `Foo`." msgstr "" +"特征的实现不需要覆盖所有可能的类型参数。这里的 `Foo::From(\"hello\")` 无法编" +"译,因为 `Foo` 没有 `From<&str>` 的实现。" #: src/generics/generic-traits.md msgid "" @@ -6062,6 +5905,8 @@ msgid "" "\"output\" type. A trait can have multiple implementations for different " "input types." msgstr "" +"泛型特征把类型作为“输入”,而关联类型则是一种“输出”类型。一个特征可以针对不同" +"的输入类型有多个实现。" #: src/generics/generic-traits.md msgid "" @@ -6071,22 +5916,25 @@ msgid "" "[specialization](https://rust-lang.github.io/rfcs/1210-impl-specialization." "html)." msgstr "" +"实际上,Rust 要求对任意类型 T,一个特征最多只能有一个实现与之匹配。与某些其" +"他语言不同,Rust 没有用于挑选“最具体”匹配项的启发式规则。目前有一项工作正在" +"添加这种支持,称为[特化" +"](https://rust-lang.github.io/rfcs/1210-impl-specialization.html)。" #: src/generics/trait-bounds.md 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/generics/trait-bounds.md msgid "You can do this with `T: Trait` or `impl Trait`:" -msgstr "您可以使用 `T: Trait` 或 `impl Trait` 执行此操作:" +msgstr "你可以使用 `T: Trait` 或 `impl Trait` 执行此操作:" #: src/generics/trait-bounds.md -#, fuzzy msgid "// struct NotClonable;" -msgstr "// struct NotClonable;\n" +msgstr "// struct NotClonable;" #: src/generics/trait-bounds.md msgid "\"{pair:?}\"" @@ -6106,7 +5954,7 @@ msgstr "显示 `where` 子句,学员在阅读代码时会看到它。" #: src/generics/trait-bounds.md msgid "It declutters the function signature if you have many parameters." -msgstr "它会在您有多个形参的情况下整理函数签名。" +msgstr "它会在你有多个形参的情况下整理函数签名。" #: src/generics/trait-bounds.md msgid "It has additional features making it more powerful." @@ -6135,14 +5983,11 @@ msgstr "与特征边界类似,`impl Trait` 语法可以在函数形参 和返 #: src/generics/impl-trait.md msgid "// Syntactic sugar for:" -msgstr "" +msgstr "// Syntactic sugar for:" #: src/generics/impl-trait.md -#, fuzzy msgid "// fn add_42_millions>(x: T) -> i32 {" -msgstr "" -"// Syntactic sugar for:\n" -"// fn add_42_millions>(x: T) -> i32 {\n" +msgstr "// fn add_42_millions>(x: T) -> i32 {" #: src/generics/impl-trait.md msgid "\"{many}\"" @@ -6157,11 +6002,12 @@ msgid "\"debuggable: {debuggable:?}\"" msgstr "\"debuggable: {debuggable:?}\"" #: src/generics/impl-trait.md -#, fuzzy msgid "" "`impl Trait` allows you to work with types which you cannot name. The " "meaning of `impl Trait` is a bit different in the different positions." -msgstr "`impl Trait` 的意义因使用位置而略有不同。" +msgstr "" +"`impl Trait` 让你可以使用那些叫不出名字的类型。`impl Trait` 的含义在不同位置" +"略有不同。" #: src/generics/impl-trait.md msgid "" @@ -6176,7 +6022,7 @@ msgid "" "don't want to expose the concrete type in a public API." msgstr "" "对返回值类型来说,它则意味着返回值类型就是实现该特征的某具体类型, 无需为该类" -"型命名。如果您不想在公共 API 中公开该具体类型,便可 使用此方法。" +"型命名。如果你不想在公共 API 中公开该具体类型,便可 使用此方法。" #: src/generics/impl-trait.md msgid "" @@ -6201,19 +6047,18 @@ msgstr "" "误消息。" #: src/generics/exercise.md -#, fuzzy msgid "" "In this short exercise, you will implement a generic `min` function that " "determines the minimum of two values, using the [`Ord`](https://doc.rust-" "lang.org/stable/std/cmp/trait.Ord.html) trait." msgstr "" -"在这个简短的练习中,您将使用 `LessThan` trait,实现一个通用 `min` 函数,用于" -"确定两个值中的最小值。" +"在这个简短的练习中,你将使用 " +"[`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html) 特征实现一" +"个泛型 `min` 函数,用来求出两个值中较小的那个。" #: src/generics/exercise.md -#, fuzzy msgid "// TODO: implement the `min` function used in `main`." -msgstr "// TODO: implement the `min` function used in `main`.\n" +msgstr "// TODO: implement the `min` function used in `main`." #: src/generics/exercise.md src/generics/solution.md #: src/error-handling/exercise.md src/error-handling/solution.md @@ -6221,88 +6066,85 @@ msgid "'z'" msgstr "'z'" #: src/generics/exercise.md src/generics/solution.md -#, fuzzy msgid "'7'" -msgstr "'x'" +msgstr "'7'" #: src/generics/exercise.md src/generics/solution.md -#, fuzzy msgid "'1'" -msgstr "'x'" +msgstr "'1'" #: src/generics/exercise.md src/generics/solution.md msgid "\"goodbye\"" -msgstr "" +msgstr "\"goodbye\"" #: src/generics/exercise.md src/generics/solution.md msgid "\"bat\"" -msgstr "" +msgstr "\"bat\"" #: src/generics/exercise.md src/generics/solution.md msgid "\"armadillo\"" -msgstr "" +msgstr "\"armadillo\"" #: src/generics/exercise.md -#, fuzzy msgid "" "Show students the [`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord." "html) trait and [`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum." "Ordering.html) enum." msgstr "" -"[“OsStr”](https://doc.rust-lang.org/std/ffi/struct.OsStr.html)和[“OsString”]" -"(https://doc.rust-lang.org/std/ffi/struct.OsString.html)" +"向学员展示 [`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html) " +"特征和 " +"[`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum.Ordering.html) 枚" +"举。" #: src/welcome-day-2-afternoon.md -#, fuzzy msgid "[Standard Library Types](./std-types.md) (1 hour and 20 minutes)" -msgstr "[标准库类型](../std-types.md)(1 小时 10 分钟)" +msgstr "[标准库类型](./std-types.md)(1 小时 20 分钟)" #: src/welcome-day-2-afternoon.md msgid "[Standard Library Traits](./std-traits.md) (1 hour and 40 minutes)" -msgstr "" +msgstr "[标准库特征](./std-traits.md)(1 小时 40 分钟)" #: src/welcome-day-2-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 3 hours and 10 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 3 小时 10 分钟" #: src/std-types.md msgid "[Standard Library](./std-types/std.md) (3 minutes)" -msgstr "" +msgstr "[标准库](./std-types/std.md)(3 分钟)" #: src/std-types.md msgid "[Documentation](./std-types/docs.md) (5 minutes)" -msgstr "" +msgstr "[文档](./std-types/docs.md)(5 分钟)" #: src/std-types.md msgid "[Option](./std-types/option.md) (10 minutes)" -msgstr "" +msgstr "[Option](./std-types/option.md)(10 分钟)" #: src/std-types.md msgid "[Result](./std-types/result.md) (10 minutes)" -msgstr "" +msgstr "[Result](./std-types/result.md)(10 分钟)" #: src/std-types.md msgid "[String](./std-types/string.md) (10 minutes)" -msgstr "" +msgstr "[String](./std-types/string.md)(10 分钟)" #: src/std-types.md msgid "[Vec](./std-types/vec.md) (10 minutes)" -msgstr "" +msgstr "[Vec](./std-types/vec.md)(10 分钟)" #: src/std-types.md msgid "[HashMap](./std-types/hashmap.md) (10 minutes)" -msgstr "" +msgstr "[HashMap](./std-types/hashmap.md)(10 分钟)" #: src/std-types.md -#, fuzzy msgid "[Exercise: Counter](./std-types/exercise.md) (20 minutes)" -msgstr "练习:面向 GUI 库的模块" +msgstr "[练习:计数器](./std-types/exercise.md)(20 分钟)" #: src/std-types.md msgid "This segment should take about 1 hour and 20 minutes" -msgstr "" +msgstr "本节大约需要 1 小时 20 分钟" #: src/std-types.md msgid "" @@ -6313,30 +6155,27 @@ msgstr "" "法。" #: src/std-types/std.md -#, fuzzy msgid "" "Rust comes with a standard library which helps establish a set of common " "types used by Rust libraries and programs. This way, two libraries can work " "together smoothly because they both use the same `String` type." msgstr "" -"Rust 附带一个标准库,此库有助于建立一个供 Rust 库和程序 使用的常用类型集。这" -"样一来,两个库便可顺畅地搭配运作, 因为它们使用相同的 `String` 类型。" +"Rust 自带一个标准库,它帮助确立了一组供 Rust 库和程序共同使用的常用类型。这" +"样一来,两个库就能顺畅地协同工作,因为它们用的是同一个 `String` 类型。" #: src/std-types/std.md -#, fuzzy msgid "" "In fact, Rust contains several layers of the Standard Library: `core`, " "`alloc` and `std`." msgstr "Rust 实际上含有多个层级的标准库,分别是 `core`、`alloc` 和 `std`。" #: src/std-types/std.md -#, fuzzy msgid "" "`core` includes the most basic types and functions that don't depend on " "`libc`, allocator or even the presence of an operating system." msgstr "" -"`core` 包括最基本的类型与函数,这些类型与函数不依赖于 `libc`、分配器 或是否存" -"在操作系统。" +"`core` 包含最基本的类型和函数,它们不依赖 `libc`、分配器,甚至不依赖操作系统" +"的存在。" #: src/std-types/std.md msgid "" @@ -6350,18 +6189,17 @@ msgid "" msgstr "嵌入式 Rust 应用通常只使用 `core`,偶尔会使用 `alloc`。" #: src/std-types/docs.md -#, fuzzy msgid "Rust comes with extensive documentation. For example:" -msgstr "Rust 附带有大量关于该语言和标准库的文档。" +msgstr "Rust 附带大量文档。例如:" #: src/std-types/docs.md -#, fuzzy msgid "" "All of the details about [loops](https://doc.rust-lang.org/stable/reference/" "expressions/loop-expr.html)." msgstr "" -"如果你想提前退出循环,请使用 [`break`](https://doc.rust-lang.org/reference/" -"expressions/loop-expr.html#break-expressions)," +"关于[循环" +"](https://doc.rust-lang.org/stable/reference/expressions/loop-expr.html)的所" +"有细节。" #: src/std-types/docs.md msgid "" @@ -6371,51 +6209,46 @@ msgstr "" "['u8'](https://doc.rust-lang.org/stable/std/primitive.u8.html) 等基元类型。" #: src/std-types/docs.md -#, fuzzy msgid "" "Standard library types like [`Option`](https://doc.rust-lang.org/stable/std/" "option/enum.Option.html) or [`BinaryHeap`](https://doc.rust-lang.org/stable/" "std/collections/struct.BinaryHeap.html)." msgstr "" -"[“str”](https://doc.rust-lang.org/std/primitive.str.html)和[“String”]" -"(https://doc.rust-lang.org/std/string/struct.String.html)" +"[`Option`](https://doc.rust-lang.org/stable/std/option/enum.Option.html) 或 " +"[`BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html) " +"这样的标准库类型。" #: src/std-types/docs.md msgid "In fact, you can document your own code:" -msgstr "事实上,您可以为自己的代码编写文档:" +msgstr "事实上,你可以为自己的代码编写文档:" #: src/std-types/docs.md -#, fuzzy msgid "" "/// Determine whether the first argument is divisible by the second argument." msgstr "" "/// Determine whether the first argument is divisible by the second " -"argument.\n" -"///\n" -"/// If the second argument is zero, the result is false.\n" +"argument." #: src/std-types/docs.md src/testing/other.md #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "///" -msgstr "//\n" +msgstr "///" #: src/std-types/docs.md msgid "/// If the second argument is zero, the result is false." -msgstr "" +msgstr "/// If the second argument is zero, the result is false." #: src/std-types/docs.md -#, fuzzy 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 "" -"文档的内容会被当做 Markdown 处理。所有已发布 Rust 库 crate 都会自动被" +"文档内容按 Markdown 处理。所有已发布的 Rust 库 crate 都会用 " "[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) 工具在 " -"[`docs.rs`](https://docs.rs)存档。 按照这种方式来为 API 中的所有公开项编写文" -"档是 Rust 中惯用的做法。" +"[`docs.rs`](https://docs.rs) 上自动生成文档。按这种方式为 API 中所有公开项编" +"写文档是 Rust 的惯用做法。" #: src/std-types/docs.md msgid "" @@ -6426,26 +6259,21 @@ msgstr "" "为“内部文档注释”:" #: src/std-types/docs.md -#, fuzzy msgid "" "//! This module contains functionality relating to divisibility of integers." msgstr "" "//! This module contains functionality relating to divisibility of " -"integers.\n" +"integers." #: src/std-types/docs.md -#, fuzzy msgid "" "Show students the generated docs for the `rand` crate at ." -msgstr "" -"向学生展示在 [`docs.rs/rand`](https://docs.rs/rand) 中为 `rand` crate 生成的" -"文档。" +msgstr "向学员展示 `rand` crate 在 上生成的文档。" #: src/std-types/option.md -#, fuzzy msgid "Option" -msgstr "异常" +msgstr "Option" #: src/std-types/option.md msgid "" @@ -6453,9 +6281,10 @@ msgid "" "type `T` or nothing. For example, [`String::find`](https://doc.rust-lang.org/" "stable/std/string/struct.String.html#method.find) returns an `Option`." msgstr "" -"我们已经了解了 `Option` 的一些用法。它可以存储“T”类型的值,或者不存储任何" -"值。例如,['String::find'](https://doc.rust-lang.org/stable/std/string/" -"struct.String.html#method.find) 会返回 `Option`。" +"我们已经了解了 `Option` 的一些用法。它可以存储`T`类型的值,或者不存储任何" +"值。例如," +"['String::find'](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.find) " +"会返回 `Option`。" #: src/std-types/option.md msgid "\"Löwe 老虎 Léopard Gepardi\"" @@ -6478,9 +6307,8 @@ msgid "\"Character not found\"" msgstr "\"Character not found\"" #: src/std-types/option.md -#, fuzzy msgid "`Option` is widely used, not just in the standard library." -msgstr "`Option` 和 `Result` 的使用范围很广,不局限于标准库。" +msgstr "`Option` 的使用范围很广,不仅限于标准库。" #: src/std-types/option.md msgid "" @@ -6494,7 +6322,7 @@ msgstr "" msgid "" "You can panic on None, but you can't \"accidentally\" forget to check for " "None." -msgstr "出现 None 时您或许会恐慌,但不能 “无意中”忘记检查是否为 None 的情况。" +msgstr "出现 None 时你或许会恐慌,但不能 “无意中”忘记检查是否为 None 的情况。" #: src/std-types/option.md msgid "" @@ -6553,7 +6381,6 @@ msgstr "" "或 `expect()` 方法,这也是一种开发者意向信号。" #: src/std-types/result.md -#, fuzzy msgid "" "`Result` documentation is a recommended read. Not during the course, but it " "is worth mentioning. It contains a lot of convenience methods and functions " @@ -6563,11 +6390,10 @@ msgstr "" "档中包含许多便捷的方法和函数,对于函数式编程很有帮助。" #: src/std-types/result.md -#, fuzzy msgid "" "`Result` is the standard type to implement error handling as we will see on " "Day 4." -msgstr "`Result` 是用于实现错误处理的标准类型,我们将在第 3 天的课程中介绍。" +msgstr "`Result` 是实现错误处理的标准类型,我们将在第 4 天看到。" #: src/std-types/string.md msgid "String" @@ -6584,7 +6410,6 @@ msgstr "" #: src/std-types/string.md src/std-traits/read-and-write.md #: src/memory-management/review.md src/testing/unit-tests.md #: src/concurrency/scoped-threads.md -#, fuzzy msgid "\"Hello\"" msgstr "\"Hello\"" @@ -6615,7 +6440,7 @@ msgid "" "all `str` methods on a `String`." msgstr "" "`String` 会实现 [`Deref`](https://doc.rust-lang.org/std/string/" -"struct.String.html#deref-methods-str),这意味着您可以 对 `String` 调用所有 " +"struct.String.html#deref-methods-str),这意味着你可以 对 `String` 调用所有 " "`str` 方法。" #: src/std-types/string.md @@ -6623,15 +6448,15 @@ msgid "" "`String::new` returns a new empty string, use `String::with_capacity` when " "you know how much data you want to push to the string." msgstr "" -"“String::new”会返回一个新的空字符串,如果您知道自己想要推送到字符串的数据量," -"请使用“String::with_capacity”。" +"`String::new`会返回一个新的空字符串,如果你知道自己想要推送到字符串的数据量" +",请使用`String::with_capacity`。" #: src/std-types/string.md msgid "" "`String::len` returns the size of the `String` in bytes (which can be " "different from its length in characters)." msgstr "" -"“String::len”会返回“String”的大小(以字节为单位,可能不同于以字符为单位的长" +"`String::len`会返回`String`的大小(以字节为单位,可能不同于以字符为单位的长" "度)。" #: src/std-types/string.md @@ -6641,22 +6466,22 @@ msgid "" "to [grapheme clusters](https://docs.rs/unicode-segmentation/latest/" "unicode_segmentation/struct.Graphemes.html)." msgstr "" -"“String::chars”会针对实际字符返回一个迭代器。请注意,由于[字素簇](https://" -"docs.rs/unicode-segmentation/latest/unicode_segmentation/struct.Graphemes." -"html),“char”可能与人们所认为的“字符”有所不同。" +"`String::chars`会针对实际字符返回一个迭代器。请注意,由于[字素簇" +"](https://docs.rs/unicode-segmentation/latest/unicode_segmentation/struct.Graphemes.html)" +",`char`可能与人们所认为的“字符”有所不同。" #: src/std-types/string.md msgid "" "When people refer to strings they could either be talking about `&str` or " "`String`." -msgstr "当人们提到字符串时,可能是指“&str”或“String”。" +msgstr "当人们提到字符串时,可能是指`&str`或`String`。" #: src/std-types/string.md msgid "" "When a type implements `Deref`, the compiler will let you " "transparently call methods from `T`." msgstr "" -"当某个类型实现“Deref\\”时,编译器会让您以公开透明方式从“T”调用方" +"当某个类型实现“Deref\\”时,编译器会让你以公开透明方式从`T`调用方" "法。" #: src/std-types/string.md @@ -6670,13 +6495,12 @@ msgid "" "`String` implements `Deref` which transparently gives it " "access to `str`'s methods." msgstr "" -"“String”会实现“Deref\\”,后者可公开透明地授予其访问“str”方法的" +"`String`会实现“Deref\\”,后者可公开透明地授予其访问`str`方法的" "权限。" #: src/std-types/string.md -#, fuzzy msgid "Write and compare `let s3 = s1.deref();` and `let s3 = &*s1;`." -msgstr "写下并比较“let s3 = s1.deref();”和“let s3 = &\\*s1;”。" +msgstr "写出并比较 `let s3 = s1.deref();` 和 `let s3 = &*s1;`。" #: src/std-types/string.md msgid "" @@ -6684,18 +6508,18 @@ msgid "" "operations you see supported on vectors are also supported on `String`, but " "with some extra guarantees." msgstr "" -"“String”是作为字节矢量的封装容器实现的,矢量上支持的许多操作在“String”上也受" +"`String`是作为字节矢量的封装容器实现的,矢量上支持的许多操作在`String`上也受" "支持,但有一些额外保证。" #: src/std-types/string.md msgid "Compare the different ways to index a `String`:" -msgstr "比较将“String”编入索引的不同方式:" +msgstr "比较将`String`编入索引的不同方式:" #: src/std-types/string.md msgid "" "To a character by using `s3.chars().nth(i).unwrap()` where `i` is in-bound, " "out-of-bounds." -msgstr "使用“s3.chars().nth(i).unwrap()”转换为字符,其中“i”代表是否出界。" +msgstr "使用`s3.chars().nth(i).unwrap()`转换为字符,其中`i`代表是否出界。" #: src/std-types/string.md msgid "" @@ -6712,6 +6536,10 @@ msgid "" "`Display`, so anything that can be formatted can also be converted to a " "string." msgstr "" +"许多类型都可以用 " +"[`to_string`](https://doc.rust-lang.org/std/string/trait.ToString.html#tymethod.to_string) " +"方法转换成字符串。这个特征会为所有实现了 `Display` 的类型自动实现,因此任何" +"可以被格式化的东西也都能转换成字符串。" #: src/std-types/vec.md msgid "" @@ -6730,23 +6558,20 @@ msgid "\"v2: len = {}, capacity = {}\"" msgstr "\"v2: len = {}, capacity = {}\"" #: src/std-types/vec.md -#, fuzzy msgid "// Canonical macro to initialize a vector with elements." -msgstr "// Canonical macro to initialize a vector with elements.\n" +msgstr "// Canonical macro to initialize a vector with elements." #: src/std-types/vec.md -#, fuzzy msgid "// Retain only the even elements." -msgstr "// Retain only the even elements.\n" +msgstr "// Retain only the even elements." #: src/std-types/vec.md msgid "\"{v3:?}\"" msgstr "\"{v3:?}\"" #: src/std-types/vec.md -#, fuzzy msgid "// Remove consecutive duplicates." -msgstr "// Remove consecutive duplicates.\n" +msgstr "// Remove consecutive duplicates." #: src/std-types/vec.md msgid "" @@ -6755,37 +6580,33 @@ msgid "" "methods on a `Vec`." msgstr "" "`Vec` 会实现 [`Deref`](https://doc.rust-lang.org/std/vec/" -"struct.Vec.html#deref-methods-%5BT%5D),这意味着您可以对 `Vec` 调用 slice 方" +"struct.Vec.html#deref-methods-%5BT%5D),这意味着你可以对 `Vec` 调用 slice 方" "法。" #: src/std-types/vec.md -#, fuzzy msgid "" "`Vec` is a type of collection, along with `String` and `HashMap`. The data " "it contains is stored on the heap. This means the amount of data doesn't " "need to be known at compile time. It can grow or shrink at runtime." msgstr "" -"“Vec”以及“String”和“HashMap”都是一种集合。它包含的数据会存储在堆上。这意味着" -"在编译时不需要知道数据量。它可以在运行时增大或缩小。" +"`Vec` 和 `String`、`HashMap` 一样,都是一种集合。它包含的数据存储在堆上,这" +"意味着数据量不需要在编译时就确定,可以在运行时增大或缩小。" #: src/std-types/vec.md -#, fuzzy msgid "" "Notice how `Vec` is a generic type too, but you don't have to specify `T` " "explicitly. As always with Rust type inference, the `T` was established " "during the first `push` call." msgstr "" -"请注意,“Vec\n" -"\n" -"”也是一种泛型,但您不必明确指定“T”。和往常的 Rust 类别推断一样,系统会在第一" -"次“push”调用期间建立“T”。" +"请注意,`Vec` 也是一个泛型类型,但你不必显式指定 `T`。和 Rust 类型推导一" +"贯的做法一样,`T` 是在第一次调用 `push` 时确定的。" #: src/std-types/vec.md msgid "" "`vec![...]` is a canonical macro to use instead of `Vec::new()` and it " "supports adding initial elements to the vector." msgstr "" -"“vec![...\\]”是用来代替“Vec::new()”的规范化宏,它支持向矢量添加初始元素。" +"“vec![...\\]”是用来代替`Vec::new()`的规范化宏,它支持向矢量添加初始元素。" #: src/std-types/vec.md msgid "" @@ -6793,17 +6614,16 @@ msgid "" "Alternatively, using `get` will return an `Option`. The `pop` function will " "remove the last element." msgstr "" -"如需将矢量编入索引,您可以使用“\\[’ ‘\\]”方法,但如果超出边界,矢量将会 " -"panic。此外,使用“get”将返回“Option”。“pop”函数会移除最后一个元素。" +"如需将矢量编入索引,你可以使用“\\[’ ‘\\]”方法,但如果超出边界,矢量将会 " +"panic。此外,使用`get`将返回`Option`。`pop`函数会移除最后一个元素。" #: src/std-types/vec.md -#, fuzzy msgid "" "Slices are covered on day 3. For now, students only need to know that a " "value of type `Vec` gives access to all of the documented slice methods, too." msgstr "" -"第 3 天会介绍 slice。目前,学生只需知道使用 `Vec` 类型的值也可访问所有已载明" -"的只读 slice 方法。" +"切片会在第 3 天介绍。目前学员只需知道,`Vec` 类型的值同样可以访问文档中列出" +"的所有切片方法。" #: src/std-types/hashmap.md msgid "Standard hash map with protection against HashDoS attacks:" @@ -6842,9 +6662,8 @@ msgid "\"{book} is unknown.\"" msgstr "\"{book} is unknown.\"" #: src/std-types/hashmap.md -#, fuzzy msgid "// Use the .entry() method to insert a value if nothing is found." -msgstr "// Use the .entry() method to insert a value if nothing is found.\n" +msgstr "// Use the .entry() method to insert a value if nothing is found." #: src/std-types/hashmap.md msgid "\"{page_counts:#?}\"" @@ -6853,7 +6672,7 @@ msgstr "\"{page_counts:#?}\"" #: src/std-types/hashmap.md msgid "" "`HashMap` is not defined in the prelude and needs to be brought into scope." -msgstr "“HashMap”未在序言中定义,因此需要纳入范围中。" +msgstr "`HashMap`未在序言中定义,因此需要纳入范围中。" #: src/std-types/hashmap.md msgid "" @@ -6874,7 +6693,7 @@ msgstr "\"The Hunger Games\"" #: src/std-types/hashmap.md msgid "Unlike `vec!`, there is unfortunately no standard `hashmap!` macro." -msgstr "遗憾的是,与“vec!”不同,不存在标准的“hashmap!”宏。" +msgstr "遗憾的是,与`vec!`不同,不存在标准的`hashmap!`宏。" #: src/std-types/hashmap.md msgid "" @@ -6892,7 +6711,7 @@ msgstr "" msgid "" "Alternatively HashMap can be built from any `Iterator` which yields key-" "value tuples." -msgstr "或者,HashMap 也可以基于任何可生成键-值元组的“Iterator”进行构建。" +msgstr "或者,HashMap 也可以基于任何可生成键-值元组的`Iterator`进行构建。" #: src/std-types/hashmap.md msgid "" @@ -6900,7 +6719,7 @@ msgid "" "examples easier. Using references in collections can, of course, be done, " "but it can lead into complications with the borrow checker." msgstr "" -"我们要展示“HashMap\\”,避免将“&str”用作键,以便简化示例。当然," +"我们要展示“HashMap\\”,避免将`&str`用作键,以便简化示例。当然," "可以在集合中使用引用,但可能会导致借用检查器出现复杂问题。" #: src/std-types/hashmap.md @@ -6908,8 +6727,8 @@ msgid "" "Try removing `to_string()` from the example above and see if it still " "compiles. Where do you think we might run into issues?" msgstr "" -"尝试从上述示例中移除“to_string()”,看看它是否仍可编译。您认为我们可能会在哪些" -"方面遇到问题?" +"尝试从上述示例中移除`to_string()`,看看它是否仍可编译。你认为我们可能会在哪" +"些方面遇到问题?" #: src/std-types/hashmap.md msgid "" @@ -6918,9 +6737,9 @@ msgid "" "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”方法的实用链接。" +"此类型具有几种特定于方法的返回值类型,例如`std::collections::hash_map::Keys`" +"。这些类型通常会出现在 Rust 文档的搜索结果中。向学员展示此类型的文档,以及指" +"向`keys`方法的实用链接。" #: src/std-types/exercise.md msgid "" @@ -6929,7 +6748,7 @@ msgid "" "stable/std/collections/struct.HashMap.html) to keep track of which values " "have been seen and how many times each one has appeared." msgstr "" -"在本练习中,您将学习一个非常简单的数据结构,并将其变成泛型的。该结构使用 " +"在本练习中,你将学习一个非常简单的数据结构,并将其变成泛型的。该结构使用 " "[`std::collections::HashMap`](https://doc.rust-lang.org/stable/std/" "collections/struct.HashMap.html) 来跟踪已经出现过的值以及每个值出现的次数。" @@ -6953,26 +6772,22 @@ msgstr "" "现 `count` 方法。" #: src/std-types/exercise.md -#, fuzzy msgid "" "/// Counter counts the number of times each value of type T has been seen." msgstr "" -"/// Counter counts the number of times each value of type T has been seen.\n" +"/// Counter counts the number of times each value of type T has been seen." #: src/std-types/exercise.md -#, fuzzy msgid "/// Create a new Counter." -msgstr "/// Create a new Counter.\n" +msgstr "/// Create a new Counter." #: src/std-types/exercise.md -#, fuzzy msgid "/// Count an occurrence of the given value." -msgstr "/// Count an occurrence of the given value.\n" +msgstr "/// Count an occurrence of the given value." #: src/std-types/exercise.md -#, fuzzy msgid "/// Return the number of times the given value has been seen." -msgstr "/// Return the number of times the given value has been seen.\n" +msgstr "/// Return the number of times the given value has been seen." #: src/std-types/exercise.md src/std-types/solution.md msgid "\"saw {} values equal to {}\"" @@ -7010,39 +6825,39 @@ msgstr "/// Return the number of times the given value has been seen.\n" #: src/std-traits.md msgid "[Comparisons](./std-traits/comparisons.md) (10 minutes)" -msgstr "" +msgstr "[比较](./std-traits/comparisons.md)(10 分钟)" #: src/std-traits.md msgid "[Operators](./std-traits/operators.md) (10 minutes)" -msgstr "" +msgstr "[运算符](./std-traits/operators.md)(10 分钟)" #: src/std-traits.md msgid "[From and Into](./std-traits/from-and-into.md) (10 minutes)" -msgstr "" +msgstr "[From 与 Into](./std-traits/from-and-into.md)(10 分钟)" #: src/std-traits.md msgid "[Casting](./std-traits/casting.md) (5 minutes)" -msgstr "" +msgstr "[类型转换](./std-traits/casting.md)(5 分钟)" #: src/std-traits.md msgid "[Read and Write](./std-traits/read-and-write.md) (10 minutes)" -msgstr "" +msgstr "[Read 与 Write](./std-traits/read-and-write.md)(10 分钟)" #: src/std-traits.md msgid "[Default, struct update syntax](./std-traits/default.md) (5 minutes)" -msgstr "" +msgstr "[Default 与结构体更新语法](./std-traits/default.md)(5 分钟)" #: src/std-traits.md msgid "[Closures](./std-traits/closures.md) (20 minutes)" -msgstr "" +msgstr "[闭包](./std-traits/closures.md)(20 分钟)" #: src/std-traits.md msgid "[Exercise: ROT13](./std-traits/exercise.md) (30 minutes)" -msgstr "" +msgstr "[练习:ROT13](./std-traits/exercise.md)(30 分钟)" #: src/std-traits.md msgid "This segment should take about 1 hour and 40 minutes" -msgstr "" +msgstr "本节大约需要 1 小时 40 分钟" #: src/std-traits.md msgid "" @@ -7063,7 +6878,6 @@ msgstr "" "这些 trait。" #: src/std-traits/comparisons.md -#, fuzzy msgid "`PartialEq` and `Eq`" msgstr "`PartialEq` 和 `Eq`" @@ -7076,7 +6890,6 @@ msgstr "" "和 `!=` 运算符会调用这些方法。" #: src/std-traits/comparisons.md -#, fuzzy msgid "" "`Eq` is a full equivalence relation (reflexive, symmetric, and transitive) " "and implies `PartialEq`. Functions that require full equivalence will use " @@ -7086,7 +6899,6 @@ msgstr "" "要完全等价的函数将使用 `Eq` 作为特征边界。" #: src/std-traits/comparisons.md -#, fuzzy msgid "`PartialOrd` and `Ord`" msgstr "`PartialOrd` 和 `Ord`" @@ -7131,10 +6943,9 @@ msgid "Discussion points:" msgstr "讨论点:" #: src/std-traits/operators.md -#, fuzzy msgid "" "You could implement `Add` for `&Point`. In which situations is that useful?" -msgstr "您可以针对 `&Point` 实现 `Add`。此做法在哪些情况下可派上用场?" +msgstr "你可以为 `&Point` 实现 `Add`。这在哪些情况下有用?" #: src/std-traits/operators.md msgid "" @@ -7142,8 +6953,8 @@ msgid "" "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` 重载运算符。这可避免调用点上存在不必要的 克隆任务。" +"回答:`Add:add` 会耗用 `self`。如果你的运算符重载对象 (即类型 `T`)不是 " +"`Copy`,建议你也为 `&T` 重载运算符。这可避免调用点上存在不必要的 克隆任务。" #: src/std-traits/operators.md msgid "" @@ -7152,21 +6963,20 @@ msgid "" msgstr "为什么 `Output` 是关联类型?可将它用作该方法的类型形参吗?" #: src/std-traits/operators.md -#, fuzzy msgid "" "Short answer: Function type parameters are controlled by the caller, but " "associated types (like `Output`) are controlled by the implementer of a " "trait." msgstr "" -"简答:函数类型形参是由调用方控管,但 `Output` 这类关联类型则由特征实现人员 控" -"管。" +"简短的回答:函数的类型参数由调用方决定,而关联类型(例如 `Output`)由特征的" +"实现方决定。" #: src/std-traits/operators.md msgid "" "You could implement `Add` for two different types, e.g. `impl Add<(i32, " "i32)> for Point` would add a tuple to a `Point`." msgstr "" -"您可以针对两种不同类型实现 `Add`,例如, `impl Add<(i32, i32)> for Point` 会" +"你可以针对两种不同类型实现 `Add`,例如, `impl Add<(i32, i32)> for Point` 会" "向 `Point` 中添加元组。" #: src/std-traits/from-and-into.md @@ -7196,7 +7006,7 @@ msgstr "" msgid "" "That's why it is common to only implement `From`, as your type will get " "`Into` implementation too." -msgstr "这就是为什么通常只需实现 `From`,因为您的类型也会实现 `Into`。" +msgstr "这就是为什么通常只需实现 `From`,因为你的类型也会实现 `Into`。" #: src/std-traits/from-and-into.md msgid "" @@ -7206,7 +7016,7 @@ msgid "" "implement `Into`." msgstr "" "若要声明某个函数实参输入类型(例如“任何可转换成 `String` 的类型”),规则便会" -"相反,此时应使用 `Into`。 您的函数会接受可实现 `From` 的类型,以及那些仅实现 " +"相反,此时应使用 `Into`。 你的函数会接受可实现 `From` 的类型,以及那些仅实现 " "`Into` 的类型。" #: src/std-traits/casting.md @@ -7236,7 +7046,7 @@ msgid "" "to a smaller type -- check the docs, and comment for clarity." msgstr "" "使用 `as` 的结果在 Rust 中 _始终_ 定义明确,并且在不同平台上保持一致。这可能" -"和您对于更改符号或转换为更小类型的直观理解不一样。为清晰起见,请查看文档和注" +"和你对于更改符号或转换为更小类型的直观理解不一样。为清晰起见,请查看文档和注" "释。" #: src/std-traits/casting.md @@ -7286,7 +7096,7 @@ msgid "" "[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), you can " "abstract over `u8` sources:" msgstr "" -"您可以使用 [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) 和 " +"你可以使用 [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) 和 " "[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html) 对 `u8` 来源" "进行抽象化处理:" @@ -7307,7 +7117,7 @@ msgid "" "Similarly, [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) lets " "you abstract over `u8` sinks:" msgstr "" -"您同样可使用 [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) 对 " +"你同样可使用 [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) 对 " "`u8` 接收器进行抽象化处理:" #: src/std-traits/read-and-write.md @@ -7357,11 +7167,10 @@ msgid "" msgstr "系统可以直接实现它,也可以通过 `#[derive(Default)]` 派生出它。" #: src/std-traits/default.md -#, fuzzy msgid "" "A derived implementation will produce a value where all fields are set to " "their default values." -msgstr "派生的实现会生成一个实例,其中字段全都设为其默认值。" +msgstr "派生出的实现会生成一个所有字段都设为默认值的值。" #: src/std-traits/default.md msgid "This means all types in the struct must implement `Default` too." @@ -7372,30 +7181,27 @@ msgid "" "Standard Rust types often implement `Default` with reasonable values (e.g. " "`0`, `\"\"`, etc)." msgstr "" -"标准的 Rust 类型通常会以合理的值(例如 ` 0`\"\" \\``等)实现`Default\\`。" +"标准的 Rust 类型通常会用合理的值实现 `Default`(例如 `0`、`\"\"` 等)。" #: src/std-traits/default.md -#, fuzzy msgid "The partial struct initialization works nicely with default." -msgstr "部分结构体副本可与默认值完美搭配运作。" +msgstr "结构体的部分初始化与 default 配合得很好。" #: src/std-traits/default.md -#, fuzzy msgid "" "The Rust standard library is aware that types can implement `Default` and " "provides convenience methods that use it." -msgstr "Rust 标准库了解类型可能会实现 `Default`,因此提供了便利的使用方式。" +msgstr "Rust 标准库知道类型可以实现 `Default`,并提供了利用它的便捷方法。" #: src/std-traits/default.md -#, fuzzy msgid "" "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 "" -"“..”语法被称为[结构体更新语法](https://doc.rust-lang.org/book/ch05-01-" -"defining-structs.html#creating-instances-from-other-instances-with-struct-" -"update-syntax)" +"`..` 语法称为[结构体更新语法" +"](https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax)" +"。" #: src/std-traits/closures.md msgid "" @@ -7410,9 +7216,8 @@ msgstr "" "org/std/ops/trait.FnOnce.html) 特征:" #: src/std-traits/closures.md -#, fuzzy msgid "\"Calling function on {input}\"" -msgstr "调用 Unsafe 函数" +msgstr "\"Calling function on {input}\"" #: src/std-traits/closures.md msgid "\"add_3: {}\"" @@ -7440,7 +7245,7 @@ msgid "" "An `FnMut` (e.g. `accumulate`) might mutate captured values. You can call it " "multiple times, but not concurrently." msgstr "" -"`FnMut`(例如 `accumulate`)可能会改变捕获的值。您可以多次调用它, 但不能并发" +"`FnMut`(例如 `accumulate`)可能会改变捕获的值。你可以多次调用它, 但不能并发" "调用它。" #: src/std-traits/closures.md @@ -7448,7 +7253,7 @@ 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`),或许只能调用它一次。它可能会耗用 " +"如果你使用 `FnOnce`(例如 `multiply_sum`),或许只能调用它一次。它可能会耗用 " "所捕获的值。" #: src/std-traits/closures.md @@ -7458,7 +7263,7 @@ msgid "" "use an `Fn` wherever an `FnMut` or `FnOnce` is called for." msgstr "" "`FnMut` 是 `FnOnce` 的子类型。`Fn` 是 `FnMut` 和 `FnOnce` 的子类型。也就是" -"说,您可以在任何 需要调用 `FnOnce` 的地方使用 `FnMut`,还可在任何需要调用 " +"说,你可以在任何 需要调用 `FnOnce` 的地方使用 `FnMut`,还可在任何需要调用 " "`FnMut` 或 `FnOnce` 的地方 使用 `Fn`。" #: src/std-traits/closures.md @@ -7467,12 +7272,16 @@ msgid "" "you can (i.e. you call it once), or `FnMut` else, and last `Fn`. This allows " "the most flexibility for the caller." msgstr "" +"当你定义一个接收闭包的函数时,能用 `FnOnce` 就用 `FnOnce`(也就是只调用一次" +"的情况),否则用 `FnMut`,最后才考虑 `Fn`。这样能给调用方最大的灵活性。" #: src/std-traits/closures.md msgid "" "In contrast, when you have a closure, the most flexible you can have is `Fn` " "(it can be passed everywhere), then `FnMut`, and lastly `FnOnce`." msgstr "" +"反过来,当你手上有一个闭包时,最灵活的是 `Fn`(它可以传到任何地方),其次是 " +"`FnMut`,最后是 `FnOnce`。" #: src/std-traits/closures.md msgid "" @@ -7499,9 +7308,8 @@ msgid "\"Hi\"" msgstr "\"Hi\"" #: src/std-traits/closures.md -#, fuzzy msgid "\"Greg\"" -msgstr "\"Greetings\"" +msgstr "\"Greg\"" #: src/std-traits/exercise.md msgid "" @@ -7510,14 +7318,13 @@ msgid "" "implement the missing bits. Only rotate ASCII alphabetic characters, to " "ensure the result is still valid UTF-8." msgstr "" -"在此示例中,您将实现经典的 [“ROT13”加密](https://en.wikipedia.org/wiki/" +"在此示例中,你将实现经典的 [“ROT13”加密](https://en.wikipedia.org/wiki/" "ROT13)。将此代码复制到 Playground,并实现缺失的位。请仅旋转 ASCII 字母字符," "以确保结果仍为有效的 UTF-8 编码字符。" #: src/std-traits/exercise.md -#, fuzzy msgid "// Implement the `Read` trait for `RotDecoder`." -msgstr "// Implement the `Read` trait for `RotDecoder`.\n" +msgstr "// Implement the `Read` trait for `RotDecoder`." #: src/std-traits/exercise.md src/std-traits/solution.md msgid "\"Gb trg gb gur bgure fvqr!\"" @@ -7559,55 +7366,55 @@ msgstr "智能指针:标准库指针类型。" #: src/welcome-day-3.md msgid "[Welcome](./welcome-day-3.md) (3 minutes)" -msgstr "" +msgstr "[欢迎](./welcome-day-3.md)(3 分钟)" #: src/welcome-day-3.md msgid "[Memory Management](./memory-management.md) (1 hour)" -msgstr "" +msgstr "[内存管理](./memory-management.md)(1 小时)" #: src/welcome-day-3.md msgid "[Smart Pointers](./smart-pointers.md) (55 minutes)" -msgstr "" +msgstr "[智能指针](./smart-pointers.md)(55 分钟)" #: src/welcome-day-3.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 20 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 20 分钟" #: src/memory-management.md msgid "[Review of Program Memory](./memory-management/review.md) (5 minutes)" -msgstr "" +msgstr "[回顾:程序的内存分配](./memory-management/review.md)(5 分钟)" #: src/memory-management.md msgid "" "[Approaches to Memory Management](./memory-management/approaches.md) (10 " "minutes)" -msgstr "" +msgstr "[内存管理方法](./memory-management/approaches.md)(10 分钟)" #: src/memory-management.md msgid "[Ownership](./memory-management/ownership.md) (5 minutes)" -msgstr "" +msgstr "[所有权](./memory-management/ownership.md)(5 分钟)" #: src/memory-management.md msgid "[Move Semantics](./memory-management/move.md) (5 minutes)" -msgstr "" +msgstr "[移动语义](./memory-management/move.md)(5 分钟)" #: src/memory-management.md msgid "[Clone](./memory-management/clone.md) (2 minutes)" -msgstr "" +msgstr "[克隆](./memory-management/clone.md)(2 分钟)" #: src/memory-management.md msgid "[Copy Types](./memory-management/copy-types.md) (5 minutes)" -msgstr "" +msgstr "[Copy 类型](./memory-management/copy-types.md)(5 分钟)" #: src/memory-management.md msgid "[Drop](./memory-management/drop.md) (10 minutes)" -msgstr "" +msgstr "[Drop](./memory-management/drop.md)(10 分钟)" #: src/memory-management.md msgid "[Exercise: Builder Type](./memory-management/exercise.md) (20 minutes)" -msgstr "" +msgstr "[练习:构建器类型](./memory-management/exercise.md)(20 分钟)" #: src/memory-management/review.md msgid "Programs allocate memory in two ways:" @@ -7650,7 +7457,6 @@ msgid "No guarantee of memory locality." msgstr "不保证内存局部性。" #: src/memory-management/review.md -#, fuzzy msgid "" "Creating a `String` puts fixed-sized metadata on the stack and dynamically " "sized data, the actual string, on the heap:" @@ -7672,12 +7478,12 @@ msgid "" "struct.System.html) and custom allocators can be implemented using the " "[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" msgstr "" -"如果学员提出相关问题,你可以提及我们不仅能使用\\[系统分配器\\]在堆上分配底层" -"内存,还能使用 [Allocator API](https://doc.rust-lang.org/std/alloc/index." -"html) 实现自定义分配器" +"如果学员提出相关问题,你可以提及底层内存是使用[系统分配器" +"](https://doc.rust-lang.org/std/alloc/struct.System.html)在堆上分配的,而且" +"可以使用 [Allocator API](https://doc.rust-lang.org/std/alloc/index.html) 实" +"现自定义分配器" #: src/memory-management/review.md -#, fuzzy msgid "" "We can inspect the memory layout with `unsafe` Rust. However, you should " "point out that this is rightfully unsafe!" @@ -7689,32 +7495,26 @@ msgid "' '" msgstr "' '" #: src/memory-management/review.md -#, fuzzy msgid "\"world\"" msgstr "\"world\"" #: src/memory-management/review.md msgid "// DON'T DO THIS AT HOME! For educational purposes only." -msgstr "" +msgstr "// DON'T DO THIS AT HOME! For educational purposes only." #: src/memory-management/review.md -#, fuzzy msgid "" "// String provides no guarantees about its layout, so this could lead to" msgstr "" -"// DON'T DO THIS AT HOME!For educational purposes only.\n" -" // String provides no guarantees about its layout, so this could lead " -"to\n" -" // undefined behavior.\n" +"// String provides no guarantees about its layout, so this could lead to" #: src/memory-management/review.md -#, fuzzy msgid "// undefined behavior." -msgstr "Rust 没有运行时未定义行为:" +msgstr "// undefined behavior." #: src/memory-management/review.md msgid "\"capacity = {capacity}, ptr = {ptr:#x}, len = {len}\"" -msgstr "" +msgstr "\"capacity = {capacity}, ptr = {ptr:#x}, len = {len}\"" #: src/memory-management/approaches.md msgid "Traditionally, languages have fallen into two broad categories:" @@ -7826,18 +7626,17 @@ msgid "" msgstr "所有变量绑定都有一个有效的“作用域”,使用 超出其作用域的变量是错误的:" #: src/memory-management/ownership.md -#, fuzzy msgid "" "We say that the variable _owns_ the value. Every Rust value has precisely " "one owner at all times." -msgstr "指出变量“拥有”值。" +msgstr "我们称变量“拥有”值。任何时候,每个 Rust 值都恰好有一个所有者。" #: src/memory-management/ownership.md -#, fuzzy msgid "" "At the end of the scope, the variable is _dropped_ and the data is freed. A " "destructor can run here to free up resources." -msgstr "作用域结束时,变量会“被丢弃”,数据会被释放。" +msgstr "" +"作用域结束时,变量会“被丢弃”,数据会被释放。此时可以运行析构函数来释放资源。" #: src/memory-management/ownership.md msgid "" @@ -7849,26 +7648,22 @@ msgstr "" "Rust 的 “单一所有者”原则与此类似。" #: src/memory-management/move.md -#, fuzzy msgid "An assignment will transfer _ownership_ between variables:" msgstr "赋值操作将在变量之间转移所有权:" #: src/memory-management/move.md -#, fuzzy msgid "\"Hello!\"" -msgstr "b\"Hello!\"" +msgstr "\"Hello!\"" #: src/memory-management/move.md -#, fuzzy msgid "// println!(\"s1: {s1}\");" -msgstr "// println!(\"s1: {s1}\");\n" +msgstr "// println!(\"s1: {s1}\");" #: src/memory-management/move.md msgid "The assignment of `s1` to `s2` transfers ownership." msgstr "将 `s1` 赋值给 `s2`,即转移了所有权。" #: src/memory-management/move.md -#, fuzzy msgid "When `s1` goes out of scope, nothing happens: it does not own anything." msgstr "当 `s1` 离开作用域时,什么都不会发生:它没有所有权。" @@ -7885,7 +7680,6 @@ msgid "After move to `s2`:" msgstr "移动到 `s2` 中之后:" #: src/memory-management/move.md -#, fuzzy msgid "" "```bob\n" " Stack Heap\n" @@ -7909,22 +7703,24 @@ msgid "" "```" msgstr "" "```bob\n" -" 栈 堆\n" -".- - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - " -"-.\n" -": : : :\n" -": " -"list : : :\n" -": +----+----+ : : +----+----+ +----+------" -"+ :\n" -": | 1 | o--+-----------+-----+--->| 2 | o--+--->| // | null " -"| :\n" -": +----+----+ : : +----+----+ +----+------" -"+ :\n" -": : : :\n" -": : : :\n" -"`- - - - - - - - - - - - -' '- - - - - - - - - - - - - - - - - - - - - - " -"-'\n" +" 栈 堆\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - -.\n" +": : : :\n" +": s1 \"(无法访问)\" : : :\n" +": +-----------+-------+ : : +----+----+----+----+----+----+ :\n" +": | ptr | o---+---+--+--+-->| H | e | l | l | o | ! | :\n" +": | len | 6 | : | : +----+----+----+----+----+----+ :\n" +": | capacity | 6 | : | : :\n" +": +-----------+-------+ : | : :\n" +": : | `- - - - - - - - - - - - - - - - - - -'\n" +": s2 : |\n" +": +-----------+-------+ : |\n" +": | ptr | o---+---+--'\n" +": | len | 6 | :\n" +": | capacity | 6 | :\n" +": +-----------+-------+ :\n" +": :\n" +"`- - - - - - - - - - - - - -'\n" "```" #: src/memory-management/move.md @@ -7934,19 +7730,16 @@ msgid "" msgstr "你将值传递给函数时,该值会被赋给函数 参数。这就转移了所有权:" #: src/memory-management/move.md -#, fuzzy msgid "\"Hello {name}\"" msgstr "\"Hello {name}\"" #: src/memory-management/move.md src/android/interoperability/java.md -#, fuzzy msgid "\"Alice\"" -msgstr "切片" +msgstr "\"Alice\"" #: src/memory-management/move.md -#, fuzzy msgid "// say_hello(name);" -msgstr "// say_hello(name);\n" +msgstr "// say_hello(name);" #: src/memory-management/move.md msgid "" @@ -7968,7 +7761,7 @@ msgstr "" #: src/memory-management/move.md msgid "" "Simple values (such as integers) can be marked `Copy` (see later slides)." -msgstr "简单的值(例如整数)可以标记为“Copy”(请看后续幻灯片)。" +msgstr "简单的值(例如整数)可以标记为`Copy`(请看后续幻灯片)。" #: src/memory-management/move.md msgid "In Rust, clones are explicit (by using `clone`)." @@ -8015,9 +7808,8 @@ msgstr "" "意中创建副本。" #: src/memory-management/move.md -#, fuzzy msgid "Defensive Copies in Modern C++" -msgstr "现代 C++ 中的双重释放" +msgstr "现代 C++ 中的防御性复制" #: src/memory-management/move.md msgid "Modern C++ solves this differently:" @@ -8028,9 +7820,8 @@ msgid "\"Cpp\"" msgstr "\"Cpp\"" #: src/memory-management/move.md -#, fuzzy msgid "// Duplicate the data in s1." -msgstr "// Duplicate the data in s1.\n" +msgstr "// Duplicate the data in s1." #: src/memory-management/move.md msgid "" @@ -8055,8 +7846,8 @@ msgid "" "the string data has to be cloned. Otherwise we would get a double-free when " "either string goes out of scope." msgstr "" -"C++ 做出了与 Rust 略有不同的选择。由于“=”会复制数据,因此必须克隆字符串数据。" -"否则,当任一字符串超出范围时,便会出现二次释放。" +"C++ 做出了与 Rust 略有不同的选择。由于`=`会复制数据,因此必须克隆字符串数据" +"。否则,当任一字符串超出范围时,便会出现二次释放。" #: src/memory-management/move.md msgid "" @@ -8066,17 +7857,18 @@ msgid "" "move, `s1` would be in a valid but unspecified state. Unlike Rust, the " "programmer is allowed to keep using `s1`." msgstr "" -"C++ 还包含[“std::move”](https://en.cppreference.com/w/cpp/utility/move),它用" -"于指示何时可以移动某个值。如果示例为“s2 = std::move(s1)”,则不会发生堆分配。" -"移动后,“s1”将处于有效但未指定的状态。与 Rust 不同,程序员可以继续使用“s1”。" +"C++ 还包含[`std::move`](https://en.cppreference.com/w/cpp/utility/move),它" +"用于指示何时可以移动某个值。如果示例为`s2 = std::move(s1)`,则不会发生堆分配" +"。移动后,`s1`将处于有效但未指定的状态。与 Rust 不同,程序员可以继续使用`s1`" +"。" #: src/memory-management/move.md msgid "" "Unlike Rust, `=` in C++ can run arbitrary code as determined by the type " "which is being copied or moved." msgstr "" -"与 Rust 不同,使用 C++ 时,“=”可以运行任意代码,具体取决于要复制或移动的类" -"型。" +"与 Rust 不同,使用 C++ 时,`=`可以运行任意代码,具体取决于要复制或移动的类型" +"。" #: src/memory-management/clone.md msgid "Clone" @@ -8094,7 +7886,7 @@ msgid "" "occurring. Look for `.clone()` and a few others like `Vec::new` or `Box::" "new`." msgstr "" -"`Clone` 的设计理念是让您轻松发现堆分配的位置。查找 `.clone()` 和其他一些内" +"`Clone` 的设计理念是让你轻松发现堆分配的位置。查找 `.clone()` 和其他一些内" "容,例如 `Vec::new` 或 `Box::new`。" #: src/memory-management/clone.md @@ -8164,12 +7956,11 @@ msgstr "" "此无法编译。" #: src/memory-management/copy-types.md -#, fuzzy msgid "" "Remove `Copy` from the `derive` attribute. The compiler error is now in the " "`println!` for `p1`." msgstr "" -"从 `derive` 属性中移除 `Copy`。现在,编译器错误位于 `p1`的 `println!` 中。" +"从 `derive` 属性中移除 `Copy`。现在,编译器错误位于 `p1` 的 `println!` 中。" #: src/memory-management/copy-types.md msgid "Show that it works if you clone `p1` instead." @@ -8201,7 +7992,6 @@ msgid "\"b\"" msgstr "\"b\"" #: src/memory-management/drop.md -#, fuzzy msgid "\"c\"" msgstr "\"c\"" @@ -8249,7 +8039,7 @@ msgid "" "values earlier than they would otherwise go out of scope." msgstr "" "`std::mem::drop` 只是一个采用任何值的空函数。重要的是它获得了值的所有权,因此" -"在其作用域结束时便会被丢弃。如此您可以轻松提前明确地丢弃值,而不必等到值超过" +"在其作用域结束时便会被丢弃。如此你可以轻松提前明确地丢弃值,而不必等到值超过" "范围的时候。" #: src/memory-management/drop.md @@ -8296,6 +8086,8 @@ msgid "" "/// Return a representation of this package as a dependency, for use in\n" " /// building other packages.\n" msgstr "" +"/// Return a representation of this package as a dependency, for use in\n" +" /// building other packages.\n" #: src/memory-management/exercise.md msgid "\"1\"" @@ -8353,7 +8145,7 @@ msgstr "\"base64: {base64:?}\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"log\"" -msgstr "" +msgstr "\"log\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"0.4\"" @@ -8365,7 +8157,7 @@ msgstr "\"log: {log:?}\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"serde\"" -msgstr "" +msgstr "\"serde\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"djmitche\"" @@ -8385,23 +8177,23 @@ msgstr "\"0.1\"" #: src/smart-pointers.md msgid "[Box" -msgstr "" +msgstr "[Box" #: src/smart-pointers.md msgid "](./smart-pointers/box.md) (10 minutes)" -msgstr "" +msgstr "](./smart-pointers/box.md)(10 分钟)" #: src/smart-pointers.md msgid "[Rc](./smart-pointers/rc.md) (5 minutes)" -msgstr "" +msgstr "[Rc](./smart-pointers/rc.md)(5 分钟)" #: src/smart-pointers.md msgid "[Trait Objects](./smart-pointers/trait-objects.md) (10 minutes)" -msgstr "" +msgstr "[特征对象](./smart-pointers/trait-objects.md)(10 分钟)" #: src/smart-pointers.md msgid "[Exercise: Binary Tree](./smart-pointers/exercise.md) (30 minutes)" -msgstr "" +msgstr "[练习:二叉树](./smart-pointers/exercise.md)(30 分钟)" #: src/smart-pointers/box.md msgid "" @@ -8421,7 +8213,7 @@ msgid "" "methods from `T` directly on a `Box`](https://doc.rust-lang.org/std/ops/" "trait.Deref.html#more-on-deref-coercion)." msgstr "" -"`Box` 会实现 `Deref`,这意味着您可以[直接在 `Box` 上通过 " +"`Box` 会实现 `Deref`,这意味着你可以[直接在 `Box` 上通过 " "`T` 调用相应方法](https://doc.rust-lang.org/std/ops/trait.Deref.html#more-on-" "deref-coercion)。" @@ -8432,18 +8224,17 @@ msgstr "递归数据类型或具有动态大小的数据类型需要使用 `Box` #: src/smart-pointers/box.md msgid "/// A non-empty list: first element and the rest of the list." -msgstr "" +msgstr "/// A non-empty list: first element and the rest of the list." #: src/smart-pointers/box.md msgid "/// An empty list." -msgstr "" +msgstr "/// An empty list." #: src/smart-pointers/box.md msgid "\"{list:?}\"" msgstr "\"{list:?}\"" #: src/smart-pointers/box.md -#, fuzzy msgid "" "```bob\n" " Stack Heap\n" @@ -8466,25 +8257,24 @@ msgid "" msgstr "" "```bob\n" " 栈 堆\n" -".- - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - " -"- -.\n" -": : : :\n" +".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - " +"- - - - -.\n" +": : : :\n" ": " -"list : : :\n" -": +------+----+----+ : : +------+----+----+ +------+----+----" -"+ :\n" -": | Cons | 1 | o--+----+-----+--->| Cons | 2 | o--+--->| Nil | // | // " -"| :\n" -": +------+----+----+ : : +------+----+----+ +------+----+----" -"+ :\n" -": : : :\n" -": : : :\n" -"'- - - - - - - - - - - - -' '- - - - - - - - - - - - - - - - - - - - - - " -"- -'\n" +"list : : :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----" +"+----+ :\n" +": | Element | 1 | o--+----+-----+--->| Element | 2 | o--+--->| Nil | // " +"| // | :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----" +"+----+ :\n" +": : : :\n" +": : : :\n" +"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - " +"- - - - -'\n" "```" #: src/smart-pointers/box.md -#, fuzzy msgid "" "`Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be " "not null." @@ -8511,14 +8301,13 @@ msgstr "" "`Box` 中的堆上,以便仅移动指针。" #: src/smart-pointers/box.md -#, fuzzy msgid "" "If `Box` was not used and we attempted to embed a `List` directly into the " "`List`, the compiler would not be able to compute a fixed size for the " "struct in memory (the `List` would be of infinite size)." msgstr "" -"如果这里未使用 `Box`,且我们曾尝试将一个 `List` 直接嵌入 `List`, 编译器就不" -"会计算内存中结构体的固定大小,结构体看起来会像是无限大。" +"如果不使用 `Box`,而是尝试将一个 `List` 直接嵌入 `List` 本身,编译器将无法计" +"算该结构体在内存中的固定大小(`List` 的大小将是无限的)。" #: src/smart-pointers/box.md msgid "" @@ -8529,16 +8318,15 @@ msgstr "" "这个问题。" #: src/smart-pointers/box.md -#, fuzzy msgid "" "Remove the `Box` in the List definition and show the compiler error. We get " "the message \"recursive without indirection\", because for data recursion, " "we have to use indirection, a `Box` or reference of some kind, instead of " "storing the value directly." msgstr "" -"将 `Box` 从 List 定义中移除后,画面上会显示编译器错误。如果您看到“Recursive " -"with indirection”错误消息,这是在提示您使用 Box 或其他类型的引用,而不是直接" -"储存值。" +"从 List 定义中移除 `Box`,并展示编译器错误。你会看到“recursive without " +"indirection”消息,这是因为数据递归必须使用某种间接方式(`Box` 或引用),而不" +"能直接存储值。" #: src/smart-pointers/box.md msgid "Niche Optimization" @@ -8550,6 +8338,8 @@ msgid "" "This makes `Box` one of the types that allow the compiler to optimize " "storage of some enums." msgstr "" +"尽管 `Box` 看起来像 C++ 中的 `std::unique_ptr`,但它不能为空 / null。这使得 " +"`Box` 成为可以让编译器优化某些枚举存储方式的类型之一。" #: src/smart-pointers/box.md msgid "" @@ -8558,28 +8348,29 @@ msgid "" "tag ([\"Null Pointer Optimization\"](https://doc.rust-lang.org/std/option/" "#representation)):" msgstr "" +"例如,`Option>` 与 `Box` 的大小相同,因为编译器使用 NULL 值而不是" +"显式的标记来区分变体([“空指针优化”" +"](https://doc.rust-lang.org/std/option/#representation)):" #: src/smart-pointers/box.md msgid "\"Just box\"" -msgstr "" +msgstr "\"Just box\"" #: src/smart-pointers/box.md -#, fuzzy msgid "\"Optional box\"" -msgstr "异常" +msgstr "\"Optional box\"" #: src/smart-pointers/box.md msgid "\"Size of just_box: {}\"" -msgstr "" +msgstr "\"Size of just_box: {}\"" #: src/smart-pointers/box.md msgid "\"Size of optional_box: {}\"" -msgstr "" +msgstr "\"Size of optional_box: {}\"" #: src/smart-pointers/box.md -#, fuzzy msgid "\"Size of none: {}\"" -msgstr "\"before: {a}\"" +msgstr "\"Size of none: {}\"" #: src/smart-pointers/rc.md msgid "" @@ -8588,7 +8379,7 @@ msgid "" "from multiple places:" msgstr "" "[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) 是引用计数的共享指" -"针。如果您需要从多个位置 引用相同的数据,请使用此指针:" +"针。如果你需要从多个位置 引用相同的数据,请使用此指针:" #: src/smart-pointers/rc.md msgid "\"a: {a}\"" @@ -8599,22 +8390,22 @@ msgid "\"b: {b}\"" msgstr "\"b: {b}\"" #: src/smart-pointers/rc.md -#, fuzzy msgid "" "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 "" -"如果您在多线程情境中,请参阅 [`Arc`](https://doc.rust-lang.org/std/sync/" -"struct.Mutex.html)。" +"如果你在多线程情境中,请参阅 [`Arc`](../concurrency/shared_state/arc.md) 和 " +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)。" #: src/smart-pointers/rc.md 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 "" -"您可以将共享指针_降级_为 [`Weak`](https://doc.rust-lang.org/std/rc/struct." -"Weak.html) 指针, 以便创建之后会被舍弃的循环引用。" +"你可以将共享指针 _降级_ 为 " +"[`Weak`](https://doc.rust-lang.org/std/rc/struct.Weak.html) 指针,以便创建之" +"后会被舍弃的循环引用。" #: src/smart-pointers/rc.md msgid "" @@ -8624,7 +8415,7 @@ msgstr "`Rc` 的计数可确保只要有引用,内含的值就会保持有效 #: src/smart-pointers/rc.md msgid "`Rc` in Rust is like `std::shared_ptr` in C++." -msgstr "Rust 中的“Rc”与 C++ 中的“std::shared_ptr”类似。" +msgstr "Rust 中的`Rc`与 C++ 中的`std::shared_ptr`类似。" #: src/smart-pointers/rc.md msgid "" @@ -8647,13 +8438,12 @@ msgid "Use `Rc::strong_count` to check the reference count." msgstr "使用 `Rc::strong_count` 可查看引用计数。" #: src/smart-pointers/rc.md -#, fuzzy msgid "" "`Rc::downgrade` gives you a _weakly reference-counted_ object to create " "cycles that will be dropped properly (likely in combination with `RefCell`)." msgstr "" -"`Rc::downgrade` 会向您提供 _弱引用计数_ 对象, 以便创建之后会被适当舍弃的周期" -"(可能会与 `RefCell` 组合)。" +"`Rc::downgrade` 会向你提供 _弱引用计数_ 对象,以便创建之后会被正确舍弃的循环" +"引用(可能会与 `RefCell` 结合使用)。" #: src/smart-pointers/trait-objects.md msgid "" @@ -8666,7 +8456,6 @@ msgid "\"Miau!\"" msgstr "\"Miau!\"" #: src/smart-pointers/trait-objects.md -#, fuzzy msgid "\"Hello, who are you? {}\"" msgstr "\"Hello, who are you? {}\"" @@ -8675,7 +8464,6 @@ msgid "Memory layout after allocating `pets`:" msgstr "以下是分配 `pets` 后的内存布局:" #: src/smart-pointers/trait-objects.md -#, fuzzy msgid "" "```bob\n" " Stack Heap\n" @@ -8735,61 +8523,62 @@ msgid "" "```" msgstr "" "```bob\n" -" Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- -.\n" -": : : :\n" -": pets : : +----+----+----+----" -"+ :\n" -": +-----------+-------+ : : +-----+-----+ .->| F | i | d | o " -"| :\n" -": | ptr | o---+---+-----+-->| o o | o o | | +----+----+----+----" -"+ :\n" -": | len | 2 | : : +-|-|-+-|-|-+ " -"`---------. :\n" -": | capacity | 2 | : : | | | | data " -"| :\n" -": +-----------+-------+ : : | | | | +-------+--|-------" -"+ :\n" -": : : | | | '-->| name | o, 4, 4 " -"| :\n" -": : : | | | | age | 5 " -"| :\n" -"`- - - - - - - - - - - - - -' : | | | +-------+----------" -"+ :\n" -" : | | " -"| :\n" -" : | | | " -"vtable :\n" -" : | | | +----------------------" -"+ :\n" -" : | | '---->| \"::talk\" " -"| :\n" -" : | | +----------------------" -"+ :\n" -" : | " -"| :\n" -" : | | " -"data :\n" -" : | | +-------+-------" -"+ :\n" -" : | '-->| lives | 9 " -"| :\n" -" : | +-------+-------" -"+ :\n" -" : " -"| :\n" -" : | " -"vtable :\n" -" : | +----------------------" -"+ :\n" -" : '---->| \"::talk\" " -"| :\n" -" : +----------------------" -"+ :\n" -" : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- -'\n" +" 栈 堆\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - " +"- - -.\n" +": : : " +" :\n" +": \"pets: Vec\" : : \"data: Cat\" " +"+----+----+----+----+ :\n" +": +-----------+-------+ : : +-------+-------+ | F | i | d | " +"o | :\n" +": | ptr | o---+---+--. : | lives | 9 | " +"+----+----+----+----+ :\n" +": | len | 2 | : | : +-------+-------+ ^ " +" :\n" +": | capacity | 2 | : | : ^ | " +" :\n" +": +-----------+-------+ : | : | '-------. " +" :\n" +": : | : | data:\"Dog\"| " +" :\n" +": : | : | " +"+-------+--|-------+ :\n" +"`- - - - - - - - - - - - - -' | : +---|-+-----+ | name | o, 4, 4 " +"| :\n" +" `--+-->| o o | o o-|----->| age | 5 " +"| :\n" +" : +-|---+-|---+ " +"+-------+----------+ :\n" +" : | | " +" :\n" +" `- - -| - - |- - - - - - - - - - - - - - " +"- - -'\n" +" | |\n" +" | | \"程序" +"文本\"\n" +" .- - -| - - |- - - - - - - - - - - - - - " +"- - -.\n" +" : | | vtable " +" :\n" +" : | | " +"+----------------------+ :\n" +" : | `----->| \"::talk\" | :\n" +" : | " +"+----------------------+ :\n" +" : | vtable " +" :\n" +" : | " +"+----------------------+ :\n" +" : '----------->| \"::talk\" | :\n" +" : " +"+----------------------+ :\n" +" : " +" :\n" +" '- - - - - - - - - - - - - - - - - - - - " +"- - -'\n" "```" #: src/smart-pointers/trait-objects.md @@ -8804,7 +8593,7 @@ msgstr "" msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." -msgstr "可通过“dyn Pet”这个方法向编译器告知实现“Pet”的动态大小类型。" +msgstr "可通过`dyn Pet`这个方法向编译器告知实现`Pet`的动态大小类型。" #: src/smart-pointers/trait-objects.md msgid "" @@ -8860,11 +8649,11 @@ msgstr "额外提示:对按顺序返回值的二元树实现迭代器。" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A node in the binary tree.\n" -msgstr "" +msgstr "/// A node in the binary tree.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A possibly-empty subtree.\n" -msgstr "" +msgstr "/// A possibly-empty subtree.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "" @@ -8877,9 +8666,8 @@ msgstr "" "/// If the same value is added multiple times, it is only stored once.\n" #: src/smart-pointers/exercise.md -#, fuzzy msgid "// Implement `new`, `insert`, `len`, and `has`." -msgstr "// Implement `new`, `insert`, and `has`.\n" +msgstr "// Implement `new`, `insert`, `len`, and `has`." #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "// not a unique item\n" @@ -8890,46 +8678,40 @@ msgid "\"bar\"" msgstr "\"bar\"" #: src/welcome-day-3-afternoon.md -#, fuzzy msgid "[Borrowing](./borrowing.md) (50 minutes)" -msgstr "" -"借用:\n" -"请参阅 [借用](ownership/borrowing.md)。" +msgstr "[借用](./borrowing.md)(50 分钟)" #: src/welcome-day-3-afternoon.md -#, fuzzy msgid "[Lifetimes](./lifetimes.md) (50 minutes)" -msgstr "[引用](../references.md)(50 分钟)" +msgstr "[生命周期](./lifetimes.md)(50 分钟)" #: src/welcome-day-3-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 1 hour and 50 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 1 小时 50 分钟" #: src/borrowing.md msgid "[Borrowing a Value](./borrowing/shared.md) (10 minutes)" -msgstr "" +msgstr "[借用值](./borrowing/shared.md)(10 分钟)" #: src/borrowing.md msgid "[Borrow Checking](./borrowing/borrowck.md) (10 minutes)" -msgstr "" +msgstr "[借用检查](./borrowing/borrowck.md)(10 分钟)" #: src/borrowing.md msgid "[Interior Mutability](./borrowing/interior-mutability.md) (10 minutes)" -msgstr "" +msgstr "[内部可变性](./borrowing/interior-mutability.md)(10 分钟)" #: src/borrowing.md -#, fuzzy msgid "[Exercise: Health Statistics](./borrowing/exercise.md) (20 minutes)" -msgstr "练习:迭代器方法链接" +msgstr "[练习:健康统计](./borrowing/exercise.md)(20 分钟)" #: src/borrowing/shared.md -#, fuzzy msgid "" "As we saw before, instead of transferring ownership when calling a function, " "you can let a function _borrow_ the value:" -msgstr "调用函数时,你可以让 函数“借用”值,而不是转移所有权:" +msgstr "正如我们之前所见,调用函数时,你可以让函数“借用”值,而不是转移所有权:" #: src/borrowing/shared.md msgid "The `add` function _borrows_ two points and returns a new point." @@ -8951,7 +8733,6 @@ msgid "Notes on stack returns:" msgstr "关于栈返回的说明:" #: src/borrowing/shared.md -#, fuzzy 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 " @@ -8962,15 +8743,16 @@ msgid "" "the same when changing to the \"RELEASE\" setting:" msgstr "" "证明从 `add` 返回的开销很低,因为编译器可以消除复制操作。更改上述代码以输出栈" -"地址,并在 [Playground](https://play.rust-lang.org/) 上运行它。在“调试”优化级" -"别中,地址应发生变化,而在改成“发布”设置时保持不变:" +"地址,并在 [Playground](https://play.rust-lang.org/?version=stable&mode=" +"release&edition=2021&gist=0cb13be1c05d7e3446686ad9947c4671) 上运行,或在 " +"[Godbolt](https://rust.godbolt.org/) 中查看汇编代码。在“DEBUG”优化级别下,地址" +"应发生变化,而改为“RELEASE”设置时则保持不变:" #: src/borrowing/shared.md msgid "The Rust compiler can do return value optimization (RVO)." msgstr "Rust 编译器能够执行返回值优化 (RVO)。" #: src/borrowing/shared.md -#, fuzzy 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 " @@ -8982,21 +8764,18 @@ msgstr "" "`memcpy` 复制。" #: src/borrowing/borrowck.md -#, fuzzy msgid "" "Rust's _borrow checker_ puts constraints on the ways you can borrow values. " "For a given value, at any time:" -msgstr "Rust 限制了借用值的方式:" +msgstr "Rust 的 _借用检查器_ 对借用值的方式加以限制。对于给定的值,在任意时刻:" #: src/borrowing/borrowck.md -#, fuzzy msgid "You can have one or more shared references to the value, _or_" -msgstr "在任何给定时间,你都可以有一个或多个 `&T` 值,或者" +msgstr "你可以有一个或多个共享引用,_或者_" #: src/borrowing/borrowck.md -#, fuzzy msgid "You can have exactly one exclusive reference to the value." -msgstr "你可以有且只有一个 `&mut T` 值。" +msgstr "你可以有且只有一个独占引用。" #: src/borrowing/borrowck.md msgid "" @@ -9030,7 +8809,6 @@ msgstr "" "是借用检查器的一个功能,名为“非词法作用域生命周期”。" #: src/borrowing/borrowck.md -#, fuzzy msgid "" "The exclusive reference constraint is quite strong. Rust uses it to ensure " "that data races do not occur. Rust also _relies_ on this constraint to " @@ -9049,7 +8827,7 @@ msgid "" "this often results in \"fighting with the borrow checker.\"" msgstr "" "借用检查器专用于处理许多常见模式,例如同时对结构体中的不同字段进行独占引用。" -"但在某些情况下,它并不能完全 “领会”您的意图,这往往会导致 “与借用检查器进行一" +"但在某些情况下,它并不能完全 “领会”你的意图,这往往会导致 “与借用检查器进行一" "番斗争”。" #: src/borrowing/interior-mutability.md @@ -9058,6 +8836,8 @@ msgid "" "only) reference. For example, a shared data structure might have an internal " "cache, and wish to update that cache from read-only methods." msgstr "" +"在某些情况下,需要修改共享(只读)引用背后的数据。例如,一个共享的数据结构可" +"能带有内部缓存,并希望在只读方法中更新该缓存。" #: src/borrowing/interior-mutability.md msgid "" @@ -9065,11 +8845,12 @@ msgid "" "a shared reference. The standard library provides several ways to do this, " "all while still ensuring safety, typically by performing a runtime check." msgstr "" +"“内部可变性”模式允许在共享引用背后进行独占(可变)访问。标准库提供了多种实现" +"方式,它们都能保证安全性,通常是通过运行时检查来实现的。" #: src/borrowing/interior-mutability.md -#, fuzzy msgid "`RefCell`" -msgstr "`RefCell`" +msgstr "`RefCell`" #: src/borrowing/interior-mutability.md msgid "\"graph: {root:#?}\"" @@ -9080,9 +8861,8 @@ msgid "\"graph sum: {}\"" msgstr "\"graph sum: {}\"" #: src/borrowing/interior-mutability.md -#, fuzzy msgid "`Cell`" -msgstr "`Cell`" +msgstr "`Cell`" #: src/borrowing/interior-mutability.md msgid "" @@ -9090,6 +8870,8 @@ msgid "" "shared reference to the `Cell`. However, it does not allow any references to " "the value. Since there are no references, borrowing rules cannot be broken." msgstr "" +"`Cell` 包装一个值,即使只持有指向该 `Cell` 的共享引用,也能读取或设置这个值" +"。但它不允许获取指向该值的任何引用。既然不存在引用,也就无从违反借用规则。" #: src/borrowing/interior-mutability.md msgid "" @@ -9097,6 +8879,8 @@ msgid "" "ways to modify data behind a shared reference. There are a variety of ways " "to ensure that safety, and `RefCell` and `Cell` are two of them." msgstr "" +"这一页要传达的重点是:Rust 提供了 _安全_ 的方式来修改共享引用背后的数据。保" +"证这种安全性的手段有多种,`RefCell` 和 `Cell` 只是其中两种。" #: src/borrowing/interior-mutability.md msgid "" @@ -9105,6 +8889,9 @@ msgid "" "case, all borrows are very short and never overlap, so the checks always " "succeed." msgstr "" +"`RefCell` 通过运行时检查来执行 Rust 通常的借用规则(要么是多个共享引用,要么" +"是单个独占引用)。在这个例子中,所有借用都非常短暂且从不重叠,因此检查总能通" +"过。" #: src/borrowing/interior-mutability.md msgid "" @@ -9112,6 +8899,8 @@ msgid "" "purpose is to allow (and count) many references. But we want to modify the " "value, so we need interior mutability." msgstr "" +"`Rc` 只允许对其内容进行共享(只读)访问,因为它的用途就是允许(并统计)多个" +"引用。但我们想修改这个值,所以需要内部可变性。" #: src/borrowing/interior-mutability.md msgid "" @@ -9119,15 +8908,14 @@ msgid "" "`&self`. This needs no runtime check, but requires moving values, which can " "have its own cost." msgstr "" +"`Cell` 是保证安全性的一种更简单的手段:它有一个接收 `&self` 的 `set` 方法。" +"这不需要运行时检查,但要求移动值,而移动本身也可能有开销。" #: src/borrowing/interior-mutability.md -#, fuzzy msgid "" "Demonstrate that reference loops can be created by adding `root` to `subtree." "children`." -msgstr "" -"演示可以通过向“subtree.children”添加“root”来创建引用循环(不要尝试输出" -"它!)。" +msgstr "演示可以通过将 `root` 添加到 `subtree.children` 来创建引用循环。" #: src/borrowing/interior-mutability.md msgid "" @@ -9136,9 +8924,9 @@ msgid "" "the presence of the reference loop, with `thread 'main' panicked at 'already " "borrowed: BorrowMutError'`." msgstr "" -"为了演示运行时 panic,请添加一个会递增“self.value”并以相同方法调用其子项" -"的“fn inc(&mut self)”。如果存在引用循环,就会 panic,并且“thread”“main”会" -"因“already borrowed: BorrowMutError”而 panic。" +"为了演示运行时 panic,请添加一个会递增`self.value`并以相同方法调用其子项的" +"`fn inc(&mut self)`。如果存在引用循环,就会 panic,并且“thread”“main”会因“" +"already borrowed: BorrowMutError”而 panic。" #: src/borrowing/exercise.md msgid "" @@ -9149,7 +8937,6 @@ msgstr "" "追踪。" #: src/borrowing/exercise.md -#, fuzzy msgid "" "You'll start with a stubbed function in an `impl` block as well as a `User` " "struct definition. Your goal is to implement the stubbed out method on the " @@ -9159,7 +8946,6 @@ msgstr "" "`impl` 块中定义的 `User` `struct` 的方法。" #: src/borrowing/exercise.md -#, fuzzy msgid "" "Copy the code below to and fill in the missing " "method:" @@ -9184,28 +8970,23 @@ msgid "\"I'm {} and my age is {}\"" msgstr "\"I'm {} and my age is {}\"" #: src/lifetimes.md -#, fuzzy msgid "" "[Lifetime Annotations](./lifetimes/lifetime-annotations.md) (10 minutes)" -msgstr "[切片与生命周期](../slices-and-lifetimes.md)(1 小时 10 分钟)" +msgstr "[生命周期注解](./lifetimes/lifetime-annotations.md)(10 分钟)" #: src/lifetimes.md -#, fuzzy msgid "[Lifetime Elision](./lifetimes/lifetime-elision.md) (5 minutes)" -msgstr "[切片与生命周期](../slices-and-lifetimes.md)(1 小时 10 分钟)" +msgstr "[生命周期省略](./lifetimes/lifetime-elision.md)(5 分钟)" #: src/lifetimes.md -#, fuzzy msgid "[Struct Lifetimes](./lifetimes/struct-lifetimes.md) (5 minutes)" -msgstr "[切片与生命周期](../slices-and-lifetimes.md)(1 小时 10 分钟)" +msgstr "[结构体生命周期](./lifetimes/struct-lifetimes.md)(5 分钟)" #: src/lifetimes.md -#, fuzzy msgid "[Exercise: Protobuf Parsing](./lifetimes/exercise.md) (30 minutes)" -msgstr "练习:迭代器方法链接" +msgstr "[练习:Protobuf 解析](./lifetimes/exercise.md)(30 分钟)" #: src/lifetimes/lifetime-annotations.md -#, fuzzy msgid "" "A reference has a _lifetime_, which must not \"outlive\" the value it refers " "to. This is verified by the borrow checker." @@ -9214,7 +8995,6 @@ msgstr "" "器进行验证。" #: src/lifetimes/lifetime-annotations.md -#, fuzzy msgid "" "The lifetime can be implicit - this is what we have seen so far. Lifetimes " "can also be explicit: `&'a Point`, `&'document str`. Lifetimes start with " @@ -9226,12 +9006,13 @@ msgstr "" "`&'a Point` 读取为 “一个借用的 `Point`,至少在生命周期 `a` 内有效”。" #: src/lifetimes/lifetime-annotations.md -#, fuzzy msgid "" "Lifetimes are always inferred by the compiler: you cannot assign a lifetime " "yourself. Explicit lifetime annotations create constraints where there is " "ambiguity; the compiler verifies that there is a valid solution." -msgstr "生命周期注释会创建约束条件;编译器会验证 是否存在有效的解决方案。" +msgstr "" +"生命周期始终由编译器推断:你不能自行指定生命周期。显式生命周期注解会在存在歧" +"义的地方创建约束;编译器会验证是否存在有效的解决方案。" #: src/lifetimes/lifetime-annotations.md msgid "" @@ -9240,16 +9021,14 @@ msgid "" msgstr "当考虑向函数传递值和从函数返回值时,生命周期会变得更加复杂。" #: src/lifetimes/lifetime-annotations.md -#, fuzzy msgid "// What is the lifetime of p3?" -msgstr "// What is the lifetime of p3?\n" +msgstr "// What is the lifetime of p3?" #: src/lifetimes/lifetime-annotations.md msgid "\"p3: {p3:?}\"" msgstr "\"p3: {p3:?}\"" #: src/lifetimes/lifetime-annotations.md -#, fuzzy msgid "" "In this example, the compiler does not know what lifetime to infer for `p3`. " "Looking inside the function body shows that it can only safely assume that " @@ -9283,16 +9062,15 @@ msgid "Lifetimes in Function Calls" msgstr "函数调用中的生命周期" #: src/lifetimes/lifetime-elision.md -#, fuzzy 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). This is not " "inference -- it is just a syntactic shorthand." msgstr "" -"必须完全指定函数参数和返回值的生命周期, 但 Rust 允许在大多数情况下通过\\[一" -"些简单的 规则\\](https://doc.rust-lang.org/nomicon/lifetime-elision.html)来" -"省略此操作。" +"函数参数和返回值的生命周期必须完全指定,但 Rust 允许在大多数情况下依据[一些简" +"单的规则](https://doc.rust-lang.org/nomicon/lifetime-elision.html)省略生命周" +"期。这并不是推断——只是一种语法简写。" #: src/lifetimes/lifetime-elision.md msgid "Each argument which does not have a lifetime annotation is given one." @@ -9329,13 +9107,12 @@ msgid "Try adjusting the signature to \"lie\" about the lifetimes returned:" msgstr "请尝试将签名调整为 “谎报”了返回的生命周期:" #: src/lifetimes/lifetime-elision.md -#, fuzzy msgid "" "This won't compile, demonstrating that the annotations are checked for " "validity by the compiler. Note that this is not the case for raw pointers " "(unsafe), and this is a common source of errors with unsafe Rust." msgstr "" -"这将无法编译,表面编译器会检查注解是否有效。请注意,原始指针并非如此(不安" +"这将无法编译,表明编译器会检查注解是否有效。请注意,原始指针并非如此(不安" "全),这是不安全 Rust 中导致错误的常见原因。" #: src/lifetimes/lifetime-elision.md @@ -9346,6 +9123,10 @@ msgid "" "help resolve ambiguity. Often, especially when prototyping, it's easier to " "just work with owned data by cloning values where necessary." msgstr "" +"学员可能会问什么时候需要用生命周期。Rust 中的借用 _始终_ 带有生命周期,只是" +"大多数时候,省略规则和类型推导让它们不必写出来。在较复杂的情况下,生命周期注" +"解有助于消除歧义。而在很多场合,尤其是做原型时,在必要处克隆值、直接使用拥有" +"所有权的数据往往更省事。" #: src/lifetimes/struct-lifetimes.md msgid "Lifetimes in Data Structures" @@ -9365,9 +9146,8 @@ msgid "\"The quick brown fox jumps over the lazy dog.\"" msgstr "\"The quick brown fox jumps over the lazy dog.\"" #: src/lifetimes/struct-lifetimes.md -#, fuzzy msgid "// erase(text);" -msgstr "// erase(text);\n" +msgstr "// erase(text);" #: src/lifetimes/struct-lifetimes.md msgid "\"{fox:?}\"" @@ -9425,7 +9205,7 @@ msgid "" "simpler than it seems! This illustrates a common parsing pattern, passing " "slices of data. The underlying data itself is never copied." msgstr "" -"在本练习中,您将为 [protobuf 二进制编码](https://protobuf.dev/programming-" +"在本练习中,你将为 [protobuf 二进制编码](https://protobuf.dev/programming-" "guides/encoding/) 构建一个解析器。别担心,其实非常简单!这展示了一种常见的解" "析模式,即传递数据 slice。底层数据本身永远不会被复制。" @@ -9462,18 +9242,17 @@ msgid "" "code also defines callbacks to handle `Person` and `PhoneNumber` fields, and " "to parse a message into a series of calls to those callbacks." msgstr "" -"整数(包括标签)使用名为 VARINT 的可变长度编码表示。幸运的是,下面为您提供了 " +"整数(包括标签)使用名为 VARINT 的可变长度编码表示。幸运的是,下面为你提供了 " "`parse_varint` 的定义。该指定代码还定义了一些回调,用于处理 `Person` 和 " "`PhoneNumber` 字段,并将消息解析为对这些回调的一系列调用。" #: src/lifetimes/exercise.md -#, fuzzy msgid "" "What remains for you is to implement the `parse_field` function and the " "`ProtoMessage` trait for `Person` and `PhoneNumber`." msgstr "" -"您要做的是实现 `parse_field` 函数,以及`Person` 和 `PhoneNumber`的特征" -"`ProtoMessage`。" +"你要做的是实现 `parse_field` 函数,以及 `Person` 和 `PhoneNumber` 的 " +"`ProtoMessage` 特征。" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Invalid varint\"" @@ -9508,7 +9287,6 @@ msgid "/// The Varint WireType indicates the value is a single VARINT.\n" msgstr "/// Varint WireType 表明该值为单个 VARINT。\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md -#, fuzzy msgid "" "//I64, -- not needed for this exercise\n" " /// The Len WireType indicates that the value is a length represented as " @@ -9516,19 +9294,17 @@ msgid "" " /// VARINT followed by exactly that number of bytes.\n" msgstr "" "//I64, -- not needed for this exercise\n" -" /// The Len WireType indicates that the value is a length represented as " -"a VARINT\n" -" /// followed by exactly that number of bytes.\n" +" /// The Len WireType indicates that the value is a length represented " +"as a\n" +" /// VARINT followed by exactly that number of bytes.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md -#, fuzzy msgid "" "/// The I32 WireType indicates that the value is precisely 4 bytes in\n" " /// little-endian order containing a 32-bit signed integer.\n" msgstr "" -"/// The I32 WireType indicates that the value is precisely 4 bytes in little-" -"endian order\n" -" /// containing a 32-bit signed integer.\n" +"/// The I32 WireType indicates that the value is precisely 4 bytes in\n" +" /// little-endian order containing a 32-bit signed integer.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// A field's value, typed based on the wire type.\n" @@ -9577,13 +9353,14 @@ msgid "" "\"Based on the wire type, build a Field, consuming as many bytes as " "necessary.\"" msgstr "" +"\"Based on the wire type, build a Field, consuming as many bytes as " +"necessary.\"" #: src/lifetimes/exercise.md msgid "\"Return the field, and any un-consumed bytes.\"" -msgstr "" +msgstr "\"Return the field, and any un-consumed bytes.\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md -#, fuzzy msgid "" "/// Parse a message in the given data, calling `T::add_field` for each field " "in\n" @@ -9591,15 +9368,15 @@ msgid "" "///\n" "/// The entire input is consumed.\n" msgstr "" -"/// Parse a message in the given data, calling `field_callback` for each " -"field in the message.\n" +"/// Parse a message in the given data, calling `T::add_field` for each " +"field in\n" +"/// the message.\n" "///\n" "/// The entire input is consumed.\n" #: src/lifetimes/exercise.md -#, fuzzy msgid "// TODO: Implement ProtoMessage for Person and PhoneNumber." -msgstr "// TODO: Implement `Widget` for `Label`.\n" +msgstr "// TODO: Implement ProtoMessage for Person and PhoneNumber." #: src/lifetimes/solution.md msgid "// Unwrap error because `value` is definitely 4 bytes long.\n" @@ -9611,18 +9388,16 @@ msgstr "// skip everything else\n" #: src/lifetimes/solution.md msgid "b\"hello\"" -msgstr "" +msgstr "b\"hello\"" #: src/welcome-day-4.md -#, fuzzy msgid "Welcome to Day 4" -msgstr "欢迎来到第一天" +msgstr "欢迎来到第四天" #: src/welcome-day-4.md -#, fuzzy msgid "" "Today we will cover topics relating to building large-scale software in Rust:" -msgstr "今天,我们将介绍一些更高级的 Rust 主题:" +msgstr "今天我们将介绍与使用 Rust 构建大规模软件相关的主题:" #: src/welcome-day-4.md msgid "Iterators: a deep dive on the `Iterator` trait." @@ -9633,65 +9408,60 @@ msgid "Modules and visibility." msgstr "模块和可见性。" #: src/welcome-day-4.md -#, fuzzy msgid "Testing." -msgstr "测试" +msgstr "测试。" #: src/welcome-day-4.md msgid "Error handling: panics, `Result`, and the try operator `?`." -msgstr "错误处理:panic、“Result”和 try 运算符“?”。" +msgstr "错误处理:panic、`Result`和 try 运算符`?`。" #: src/welcome-day-4.md msgid "" "Unsafe Rust: the escape hatch when you can't express yourself in safe Rust." -msgstr "不安全 Rust:当无法用安全 Rust 表达您的意图时,则可将其作为应急方法。" +msgstr "不安全 Rust:当无法用安全 Rust 表达你的意图时,则可将其作为应急方法。" #: src/welcome-day-4.md msgid "[Welcome](./welcome-day-4.md) (3 minutes)" -msgstr "" +msgstr "[欢迎](./welcome-day-4.md)(3 分钟)" #: src/welcome-day-4.md msgid "[Iterators](./iterators.md) (45 minutes)" -msgstr "" +msgstr "[迭代器](./iterators.md)(45 分钟)" #: src/welcome-day-4.md msgid "[Modules](./modules.md) (40 minutes)" -msgstr "" +msgstr "[模块](./modules.md)(40 分钟)" #: src/welcome-day-4.md -#, fuzzy msgid "[Testing](./testing.md) (45 minutes)" -msgstr "" -"借用:\n" -"请参阅 [借用](ownership/borrowing.md)。" +msgstr "[测试](./testing.md)(45 分钟)" #: src/welcome-day-4.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 40 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 40 分钟" #: src/iterators.md msgid "[Iterator](./iterators/iterator.md) (5 minutes)" -msgstr "" +msgstr "[Iterator](./iterators/iterator.md)(5 分钟)" #: src/iterators.md msgid "[IntoIterator](./iterators/intoiterator.md) (5 minutes)" -msgstr "" +msgstr "[IntoIterator](./iterators/intoiterator.md)(5 分钟)" #: src/iterators.md msgid "[FromIterator](./iterators/fromiterator.md) (5 minutes)" -msgstr "" +msgstr "[FromIterator](./iterators/fromiterator.md)(5 分钟)" #: src/iterators.md -#, fuzzy msgid "" "[Exercise: Iterator Method Chaining](./iterators/exercise.md) (30 minutes)" -msgstr "练习:迭代器方法链接" +msgstr "[练习:迭代器方法链](./iterators/exercise.md)(30 分钟)" #: src/iterators.md src/testing.md msgid "This segment should take about 45 minutes" -msgstr "" +msgstr "本节大约需要 45 分钟" #: src/iterators/iterator.md msgid "" @@ -9702,14 +9472,13 @@ msgid "" msgstr "" "['Iterator'](https://doc.rust-lang.org/std/iter/trait.Iterator.html) trait 支" "持迭代集合中的值。它需要用到 `next` 方法,并提供很多方法。许多标准库类型均能" -"实现 `Iterator`,您也可以自行实现:" +"实现 `Iterator`,你也可以自行实现:" #: src/iterators/iterator.md msgid "\"fib({i}): {n}\"" msgstr "\"fib({i}): {n}\"" #: src/iterators/iterator.md -#, fuzzy msgid "" "The `Iterator` trait implements many common functional programming " "operations over collections (e.g. `map`, `filter`, `reduce`, etc). This is " @@ -9717,9 +9486,9 @@ msgid "" "functions should produce the code as efficient as equivalent imperative " "implementations." msgstr "" -"`Iterator` 特征会对集合实现许多常见的函数程序操作, 例如 ` map`filter \\``和" -"`reduce\\` 等。您可以通过此特征找到有关它们的所有 文档。在 Rust 中,这些函数" -"应生成代码,且生成的代码应与等效命令式实现一样 高效。" +"`Iterator` 特征为集合实现了许多常见的函数式编程操作(例如 `map`、`filter`、" +"`reduce` 等)。你可以在这个特征里找到关于它们的全部文档。在 Rust 中,这些函" +"数生成的代码应当与等效的命令式实现一样高效。" #: src/iterators/iterator.md msgid "" @@ -9730,50 +9499,47 @@ msgid "" msgstr "" "`IntoIterator` 是迫使 for 循环运作的特征。此特征由集合类型 (例如 `Vec`)" "和相关引用(例如 `&Vec` 和 `&[T]`)而实现。此外,范围也会实现这项特征。因" -"此, 您可以使用 `for i in some_vec { .. }` 来遍历某矢量,但 `some_vec." +"此, 你可以使用 `for i in some_vec { .. }` 来遍历某矢量,但 `some_vec." "next()` 不存在。" #: src/iterators/intoiterator.md -#, fuzzy msgid "" "The `Iterator` trait tells you how to _iterate_ once you have created an " "iterator. The related trait [`IntoIterator`](https://doc.rust-lang.org/std/" "iter/trait.IntoIterator.html) defines how to create an iterator for a type. " "It is used automatically by the `for` loop." msgstr "" -"“Iterator”trait会告知您在创建迭代器后如何进行迭代。相关 trait“IntoIterator”会" -"告知您如何创建迭代器:" +"`Iterator` 特征告诉你在创建迭代器之后如何 _迭代_。相关的 " +"[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +"特征则定义了如何为某个类型创建迭代器,`for` 循环会自动使用它。" #: src/iterators/intoiterator.md msgid "\"point = {x}, {y}\"" msgstr "\"point = {x}, {y}\"" #: src/iterators/intoiterator.md -#, fuzzy msgid "" "Click through to the docs for `IntoIterator`. Every implementation of " "`IntoIterator` must declare two types:" -msgstr "这里的语法表示,“IntoIterator”的每个实现都必须声明两种类型:" +msgstr "" +"点进 `IntoIterator` 的文档看看。`IntoIterator` 的每个实现都必须声明两种类型" +":" #: src/iterators/intoiterator.md -#, fuzzy msgid "`Item`: the type to iterate over, such as `i8`," -msgstr "`Item`:我们迭代的类型,例如 `i8`," +msgstr "`Item`:要迭代的类型,例如 `i8`," #: src/iterators/intoiterator.md msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." -msgstr "“IntoIter”:“into_iter”方法返回的“Iterator”类型。" +msgstr "`IntoIter`:`into_iter`方法返回的`Iterator`类型。" #: src/iterators/intoiterator.md -#, fuzzy msgid "" "Note that `IntoIter` and `Item` are linked: the iterator must have the same " "`Item` type, which means that it returns `Option`" msgstr "" -"请注意,“IntoIter”和“Item”已关联:迭代器必须具有相同的“Item”类型,这意味着它" -"会返回“Option\n" -"\n" -"”" +"请注意,`IntoIter` 和 `Item` 是关联的:迭代器必须具有相同的 `Item` 类型,也" +"就是说它返回 `Option`" #: src/iterators/intoiterator.md msgid "The example iterates over all combinations of x and y coordinates." @@ -9817,7 +9583,7 @@ msgid "" "std/iter/trait.Iterator.html)." msgstr "" "[`FromIterator`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html) " -"让您可通过 [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator." +"让你可通过 [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator." "html) 构建一个集合。" #: src/iterators/fromiterator.md @@ -9825,23 +9591,21 @@ msgid "\"prime_squares: {prime_squares:?}\"" msgstr "\"prime_squares: {prime_squares:?}\"" #: src/iterators/fromiterator.md -#, fuzzy msgid "`Iterator` implements" -msgstr "“Iterator”" +msgstr "`Iterator` 实现了" #: src/iterators/fromiterator.md msgid "There are two ways to specify `B` for this method:" msgstr "可以通过两种方式为此方法指定 `B`:" #: src/iterators/fromiterator.md -#, fuzzy msgid "" "With the \"turbofish\": `some_iterator.collect::()`, as " "shown. The `_` shorthand used here lets Rust infer the type of the `Vec` " "elements." msgstr "" -"使用 `turbofish` 时:`some_iterator.collect::()`,如下所示。" -"通过此处所用的 `_` 简写形式,Rust 能够推理 `Vec` 元素的类型。" +"使用“turbofish”:`some_iterator.collect::()`,如上所示。这" +"里用到的 `_` 简写让 Rust 推导 `Vec` 元素的类型。" #: src/iterators/fromiterator.md msgid "" @@ -9852,37 +9616,35 @@ msgstr "" "示例重写成使用这种形式。" #: src/iterators/fromiterator.md -#, fuzzy msgid "" "There are basic implementations of `FromIterator` for `Vec`, `HashMap`, etc. " "There are also more specialized implementations which let you do cool things " "like convert an `Iterator>` into a `Result, E>`." msgstr "" -"还有一些实现,让您可执行一些很酷的操作,比如 将 `Iterator>` 转换成 `Result, E>`。" +"`Vec`、`HashMap` 等类型都有 `FromIterator` 的基本实现。此外还有一些更专门的" +"实现,让你可以做一些很酷的事情,比如把 `Iterator>` 转换" +"成 `Result, E>`。" #: src/iterators/exercise.md -#, fuzzy msgid "" "In this exercise, you will need to find and use some of the provided methods " "in the [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) " "trait to implement a complex calculation." msgstr "" -"您可以自行实现 [`Iterator`](https://doc.rust-lang.org/std/iter/trait." -"Iterator.html) 特征:" +"在本练习中,你需要在 " +"[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) 特征提" +"供的方法中找到并使用其中一些,来实现一个较复杂的计算。" #: src/iterators/exercise.md -#, fuzzy msgid "" "Copy the following code to and make the tests " "pass. Use an iterator expression and `collect` the result to construct the " "return value." msgstr "" -"将以下代码复制到 ,然后设法通过测试。请尽量避免" -"为中间结果分配“Vec”:" +"将以下代码复制到 并让测试通过。请使用迭代器表" +"达式,并用 `collect` 收集结果来构造返回值。" #: src/iterators/exercise.md src/iterators/solution.md -#, fuzzy msgid "" "/// Calculate the differences between elements of `values` offset by " "`offset`,\n" @@ -9891,41 +9653,39 @@ msgid "" "/// Element `n` of the result is `values[(n+offset)%len] - values[n]`.\n" msgstr "" "/// Calculate the differences between elements of `values` offset by " -"`offset`, wrapping\n" -"/// around from the end of `values` to the beginning.\n" +"`offset`,\n" +"/// wrapping around from the end of `values` to the beginning.\n" "///\n" "/// Element `n` of the result is `values[(n+offset)%len] - values[n]`.\n" #: src/modules.md -#, fuzzy msgid "[Modules](./modules/modules.md) (3 minutes)" -msgstr "练习:面向 GUI 库的模块" +msgstr "[模块](./modules/modules.md)(3 分钟)" #: src/modules.md msgid "[Filesystem Hierarchy](./modules/filesystem.md) (5 minutes)" -msgstr "" +msgstr "[文件系统层级结构](./modules/filesystem.md)(5 分钟)" #: src/modules.md msgid "[Visibility](./modules/visibility.md) (5 minutes)" -msgstr "" +msgstr "[可见性](./modules/visibility.md)(5 分钟)" #: src/modules.md msgid "[use, super, self](./modules/paths.md) (10 minutes)" -msgstr "" +msgstr "[use、super、self](./modules/paths.md)(10 分钟)" #: src/modules.md -#, fuzzy msgid "" "[Exercise: Modules for a GUI Library](./modules/exercise.md) (15 minutes)" -msgstr "练习:面向 GUI 库的模块" +msgstr "[练习:面向 GUI 库的模块](./modules/exercise.md)(15 分钟)" #: src/modules/modules.md msgid "We have seen how `impl` blocks let us namespace functions to a type." -msgstr "我们已看了“impl”块如何让我们将函数的命名空间建为一种类型。" +msgstr "我们已看了`impl`块如何让我们将函数的命名空间建为一种类型。" #: src/modules/modules.md msgid "Similarly, `mod` lets us namespace types and functions:" -msgstr "同样,“mod”让我们可为类型和函数建立命名空间:" +msgstr "同样,`mod`让我们可为类型和函数建立命名空间:" #: src/modules/modules.md msgid "\"In the foo module\"" @@ -9940,8 +9700,8 @@ msgid "" "Packages provide functionality and include a `Cargo.toml` file that " "describes how to build a bundle of 1+ crates." msgstr "" -"包提供功能,并包含一个描述如何构建包含 1 个以上 crate 的捆绑包的“Cargo." -"toml”文件。" +"包提供功能,并包含一个描述如何构建包含 1 个以上 crate 的捆绑包的`Cargo.toml`" +"文件。" #: src/modules/modules.md msgid "" @@ -9966,20 +9726,20 @@ msgid "" "rs`. Similarly, a `garden::vegetables` module can be found at `src/garden/" "vegetables.rs`." msgstr "" -"这会告知 Rust 可以在“src/garden.rs”中找到“garden”模块内容。同样,您可以" -"在“src/garden/vegetables.rs”中找到“garden::vegetables”模块。" +"这会告知 Rust 可以在`src/garden.rs`中找到`garden`模块内容。同样,你可以在" +"`src/garden/vegetables.rs`中找到`garden::vegetables`模块。" #: src/modules/filesystem.md msgid "The `crate` root is in:" -msgstr "“crate”根目录位于:" +msgstr "`crate`根目录位于:" #: src/modules/filesystem.md msgid "`src/lib.rs` (for a library crate)" -msgstr "“src/lib.rs”(对于库 crate)" +msgstr "`src/lib.rs`(对于库 crate)" #: src/modules/filesystem.md msgid "`src/main.rs` (for a binary crate)" -msgstr "“src/main.rs”(对于二进制文件 crate)" +msgstr "`src/main.rs`(对于二进制文件 crate)" #: src/modules/filesystem.md msgid "" @@ -9991,41 +9751,35 @@ msgstr "" "(在本例中为模块)。" #: src/modules/filesystem.md -#, fuzzy msgid "" "//! This module implements the garden, including a highly performant " "germination" msgstr "" "//! This module implements the garden, including a highly performant " -"germination\n" -"//! implementation.\n" +"germination" #: src/modules/filesystem.md -#, fuzzy msgid "//! implementation." -msgstr "实现" +msgstr "//! implementation." #: src/modules/filesystem.md -#, fuzzy msgid "// Re-export types from this module." -msgstr "// Re-export types from this module.\n" +msgstr "// Re-export types from this module." #: src/modules/filesystem.md -#, fuzzy msgid "/// Sow the given seed packets." -msgstr "/// Sow the given seed packets.\n" +msgstr "/// Sow the given seed packets." #: src/modules/filesystem.md -#, fuzzy msgid "/// Harvest the produce in the garden that is ready." -msgstr "/// Harvest the produce in the garden that is ready.\n" +msgstr "/// Harvest the produce in the garden that is ready." #: src/modules/filesystem.md 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 "" -"在 Rust 2018 之前的版本中,模块需要位于“module/mod.rs”而非“module.rs”中,对" +"在 Rust 2018 之前的版本中,模块需要位于`module/mod.rs`而非`module.rs`中,对" "于 2018 年之后的版本而言,这仍是有效的替代方案。" #: src/modules/filesystem.md @@ -10033,7 +9787,7 @@ 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”的文件" +"引入`filename.rs`来替代`filename/mod.rs`的主要原因是,许多名为`mod.rs`的文件" "在 IDE 中可能难以区分。" #: src/modules/filesystem.md @@ -10047,7 +9801,6 @@ msgid "" msgstr "Rust 寻找模块的位置可通过编译器指令更改:" #: src/modules/filesystem.md -#, fuzzy msgid "\"some/path.rs\"" msgstr "\"some/path.rs\"" @@ -10056,7 +9809,7 @@ 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 "" -"例如,如果您想将某个模块的测试放在名为“some_module_test.rs”的文件中(类似于 " +"例如,如果你想将某个模块的测试放在名为`some_module_test.rs`的文件中(类似于 " "Go 中的惯例),这样做很有用。" #: src/modules/visibility.md @@ -10076,7 +9829,7 @@ msgid "" "In other words, if an item is visible in module `foo`, it's visible in all " "the descendants of `foo`." msgstr "" -"换言之,如果某个项在模块“foo”中可见,那么该项在“foo”的所有后代中均可见。" +"换言之,如果某个项在模块`foo`中可见,那么该项在`foo`的所有后代中均可见。" #: src/modules/visibility.md msgid "\"outer::private\"" @@ -10096,13 +9849,13 @@ msgstr "\"outer::inner::public\"" #: src/modules/visibility.md msgid "Use the `pub` keyword to make modules public." -msgstr "使用“pub”关键字将模块设为公开。" +msgstr "使用`pub`关键字将模块设为公开。" #: src/modules/visibility.md msgid "" "Additionally, there are advanced `pub(...)` specifiers to restrict the scope " "of public visibility." -msgstr "此外,您还可以使用高级“pub(...)”说明符来限制公开可见的范围。" +msgstr "此外,你还可以使用高级`pub(...)`说明符来限制公开可见的范围。" #: src/modules/visibility.md msgid "" @@ -10114,11 +9867,11 @@ msgstr "" #: src/modules/visibility.md msgid "Configuring `pub(crate)` visibility is a common pattern." -msgstr "配置“pub(crate)”可见性是一种常见模式。" +msgstr "配置`pub(crate)`可见性是一种常见模式。" #: src/modules/visibility.md msgid "Less commonly, you can give visibility to a specific path." -msgstr "您可以为特定路径授予可见性,这种情况不太常见。" +msgstr "你可以为特定路径授予可见性,这种情况不太常见。" #: src/modules/visibility.md msgid "" @@ -10135,8 +9888,8 @@ msgid "" "A module can bring symbols from another module into scope with `use`. You " "will typically see something like this at the top of each module:" msgstr "" -"一个模块可以使用“use”将另一个模块的符号全部纳入。您通常在每个模块的顶部会看到" -"如下内容:" +"一个模块可以使用`use`将另一个模块的符号全部纳入。你通常在每个模块的顶部会看" +"到如下内容:" #: src/modules/paths.md msgid "Paths" @@ -10156,7 +9909,7 @@ msgstr "`foo` 或 `self::foo` 是指当前模块中的 `foo`," #: src/modules/paths.md msgid "`super::foo` refers to `foo` in the parent module." -msgstr "“super::foo”是指父模块中的“foo”。" +msgstr "`super::foo`是指父模块中的`foo`。" #: src/modules/paths.md msgid "As an absolute path:" @@ -10168,7 +9921,7 @@ msgstr "`crate::foo` 是指当前 crate 的根中的 `foo`," #: src/modules/paths.md msgid "`bar::foo` refers to `foo` in the `bar` crate." -msgstr "“bar::foo”是指“bar”crate 中的“foo”。" +msgstr "`bar::foo`是指`bar`crate 中的`foo`。" #: src/modules/paths.md msgid "" @@ -10196,7 +9949,7 @@ msgstr "" "在大多数情况下,只有模块中显示的项才需通过 `use` 引入。不过,即使实现该 " "trait 的类型已处于作用域内,如要调用该 trait 的任何方法,仍需将该 trait 引入" "到作用域内。例如,如需对实现 `Read` trait 的类型使用 `read_to_string` 方法," -"您需要使用 `use std::io::Read` 引入。" +"你需要使用 `use std::io::Read` 引入。" #: src/modules/paths.md msgid "" @@ -10213,44 +9966,43 @@ msgid "" "This library defines a `Widget` trait and a few implementations of that " "trait, as well as a `main` function." msgstr "" +"在本练习中,你将重新组织一个小型 GUI 库的实现。这个库定义了一个 `Widget` 特" +"征、该特征的几个实现,以及一个 `main` 函数。" #: src/modules/exercise.md -#, fuzzy msgid "" "It is typical to put each type or set of closely-related types into its own " "module, so each widget type should get its own module." msgstr "" -"在本练习中,您需要将课程 “方法和特征”部分的 GUI 库练习重新整理为一组模块。通" -"常情况下,将每种类型或一组密切相关的类型放入各自的模块中,因此每种 widget 类" -"型都应拥有自己的模块。" +"通常的做法是把每个类型或一组密切相关的类型放进各自的模块,因此每种 widget 类" +"型都应该有自己的模块。" #: src/modules/exercise.md -#, fuzzy msgid "Cargo Setup" -msgstr "设置" +msgstr "Cargo 设置" #: src/modules/exercise.md msgid "" "The Rust playground only supports one file, so you will need to make a Cargo " "project on your local filesystem:" msgstr "" -"Rust Playground 仅支持一个文件,因此您需要在本地文件系统上创建一个 Cargo 项" +"Rust Playground 仅支持一个文件,因此你需要在本地文件系统上创建一个 Cargo 项" "目:" #: src/modules/exercise.md -#, fuzzy msgid "" "Edit the resulting `src/main.rs` to add `mod` statements, and add additional " "files in the `src` directory." -msgstr "修改 `src/main.rs` 以添加 `mod` 语句,并在 `src` 目录中添加其他文件。" +msgstr "" +"修改生成的 `src/main.rs`,添加 `mod` 语句,并在 `src` 目录中添加其他文件。" #: src/modules/exercise.md msgid "Source" -msgstr "" +msgstr "源代码" #: src/modules/exercise.md msgid "Here's the single-module implementation of the GUI library:" -msgstr "" +msgstr "下面是该 GUI 库的单模块实现:" #: src/modules/exercise.md msgid "/// Natural width of `self`.\n" @@ -10273,15 +10025,14 @@ msgid "// Add 4 paddings for borders\n" msgstr "// Add 4 paddings for borders\n" #: src/modules/exercise.md -#, fuzzy msgid "" "// TODO: Change draw_into to return Result<(), std::fmt::Error>. Then use " "the\n" " // ?-operator here instead of .unwrap().\n" msgstr "" -"// 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" +"// TODO: Change draw_into to return Result<(), std::fmt::Error>. Then use " +"the\n" +" // ?-operator here instead of .unwrap().\n" #: src/modules/exercise.md src/modules/solution.md msgid "\"+-{:-. Then use" -msgstr "" -"// 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" +msgstr "// draw_into to return Result<(), std::fmt::Error>. Then use" #: src/modules/solution.md msgid "// the ?-operator here instead of .unwrap()." -msgstr "" +msgstr "// the ?-operator here instead of .unwrap()." #: src/modules/solution.md -#, fuzzy msgid "// ---- src/main.rs ----" -msgstr "// ---- src/main.rs ----\n" +msgstr "// ---- src/main.rs ----" #: src/testing.md msgid "[Test Modules](./testing/unit-tests.md) (5 minutes)" -msgstr "" +msgstr "[测试模块](./testing/unit-tests.md)(5 分钟)" #: src/testing.md msgid "[Other Types of Tests](./testing/other.md) (5 minutes)" -msgstr "" +msgstr "[其他类型的测试](./testing/other.md)(5 分钟)" #: src/testing.md msgid "[Compiler Lints and Clippy](./testing/lints.md) (3 minutes)" -msgstr "" +msgstr "[编译器 Lint 和 Clippy](./testing/lints.md)(3 分钟)" #: src/testing.md msgid "[Exercise: Luhn Algorithm](./testing/exercise.md) (30 minutes)" -msgstr "" +msgstr "[练习:卢恩算法](./testing/exercise.md)(30 分钟)" #: src/testing/unit-tests.md msgid "Unit Tests" @@ -10474,34 +10202,32 @@ msgstr "Rust 和 Cargo 随附了一个简单的单元测试框架:" #: src/testing/unit-tests.md msgid "Unit tests are supported throughout your code." -msgstr "单元测试在您的整个代码中都受支持。" +msgstr "单元测试在你的整个代码中都受支持。" #: src/testing/unit-tests.md msgid "Integration tests are supported via the `tests/` directory." -msgstr "您可以通过 `tests/` 目录来支持集成测试。" +msgstr "你可以通过 `tests/` 目录来支持集成测试。" #: src/testing/unit-tests.md -#, fuzzy msgid "" "Tests are marked with `#[test]`. Unit tests are often put in a nested " "`tests` module, using `#[cfg(test)]` to conditionally compile them only when " "building tests." msgstr "" -"测试标有 `#[test]`。单元测试通常会放在嵌套的 `tests` 模块中,仅在构建测试时使" -"用 `#[cfg(test)]` 对它们进行有条件地编译。" +"测试用 `#[test]` 标记。单元测试通常放在嵌套的 `tests` 模块中,并用 " +"`#[cfg(test)]` 让它们只在构建测试时才被编译。" #: src/testing/unit-tests.md -#, fuzzy msgid "\"Hello World\"" -msgstr "Hello World!" +msgstr "\"Hello World\"" #: src/testing/unit-tests.md msgid "This lets you unit test private helpers." -msgstr "这样一来,您可以对专用帮助程序进行单元测试。" +msgstr "这样一来,你可以对专用帮助程序进行单元测试。" #: src/testing/unit-tests.md msgid "The `#[cfg(test)]` attribute is only active when you run `cargo test`." -msgstr "仅当您运行 `cargo test` 时,`#[cfg(test)]` 属性才有效。" +msgstr "仅当你运行 `cargo test` 时,`#[cfg(test)]` 属性才有效。" #: src/testing/unit-tests.md msgid "Run the tests in the playground in order to show their results." @@ -10513,20 +10239,19 @@ msgstr "集成测试" #: src/testing/other.md msgid "If you want to test your library as a client, use an integration test." -msgstr "如果您想要以客户的身份测试您的库,请使用集成测试。" +msgstr "如果你想要以客户的身份测试你的库,请使用集成测试。" #: src/testing/other.md msgid "Create a `.rs` file under `tests/`:" msgstr "在 `tests/` 下方创建一个 `.rs` 文件:" #: src/testing/other.md -#, fuzzy msgid "// tests/my_library.rs" -msgstr "// tests/my_library.rs\n" +msgstr "// tests/my_library.rs" #: src/testing/other.md msgid "These tests only have access to the public API of your crate." -msgstr "这些测试只能使用您的 crate 的公共 API。" +msgstr "这些测试只能使用你的 crate 的公共 API。" #: src/testing/other.md msgid "Documentation Tests" @@ -10537,25 +10262,24 @@ msgid "Rust has built-in support for documentation tests:" msgstr "Rust 本身就支持文档测试:" #: src/testing/other.md -#, fuzzy msgid "/// Shortens a string to the given length." -msgstr "/// The car has arrived on the given floor.\n" +msgstr "/// Shortens a string to the given length." #: src/testing/other.md msgid "/// ```" -msgstr "" +msgstr "/// ```" #: src/testing/other.md msgid "/// # use playground::shorten_string;" -msgstr "" +msgstr "/// # use playground::shorten_string;" #: src/testing/other.md msgid "/// assert_eq!(shorten_string(\"Hello World\", 5), \"Hello\");" -msgstr "" +msgstr "/// assert_eq!(shorten_string(\"Hello World\", 5), \"Hello\");" #: src/testing/other.md msgid "/// assert_eq!(shorten_string(\"Hello World\", 20), \"Hello World\");" -msgstr "" +msgstr "/// assert_eq!(shorten_string(\"Hello World\", 20), \"Hello World\");" #: src/testing/other.md msgid "Code blocks in `///` comments are automatically seen as Rust code." @@ -10566,7 +10290,6 @@ msgid "The code will be compiled and executed as part of `cargo test`." msgstr "代码会作为 `cargo test` 的一部分进行编译和执行。" #: src/testing/other.md -#, fuzzy msgid "" "Adding `#` in the code will hide it from the docs, but will still compile/" "run it." @@ -10634,7 +10357,6 @@ msgstr "" "字符串作为输入内容,并执行以下操作来验证信用卡号:" #: src/testing/exercise.md -#, fuzzy msgid "Ignore all spaces. Reject number with fewer than two digits." msgstr "忽略所有空格。拒绝少于两位的号码。" @@ -10643,16 +10365,16 @@ msgid "" "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 "" -"从**右到左**,将偶数位的数字乘二。对于数字“1234”,我们将“3”和“1”乘二;对于数" -"字“98765”,将“6”和“8”乘二。" +"从**右到左**,将偶数位的数字乘二。对于数字`1234`,我们将`3`和`1`乘二;对于数" +"字`98765`,将`6`和`8`乘二。" #: src/testing/exercise.md msgid "" "After doubling a digit, sum the digits if the result is greater than 9. So " "doubling `7` becomes `14` which becomes `1 + 4 = 5`." msgstr "" -"将一个数字乘二后,如果结果大于 9,则将每位数字相加。因此,将“7”乘二得“14”,然" -"后“1 + 4 = 5”。" +"将一个数字乘二后,如果结果大于 9,则将每位数字相加。因此,将`7`乘二得`14`," +"然后`1 + 4 = 5`。" #: src/testing/exercise.md msgid "Sum all the undoubled and doubled digits." @@ -10660,7 +10382,7 @@ msgstr "将所有未乘二和已乘二的数字相加。" #: src/testing/exercise.md msgid "The credit card number is valid if the sum ends with `0`." -msgstr "如果总和以“0”结尾,则信用卡号有效。" +msgstr "如果总和以`0`结尾,则信用卡号有效。" #: src/testing/exercise.md msgid "" @@ -10672,13 +10394,13 @@ msgstr "" "部分算法是否正确实现。" #: src/testing/exercise.md -#, fuzzy msgid "" "Copy the code below to and write additional " "tests to uncover bugs in the provided implementation, fixing any bugs you " "find." msgstr "" -"将以下代码复制到 ,并填入缺少的函数和方法:" +"将以下代码复制到 ,并编写更多测试来发现所给实现" +"中的 bug,然后修复你找到的所有 bug。" #: src/testing/exercise.md src/testing/solution.md msgid "\"4263 9826 4026 9299\"" @@ -10753,46 +10475,44 @@ msgid "\" 0 0 \"" msgstr "\" 0 0 \"" #: src/welcome-day-4-afternoon.md -#, fuzzy msgid "[Error Handling](./error-handling.md) (55 minutes)" -msgstr "[错误处理](../error-handling.md)(45 分钟)" +msgstr "[错误处理](./error-handling.md)(55 分钟)" #: src/welcome-day-4-afternoon.md msgid "[Unsafe Rust](./unsafe-rust.md) (1 hour and 5 minutes)" -msgstr "" +msgstr "[不安全 Rust](./unsafe-rust.md)(1 小时 5 分钟)" #: src/welcome-day-4-afternoon.md msgid "" "Including 10 minute breaks, this session should take about 2 hours and 10 " "minutes" -msgstr "" +msgstr "算上 10 分钟的休息时间,本场大约需要 2 小时 10 分钟" #: src/error-handling.md msgid "[Panics](./error-handling/panics.md) (3 minutes)" -msgstr "" +msgstr "[Panics](./error-handling/panics.md)(3 分钟)" #: src/error-handling.md msgid "[Try Operator](./error-handling/try.md) (5 minutes)" -msgstr "" +msgstr "[尝试运算符](./error-handling/try.md)(5 分钟)" #: src/error-handling.md msgid "[Try Conversions](./error-handling/try-conversions.md) (5 minutes)" -msgstr "" +msgstr "[尝试转换](./error-handling/try-conversions.md)(5 分钟)" #: src/error-handling.md msgid "[Error Trait](./error-handling/error.md) (5 minutes)" -msgstr "" +msgstr "[Error 特征](./error-handling/error.md)(5 分钟)" #: src/error-handling.md msgid "" "[thiserror and anyhow](./error-handling/thiserror-and-anyhow.md) (5 minutes)" -msgstr "" +msgstr "[thiserror 和 anyhow](./error-handling/thiserror-and-anyhow.md)(5 分钟)" #: src/error-handling.md -#, fuzzy msgid "" "[Exercise: Rewriting with Result](./error-handling/exercise.md) (30 minutes)" -msgstr "练习:迭代器方法链接" +msgstr "[练习:使用 Result 进行重写](./error-handling/exercise.md)(30 分钟)" #: src/error-handling/panics.md msgid "Rust handles fatal errors with a \"panic\"." @@ -10841,7 +10561,7 @@ msgstr "如果崩溃不可接受,请使用不会触发 panic 的 API(例如 msgid "" "By default, a panic will cause the stack to unwind. The unwinding can be " "caught:" -msgstr "默认情况下,panic 会导致堆栈展开。您可以捕获展开信息:" +msgstr "默认情况下,panic 会导致堆栈展开。你可以捕获展开信息:" #: src/error-handling/panics.md msgid "\"No problem here!\"" @@ -10870,10 +10590,9 @@ msgstr "" #: src/error-handling/panics.md msgid "This does not work if `panic = 'abort'` is set in your `Cargo.toml`." -msgstr "如果您在 `Cargo.toml` 中设置了 `panic = 'abort'`,此方法不会生效。" +msgstr "如果你在 `Cargo.toml` 中设置了 `panic = 'abort'`,此方法不会生效。" #: src/error-handling/try.md -#, fuzzy msgid "" "Runtime errors like connection-refused or file-not-found are handled with " "the `Result` type, but matching this type on every call can be cumbersome. " @@ -10888,14 +10607,12 @@ msgid "into the much simpler" msgstr "转换成更简单的命令" #: src/error-handling/try.md -#, fuzzy msgid "We can use this to simplify our error handling code:" msgstr "我们可以用它来简化错误处理代码:" #: src/error-handling/try.md -#, fuzzy msgid "//fs::write(\"config.dat\", \"alice\").unwrap();" -msgstr "//fs::write(\"config.dat\", \"alice\").unwrap();\n" +msgstr "//fs::write(\"config.dat\", \"alice\").unwrap();" #: src/error-handling/try.md src/error-handling/try-conversions.md #: src/error-handling/thiserror-and-anyhow.md @@ -10923,16 +10640,15 @@ msgstr "" "件。" #: src/error-handling/try.md -#, fuzzy msgid "" "Note that `main` can return a `Result<(), E>` as long as it implements `std::" "process::Termination`. In practice, this means that `E` implements `Debug`. " "The executable will print the `Err` variant and return a nonzero exit status " "on error." msgstr "" -"请注意,`main` 函数只要实现 `std::process:Terality`,就可以返回 `Result<(), " -"E>`。在实践中,这意味着 `E` 会实现 `Debug`。可执行文件将输出 `Err` 变体,并在" -"出现错误时返回非零退出状态。" +"请注意,只要实现了 `std::process::Termination`,`main` 就可以返回 " +"`Result<(), E>`。实践中这意味着 `E` 实现了 `Debug`。可执行文件会输出 `Err` " +"变体,并在出错时返回非零退出状态。" #: src/error-handling/try-conversions.md msgid "" @@ -10945,28 +10661,26 @@ msgid "works the same as" msgstr "效果等同于" #: src/error-handling/try-conversions.md -#, fuzzy msgid "" "The `From::from` call here means we attempt to convert the error type to the " "type returned by the function. This makes it easy to encapsulate errors into " "higher-level errors." msgstr "" -"此处的 `From::from` 调用表示,我们尝试将错误类型转换为 函数返回的类型:" +"这里的 `From::from` 调用意味着我们尝试把错误类型转换为函数返回的类型。这让我" +"们可以方便地将错误封装成更高层次的错误。" #: src/error-handling/try-conversions.md msgid "\"IO error: {e}\"" msgstr "\"IO error: {e}\"" #: src/error-handling/try-conversions.md -#, fuzzy msgid "\"Found no username in {path}\"" -msgstr "\"Found no username in {0}\"" +msgstr "\"Found no username in {path}\"" #: src/error-handling/try-conversions.md #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "//fs::write(\"config.dat\", \"\").unwrap();" -msgstr "//fs::write(\"config.dat\", \"\").unwrap();\n" +msgstr "//fs::write(\"config.dat\", \"\").unwrap();" #: src/error-handling/try-conversions.md msgid "" @@ -10976,6 +10690,10 @@ msgid "" "of type `Result` if `ErrorOuter` and `ErrorInner` are the " "same type or if `ErrorOuter` implements `From`." msgstr "" +"`?` 运算符返回的值必须与函数的返回类型兼容。对 `Result` 而言,这意味着错误类" +"型必须兼容。返回 `Result` 的函数,只有在 `ErrorOuter` 与 " +"`ErrorInner` 是同一类型、或者 `ErrorOuter` 实现了 `From` 时,才" +"能对 `Result` 类型的值使用 `?`。" #: src/error-handling/try-conversions.md msgid "" @@ -10990,6 +10708,8 @@ msgid "" "`Option` can use the `?` operator on `Option` for arbitrary `T` and " "`U` types." msgstr "" +"`Option` 没有这种兼容性要求。返回 `Option` 的函数可以对任意 `T` 和 `U` 类" +"型的 `Option` 使用 `?` 运算符。" #: src/error-handling/try-conversions.md msgid "" @@ -10997,21 +10717,23 @@ msgid "" "However, `Option::ok_or` converts `Option` to `Result` whereas `Result::ok` " "turns `Result` into `Option`." msgstr "" +"返回 `Result` 的函数不能对 `Option` 使用 `?`,反之亦然。不过 " +"`Option::ok_or` 可以把 `Option` 转换成 `Result`,而 `Result::ok` 则把 " +"`Result` 转换成 `Option`。" #: src/error-handling/error.md msgid "Dynamic Error Types" msgstr "动态错误类型" #: src/error-handling/error.md -#, fuzzy msgid "" "Sometimes we want to allow any type of error to be returned without writing " "our own enum covering all the different possibilities. The `std::error::" "Error` trait makes it easy to create a trait object that can contain any " "error." msgstr "" -"有时,我们需要允许返回任意类型的错误,但又不想自己手动编写枚举来涵盖所有不同" -"的可能性。 `std::error::Error` 可以让我们轻松做到这一点。" +"有时我们希望允许返回任意类型的错误,而不必自己编写涵盖所有可能情况的枚举。" +"`std::error::Error` 特征让我们可以轻松创建一个能容纳任何错误的特征对象。" #: src/error-handling/error.md msgid "\"count.dat\"" @@ -11038,7 +10760,6 @@ msgstr "" "ParseIntError`(通过 `String::parse`)。" #: src/error-handling/error.md -#, fuzzy msgid "" "Boxing errors saves on code, but gives up the ability to cleanly handle " "different error cases differently in the program. As such it's generally not " @@ -11046,10 +10767,9 @@ msgid "" "can be a good option in a program where you just want to display the error " "message somewhere." msgstr "" -"虽然这可以省却编写代码的麻烦,但也会导致我们无法在程序中以不同的方式正常处理" -"不同的 错误情况。因此,在库的公共 API 中使用 `Box` 通常不是一个好" -"主意。 但是对于您只需要在某处显示错误消息的程序来说,这不失为一个 很好的选" -"择。" +"把错误装箱可以省去不少代码,但也放弃了在程序中区分处理不同错误情况的能力。因" +"此,在库的公共 API 中使用 `Box` 通常不是个好主意;但如果程序只需" +"要把错误消息显示在某处,它就是个不错的选择。" #: src/error-handling/error.md msgid "" @@ -11059,28 +10779,31 @@ msgid "" "compatible with `no_std` in [nightly](https://github.com/rust-lang/rust/" "issues/103765) only." msgstr "" +"定义自定义错误类型时,记得实现 `std::error::Error` 特征,这样它才能被装箱。" +"但如果你需要支持 `no_std` 属性,请注意 `std::error::Error` 特征目前仅在 " +"[nightly](https://github.com/rust-lang/rust/issues/103765) 中与 `no_std` 兼" +"容。" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "" "The [`thiserror`](https://docs.rs/thiserror/) and [`anyhow`](https://docs.rs/" "anyhow/) crates are widely used to simplify error handling." msgstr "" -"[`thiserror`](https://docs.rs/thiserror/) 和 [`anyhow`](https://docs.rs/" -"anyhow/) crate 用于简化错误处理。`thiserror` 有助于创建实现 `From` 的自定" -"义错误类型。`anyhow` 有助于处理函数中的错误,包括为错误添加上下文信息。" +"[`thiserror`](https://docs.rs/thiserror/) 和 " +"[`anyhow`](https://docs.rs/anyhow/) 这两个 crate 被广泛用于简化错误处理。" #: src/error-handling/thiserror-and-anyhow.md msgid "" "`thiserror` is often used in libraries to create custom error types that " "implement `From`." -msgstr "" +msgstr "`thiserror` 常用于库中,用来创建实现了 `From` 的自定义错误类型。" #: src/error-handling/thiserror-and-anyhow.md msgid "" "`anyhow` is often used by applications to help with error handling in " "functions, including adding contextual information to your errors." msgstr "" +"`anyhow` 常用于应用程序中,帮助处理函数中的错误,包括为错误添加上下文信息。" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Found no username in {0}\"" @@ -11104,62 +10827,54 @@ msgstr "\"Error: {err:?}\"" #: src/error-handling/thiserror-and-anyhow.md msgid "`thiserror`" -msgstr "" +msgstr "`thiserror`" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "" "The `Error` derive macro is provided by `thiserror`, and has lots of useful " "attributes to help define error types in a compact way." msgstr "" -"`Error` 派生宏由 `thiserror` 提供,并且具有许多有用的属性(例如 " -"`#[error]`),有助于定义有用的错误类型。" +"`Error` 派生宏由 `thiserror` 提供,它带有许多有用的属性,可以帮助你以紧凑的" +"方式定义错误类型。" #: src/error-handling/thiserror-and-anyhow.md msgid "The `std::error::Error` trait is derived automatically." -msgstr "" +msgstr "`std::error::Error` 特征会自动派生。" #: src/error-handling/thiserror-and-anyhow.md msgid "The message from `#[error]` is used to derive the `Display` trait." -msgstr "" +msgstr "`#[error]` 中的消息用于派生 `Display` 特征。" #: src/error-handling/thiserror-and-anyhow.md msgid "`anyhow`" -msgstr "" +msgstr "`anyhow`" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "" "`anyhow::Error` is essentially a wrapper around `Box`. As such " "it's again generally not a good choice for the public API of a library, but " "is widely used in applications." -msgstr "”是“Result\\”的类型别名。" +msgstr "" +"`anyhow::Error` 本质上是 `Box` 的封装。因此同样地,它通常不适合作" +"为库的公共 API,但在应用程序中被广泛使用。" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "`anyhow::Result` is a type alias for `Result`." -msgstr "“anyhow::Result" +msgstr "`anyhow::Result` 是 `Result` 的类型别名。" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "" "Actual error type inside of it can be extracted for examination if necessary." -msgstr "“anyhow::Error”本质上是“Box" +msgstr "如有需要,可以提取其内部的实际错误类型进行检查。" #: src/error-handling/thiserror-and-anyhow.md -#, fuzzy msgid "" "Functionality provided by `anyhow::Result` may be familiar to Go " "developers, as it provides similar usage patterns and ergonomics to `(T, " "error)` from Go." msgstr "" -"”的封装容器。因此,就像前面提到的那样,在库的公共 API 中 使用它通常不是一个好" -"主意。但是它广泛用于应用中。\n" -"\n" -"如果需要,可以提取其内部的实际错误类型进行检查。\n" -"\n" -"Go 开发者可能会十分熟悉 `anyhow::Result` 提供的功能, 因为它的使用模式和工" -"效学设计与 Go 的 `(T, error)` 方法十分相似。" +"Go 开发者可能会对 `anyhow::Result` 提供的功能感到熟悉,因为它的使用模式和" +"易用性与 Go 的 `(T, error)` 十分相似。" #: src/error-handling/thiserror-and-anyhow.md msgid "" @@ -11167,9 +10882,10 @@ msgid "" "`Option` types. `use anyhow::Context` is necessary to enable `.context()` " "and `.with_context()` on those types." msgstr "" +"`anyhow::Context` 是为标准的 `Result` 和 `Option` 类型实现的特征。需要 `use " +"anyhow::Context` 才能在这些类型上使用 `.context()` 和 `.with_context()`。" #: src/error-handling/exercise.md -#, fuzzy msgid "Exercise: Rewriting with Result" msgstr "练习:使用 Result 进行重写" @@ -11182,7 +10898,7 @@ msgid "" msgstr "" "以下代码实现了一个非常简单的表达式语言解析器。不过,它通过 panic 机制来处理错" "误。请重写该代码,改用惯用的错误处理方式,并将错误传播到 `main` 函数的返回" -"值。您可以随意使用 `thiserror` 和 `anyhow`。" +"值。你可以随意使用 `thiserror` 和 `anyhow`。" #: src/error-handling/exercise.md msgid "" @@ -11276,36 +10992,36 @@ msgstr "\"Invalid number\"" #: src/unsafe-rust.md msgid "[Unsafe](./unsafe-rust/unsafe.md) (5 minutes)" -msgstr "" +msgstr "[Unsafe](./unsafe-rust/unsafe.md)(5 分钟)" #: src/unsafe-rust.md msgid "" "[Dereferencing Raw Pointers](./unsafe-rust/dereferencing.md) (10 minutes)" -msgstr "" +msgstr "[解引用裸指针](./unsafe-rust/dereferencing.md)(10 分钟)" #: src/unsafe-rust.md msgid "[Mutable Static Variables](./unsafe-rust/mutable-static.md) (5 minutes)" -msgstr "" +msgstr "[可变的静态变量](./unsafe-rust/mutable-static.md)(5 分钟)" #: src/unsafe-rust.md msgid "[Unions](./unsafe-rust/unions.md) (5 minutes)" -msgstr "" +msgstr "[联合体](./unsafe-rust/unions.md)(5 分钟)" #: src/unsafe-rust.md msgid "[Unsafe Functions](./unsafe-rust/unsafe-functions.md) (5 minutes)" -msgstr "" +msgstr "[Unsafe 函数](./unsafe-rust/unsafe-functions.md)(5 分钟)" #: src/unsafe-rust.md msgid "[Unsafe Traits](./unsafe-rust/unsafe-traits.md) (5 minutes)" -msgstr "" +msgstr "[Unsafe 特征](./unsafe-rust/unsafe-traits.md)(5 分钟)" #: src/unsafe-rust.md msgid "[Exercise: FFI Wrapper](./unsafe-rust/exercise.md) (30 minutes)" -msgstr "" +msgstr "[练习:FFI 封装容器](./unsafe-rust/exercise.md)(30 分钟)" #: src/unsafe-rust.md msgid "This segment should take about 1 hour and 5 minutes" -msgstr "" +msgstr "本节大约需要 1 小时 5 分钟" #: src/unsafe-rust/unsafe.md msgid "The Rust language has two parts:" @@ -11322,12 +11038,10 @@ msgid "" msgstr "\\*\\*不安全 Rust:\\*\\*如果违反了前提条件,可能会触发未定义的行为。" #: src/unsafe-rust/unsafe.md -#, fuzzy msgid "" "We saw mostly safe Rust in this course, but it's important to know what " "Unsafe Rust is." -msgstr "" -"本课程中出现的大多为“安全 Rust”,但是了解“不安全 Rust”的定义 非常重要。" +msgstr "本课程中我们看到的大多是安全 Rust,但了解不安全 Rust 是什么同样重要。" #: src/unsafe-rust/unsafe.md msgid "" @@ -11372,15 +11086,14 @@ msgstr "" "[Rustonomicon](https://doc.rust-lang.org/nomicon/)。" #: src/unsafe-rust/unsafe.md -#, fuzzy msgid "" "Unsafe Rust does not mean the code is incorrect. It means that developers " "have turned off some compiler safety features and have to write correct code " "by themselves. It means the compiler no longer enforces Rust's memory-safety " "rules." msgstr "" -"不安全 Rust 并不意味着代码不正确,而是这意味着开发者已停用 编译器的安全功能," -"必须自行编写正确的 代码。也就是说,编译器不再强制执行 Rust 的内存安全规则。" +"不安全 Rust 并不意味着代码不正确,而是意味着开发者关闭了编译器的部分安全检查" +",必须自己保证代码正确。也就是说,编译器不再强制执行 Rust 的内存安全规则。" #: src/unsafe-rust/dereferencing.md msgid "Creating pointers is safe, but dereferencing them requires `unsafe`:" @@ -11394,23 +11107,26 @@ msgstr "\"careful!\"" msgid "" "// SAFETY: r1 and r2 were obtained from references and so are guaranteed to" msgstr "" +"// SAFETY: r1 and r2 were obtained from references and so are guaranteed " +"to" #: src/unsafe-rust/dereferencing.md msgid "" "// be non-null and properly aligned, the objects underlying the references" msgstr "" +"// be non-null and properly aligned, the objects underlying the references" #: src/unsafe-rust/dereferencing.md msgid "// from which they were obtained are live throughout the whole unsafe" -msgstr "" +msgstr "// from which they were obtained are live throughout the whole unsafe" #: src/unsafe-rust/dereferencing.md msgid "// block, and they are not accessed either through the references or" -msgstr "" +msgstr "// block, and they are not accessed either through the references or" #: src/unsafe-rust/dereferencing.md msgid "// concurrently through any other pointers." -msgstr "" +msgstr "// concurrently through any other pointers." #: src/unsafe-rust/dereferencing.md msgid "\"r1 is: {}\"" @@ -11426,11 +11142,11 @@ msgstr "\"r2 is: {}\"" #: src/unsafe-rust/dereferencing.md msgid "// NOT SAFE. DO NOT DO THIS." -msgstr "" +msgstr "// NOT SAFE. DO NOT DO THIS." #: src/unsafe-rust/dereferencing.md msgid "/*" -msgstr "" +msgstr "/*" #: src/unsafe-rust/dereferencing.md msgid "" @@ -11480,24 +11196,22 @@ msgid "In most cases the pointer must also be properly aligned." msgstr "在大多数情况下,指针还必须正确对齐。" #: src/unsafe-rust/dereferencing.md -#, fuzzy msgid "" "The \"NOT SAFE\" section gives an example of a common kind of UB bug: `*r1` " "has the `'static` lifetime, so `r3` has type `&'static String`, and thus " "outlives `s`. Creating a reference from a pointer requires _great care_." msgstr "" -"“不安全”部分给出了一个常见 UB bug 的示例:`*r1` 的生命周期为 `'static`,因此 " -"`r3` 为 `&'static String` 类型,存在时间比 `s` 更长。从指针创建引用需要 _特别" -"注意_。" +"“NOT SAFE”那一段给出了一类常见 UB bug 的示例:`*r1` 具有 `'static` 生命周期" +",因此 `r3` 的类型是 `&'static String`,从而比 `s` 活得更久。从指针创建引用" +"需要 _格外小心_。" #: src/unsafe-rust/mutable-static.md msgid "It is safe to read an immutable static variable:" msgstr "读取不可变的静态变量是安全的操作:" #: src/unsafe-rust/mutable-static.md -#, fuzzy msgid "\"Hello, world!\"" -msgstr "Hello World!" +msgstr "\"Hello, world!\"" #: src/unsafe-rust/mutable-static.md msgid "\"HELLO_WORLD: {HELLO_WORLD}\"" @@ -11513,6 +11227,7 @@ msgstr "但是,读取和写入可变的静态变量是不安全的,因为这 msgid "" "// SAFETY: There are no other threads which could be accessing `COUNTER`." msgstr "" +"// SAFETY: There are no other threads which could be accessing `COUNTER`." #: src/unsafe-rust/mutable-static.md msgid "\"COUNTER: {COUNTER}\"" @@ -11540,7 +11255,7 @@ msgstr "" #: src/unsafe-rust/unions.md msgid "Unions are like enums, but you need to track the active field yourself:" -msgstr "联合体与枚举类似,但您需要自行跟踪活跃字段:" +msgstr "联合体与枚举类似,但你需要自行跟踪活跃字段:" #: src/unsafe-rust/unions.md msgid "\"int: {}\"" @@ -11551,16 +11266,15 @@ msgid "\"bool: {}\"" msgstr "\"bool: {}\"" #: src/unsafe-rust/unions.md -#, fuzzy msgid "// Undefined behavior!" -msgstr "Rust 没有运行时未定义行为:" +msgstr "// Undefined behavior!" #: src/unsafe-rust/unions.md msgid "" "Unions are very rarely needed in Rust as you can usually use an enum. They " "are occasionally needed for interacting with C library APIs." msgstr "" -"在 Rust 中很少需要用到联合体,因为您通常可以使用枚举。联合体只是偶尔用于 与 " +"在 Rust 中很少需要用到联合体,因为你通常可以使用枚举。联合体只是偶尔用于 与 " "C 库 API 进行交互。" #: src/unsafe-rust/unions.md @@ -11570,7 +11284,7 @@ msgid "" "transmute.html) or a safe wrapper such as the [`zerocopy`](https://crates.io/" "crates/zerocopy) crate." msgstr "" -"如果您只是想将字节重新解释为其他类型,则可能需要使用 [`std::mem::transmute`]" +"如果你只是想将字节重新解释为其他类型,则可能需要使用 [`std::mem::transmute`]" "(https://doc.rust-lang.org/stable/std/mem/fn.transmute.html) 或 安全的封装容" "器,例如 [`zerocopy`](https://crates.io/crates/zerocopy) crate。" @@ -11583,7 +11297,7 @@ msgid "" "A function or method can be marked `unsafe` if it has extra preconditions " "you must uphold to avoid undefined behaviour:" msgstr "" -"如果函数或方法具有额外的前提条件,您必须遵守这些前提条件来避免未定义的行为, " +"如果函数或方法具有额外的前提条件,你必须遵守这些前提条件来避免未定义的行为, " "则可以将该函数或方法标记为 `unsafe`:" #: src/unsafe-rust/unsafe-functions.md src/unsafe-rust/exercise.md @@ -11601,16 +11315,14 @@ msgid "\"🗻∈🌏\"" msgstr "\"🗻∈🌏\"" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "" "// SAFETY: The indices are in the correct order, within the bounds of the" msgstr "" -"// Safe because the indices are in the correct order, within the bounds of\n" -" // the string slice, and lie on UTF-8 sequence boundaries.\n" +"// SAFETY: The indices are in the correct order, within the bounds of the" #: src/unsafe-rust/unsafe-functions.md msgid "// string slice, and lie on UTF-8 sequence boundaries." -msgstr "" +msgstr "// string slice, and lie on UTF-8 sequence boundaries." #: src/unsafe-rust/unsafe-functions.md msgid "\"emoji: {}\"" @@ -11623,10 +11335,11 @@ msgstr "\"char count: {}\"" #: src/unsafe-rust/unsafe-functions.md msgid "// SAFETY: `abs` doesn't deal with pointers and doesn't have any safety" msgstr "" +"// SAFETY: `abs` doesn't deal with pointers and doesn't have any safety" #: src/unsafe-rust/unsafe-functions.md msgid "// requirements." -msgstr "" +msgstr "// requirements." #: src/unsafe-rust/unsafe-functions.md msgid "\"Absolute value of -3 according to C: {}\"" @@ -11634,19 +11347,19 @@ msgstr "\"Absolute value of -3 according to C: {}\"" #: src/unsafe-rust/unsafe-functions.md msgid "// Not upholding the UTF-8 encoding requirement breaks memory safety!" -msgstr "" +msgstr "// Not upholding the UTF-8 encoding requirement breaks memory safety!" #: src/unsafe-rust/unsafe-functions.md msgid "// println!(\"emoji: {}\", unsafe { emojis.get_unchecked(0..3) });" -msgstr "" +msgstr "// println!(\"emoji: {}\", unsafe { emojis.get_unchecked(0..3) });" #: src/unsafe-rust/unsafe-functions.md msgid "// println!(\"char count: {}\", count_chars(unsafe {" -msgstr "" +msgstr "// println!(\"char count: {}\", count_chars(unsafe {" #: src/unsafe-rust/unsafe-functions.md msgid "// emojis.get_unchecked(0..3) }));" -msgstr "" +msgstr "// emojis.get_unchecked(0..3) }));" #: src/unsafe-rust/unsafe-functions.md msgid "Writing Unsafe Functions" @@ -11657,33 +11370,30 @@ msgid "" "You can mark your own functions as `unsafe` if they require particular " "conditions to avoid undefined behaviour." msgstr "" -"如果您自己编写的函数需要满足特定条件以避免未定义的行为, 您可以将这些函数标记" +"如果你自己编写的函数需要满足特定条件以避免未定义的行为, 你可以将这些函数标记" "为 `unsafe`。" #: src/unsafe-rust/unsafe-functions.md msgid "/// Swaps the values pointed to by the given pointers." -msgstr "" +msgstr "/// Swaps the values pointed to by the given pointers." #: src/unsafe-rust/unsafe-functions.md src/unsafe-rust/unsafe-traits.md msgid "/// # Safety" -msgstr "" +msgstr "/// # Safety" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "/// The pointers must be valid and properly aligned." -msgstr "在大多数情况下,指针还必须正确对齐。" +msgstr "/// The pointers must be valid and properly aligned." #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "// SAFETY: ..." -msgstr "// ...\n" +msgstr "// SAFETY: ..." #: src/unsafe-rust/unsafe-functions.md msgid "\"a = {}, b = {}\"" msgstr "\"a = {}, b = {}\"" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "" "`get_unchecked`, like most `_unchecked` functions, is unsafe, because it can " "create UB if the range is incorrect. `abs` is incorrect for a different " @@ -11692,8 +11402,10 @@ msgid "" "might violate Rust's memory model, but in general any C function might have " "undefined behaviour under any arbitrary circumstances." msgstr "" -"这个问题通常仅存在于使用指针执行违反 Rust 内存模型的操作的外部函数中。 但一般" -"而言,任何 C 函数都有可能在任意情况下出现未定义行为。" +"`get_unchecked` 和大多数 `_unchecked` 函数一样是不安全的,因为范围不正确时会" +"产生 UB。`abs` 不正确的原因则不同:它是一个外部函数(FFI)。调用外部函数通常" +"只有在这些函数对指针做了可能违反 Rust 内存模型的操作时才成问题,但一般而言," +"任何 C 函数都可能在任意情况下出现未定义行为。" #: src/unsafe-rust/unsafe-functions.md msgid "" @@ -11704,23 +11416,21 @@ msgstr "" "items/external-blocks.html)。" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "" "We wouldn't actually use pointers for a `swap` function - it can be done " "safely with references." -msgstr "实际上,我们不会这样使用指针,因为使用引用可以安全地达到相同的目的。" +msgstr "实际上我们不会用指针来实现 `swap` 函数——用引用就可以安全地做到。" #: src/unsafe-rust/unsafe-functions.md -#, fuzzy msgid "" "Note that unsafe code is allowed within an unsafe function without an " "`unsafe` block. We can prohibit this with `#[deny(unsafe_op_in_unsafe_fn)]`. " "Try adding it and see what happens. This will likely change in a future Rust " "edition." msgstr "" -"请注意,在不安全函数中,可以在没有 `unsafe` 代码块的情况下使用不安全代码。我" -"们可以 使用 `#[deny(unsafe_op_in_unsafe_fn)]` 来禁止此行为。请尝试添加该命" -"令,看看会出现什么情况。" +"请注意,在不安全函数内部,不需要 `unsafe` 代码块就可以写不安全代码。我们可以" +"用 `#[deny(unsafe_op_in_unsafe_fn)]` 禁止这种写法。试着加上它,看看会发生什" +"么。这一点在未来的 Rust 版次中很可能会改变。" #: src/unsafe-rust/unsafe-traits.md msgid "Implementing Unsafe Traits" @@ -11731,7 +11441,7 @@ msgid "" "Like with functions, you can mark a trait as `unsafe` if the implementation " "must guarantee particular conditions to avoid undefined behaviour." msgstr "" -"与函数一样,如果您在实现某个 trait 时必须保证特定条件来避免未定义的行为, 您" +"与函数一样,如果你在实现某个 trait 时必须保证特定条件来避免未定义的行为, 你" "也可以将该 trait 标记为 `unsafe`。" #: src/unsafe-rust/unsafe-traits.md @@ -11743,22 +11453,16 @@ msgstr "" "docs.rs/zerocopy/latest/zerocopy/trait.AsBytes.html):" #: src/unsafe-rust/unsafe-traits.md -#, fuzzy msgid "/// ..." -msgstr "// ...\n" +msgstr "/// ..." #: src/unsafe-rust/unsafe-traits.md -#, fuzzy msgid "/// The type must have a defined representation and no padding." -msgstr "" -"/// ...\n" -"/// # Safety\n" -"/// The type must have a defined representation and no padding.\n" +msgstr "/// The type must have a defined representation and no padding." #: src/unsafe-rust/unsafe-traits.md -#, fuzzy msgid "// SAFETY: `u32` has a defined representation and no padding." -msgstr "// Safe because u32 has a defined representation and no padding.\n" +msgstr "// SAFETY: `u32` has a defined representation and no padding." #: src/unsafe-rust/unsafe-traits.md msgid "" @@ -11793,7 +11497,7 @@ msgstr "" #: src/unsafe-rust/exercise.md msgid "You will want to consult the manual pages:" -msgstr "建议您参考以下手册页面:" +msgstr "建议你参考以下手册页面:" #: src/unsafe-rust/exercise.md msgid "[`opendir(3)`](https://man7.org/linux/man-pages/man3/opendir.3.html)" @@ -11813,7 +11517,7 @@ msgid "" "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/)模块。在下方,您" +"你还需要浏览[`std::ffi`](https://doc.rust-lang.org/std/ffi/)模块。在下方,你" "会发现完成这个练习所需的多种字符串类型:" #: src/unsafe-rust/exercise.md @@ -11829,8 +11533,8 @@ 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)" +"[`str`](https://doc.rust-lang.org/std/primitive.str.html)和" +"[`String`](https://doc.rust-lang.org/std/string/struct.String.html)" #: src/unsafe-rust/exercise.md msgid "UTF-8" @@ -11845,8 +11549,8 @@ 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)" +"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html)和" +"[`CString`](https://doc.rust-lang.org/std/ffi/struct.CString.html)" #: src/unsafe-rust/exercise.md msgid "NUL-terminated" @@ -11861,8 +11565,8 @@ 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)" +"[`OsStr`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html)和" +"[`OsString`](https://doc.rust-lang.org/std/ffi/struct.OsString.html)" #: src/unsafe-rust/exercise.md msgid "OS-specific" @@ -11874,49 +11578,47 @@ msgstr "与操作系统通信" #: src/unsafe-rust/exercise.md msgid "You will convert between all these types:" -msgstr "您将在以下所有类型之间进行转换:" +msgstr "你将在以下所有类型之间进行转换:" #: src/unsafe-rust/exercise.md msgid "" "`&str` to `CString`: you need to allocate space for a trailing `\\0` " "character," -msgstr "将 `&str` 转换为 `CString`:您需要为尾随 `\\0` 字符分配空格," +msgstr "将 `&str` 转换为 `CString`:你需要为尾随 `\\0` 字符分配空格," #: src/unsafe-rust/exercise.md msgid "`CString` to `*const i8`: you need a pointer to call C functions," -msgstr "将 `CString` 转换为 `\\*const i8` :您需要一个指针来调用 C 函数," +msgstr "将 `CString` 转换为 `*const i8`:你需要一个指针来调用 C 函数," #: src/unsafe-rust/exercise.md msgid "" "`*const i8` to `&CStr`: you need something which can find the trailing `\\0` " "character," msgstr "" -"将 `\\*const i8` 转换为 `&CStr` :您需要一些能够找到尾随 `\\0` 字符的内容," +"将 `*const i8` 转换为 `&CStr`:你需要一些能够找到尾随 `\\0` 字符的内容," #: src/unsafe-rust/exercise.md -#, fuzzy msgid "" "`&CStr` to `&[u8]`: a slice of bytes is the universal interface for \"some " "unknown data\"," -msgstr "" -"将 `&CStr` 转换为 `&\\[u8\\]` :一个字节 Slice 是“一些未知数据”的通用接口," +msgstr "将 `&CStr` 转换为 `&[u8]`:字节切片是“某些未知数据”的通用接口," #: src/unsafe-rust/exercise.md 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)来" -"创建它," +"将 `&[u8]` 转换为 `&OsStr`:`&OsStr` 是向 `OsString` 迈进的一步,请使用 " +"[`OsStrExt`](https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html) " +"来创建它," #: src/unsafe-rust/exercise.md 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”。" +"将 `&OsStr` 转换为 `OsString`:你需要克隆 `&OsStr` 中的数据,以便能够返回它并" +"再次调用 `readdir`。" #: src/unsafe-rust/exercise.md msgid "" @@ -11982,23 +11684,20 @@ msgid "\"readdir$INODE64\"" msgstr "\"readdir$INODE64\"" #: src/unsafe-rust/exercise.md -#, fuzzy msgid "" "// Call opendir and return a Ok value if that worked,\n" " // otherwise return Err with a message." msgstr "" "// Call opendir and return a Ok value if that worked,\n" -" // otherwise return Err with a message.\n" +" // otherwise return Err with a message." #: src/unsafe-rust/exercise.md -#, fuzzy msgid "// Keep calling readdir until we get a NULL pointer back." -msgstr "// Keep calling readdir until we get a NULL pointer back.\n" +msgstr "// Keep calling readdir until we get a NULL pointer back." #: src/unsafe-rust/exercise.md -#, fuzzy msgid "// Call closedir as needed." -msgstr "// Call closedir as needed.\n" +msgstr "// Call closedir as needed." #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md #: src/android/interoperability/with-c/rust.md @@ -12090,7 +11789,6 @@ msgid "\"\\n\"" msgstr "\"\\n\"" #: src/unsafe-rust/solution.md -#, fuzzy msgid "\"crab.rs\"" msgstr "\"crab.rs\"" @@ -12109,7 +11807,7 @@ msgid "" "write new services, libraries, drivers or even firmware in Rust (or improve " "existing code as needed)." msgstr "" -"Rust 支持Android 的原生平台开发。这意味着您可以在Rust 中编写新的操作系统服" +"Rust 支持Android 的原生平台开发。这意味着你可以在Rust 中编写新的操作系统服" "务,以及扩展现有服务。" #: src/android.md @@ -12260,7 +11958,7 @@ msgstr "`rust_proc_macro`" msgid "" "Produces a `proc-macro` Rust library. These are analogous to compiler " "plugins." -msgstr "生成“proc-macro”Rust 库。这些宏与编译器插件类似。" +msgstr "生成`proc-macro`Rust 库。这些宏与编译器插件类似。" #: src/android/build-rules.md #, fuzzy @@ -12418,7 +12116,7 @@ msgstr "Rust 库" #: src/android/build-rules/library.md msgid "You use `rust_library` to create a new Rust library for Android." -msgstr "您可以使用 `rust_library` 为 Android 创建一个新的 Rust 库。" +msgstr "你可以使用 `rust_library` 为 Android 创建一个新的 Rust 库。" #: src/android/build-rules/library.md msgid "Here we declare a dependency on two libraries:" @@ -12484,7 +12182,7 @@ msgstr "\"Hello {name}, it is very nice to meet you!\"" #: src/android/build-rules/library.md msgid "You build, push, and run the binary like before:" -msgstr "您可以像之前一样构建、推送和运行二进制文件:" +msgstr "你可以像之前一样构建、推送和运行二进制文件:" #: src/android/build-rules/library.md #, fuzzy @@ -12517,7 +12215,7 @@ msgstr "Rust 代码可以调用现有的 AIDL 服务器," #: src/android/aidl.md msgid "You can create new AIDL servers in Rust." -msgstr "您可以在 Rust 中创建新的 AIDL 服务器。" +msgstr "你可以在 Rust 中创建新的 AIDL 服务器。" #: src/android/aidl/birthday-service.md msgid "" @@ -12532,7 +12230,7 @@ msgstr "AIDL 接口" #: src/android/aidl/example-service/interface.md msgid "You declare the API of your service using an AIDL interface:" -msgstr "您可以使用 AIDL 接口声明您的服务的 API:" +msgstr "你可以使用 AIDL 接口声明你的服务的 API:" #: src/android/aidl/example-service/interface.md #: src/android/aidl/example-service/service-bindings.md @@ -12787,7 +12485,7 @@ msgstr "在另一个终端中,检查该服务是否正在运行:" #: src/android/aidl/example-service/deploy.md msgid "You can also call the service with `service call`:" -msgstr "您还可以使用 `service call` 命令调用该服务:" +msgstr "你还可以使用 `service call` 命令调用该服务:" #: src/android/aidl/example-service/client.md msgid "AIDL Client" @@ -12838,7 +12536,7 @@ msgstr "请注意,客户端不依赖于 `libbirthdayservice`。" #: src/android/aidl/example-service/client.md msgid "Build, push, and run the client on your device:" -msgstr "在您的设备上构建、推送并运行客户端:" +msgstr "在你的设备上构建、推送并运行客户端:" #: src/android/aidl/example-service/client.md #, fuzzy @@ -13305,7 +13003,7 @@ msgstr "\"foo\"" #: src/android/testing.md #, fuzzy msgid "You can now run the test with" -msgstr "您现在可以自动生成绑定代码:" +msgstr "你现在可以自动生成绑定代码:" #: src/android/testing.md #, fuzzy @@ -13363,7 +13061,7 @@ msgid "" "example in a local environment. Use `cargo add googletest` to quickly add it " "to an existing Cargo project." msgstr "" -"GoogleTest 不是 Rust Playground 的一部分,因此您需要在本地环境中运行此示例。" +"GoogleTest 不是 Rust Playground 的一部分,因此你需要在本地环境中运行此示例。" "使用 `cargo add googletest` 快速将其添加到现有 Cargo 项目中。" #: src/android/testing/googletest.md @@ -13425,7 +13123,7 @@ msgid "" "You need to refactor your code to use traits, which you can then quickly " "mock:" msgstr "" -"对于模拟,[Mockall](https://docs.rs/mockall/) 是一个广泛使用的库。您需要重构" +"对于模拟,[Mockall](https://docs.rs/mockall/) 是一个广泛使用的库。你需要重构" "代码才能使用 trait,然后便可很快地对其进行模拟:" #: src/android/testing/mocking.md @@ -13439,7 +13137,7 @@ msgid "" msgstr "" "此处的建议适用于 Android (AOSP),其中推荐使用 Mockall 模拟库。[crates.io 上还" "有其他模拟库可用](https://crates.io/keywords/mock),尤其是在模拟 HTTP 服务方" -"面。其他模拟库的工作方式与 Mockall 类似,这意味着通过它们您可轻松实现对指定 " +"面。其他模拟库的工作方式与 Mockall 类似,这意味着通过它们你可轻松实现对指定 " "trait 的模拟。" #: src/android/testing/mocking.md @@ -13449,7 +13147,7 @@ msgid "" "more stable test execution. On the other hand, the mocks can be configured " "wrongly and return output different from what the real dependencies would do." msgstr "" -"请注意,模拟在某种程度上具有 _争议性_:借助模拟,您可以将测试与其依赖项完全隔" +"请注意,模拟在某种程度上具有 _争议性_:借助模拟,你可以将测试与其依赖项完全隔" "离。最立竿见影的是,测试作业会更快且更稳定。另一方面,模拟对象的配置可能出现" "错误,并返回与真实依赖项不同的输出。" @@ -13460,8 +13158,8 @@ msgid "" "means that you get the correct behavior in your tests, plus they are fast " "and will automatically clean up after themselves." msgstr "" -"建议您尽可能使用真实依赖项。例如,许多数据库都支持您配置内存后端。这意味着," -"您可以在测试中获得正确的功能行为,而且测试速度会很快并会自动清理。" +"建议你尽可能使用真实依赖项。例如,许多数据库都支持你配置内存后端。这意味着," +"你可以在测试中获得正确的功能行为,而且测试速度会很快并会自动清理。" #: src/android/testing/mocking.md msgid "" @@ -13469,8 +13167,8 @@ msgid "" "binds to a random port on `localhost`. Always prefer this over mocking away " "the framework since it helps you test your code in the real environment." msgstr "" -"同样,许多 Web 框架都支持您启动进程内服务器,该服务器会绑定到 `localhost` 上" -"的随机端口。相比模拟框架,请始终优先选择这种方式,因为这有助于您在真实环境中" +"同样,许多 Web 框架都支持你启动进程内服务器,该服务器会绑定到 `localhost` 上" +"的随机端口。相比模拟框架,请始终优先选择这种方式,因为这有助于你在真实环境中" "测试代码。" #: src/android/testing/mocking.md @@ -13479,7 +13177,7 @@ msgid "" "in a local environment. Use `cargo add mockall` to quickly add Mockall to an " "existing Cargo project." msgstr "" -"Mockall 不是 Rust Playground 的一部分,因此您需要在本地环境中运行此示例。使" +"Mockall 不是 Rust Playground 的一部分,因此你需要在本地环境中运行此示例。使" "用 `cargo add mockall` 快速将 Mockall 添加到现有 Cargo 项目中。" #: src/android/testing/mocking.md @@ -13488,7 +13186,7 @@ msgid "" "expectations which depend on the arguments passed. Here we use this to mock " "a cat which becomes hungry 3 hours after the last time it was fed:" msgstr "" -"Mockall 具有更多功能。具体而言,您可以设置基于传递参数的预期值。在这里,我们" +"Mockall 具有更多功能。具体而言,你可以设置基于传递参数的预期值。在这里,我们" "使用该功能来模拟一只猫,它在上次被喂食的 3 小时后会感到饥饿:" #: src/android/testing/mocking.md @@ -13497,7 +13195,7 @@ msgid "" "called to `n` --- the mock will automatically panic when dropped if this " "isn't satisfied." msgstr "" -"您可以使用 `.times(n)` 将调用模拟方法的次数限制为 `n`,如果不满足此条件,模拟" +"你可以使用 `.times(n)` 将调用模拟方法的次数限制为 `n`,如果不满足此条件,模拟" "对象被释放时会自动 panic。" #: src/android/logging.md @@ -13586,7 +13284,7 @@ msgstr "日志将会在 `adb logcat` 中显示:" msgid "" "Rust has excellent support for interoperability with other languages. This " "means that you can:" -msgstr "Rust 对于与其他编程语言的互操作性有着出色的支持。这意味着您可以:" +msgstr "Rust 对于与其他编程语言的互操作性有着出色的支持。这意味着你可以:" #: src/android/interoperability.md msgid "Call Rust functions from other languages." @@ -13601,7 +13299,7 @@ msgid "" "When you call functions in a foreign language we say that you're using a " "_foreign function interface_, also known as FFI." msgstr "" -"当您从外部语言调用函数时,我们称之为使用 **外部函数接口**(*Foreign Function " +"当你从外部语言调用函数时,我们称之为使用 **外部函数接口**(*Foreign Function " "Interface*, FFI)。" #: src/android/interoperability/with-c.md @@ -13721,7 +13419,7 @@ msgstr "_interoperability/bindgen/libbirthday_wrapper.h_:" #: src/android/interoperability/with-c/bindgen.md msgid "You can now auto-generate the bindings:" -msgstr "您现在可以自动生成绑定代码:" +msgstr "你现在可以自动生成绑定代码:" #: src/android/interoperability/with-c/bindgen.md #, fuzzy @@ -13932,7 +13630,7 @@ msgid "" "from each language to the other. You provide this description using extern " "blocks in a Rust module annotated with the `#[cxx::bridge]` attribute macro." msgstr "" -"CXX依赖于提供的函数签名说明,这些签名会在不用语言之间进行交互使用。您可以在带" +"CXX依赖于提供的函数签名说明,这些签名会在不用语言之间进行交互使用。你可以在带" "有 `#[cxx::bridge]` 属性宏注解的 Rust 模块中使用 extern 代码块提供此说明。" #: src/android/interoperability/cpp/bridge.md @@ -13978,7 +13676,7 @@ msgstr "\"include/blobstore.h\"" #: src/android/interoperability/cpp/bridge.md msgid "The bridge is generally declared in an `ffi` module within your crate." -msgstr "桥接通常在您的 crate 内的 `ffi` 模块中声明。" +msgstr "桥接通常在你的 crate 内的 `ffi` 模块中声明。" #: src/android/interoperability/cpp/bridge.md msgid "" @@ -13997,7 +13695,7 @@ msgid "" "(though this doesn't apply for Android projects)." msgstr "" "如需查看生成的 Rust 代码,请使用 [cargo-expand](https://github.com/dtolnay/" -"cargo-expand) 查看展开后的 proc 宏。对于大多数示例,您可以使用 `cargo " +"cargo-expand) 查看展开后的 proc 宏。对于大多数示例,你可以使用 `cargo " "expand ::ffi` 来仅展开 `ffi` 模块(但这不适用于 Android 项目)。" #: src/android/interoperability/cpp/bridge.md @@ -14071,7 +13769,7 @@ msgstr "" msgid "" "`unsafe extern` blocks allow you to declare C++ functions that are safe to " "call from Rust." -msgstr "借助 `unsafe extern` 代码块,您可以声明可从 Rust 安全调用的 C++ 函数。" +msgstr "借助 `unsafe extern` 代码块,你可以声明可从 Rust 安全调用的 C++ 函数。" #: src/android/interoperability/cpp/shared-types.md msgid "// A=1, J=11, Q=12, K=13\n" @@ -14089,7 +13787,7 @@ msgid "" "corresponding C++ type." msgstr "" "共享类型的 `#[derive()]` 支持有限数量的 trait。系统还会针对 C++ 代码生成相应" -"的功能,例如,如果您派生了 `Hash`,还会为相应的 C++ 类型生成 `std::hash` 实" +"的功能,例如,如果你派生了 `Hash`,还会为相应的 C++ 类型生成 `std::hash` 实" "现。" #: src/android/interoperability/cpp/shared-enums.md @@ -14318,7 +14016,7 @@ msgstr "" msgid "" "Note that you also need to depend on the `cxx-bridge-header` library in " "order to pull in common CXX definitions." -msgstr "请注意,您还需要依靠 `cxx-bridge-header` 库才能提取常见的 CXX 定义。" +msgstr "请注意,你还需要依靠 `cxx-bridge-header` 库才能提取常见的 CXX 定义。" #: src/android/interoperability/cpp/android-build-cpp.md msgid "" @@ -14330,7 +14028,7 @@ msgid "" msgstr "" "如需了解如何在 Android 中使用 CXX 的完整文档,请参阅 [Android 文档](https://" "source.android.com/docs/setup/build/rust/building-rust-modules/android-rust-" -"patterns#rust-cpp-interop-using-cxx)。建议您与全班同学分享该链接,以便学生知" +"patterns#rust-cpp-interop-using-cxx)。建议你与全班同学分享该链接,以便学生知" "道日后可以在哪里找到这些说明。" #: src/android/interoperability/cpp/android-cpp-genrules.md @@ -14402,7 +14100,7 @@ msgid "" "named `lib.rs.h` and your source file will be named `lib.rs.cc`. This naming " "convention isn't enforced, though." msgstr "" -"按照惯例,如果您的 Rust 源文件是 `lib.rs`,则头文件将命名为 `lib.rs.h`,源文" +"按照惯例,如果你的 Rust 源文件是 `lib.rs`,则头文件将命名为 `lib.rs.h`,源文" "件将命名为 `lib.rs.cc`。不过,系统并不强制执行此命名惯例。" #: src/android/interoperability/cpp/android-build-rust.md @@ -14430,7 +14128,7 @@ msgid "" msgstr "" "Java可以通过 [ Java 本地接口 (JNI)](https://en.wikipedia.org/wiki/" "Java_Native_Interface) 加载共享对象。[`jni` crate](https://docs.rs/jni/) 允许" -"您创建一个兼容的库。" +"你创建一个兼容的库。" #: src/android/interoperability/java.md msgid "First, we create a Rust function to export to Java:" @@ -14502,7 +14200,7 @@ msgstr "Hello World!" #: src/android/interoperability/java.md msgid "Finally, you can build, sync, and run the binary:" -msgstr "最后,您可以构建、同步和运行二进制文件:" +msgstr "最后,你可以构建、同步和运行二进制文件:" #: src/exercises/android/morning.md msgid "" @@ -14525,7 +14223,7 @@ 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." msgstr "" -"此处没有提供解决方案,因为这是开放式的:它依赖于班级中是否有人有一段您可以即" +"此处没有提供解决方案,因为这是开放式的:它依赖于班级中是否有人有一段你可以即" "时转换成 Rust 的代码。" #: src/chromium.md @@ -14548,7 +14246,7 @@ msgid "" "feel free to follow this recipe in your part of the codebase instead of the " "exact part we talk about." msgstr "" -"今天,我们将调用 Rust 对字符串进行一些有趣的操作。如果您的代码中某个部分是用" +"今天,我们将调用 Rust 对字符串进行一些有趣的操作。如果你的代码中某个部分是用" "于向用户展示 UTF8 字符串,那么可以在代码库中的对应部分按照这个步骤来操作,而" "不一定要在我们所讨论的确切部分。" @@ -14558,7 +14256,7 @@ msgid "" "flags is OK, so long as your code is relatively recent (commit position " "1223636 onwards, corresponding to November 2023):" msgstr "" -"请确保您可以构建并运行 Chromium。只要您的代码较新(提交位置始于 1223636,对应" +"请确保你可以构建并运行 Chromium。只要你的代码较新(提交位置始于 1223636,对应" "于 2023 年 11 月),则可在任何平台和任何一组 build 标志下运行。" #: src/chromium/setup.md @@ -14573,12 +14271,12 @@ msgid "" "the-code/) if you aren't already at that point. Be warned: setting up to " "build Chromium takes time." msgstr "" -"如果您不具备这点,请参阅 [如何构建 Chromium](https://www.chromium.org/" +"如果你不具备这点,请参阅 [如何构建 Chromium](https://www.chromium.org/" "developers/how-tos/get-the-code/)。注意:设置 build Chromium 需要花些时间。" #: src/chromium/setup.md msgid "It's also recommended that you have Visual Studio code installed." -msgstr "此外,我们还建议您安装 Visual Studio 代码。" +msgstr "此外,我们还建议你安装 Visual Studio 代码。" #: src/chromium/setup.md #, fuzzy @@ -14593,7 +14291,7 @@ msgid "" "catch up in the next slot." msgstr "" "本课程的这一部分包含一系列练习,它们之间是相辅相成的。我们将在整个课程中进行" -"这些练习,而不仅仅是在最后阶段完成。如果您没有时间完成某个部分,也无需担心:" +"这些练习,而不仅仅是在最后阶段完成。如果你没有时间完成某个部分,也无需担心:" "可以在下一阶段赶上进度。" #: src/chromium/cargo.md @@ -14608,7 +14306,7 @@ msgstr "" #: src/chromium/cargo.md msgid "When writing code in Rust, your choices are:" -msgstr "使用 Rust 编写代码时,您可以选择:" +msgstr "使用 Rust 编写代码时,你可以选择:" #: src/chromium/cargo.md msgid "" @@ -14644,7 +14342,7 @@ msgid "" "important part of the Rust ecosystem and you should keep it in your toolbox." msgstr "" "从现在开始,我们将重点介绍 `gn` 和 `ninja`,因为这是在 Chromium 浏览器构建 " -"Rust 代码时必会用到的两种方式。同时,Cargo 是 Rust 生态系统的重要组成部分,您" +"Rust 代码时必会用到的两种方式。同时,Cargo 是 Rust 生态系统的重要组成部分,你" "应将其视为必备工具。" #: src/chromium/cargo.md @@ -14705,7 +14403,7 @@ msgid "" "`cargo` makes it easy to try a library (just add a single line to `Cargo." "toml` and start writing code)" msgstr "" -"借助 `cargo`,您便可以轻松试用库(只需向 `Cargo.toml`` 添加一行代码然后开始编" +"借助 `cargo`,你便可以轻松试用库(只需向 `Cargo.toml` 添加一行代码然后开始编" "写即可)" #: src/chromium/cargo.md @@ -14735,7 +14433,7 @@ msgstr "" msgid "" "`cargo` makes it easy to add a tool via `cargo install --locked cargo-vet`." msgstr "" -"借助 `cargo`,您可通过 `cargo install --locked cargo-vet` 轻松添加工具。" +"借助 `cargo`,你可通过 `cargo install --locked cargo-vet` 轻松添加工具。" #: src/chromium/cargo.md msgid "It may be worth comparing with Chrome Extensions or VScode extensions." @@ -14827,7 +14525,7 @@ msgid "" "Clang compiler, the `rustc` sources (fetched from GitHub, reviewed by Rust " "compiler team), binary Rust compiler downloaded for bootstrapping" msgstr "" -"`rustc`(Rust 编译器)则依赖于 LLVM 库、Clang 编译器、“rustc”源代码(从 " +"`rustc`(Rust 编译器)则依赖于 LLVM 库、Clang 编译器、`rustc`源代码(从 " "GitHub 获取,并由 Rust 编译器团队审核)、为引导而下载的二进制 Rust 编译器" #: src/chromium/cargo.md @@ -15021,7 +14719,7 @@ msgid "" "You can also add `deps` on other Rust targets. Later we'll use this to " "depend upon third party code." msgstr "" -"您还可以在其他 Rust 目标上添加 `deps`。稍后,我们通过该操作来使用第三方代码。" +"你还可以在其他 Rust 目标上添加 `deps`。稍后,我们通过该操作来使用第三方代码。" #: src/chromium/build-rules.md msgid "" @@ -15031,7 +14729,7 @@ msgid "" "list of all source files which `ninja` needs in order to determine when " "rebuilds are necessary." msgstr "" -"您必须 _同时_ 指定 crate 根目录 _和_ 完整的源代码列表。`crate_root` 是供 " +"你必须 _同时_ 指定 crate 根目录 _和_ 完整的源代码列表。`crate_root` 是供 " "Rust 编译器使用的文件,表示编译单元的根文件,通常为 `lib.rs`。`sources` 是所" "有源文件的完整列表,`ninja` 需要用它来确定何时该进行重新构建。" @@ -15147,7 +14845,7 @@ msgid "" "Ensure your VSCode has the `rust-analyzer` extension, not earlier forms of " "Rust support" msgstr "" -"请确保您的 VSCode 安装了 `rust-analyzer` 扩展程序,而不是较早版本的 Rust 支持" +"请确保你的 VSCode 安装了 `rust-analyzer` 扩展程序,而不是较早版本的 Rust 支持" "插件。" #: src/chromium/build-rules/vscode.md @@ -15173,7 +14871,7 @@ msgid "" "The following steps may help with the demo (but feel free to instead use a " "piece of Chromium-related Rust that you are most familiar with):" msgstr "" -"以下步骤可能会对演示有所帮助(但您也可以选用一段最为熟悉的 Chromium 相关 " +"以下步骤可能会对演示有所帮助(但你也可以选用一段最为熟悉的 Chromium 相关 " "Rust 代码):" #: src/chromium/build-rules/vscode.md @@ -15202,7 +14900,7 @@ msgid "" "Demo **go to definition** (typical bindings: vscode = F12; vim/CoC = g d). " "(This will take you to `//third_party/rust/.../qr_code-.../src/lib.rs`.)" msgstr "" -"演示 **go to definition**(典型绑定:vscode = F12;vim/CoC = gd)。(然后您会" +"演示 **go to definition**(典型绑定:vscode = F12;vim/CoC = gd)。(然后你会" "前往 `//third_party/rust/.../qr_code-.../src/lib.rs`。)" #: src/chromium/build-rules/vscode.md @@ -15279,7 +14977,7 @@ msgid "" "in subsequent exercises. If you've succeeded, you will be able to use right-" "click \"Go to definition\" on `println!`." msgstr "" -"如果您使用 VSCode,现在就请设置 Rust,以便其能在 VSCode 中正常运行。这对后续" +"如果你使用 VSCode,现在就请设置 Rust,以便其能在 VSCode 中正常运行。这对后续" "练习会很有帮助。如果操作成功,则可使用右键点击 `println!` 上的 \"Go to " "definition\"。" @@ -15294,32 +14992,35 @@ msgid "" "source.chromium.org/chromium/chromium/src/+/main:build/rust/" "rust_static_library.gni;l=16)" msgstr "" -"适用于 [`rust_static_library` gn 模板] 的选项 (https://source.chromium.org/" -"chromium/chromium/src/+/main:build/rust/rust_static_library.gni;l=16)" +"[`rust_static_library` gn 模板" +"](https://source.chromium.org/chromium/chromium/src/+/main:build/rust/rust_static_library.gni;l=16)" +"可用的选项" #: src/exercises/chromium/build-rules.md msgid "" "Information about [`#[no_mangle]`](https://doc.rust-lang.org/beta/reference/" "abi.html#the-no_mangle-attribute)" msgstr "" -"关于 [`#[no_mangle]`] 的详细信息 (https://doc.rust-lang.org/beta/reference/" -"abi.html#the-no_mangle-attribute)" +"关于 " +"[`#[no_mangle]`](https://doc.rust-lang.org/beta/reference/abi.html#the-no_mangle-attribute) " +"的详细信息" #: src/exercises/chromium/build-rules.md msgid "" "Information about [`extern \"C\"`](https://doc.rust-lang.org/std/keyword." "extern.html)" msgstr "" -"关于 [`extern \"C\"`] 的详细信息 (https://doc.rust-lang.org/std/keyword." -"extern.html)" +"关于 [`extern \"C\"`](https://doc.rust-lang.org/std/keyword.extern.html) 的" +"详细信息" #: src/exercises/chromium/build-rules.md msgid "" "Information about gn's [`--export-rust-project`](https://gn.googlesource.com/" "gn/+/main/docs/reference.md#compilation-database) switch" msgstr "" -"关于 gn 的 [`--export-rust-project`] 开关的详细信息 (https://gn.googlesource." -"com/gn/+/main/docs/reference.md#compilation-database) " +"关于 gn 的 " +"[`--export-rust-project`](https://gn.googlesource.com/gn/+/main/docs/reference.md#compilation-database) " +"开关的详细信息" #: src/exercises/chromium/build-rules.md msgid "" @@ -15576,7 +15277,7 @@ msgid "" "language (which looks a lot like Rust) and then CXX tools generate " "declarations for functions and types in both Rust and C++." msgstr "" -"您可以使用接口定义语言(与 Rust 极为相似)描述整个语言边界,然后 CXX 工具会据" +"你可以使用接口定义语言(与 Rust 极为相似)描述整个语言边界,然后 CXX 工具会据" "此生成 Rust 和 C++ 函数及类型的声明。" #: src/chromium/interoperability-with-cpp.md @@ -15594,7 +15295,7 @@ msgid "" "the same as you previously did. Point out that automating the process has " "the following benefits:" msgstr "" -"请仔细研究这个图表。解释背后的原理和您之前所做的完全相同。说明自动执行这一流" +"请仔细研究这个图表。解释背后的原理和你之前所做的完全相同。说明自动执行这一流" "程具有以下好处:" #: src/chromium/interoperability-with-cpp.md @@ -15731,14 +15432,14 @@ msgstr "CXX 基本适用于以下情况:" msgid "" "Your Rust-C++ interface is sufficiently simple that you can declare all of " "it." -msgstr "您的 Rust-C++ 接口非常简单,可以声明其中的全部内容。" +msgstr "你的 Rust-C++ 接口非常简单,可以声明其中的全部内容。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "You're using only the types natively supported by CXX already, for example " "`std::unique_ptr`, `std::string`, `&[u8]` etc." msgstr "" -"目前,您只使用了 CXX 提供原生支持的类型,例如 `std::unique_ptr`、`std::" +"目前,你只使用了 CXX 提供原生支持的类型,例如 `std::unique_ptr`、`std::" "string`、`&[u8]` 等。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md @@ -15756,7 +15457,7 @@ msgid "" "enough." msgstr "" "由于这些局限,我们在 Chromium 中只能将 Rust 用于隔离紧密的 “叶节点”,而无法用" -"于任意的 Rust-C++ 互操作。当您打算在 Chromium 中探索 Rust 的应用场景时,推荐" +"于任意的 Rust-C++ 互操作。当你打算在 Chromium 中探索 Rust 的应用场景时,推荐" "先从拟定针对语言边界的 CXX 绑定入手,以查看该语言边界是否足够简单明了。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md @@ -15954,12 +15655,12 @@ msgid "" "to your existing `rust_static_library` target alongside `crate_root` and " "`sources`." msgstr "" -"添加到您现有的 `rust_static_library` 以及 `crate_root` 和 `sources` 的目标" +"添加到你现有的 `rust_static_library` 以及 `crate_root` 和 `sources` 的目标" "中。" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "C++ headers will be generated at a sensible location, so you can just" -msgstr "C++ 头文件会在合理的位置生成,因此您只需" +msgstr "C++ 头文件会在合理的位置生成,因此你只需" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "\"ui/base/my_rust_file.rs.h\"" @@ -15972,7 +15673,7 @@ msgid "" "source.chromium.org/chromium/chromium/src/+/main:base/containers/span_rust.h;" "l=21)." msgstr "" -"您会发现,`//base` 中提供了一些实用函数,可将 Chromium C++ 类型与 CXX Rust 类" +"你会发现,`//base` 中提供了一些实用函数,可将 Chromium C++ 类型与 CXX Rust 类" "型相互转换,例如 [`SpanToRustSlice`](https://source.chromium.org/chromium/" "chromium/src/+/main:base/containers/span_rust.h;l=21)。" @@ -16022,7 +15723,7 @@ msgid "" "specifies a single function, to be called from C++, called " "`hello_from_rust`, taking no parameters and returning no value." msgstr "" -"在您之前创建的 Rust 文件中,添加 `#[cxx::bridge]` 来指定一个将从 C++ 调用的函" +"在你之前创建的 Rust 文件中,添加 `#[cxx::bridge]` 来指定一个将从 C++ 调用的函" "数(名为 `hello_from_rust`),该函数不接受任何参数也不返回任何值。" #: src/exercises/chromium/interoperability-with-cpp.md @@ -16058,7 +15759,7 @@ msgid "" "It's a good idea to play with CXX a little. It helps you think about how " "flexible Rust in Chromium actually is." msgstr "" -"建议尝试操作一下 CXX。这有助于您更好地理解 Rust 在Chromium 中的灵活性。" +"建议尝试操作一下 CXX。这有助于你更好地理解 Rust 在Chromium 中的灵活性。" #: src/exercises/chromium/interoperability-with-cpp.md #, fuzzy @@ -16067,14 +15768,14 @@ msgstr "一些注意事项:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Call back into C++ from Rust. You will need:" -msgstr "从 Rust 回调到 C++。您需要执行以下操作:" +msgstr "从 Rust 回调到 C++。你需要执行以下操作:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" "An additional header file which you can `include!` from your `cxx::bridge`. " "You'll need to declare your C++ function in that new header file." msgstr "" -"创建一个附加头文件,且您可以从 `cxx::bridge` 对其进行 `include!` 操作。您需要" +"创建一个附加头文件,且你可以从 `cxx::bridge` 对其进行 `include!` 操作。你需要" "在这个新的头文件中声明要调用的 C++ 函数。" #: src/exercises/chromium/interoperability-with-cpp.md @@ -16092,7 +15793,7 @@ msgid "" "You may also need to `#include \"third_party/rust/cxx/v1/crate/include/cxx." "h\"`" msgstr "" -"您可能还需要添加 `#include \"third_party/rust/cxx/v1/crate/include/cxx.h\"`" +"你可能还需要添加 `#include \"third_party/rust/cxx/v1/crate/include/cxx.h\"`" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Pass a C++ string from C++ into Rust." @@ -16113,7 +15814,7 @@ msgstr "" msgid "" "Intentionally get the C++ function signatures mismatched from the `#[cxx::" "bridge]`, and get used to the errors you see." -msgstr "刻意让 C++ 函数签名与 `#[cxx::bridge]` 不匹配,并适应您看到的错误。" +msgstr "刻意让 C++ 函数签名与 `#[cxx::bridge]` 不匹配,并适应你看到的错误。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -16128,7 +15829,7 @@ msgid "" "Create a Rust object and pass it into C++, so that C++ owns it. (Hint: you " "need a `Box`)." msgstr "" -"创建一个 Rust 对象并将其传递到 C++,以便 C++ 拥有它的所有权。(提示:您需要使" +"创建一个 Rust 对象并将其传递到 C++,以便 C++ 拥有它的所有权。(提示:你需要使" "用 `Box`)。" #: src/exercises/chromium/interoperability-with-cpp.md @@ -16149,7 +15850,7 @@ msgid "" "couple of use-cases for Rust in Chromium where the interface would be " "sufficiently simple. Sketch how you might define that interface." msgstr "" -"现在,您已经了解了 CXX 互操作性的优势和局限,请思考几个 Rust 在 Chromium 中的" +"现在,你已经了解了 CXX 互操作性的优势和局限,请思考几个 Rust 在 Chromium 中的" "应用场景,其中接口要足够简单构思该如何定义该接口。" #: src/exercises/chromium/interoperability-with-cpp.md @@ -16167,7 +15868,7 @@ msgstr "" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Some of the questions you may encounter:" -msgstr "您可能会遇到以下问题:" +msgstr "你可能会遇到以下问题:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -16176,7 +15877,7 @@ msgid "" "quite match the declaration in your `cxx::bridge`." msgstr "" "当我用类型 Y 初始化类型 X 的变量时,出现了初始化问题,其中 X 和 Y 都是函数类" -"型。这是因为您的 C++ 函数实现与 `cxx::bridge` 中的声明并不完全一致。" +"型。这是因为你的 C++ 函数实现与 `cxx::bridge` 中的声明并不完全一致。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -16185,9 +15886,9 @@ msgid "" "sized. For CXX trivial types yes, it's _possible_ to cause UB, although " "CXX's design makes it quite difficult to craft such an example." msgstr "" -"我好像能随意将 C++ 引用转换为 Rust 引用。这样不会导致 UB 风险吗?对于 CXX 的_" -"不透明_类型,答案为否,因为它们的大小为零。对于 CXX 的基本类型,确实_有可能_" -"导致 UB,但鉴于 CXX 的设计策略,要构建能导致这种情况的示例颇为困难。" +"我好像能随意将 C++ 引用转换为 Rust 引用。这样不会导致 UB 风险吗?对于 CXX 的" +" _不透明_ 类型,答案为否,因为它们的大小为零。对于 CXX 的基本类型,确实 _有" +"可能_ 导致 UB,但鉴于 CXX 的设计策略,要构建能导致这种情况的示例颇为困难。" #: src/chromium/adding-third-party-crates.md msgid "" @@ -16318,9 +16019,9 @@ msgid "" "dependencies.html) --- most commonly, you'll want to specify the `features` " "that you wish to enable in the crate." msgstr "" -"与任何其他 `Cargo.toml` 一样,您可以指定 [有关依赖项的更多详细信息](https://" +"与任何其他 `Cargo.toml` 一样,你可以指定 [有关依赖项的更多详细信息](https://" "doc.rust-lang.org/cargo/reference/specifying-dependencies.html)。最常见的是," -"您需要指定要在 crate 中启用的 `features`。" +"你需要指定要在 crate 中启用的 `features`。" #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "" @@ -16356,7 +16057,7 @@ msgid "" "Depending on the crate source code layout, you may also need to use this " "file to specify where its `LICENSE` file(s) can be found." msgstr "" -"根据 crate 源代码布局,您可能还需要使用此文件指定其 `LICENSE` 文件的所在位" +"根据 crate 源代码布局,你可能还需要使用此文件指定其 `LICENSE` 文件的所在位" "置。" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md @@ -16383,7 +16084,7 @@ msgid "" "`crates.io`. See [the earlier section](../cargo.md) discussing this security " "decision." msgstr "" -"虽然 `gnrt` 工具是 Chromium 源代码的一部分,但通过运行此命令,您可以从 " +"虽然 `gnrt` 工具是 Chromium 源代码的一部分,但通过运行此命令,你可以从 " "`crates.io` 下载并运行其依赖项。有关该安全决策的讨论,请参阅 [前面的部分](../" "cargo.md)。" @@ -16415,7 +16116,7 @@ msgid "" msgstr "" "Chromium 会修复一些 crate 的补丁,并将其保存在 `//third_party/rust/" "chromium_crates_io/patches` 中。系统会自动重新应用这些补丁,但如果补丁应用失" -"败,您可能需要进行手动操作。" +"败,你可能需要进行手动操作。" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" @@ -16424,7 +16125,7 @@ msgstr "下载 crate 后,按如下方式生成 `BUILD.gn` 文件:" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "Now run `git status`. You should find:" -msgstr "现在,运行 `git status`。您应该会看到:" +msgstr "现在,运行 `git status`。你应该会看到:" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" @@ -16493,7 +16194,7 @@ msgstr "我们的 gn 模板均支持" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Work required by you" -msgstr "您需要完成的工作" +msgstr "你需要完成的工作" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Checking rustc version to configure features on and off" @@ -16603,7 +16304,7 @@ msgstr "" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "So, your options are:" -msgstr "因此,您可以选择:" +msgstr "因此,你可以选择:" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "Avoid these crates" @@ -16691,7 +16392,7 @@ msgid "" msgstr "" "添加新库须遵守 Chromium 的标准 [政策](https://chromium.googlesource.com/" "chromium/src/+/refs/heads/main/docs/rust.md#Third_party-review),当然也要遵守" -"安全审核标准。您可能不仅要引入单个 crate,而且还要引入传递依赖项,因此可能需" +"安全审核标准。你可能不仅要引入单个 crate,而且还要引入传递依赖项,因此可能需" "要审核大量代码。另一方面,安全的 Rust 代码可能产生的副作用有限。应如何对其进" "行审核?" @@ -16755,7 +16456,7 @@ msgid "" "100% perfection here: there's often just too much code.)" msgstr "" "尽可能地仔细阅读所有代码,查找任何可能属于恶意插入,稍显异常的地方。(但现实" -"中,您不可能做到百无遗漏,因为代码量通常太庞大了。)" +"中,你不可能做到百无遗漏,因为代码量通常太庞大了。)" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" @@ -16795,7 +16496,7 @@ msgid "" "You should land all this, along with your `Cargo.toml` and `gnrt_config." "toml` changes, into the Chromium repo." msgstr "" -"您应将所有这些内容,以及对 `Cargo.toml` 和 `gnrt_config.toml` 的更改一起提交" +"你应将所有这些内容,以及对 `Cargo.toml` 和 `gnrt_config.toml` 的更改一起提交" "到 Chromium 仓库中。" #: src/chromium/adding-third-party-crates/checking-in.md @@ -16803,7 +16504,7 @@ msgid "" "**Important**: you need to use `git add -f` because otherwise `.gitignore` " "files may result in some files being skipped." msgstr "" -"**重要提示**:您需要使用 `git add -f` 命令,否则 `.gitignore` 文件可能会导致" +"**重要提示**:你需要使用 `git add -f` 命令,否则 `.gitignore` 文件可能会导致" "某些文件被跳过。" #: src/chromium/adding-third-party-crates/checking-in.md @@ -16813,9 +16514,9 @@ msgid "" "branches, and many projects still use non-inclusive terminology there. So " "you may need to run:" msgstr "" -"在此过程中,您可能会发现由于使用了非包容性语言,导致提交前检查失败。这是因为 " +"在此过程中,你可能会发现由于使用了非包容性语言,导致提交前检查失败。这是因为 " "Rust crate 数据往往包含 git 分支的名称,而许多项目仍然在使用非包容性术语。因" -"此,您需要运行以下命令:" +"此,你需要运行以下命令:" #: src/chromium/adding-third-party-crates/keeping-up-to-date.md msgid "" @@ -16825,10 +16526,10 @@ msgid "" "hoped that we will soon automate this for Rust crates, but for now, it's " "still your responsibility just as it is for any other third party dependency." msgstr "" -"作为任何第三方 Chromium 依赖项的所有者,您 [应使用任何安全修复程序,确保该依" +"作为任何第三方 Chromium 依赖项的所有者,你 [应使用任何安全修复程序,确保该依" "赖项处于最新状态](https://chromium.googlesource.com/chromium/src/+/main/docs/" "adding_to_third_party.md#add-owners)。我们希望能够尽快实现对 Rust crate 自动" -"执行此操作,但目前仍由您负责执行,就像对待任何其他第三方依赖项一样。" +"执行此操作,但目前仍由你负责执行,就像对待任何其他第三方依赖项一样。" #: src/exercises/chromium/third-party.md msgid "" @@ -16849,8 +16550,8 @@ msgid "" "[`rust_executable` target](https://source.chromium.org/chromium/chromium/src/" "+/main:build/rust/rust_executable.gni) which uses `uwuify`)." msgstr "" -"(在下一个练习中,我们将使用 Chromium 中的 uwuify;但您也可以跳过这一步,现在" -"就开始此操作。或者,您可以创建一个使用 `uwuify` 的新 [`rust_executable` 目标]" +"(在下一个练习中,我们将使用 Chromium 中的 uwuify;但你也可以跳过这一步,现在" +"就开始此操作。或者,你可以创建一个使用 `uwuify` 的新 [`rust_executable` 目标]" "(https://source.chromium.org/chromium/chromium/src/+/main:build/rust/" "rust_executable.gni)。" @@ -16922,7 +16623,7 @@ msgstr "综合应用练习" msgid "" "In this exercise, you're going to add a whole new Chromium feature, bringing " "together everything you already learned." -msgstr "在本练习中,您将运用之前所学的全部知识,添加一项全新的 Chromium 功能。" +msgstr "在本练习中,你将运用之前所学的全部知识,添加一项全新的 Chromium 功能。" #: src/exercises/chromium/bringing-it-together.md #, fuzzy @@ -16958,7 +16659,7 @@ msgid "" "In fact, you already [imported that crate in the previous exercise](https://" "crates.io/crates/uwuify)." msgstr "" -"事实上,您已经 [在上一个练习中导入了该 crate](https://crates.io/crates/" +"事实上,你已经 [在上一个练习中导入了该 crate](https://crates.io/crates/" "uwuify)。" #: src/exercises/chromium/bringing-it-together.md @@ -16988,7 +16689,7 @@ msgid "" "If you've done everything right across all these exercises, congratulations, " "you should have created Chrome for pixies!" msgstr "" -"如果您正确完成了这些练习中的所有操作,那么恭喜您已经成功创建了一款精灵版 " +"如果你正确完成了这些练习中的所有操作,那么恭喜你已经成功创建了一款精灵版 " "Chrome!" #: src/exercises/chromium/bringing-it-together.md @@ -17024,10 +16725,10 @@ msgid "" "around like Rust data, because it may contain self-referential pointers." msgstr "" "学生可以通过多种方式设计 C++/Rust 边界,例如按值传递和返回字符串,或对字符串" -"采取可变引用。如果使用可变引用,CXX 可能会提示学生需要使用 [`Pin`](https://" -"doc.rust-lang.org/std/pin/) 方法。您可能需要解释“Pin”的用途,以及为何 CXX 需" -"要它来对 C++ 数据进行可变引用:原因是 C++ 数据无法像 Rust 数据那样自由移动," -"它可能包含自引用指针。" +"采取可变引用。如果使用可变引用,CXX 可能会提示学生需要使用 " +"[`Pin`](https://doc.rust-lang.org/std/pin/) 方法。你可能需要解释`Pin`的用途" +",以及为何 CXX 需要它来对 C++ 数据进行可变引用:原因是 C++ 数据无法像 Rust " +"数据那样自由移动,它可能包含自引用指针。" #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -17250,7 +16951,7 @@ msgid "" "define your own entry point. This will typically involve a linker script and " "some assembly code to set things up ready for Rust code to run." msgstr "" -"请注意,未提供 `main` 函数或任何其他入口点;您可以自行定义入口点。通常需要使" +"请注意,未提供 `main` 函数或任何其他入口点;你可以自行定义入口点。通常需要使" "用链接器脚本和一些汇编代码进行设置工作,以便 Rust 代码能够顺利运行。" #: src/bare-metal/alloc.md @@ -17258,7 +16959,7 @@ msgid "" "To use `alloc` you must implement a [global (heap) allocator](https://doc." "rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html)." msgstr "" -"如需使用 `alloc`,您必须实现 [全局(堆)分配器](https://doc.rust-lang.org/" +"如需使用 `alloc`,你必须实现 [全局(堆)分配器](https://doc.rust-lang.org/" "stable/std/alloc/trait.GlobalAlloc.html)。" #: src/bare-metal/alloc.md @@ -17303,7 +17004,7 @@ msgid "" "exactly one global allocator defined in your binary. Usually this is done in " "the top-level binary crate." msgstr "" -"如果依赖项树中的所有 crate 都依赖于 `alloc`,则您必须在二进制文件中明确定义一" +"如果依赖项树中的所有 crate 都依赖于 `alloc`,则你必须在二进制文件中明确定义一" "个全局分配器。通常,在顶级二进制 crate 中完成此操作。" #: src/bare-metal/alloc.md @@ -17446,7 +17147,7 @@ msgid "" "If you `cargo install cargo-binutils` then you can run `cargo objdump --bin " "pac -- -d --no-show-raw-insn` to see the resulting binary." msgstr "" -"如果您使用 `cargo install cargo-binutils`,则可以运行 `cargo objdump --bin " +"如果你使用 `cargo install cargo-binutils`,则可以运行 `cargo objdump --bin " "pac -- -d --no-show-raw-insn`,查看生成的二进制文件。" #: src/bare-metal/microcontrollers/hals.md @@ -17538,7 +17239,7 @@ msgstr "" msgid "" "Changing the configuration of a pin consumes the old pin instance, so you " "can’t keep use the old instance afterwards." -msgstr "更改引脚的配置会使旧的引脚实例失效,因此您无法再继续使用旧实例。" +msgstr "更改引脚的配置会使旧的引脚实例失效,因此你无法再继续使用旧实例。" #: src/bare-metal/microcontrollers/type-state.md msgid "" @@ -17557,7 +17258,7 @@ msgid "" "You can call `is_high` on an input pin and `set_high` on an output pin, but " "not vice-versa." msgstr "" -"您可以在输入引脚上调用 `is_high`,在输出引脚上调用 `set_high`,反之则不行。" +"你可以在输入引脚上调用 `is_high`,在输出引脚上调用 `set_high`,反之则不行。" #: src/bare-metal/microcontrollers/type-state.md msgid "Many HAL crates follow this pattern." @@ -17647,7 +17348,7 @@ msgid "" "toml` file in your project directory." msgstr "" "`cargo-embed` 是一个 cargo 子命令,用于构建和刷写二进制文件、记录 RTT(实时传" -"输)输出以及连接 GDB。您可通过项目目录中的 `Embed.toml` 文件对其进行配置。" +"输)输出以及连接 GDB。你可通过项目目录中的 `Embed.toml` 文件对其进行配置。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" @@ -17676,7 +17377,7 @@ msgstr "调试访问端口通常为 5 针 JTAG 接口或 2 针串行线调试接 msgid "" "probe-rs is a library which you can integrate into your own tools if you " "want to." -msgstr "probe-rs 是一个库,如有需要,可以将其集成到您的工具中。" +msgstr "probe-rs 是一个库,如有需要,可以将其集成到你的工具中。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" @@ -17873,7 +17574,7 @@ 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 "" -"您拥有一个 [`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/" +"你拥有一个 [`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/" "struct.Board.html) 结构体,其中包含各种引脚和外围设备的字段。" #: src/exercises/bare-metal/compass.md @@ -17882,7 +17583,7 @@ msgid "" "com/pdf/nRF52833_PS_v1.5.pdf) if you want, but it shouldn't be necessary for " "this exercise." msgstr "" -"如有需要,您还可以查看 [nRF52833 数据表](https://infocenter.nordicsemi.com/" +"如有需要,你还可以查看 [nRF52833 数据表](https://infocenter.nordicsemi.com/" "pdf/nRF52833_PS_v1.5.pdf),但对本练习来说这不是必需的。" #: src/exercises/bare-metal/compass.md @@ -18242,7 +17943,7 @@ msgid "" "(EL1). If you need to run at a different exception level you'll need to " "modify `entry.S` accordingly." msgstr "" -"今天下午的所有示例都假定我们将在异常级别 1 (EL1) 下运行。如果您需要在其他异常" +"今天下午的所有示例都假定我们将在异常级别 1 (EL1) 下运行。如果你需要在其他异常" "级别下运行,则需要修改相应的 `entry.S`。" #: src/bare-metal/aps/inline-assembly.md @@ -18377,7 +18078,7 @@ msgstr "切勿提及引用。" msgid "" "`addr_of!` lets you get fields of structs without creating an intermediate " "reference." -msgstr "借助 `addr_of!`,您无需创建中间引用即可获取结构体字段。" +msgstr "借助 `addr_of!`,你无需创建中间引用即可获取结构体字段。" #: src/bare-metal/aps/mmio.md msgid "" @@ -18393,7 +18094,7 @@ msgid "" "compiler may assume that the value read is the same as the value just " "written, and not bother actually reading memory." msgstr "" -"通常情况下,如果您先写入操作,紧接着进行读取操作(例如通过可变引用),则编译" +"通常情况下,如果你先写入操作,紧接着进行读取操作(例如通过可变引用),则编译" "器可能会认为读取的值是最新写入的值,就不再执行实际的内存读取过程。" #: src/bare-metal/aps/mmio.md @@ -18896,8 +18597,8 @@ msgid "" "(https://crates.io/crates/log) crate. We can do this by implementing the " "`Log` trait." msgstr "" -"最好能够使用 [`log`](https://crates.io/crates/log) crate 中的日志记录宏。可以" -"通过实现“Log”trait 来做到这一点。" +"最好能够使用 [`log`](https://crates.io/crates/log) crate 中的日志记录宏。可" +"以通过实现`Log`trait 来做到这一点。" #: src/bare-metal/aps/logging.md msgid "\"[{}] {}\"" @@ -19130,7 +18831,7 @@ msgid "" "you create page tables according to the AArch64 Virtual Memory System " "Architecture." msgstr "" -"借助 [`aarch64-paging`](https://crates.io/crates/aarch64-paging) crate,您可" +"借助 [`aarch64-paging`](https://crates.io/crates/aarch64-paging) crate,你可" "根据 AArch64 虚拟内存系统架构创建分页表。" #: src/bare-metal/useful-crates/aarch64-paging.md @@ -19342,7 +19043,7 @@ 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 "" -"使用该时钟可将当前时间输出到串行控制台。您可以使用 [`chrono`](https://crates." +"使用该时钟可将当前时间输出到串行控制台。你可以使用 [`chrono`](https://crates." "io/crates/chrono) crate 设置日期/时间格式。" #: src/exercises/bare-metal/rtc.md @@ -20486,7 +20187,7 @@ msgstr "// Output their thoughts\n" #: src/exercises/concurrency/dining-philosophers.md msgid "You can use the following `Cargo.toml`:" -msgstr "您可以使用以下 `Cargo.toml`:" +msgstr "你可以使用以下 `Cargo.toml`:" #: src/exercises/concurrency/dining-philosophers.md msgid "" @@ -20576,12 +20277,12 @@ msgid "" "You can now download the start page. Try with a small site such as `https://" "www.google.org/`." msgstr "" -"您现在可以下载初始页了。请尝试使用一个小网站,例如 `https://www.google.org/" +"你现在可以下载初始页了。请尝试使用一个小网站,例如 `https://www.google.org/" "`。" #: src/exercises/concurrency/link-checker.md msgid "Your `src/main.rs` file should look something like this:" -msgstr "您的 `src/main.rs` 文件应如下所示:" +msgstr "你的 `src/main.rs` 文件应如下所示:" #: src/exercises/concurrency/link-checker.md #: src/exercises/concurrency/solutions-morning.md @@ -20639,7 +20340,7 @@ msgid "" "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` 网域的所有网页中提取链接。" +"你可以对此进行扩展,以递归方式从 `www.google.org` 网域的所有网页中提取链接。" "设置网页上限(例如 100 个),以免被网站屏蔽。" #: src/exercises/concurrency/solutions-morning.md @@ -20887,8 +20588,8 @@ msgid "" "_reactor_) and is responsible for executing futures (an _executor_). Rust " "does not have a \"built-in\" runtime, but several options are available:" msgstr "" -"_运行时_ 支持异步执行操作(即 _反应器),并负责执行 Future (即 _执行器)。" -"Rust 没有 “内置”运行时,但有以下几个选项可供选择:" +"_运行时_ 支持异步执行操作(即 _反应器_),并负责执行 Future(即 _执行器_)。" +"Rust 没有“内置”运行时,但有以下几个选项可供选择:" #: src/async/runtimes.md msgid "" @@ -21364,7 +21065,7 @@ msgstr "\"current_thread\"" msgid "" "Run the code and see that the sleeps happen consecutively rather than " "concurrently." -msgstr "运行该代码,您会发现休眠操作是连续发生的,而不是并发进行的。" +msgstr "运行该代码,你会发现休眠操作是连续发生的,而不是并发进行的。" #: src/async/pitfalls/blocking-executor.md msgid "" @@ -21483,7 +21184,7 @@ msgstr "\"work result for iteration {i}: {resp}\"" msgid "" "You may recognize this as an example of the actor pattern. Actors typically " "call `select!` in a loop." -msgstr "您可能认为这是执行器模式的一个示例。执行器通常会循环调用 `select!`。" +msgstr "你可能认为这是执行器模式的一个示例。执行器通常会循环调用 `select!`。" #: src/async/pitfalls/pin.md msgid "" @@ -21624,7 +21325,7 @@ msgid "" "digging deeper." msgstr "" "对于 `async trait` 的语言支持中的挑战是深入 Rust的,并且可能不值得深入描述。" -"如果您对深入了解感兴趣,Niko Matsakis 在[这篇文章](https://" +"如果你对深入了解感兴趣,Niko Matsakis 在[这篇文章](https://" "smallcultfollowing.com/babysteps/blog/2019/10/26/async-fn-in-traits-are-" "hard/)中对它们做了很好的解释。" @@ -21664,7 +21365,7 @@ msgid "" "The compiler doesn't help with cancellation-safety. You need to read API " "documentation and consider what state your `async fn` holds." msgstr "" -"编译器无法确保取消操作的安全性。您需要阅读 API 文档,并考虑 `async fn` 所持状" +"编译器无法确保取消操作的安全性。你需要阅读 API 文档,并考虑 `async fn` 所持状" "态。" #: src/async/pitfalls/cancellation.md @@ -21681,13 +21382,13 @@ msgstr "该示例丢失了字符串的某些部分。" msgid "" "Whenever the `tick()` branch finishes first, `next()` and its `buf` are " "dropped." -msgstr "每当 `tick()` 分支先完成操作时,`next() 及其 `buf` 均会被丢弃。" +msgstr "每当 `tick()` 分支先完成操作时,`next()` 及其 `buf` 均会被丢弃。" #: src/async/pitfalls/cancellation.md msgid "" "`LinesReader` can be made cancellation-safe by making `buf` part of the " "struct:" -msgstr "通过将 `buf` 整合到结构体中,`LinesReader 可以确保取消操作的安全性:" +msgstr "通过将 `buf` 整合到结构体中,`LinesReader` 可以确保取消操作的安全性:" #: src/async/pitfalls/cancellation.md #, fuzzy @@ -21727,7 +21428,7 @@ msgstr "" #: src/exercises/concurrency/afternoon.md msgid "" "To practice your Async Rust skills, we have again two exercises for you:" -msgstr "为了练习您的异步 Rust 技能,我们再次为您提供了两个练习:" +msgstr "为了练习你的异步 Rust 技能,我们再次为你提供了两个练习:" #: src/exercises/concurrency/afternoon.md msgid "" @@ -21740,7 +21441,7 @@ msgstr "" msgid "" "A Broadcast Chat Application: this is a larger project that allows you " "experiment with more advanced Async Rust features." -msgstr "广播聊天应用:这是一个更大的项目,允许您尝试更高级的异步Rust功能。" +msgstr "广播聊天应用:这是一个更大的项目,允许你尝试更高级的异步Rust功能。" #: src/exercises/concurrency/dining-philosophers-async.md #: src/exercises/concurrency/solutions-afternoon.md @@ -21779,7 +21480,7 @@ msgid "" "Since this time you are using Async Rust, you'll need a `tokio` dependency. " "You can use the following `Cargo.toml`:" msgstr "" -"因为这次您正在使用异步Rust,您将需要一个 `tokio` 依赖。您可以使用以下的 " +"因为这次你正在使用异步Rust,你将需要一个 `tokio` 依赖。你可以使用以下的 " "`Cargo.toml`:" #: src/exercises/concurrency/dining-philosophers-async.md @@ -21811,12 +21512,12 @@ msgstr "" msgid "" "Also note that this time you have to use the `Mutex` and the `mpsc` module " "from the `tokio` crate." -msgstr "另外,请注意,这次您必须使用来自 `tokio` 包的 `Mutex` 和 `mpsc` 模块。" +msgstr "另外,请注意,这次你必须使用来自 `tokio` 包的 `Mutex` 和 `mpsc` 模块。" #: src/exercises/concurrency/dining-philosophers-async.md #, fuzzy msgid "Can you make your implementation single-threaded?" -msgstr "您可以单线程化您的实现吗?" +msgstr "你可以单线程化你的实现吗?" #: src/exercises/concurrency/chat-app.md msgid "" @@ -21894,7 +21595,7 @@ msgid "" "[`tokio_websockets`](https://docs.rs/tokio-websockets/). Spend a few minutes " "to familiarize yourself with the API." msgstr "" -"您将需要来自 `tokio` 和 [`tokio_websockets`](https://docs.rs/tokio-" +"你将需要来自 `tokio` 和 [`tokio_websockets`](https://docs.rs/tokio-" "websockets/0.3.2/tokio_websockets/) 的以下函数。请花几分钟时间熟悉这些 API。" #: src/exercises/concurrency/chat-app.md @@ -21967,7 +21668,7 @@ msgid "" "described below." msgstr "" "将以下服务器和客户端代码分别复制到 `src/bin/server.rs` 和 `src/bin/client." -"rs` 中。您的任务是按照下面的描述完成这些文件。" +"rs` 中。你的任务是按照下面的描述完成这些文件。" #: src/exercises/concurrency/chat-app.md #: src/exercises/concurrency/solutions-afternoon.md @@ -22152,7 +21853,7 @@ msgstr "\"From server: {}\"" msgid "" "_Thank you for taking Comprehensive Rust 🦀!_ We hope you enjoyed it and " "that it was useful." -msgstr "_感谢您参与学习 Comprehensive Rust 🦀!_ 希望您喜欢并且觉得它有用。" +msgstr "_感谢你参与学习 Comprehensive Rust 🦀!_ 希望你喜欢并且觉得它有用。" #: src/thanks.md msgid "" @@ -22161,9 +21862,9 @@ msgid "" "please get in [contact with us on GitHub](https://github.com/google/" "comprehensive-rust/discussions). We would love to hear from you." msgstr "" -"组织这门课程让我们收获了很多乐趣。本课程并非完美无缺,因此,如果您发现任何错" +"组织这门课程让我们收获了很多乐趣。本课程并非完美无缺,因此,如果你发现任何错" "误或有任何改进建议,请[在 GitHub 上与我们联系](https://github.com/google/" -"comprehensive-rust/discussions)。我们期待收到您的宝贵意见。" +"comprehensive-rust/discussions)。我们期待收到你的宝贵意见。" #: src/glossary.md msgid "" @@ -22802,7 +22503,7 @@ msgid "" "in the examples." msgstr "" "[通过例子学 Rust](https://doc.rust-lang.org/rust-by-example/):通过一系列展示" -"不同结构的示例介绍 Rust 语法。有时会包括一些小练习,会要求您充分地阐述示例中" +"不同结构的示例介绍 Rust 语法。有时会包括一些小练习,会要求你充分地阐述示例中" "的代码。" #: src/other-resources.md @@ -22891,7 +22592,7 @@ msgid "" "you learn Rust." msgstr "" "[Rust on Exercism(在 Exercism 上学 Rust)](https://exercism.org/tracks/" -"rust):100 多项练习助您学习 Rust。" +"rust):100 多项练习助你学习 Rust。" #: src/other-resources.md msgid "" @@ -23367,7 +23068,7 @@ msgstr "" #~ "Add `vendor_available: true` if your AIDL file is used by a binary in the " #~ "vendor partition." #~ msgstr "" -#~ "如果供应商分区中的二进制文件使用了您的 AIDL 文件,请添加 " +#~ "如果供应商分区中的二进制文件使用了你的 AIDL 文件,请添加 " #~ "`vendor_available: true`。" #, fuzzy @@ -24613,7 +24314,7 @@ msgstr "" #~ "You will also need a way to find links. We can use [`scraper`](https://" #~ "docs.rs/scraper/) for that:" #~ msgstr "" -#~ "您还需要一种查找链接的方法。为此,我们可以使用 [`scraper`](https://docs." +#~ "你还需要一种查找链接的方法。为此,我们可以使用 [`scraper`](https://docs." #~ "rs/scraper/):" #~ msgid "" @@ -24853,7 +24554,7 @@ msgstr "" #~ "characters (here a `'/'`) and how you can control alignment:" #~ msgstr "" #~ "如果要绘制对齐的文本,可以使用[填充/对齐](https://doc.rust-lang.org/std/" -#~ "fmt/index.html#fillalignment)格式设置运算符。需要特别注意的是您填充不同字" +#~ "fmt/index.html#fillalignment)格式设置运算符。需要特别注意的是你填充不同字" #~ "符(此处是“/”)的方式以及控制对齐的方式:" #~ msgid "\"left aligned: |{:/>`, but this doesn't " #~ "work out-of-the-box either: it's hard to convert from `Vec>` to " #~ "`&[&[i32]]` so now you cannot easily use `pretty_print` either." #~ msgstr "" -#~ "您可以尝试使用类似 `Vec>` 的方式,但这也无法直接工作:从 " -#~ "`Vec>` 转换为 `&[&[i32]]` 很困难,因此您现在也不能轻松使用 " +#~ "你可以尝试使用类似 `Vec>` 的方式,但这也无法直接工作:从 " +#~ "`Vec>` 转换为 `&[&[i32]]` 很困难,因此你现在也不能轻松使用 " #~ "`pretty_print`。" #~ msgid ""