Skip to content

Commit

Permalink
update original
Browse files Browse the repository at this point in the history
  • Loading branch information
funkill committed Oct 27, 2024
1 parent 53cd31d commit 433afd5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
8 changes: 3 additions & 5 deletions rust-by-example/po/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -12714,7 +12714,7 @@ msgid ""
"heap is freed."
msgstr ""
"在 Rust 中,所有值默认都是栈分配的。通过创建 `Box<T>`,可以将值**装箱**(在堆上分配)。"
"Box 是指向堆分配的 `T` 类型值的智能指针。当 box 离开作用域时,会调用其析构函数,"
"Box 是指向堆分配的 `T` 类型值的智能指针。当 Box 离开作用域时,会调用其析构函数,"
"内部对象被销毁,堆上的内存被释放。"

#: src/std/box.md:8
Expand Down Expand Up @@ -12898,7 +12898,7 @@ msgid ""
" // count is enumerated in a separate variable (`i`)\n"
msgstr ""
"// 遍历 `Vector` 时,可以同时用一个单独的变量(`i`)\n"
"// 来枚举迭代计数\n"
" // 来枚举迭代计数\n"

#: src/std/vec.md:55
msgid "\"In position {} we have value {}\""
Expand All @@ -12910,7 +12910,7 @@ msgid ""
" // over in a way that allows modifying each value\n"
msgstr ""
"// 借助 `iter_mut`,可变的 `Vector` 也可以被遍历,\n"
"// 并且允许修改每个值\n"
" // 并且允许修改每个值\n"

#: src/std/vec.md:63
msgid "\"Updated vector: {:?}\""
Expand Down Expand Up @@ -13966,15 +13966,13 @@ msgid ""
" // reference in the memory heap.\n"
msgstr ""
"// 这里没有指定值,因为它是指向堆内存中引用的指针。\n"
" // \n"

#: src/std/arc.md:24
msgid ""
"// As Arc was used, threads can be spawned using the value allocated\n"
" // in the Arc variable pointer's location.\n"
msgstr ""
"// 由于使用了 Arc,可以使用 Arc 变量指针所指向的值来生成线程。\n"
" // \n"

#: src/std/arc.md:30
msgid "// Make sure all Arc instances are printed from spawned threads.\n"
Expand Down
1 change: 0 additions & 1 deletion rust-by-example/src/generics/new_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ impl Years {
}
}
impl Days {
/// truncates partial years
pub fn to_years(&self) -> Years {
Expand Down
2 changes: 1 addition & 1 deletion rust-by-example/src/primitives/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn main() {
}
}
// Out of bound indexing on array causes compile time error.
// Out of bound indexing on array with constant value causes compile time error.
//println!("{}", xs[5]);
// Out of bound indexing on slice causes runtime error.
//println!("{}", xs[..][5]);
Expand Down
2 changes: 1 addition & 1 deletion rust-by-example/src/std_misc/file/read_lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn main() {
// File hosts.txt must exist in the current path
if let Ok(lines) = read_lines("./hosts.txt") {
// Consumes the iterator, returns an (Optional) String
for line in lines.flatten() {
for line in lines.map_while(Result::ok) {
println!("{}", line);
}
}
Expand Down

0 comments on commit 433afd5

Please sign in to comment.