diff --git a/src/advance/functional-programing/closure.md b/src/advance/functional-programing/closure.md index c5007350..c8d7a20b 100644 --- a/src/advance/functional-programing/closure.md +++ b/src/advance/functional-programing/closure.md @@ -303,7 +303,7 @@ where } ``` -上面的缓存有一个很大的问题:只支持 `u32` 类型的值,若我们想要缓存 `&str` 类型,显然就行不通了,因此需要将 `u32` 替换成泛型 `E`,该练习就留给读者自己完成,具体代码可以参考[这里](https://practice.rs/functional-programing/closure.html#closure-in-structs) +上面的缓存有一个很大的问题:只支持 `u32` 类型的值,若我们想要缓存 `&str` 类型,显然就行不通了,因此需要将 `u32` 替换成泛型 `E`,该练习就留给读者自己完成,具体代码可以参考[这里](https://zh-practice.course.rs/functional-programing/closure.html#closure-in-structs) ## 捕获作用域中的值 @@ -812,4 +812,4 @@ fn factory(x:i32) -> Box i32> { ## 课后习题 -> [Rust By Practice](https://practice.rs/functional-programing/closure.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/functional-programing/closure.md)。 +> [Rust By Practice](https://zh-practice.course.rs/functional-programing/closure.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/functional-programing/closure.md)。 diff --git a/src/advance/into-types/converse.md b/src/advance/into-types/converse.md index 4756594c..c89aa5a0 100644 --- a/src/advance/into-types/converse.md +++ b/src/advance/into-types/converse.md @@ -324,9 +324,9 @@ unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>) -> &'b mut R ## 课后练习 > Rust By Practice,支持代码在线编辑和运行,并提供详细的习题解答。 -> - [as](https://zh.practice.rs/type-conversions/as.html) +> - [as](https://zh-practice.course.rs/type-conversions/as.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/type-conversions/as.md) -> - [From/Into](https://zh.practice.rs/type-conversions/from-into.html) +> - [From/Into](https://zh-practice.course.rs/type-conversions/from-into.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/type-conversions/from-into.md) -> - [其它转换](https://zh.practice.rs/type-conversions/others.html) +> - [其它转换](https://zh-practice.course.rs/type-conversions/others.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/type-conversions/others.md) \ No newline at end of file diff --git a/src/advance/lifetime/static.md b/src/advance/lifetime/static.md index d0a8b002..762c0d23 100644 --- a/src/advance/lifetime/static.md +++ b/src/advance/lifetime/static.md @@ -186,7 +186,7 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/lifetime/static.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) +> [Rust By Practice](https://zh-practice.course.rs/lifetime/static.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) ## 总结 diff --git a/src/basic/base-type/char-bool.md b/src/basic/base-type/char-bool.md index 05c3625b..edac5f1a 100644 --- a/src/basic/base-type/char-bool.md +++ b/src/basic/base-type/char-bool.md @@ -72,5 +72,5 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/basic-types/char-bool-unit.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/char-bool.md)。 +> [Rust By Practice](https://zh-practice.course.rs/basic-types/char-bool-unit.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/char-bool.md)。 diff --git a/src/basic/base-type/function.md b/src/basic/base-type/function.md index ba6f2d79..4ea0dced 100644 --- a/src/basic/base-type/function.md +++ b/src/basic/base-type/function.md @@ -192,4 +192,4 @@ fn forever() -> ! { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/basic-types/functions.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/functions.md)。 +> [Rust By Practice](https://zh-practice.course.rs/basic-types/functions.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/functions.md)。 diff --git a/src/basic/base-type/numbers.md b/src/basic/base-type/numbers.md index 090cc376..f535682c 100644 --- a/src/basic/base-type/numbers.md +++ b/src/basic/base-type/numbers.md @@ -245,13 +245,13 @@ fn main() { Rust的位运算基本上和其他语言一样 -| 运算符 | 说明 | -| ------- | -------------------------------------- | -| & 位与 | 相同位置均为1时则为1,否则为0 | -| \| 位或 | 相同位置只要有1时则为1,否则为0 | -| ^ 异或 | 相同位置不相同则为1,相同则为0 | -| ! 位非 | 把位中的0和1相互取反,即0置为1,1置为0 | -| << 左移 | 所有位向左移动指定位数,右位补0 | +| 运算符 | 说明 | +| ------- | ------------------------------------------------------ | +| & 位与 | 相同位置均为1时则为1,否则为0 | +| \| 位或 | 相同位置只要有1时则为1,否则为0 | +| ^ 异或 | 相同位置不相同则为1,相同则为0 | +| ! 位非 | 把位中的0和1相互取反,即0置为1,1置为0 | +| << 左移 | 所有位向左移动指定位数,右位补0 | | >> 右移 | 所有位向右移动指定位数,带符号移动(正数补0,负数补1) | @@ -356,7 +356,7 @@ use num::complex::Complex; ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/basic-types/numbers.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/numbers.md)。 +> [Rust By Practice](https://zh-practice.course.rs/basic-types/numbers.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/numbers.md)。 diff --git a/src/basic/base-type/statement-expression.md b/src/basic/base-type/statement-expression.md index 82c49c7e..975f2044 100644 --- a/src/basic/base-type/statement-expression.md +++ b/src/basic/base-type/statement-expression.md @@ -113,5 +113,5 @@ fn ret_unit_type() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/basic-types/statements-expressions.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/statements.md)。 +> [Rust By Practice](https://zh-practice.course.rs/basic-types/statements-expressions.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/basic-types/statements.md)。 diff --git a/src/basic/collections/hashmap.md b/src/basic/collections/hashmap.md index 7e825433..7bc41514 100644 --- a/src/basic/collections/hashmap.md +++ b/src/basic/collections/hashmap.md @@ -314,4 +314,4 @@ assert_eq!(hash.get(&42), Some(&"the answer")); ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/collections/hashmap.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/collections/Hashmap.md)。 \ No newline at end of file +> [Rust By Practice](https://zh-practice.course.rs/collections/hashmap.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/collections/Hashmap.md)。 \ No newline at end of file diff --git a/src/basic/collections/vector.md b/src/basic/collections/vector.md index 445f1719..5e84e8de 100644 --- a/src/basic/collections/vector.md +++ b/src/basic/collections/vector.md @@ -452,4 +452,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/collections/vector.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/collections/Vector.md)。 +> [Rust By Practice](https://zh-practice.course.rs/collections/vector.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/collections/Vector.md)。 diff --git a/src/basic/comment.md b/src/basic/comment.md index 6c36707d..fe7e2dad 100644 --- a/src/basic/comment.md +++ b/src/basic/comment.md @@ -472,4 +472,4 @@ Green ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/comments-docs.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) \ No newline at end of file +> [Rust By Practice](https://zh-practice.course.rs/comments-docs.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) \ No newline at end of file diff --git a/src/basic/compound-type/array.md b/src/basic/compound-type/array.md index e2b4d473..a0f8cf9f 100644 --- a/src/basic/compound-type/array.md +++ b/src/basic/compound-type/array.md @@ -216,4 +216,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/compound-types/array.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/array.md)。 +> [Rust By Practice](https://zh-practice.course.rs/compound-types/array.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/array.md)。 diff --git a/src/basic/compound-type/enum.md b/src/basic/compound-type/enum.md index aa999383..0f086bef 100644 --- a/src/basic/compound-type/enum.md +++ b/src/basic/compound-type/enum.md @@ -292,4 +292,4 @@ let none = plus_one(None); ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/compound-types/enum.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/enum.md)。 +> [Rust By Practice](https://zh-practice.course.rs/compound-types/enum.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/enum.md)。 diff --git a/src/basic/compound-type/string-slice.md b/src/basic/compound-type/string-slice.md index c17dbb9f..f983ddc0 100644 --- a/src/basic/compound-type/string-slice.md +++ b/src/basic/compound-type/string-slice.md @@ -713,11 +713,11 @@ for b in "中国人".bytes() { ## 课后练习 > Rust By Practice,支持代码在线编辑和运行,并提供详细的习题解答。 -> - [字符串](https://zh.practice.rs/compound-types/string.html) +> - [字符串](https://zh-practice.course.rs/compound-types/string.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/string.md) -> - [切片](https://zh.practice.rs/compound-types/slice.html) +> - [切片](https://zh-practice.course.rs/compound-types/slice.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/slice.md) -> - [String](https://zh.practice.rs/collections/String.html) +> - [String](https://zh-practice.course.rs/collections/String.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/collections/String.md)
diff --git a/src/basic/compound-type/struct.md b/src/basic/compound-type/struct.md index 18c208b5..567d1d55 100644 --- a/src/basic/compound-type/struct.md +++ b/src/basic/compound-type/struct.md @@ -426,5 +426,5 @@ $ cargo run ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/compound-types/struct.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/struct.md)。 +> [Rust By Practice](https://zh-practice.course.rs/compound-types/struct.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/struct.md)。 diff --git a/src/basic/compound-type/tuple.md b/src/basic/compound-type/tuple.md index 3aee3e0b..9c15dacf 100644 --- a/src/basic/compound-type/tuple.md +++ b/src/basic/compound-type/tuple.md @@ -76,4 +76,4 @@ fn calculate_length(s: String) -> (String, usize) { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/compound-types/tuple.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/tuple.md)。 \ No newline at end of file +> [Rust By Practice](https://zh-practice.course.rs/compound-types/tuple.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/compound-types/tuple.md)。 \ No newline at end of file diff --git a/src/basic/crate-module/crate.md b/src/basic/crate-module/crate.md index d697222f..e6c81a7f 100644 --- a/src/basic/crate-module/crate.md +++ b/src/basic/crate-module/crate.md @@ -111,4 +111,4 @@ error: a bin target must be available for `cargo run` ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/crate-module/crate.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/crate.md)。 \ No newline at end of file +> [Rust By Practice](https://zh-practice.course.rs/crate-module/crate.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/crate.md)。 \ No newline at end of file diff --git a/src/basic/crate-module/module.md b/src/basic/crate-module/module.md index 38c1e83a..54f130d0 100644 --- a/src/basic/crate-module/module.md +++ b/src/basic/crate-module/module.md @@ -360,4 +360,4 @@ pub mod hosting; ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/crate-module/module.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/module.md)。 +> [Rust By Practice](https://zh-practice.course.rs/crate-module/module.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/module.md)。 diff --git a/src/basic/crate-module/use.md b/src/basic/crate-module/use.md index 2ae8148d..b1059f25 100644 --- a/src/basic/crate-module/use.md +++ b/src/basic/crate-module/use.md @@ -468,4 +468,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/crate-module/use-pub.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/use-pub.md)。 \ No newline at end of file +> [Rust By Practice](https://zh-practice.course.rs/crate-module/use-pub.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/crate-module/use-pub.md)。 \ No newline at end of file diff --git a/src/basic/flow-control.md b/src/basic/flow-control.md index 02127317..3022dc8d 100644 --- a/src/basic/flow-control.md +++ b/src/basic/flow-control.md @@ -370,4 +370,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/flow-control.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/flow-control.md)。 +> [Rust By Practice](https://zh-practice.course.rs/flow-control.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/flow-control.md)。 diff --git a/src/basic/formatted-output.md b/src/basic/formatted-output.md index dce32bb5..91510bc6 100644 --- a/src/basic/formatted-output.md +++ b/src/basic/formatted-output.md @@ -462,7 +462,7 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/formatted-output.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) +> [Rust By Practice](https://zh-practice.course.rs/formatted-output.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) ## 总结 diff --git a/src/basic/lifetime.md b/src/basic/lifetime.md index d1407377..70cd8642 100644 --- a/src/basic/lifetime.md +++ b/src/basic/lifetime.md @@ -649,7 +649,7 @@ where ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/lifetime/basic.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) +> [Rust By Practice](https://zh-practice.course.rs/lifetime/basic.html),支持代码在线编辑和运行,并提供详细的习题解答。(本节暂无习题解答) ## 总结 diff --git a/src/basic/match-pattern/all-patterns.md b/src/basic/match-pattern/all-patterns.md index bde8c882..17575962 100644 --- a/src/basic/match-pattern/all-patterns.md +++ b/src/basic/match-pattern/all-patterns.md @@ -644,4 +644,4 @@ num @ (1 | 2) ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/pattern-match/patterns.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/pattern-match/patterns.md)。 +> [Rust By Practice](https://zh-practice.course.rs/pattern-match/patterns.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/pattern-match/patterns.md)。 diff --git a/src/basic/match-pattern/match-if-let.md b/src/basic/match-pattern/match-if-let.md index 69787f94..bf2ed72f 100644 --- a/src/basic/match-pattern/match-if-let.md +++ b/src/basic/match-pattern/match-if-let.md @@ -397,4 +397,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/pattern-match/match-iflet.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/pattern-match/match.md)。 +> [Rust By Practice](https://zh-practice.course.rs/pattern-match/match-iflet.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/pattern-match/match.md)。 diff --git a/src/basic/method.md b/src/basic/method.md index 8964ee35..297f9bc9 100644 --- a/src/basic/method.md +++ b/src/basic/method.md @@ -279,4 +279,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/method.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/method.md)。 +> [Rust By Practice](https://zh-practice.course.rs/method.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/method.md)。 diff --git a/src/basic/ownership/borrowing.md b/src/basic/ownership/borrowing.md index 561acea1..27bac657 100644 --- a/src/basic/ownership/borrowing.md +++ b/src/basic/ownership/borrowing.md @@ -312,4 +312,4 @@ fn no_dangle() -> String { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/ownership/borrowing.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/borrowing.md)。 +> [Rust By Practice](https://zh-practice.course.rs/ownership/borrowing.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/borrowing.md)。 diff --git a/src/basic/ownership/ownership.md b/src/basic/ownership/ownership.md index 5edd3ada..0897a982 100644 --- a/src/basic/ownership/ownership.md +++ b/src/basic/ownership/ownership.md @@ -338,5 +338,5 @@ fn takes_and_gives_back(a_string: String) -> String { // a_string 进入作用 ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/ownership/ownership.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)。 +> [Rust By Practice](https://zh-practice.course.rs/ownership/ownership.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)。 diff --git a/src/basic/result-error/panic.md b/src/basic/result-error/panic.md index 5b1199fb..05332713 100644 --- a/src/basic/result-error/panic.md +++ b/src/basic/result-error/panic.md @@ -214,4 +214,4 @@ let home: IpAddr = "127.0.0.1".parse().unwrap(); ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/result-panic/panic.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/result-panic/panic.md)。 +> [Rust By Practice](https://zh-practice.course.rs/result-panic/panic.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/result-panic/panic.md)。 diff --git a/src/basic/result-error/result.md b/src/basic/result-error/result.md index e1d7a8a7..044d5ab4 100644 --- a/src/basic/result-error/result.md +++ b/src/basic/result-error/result.md @@ -403,4 +403,4 @@ let x = try!(function_with_error()); ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/result-panic/result.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/result-panic/result.md)。 +> [Rust By Practice](https://zh-practice.course.rs/result-panic/result.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/result-panic/result.md)。 diff --git a/src/basic/trait/advance-trait.md b/src/basic/trait/advance-trait.md index 7d8a4cd1..12040770 100644 --- a/src/basic/trait/advance-trait.md +++ b/src/basic/trait/advance-trait.md @@ -427,4 +427,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/generics-traits/advanced-traits.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/advanced-trait.md)。 +> [Rust By Practice](https://zh-practice.course.rs/generics-traits/advanced-traits.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/advanced-trait.md)。 diff --git a/src/basic/trait/generic.md b/src/basic/trait/generic.md index 2d30f1c0..3994a230 100644 --- a/src/basic/trait/generic.md +++ b/src/basic/trait/generic.md @@ -467,7 +467,7 @@ fn main() { ## 课后练习 > Rust By Practice,支持代码在线编辑和运行,并提供详细的习题解答。 -> - [泛型](https://zh.practice.rs/generics-traits/generics.html) +> - [泛型](https://zh-practice.course.rs/generics-traits/generics.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/generics.md) -> - [const 泛型](https://zh.practice.rs/generics-traits/const-generics.html) +> - [const 泛型](https://zh-practice.course.rs/generics-traits/const-generics.html) > - [习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/const-generics.md) \ No newline at end of file diff --git a/src/basic/trait/trait-object.md b/src/basic/trait/trait-object.md index 7efe594d..9602e4a3 100644 --- a/src/basic/trait/trait-object.md +++ b/src/basic/trait/trait-object.md @@ -381,4 +381,4 @@ error[E0038]: the trait `std::clone::Clone` cannot be made into an object ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/generics-traits/trait-object.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/trait-object.md)。 +> [Rust By Practice](https://zh-practice.course.rs/generics-traits/trait-object.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/trait-object.md)。 diff --git a/src/basic/trait/trait.md b/src/basic/trait/trait.md index 7d25bc8c..6a43a4e1 100644 --- a/src/basic/trait/trait.md +++ b/src/basic/trait/trait.md @@ -580,4 +580,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/generics-traits/traits.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/traits.md)。 +> [Rust By Practice](https://zh-practice.course.rs/generics-traits/traits.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/generics-traits/traits.md)。 diff --git a/src/basic/variable.md b/src/basic/variable.md index 5a7e541c..9bbd36f9 100644 --- a/src/basic/variable.md +++ b/src/basic/variable.md @@ -259,5 +259,5 @@ error: aborting due to previous error ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/variables.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/variables.md)。 +> [Rust By Practice](https://zh-practice.course.rs/variables.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice/blob/master/solutions/variables.md)。 diff --git a/src/too-many-lists/do-we-need-it.md b/src/too-many-lists/do-we-need-it.md index a6254f11..8e464ef3 100644 --- a/src/too-many-lists/do-we-need-it.md +++ b/src/too-many-lists/do-we-need-it.md @@ -49,7 +49,7 @@ $ cd lists #### 我无法接受内存重新分配的代价 -是的,`Vec` 当 [`capacity`](https://practice.rs/collections/vector.html#capacity) 不够时,会重新分配一块内存,然后将之前的 `Vec` 全部拷贝过去,但是对于绝大多数使用场景,要么 `Vec` 不在热点路径中,要么 `Vec` 的容量可以提前预测。 +是的,`Vec` 当 [`capacity`](https://zh-practice.course.rs/collections/vector.html#capacity) 不够时,会重新分配一块内存,然后将之前的 `Vec` 全部拷贝过去,但是对于绝大多数使用场景,要么 `Vec` 不在热点路径中,要么 `Vec` 的容量可以提前预测。 对于前者,那性能如何自然无关紧要。而对于后者,我们只需要使用 `Vec::with_capacity` 提前分配足够的空间即可,同时,Rust 中所有的迭代器还提供了 `size_hint` 也可以解决这种问题。