From ad2f389019d029f927536db545821d806528fd3c Mon Sep 17 00:00:00 2001 From: Abdulfaiz Shaikh <116955072+abdulshaikh55@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:21:55 +0530 Subject: [PATCH 1/7] Update ownership.md --- en/src/ownership/ownership.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/en/src/ownership/ownership.md b/en/src/ownership/ownership.md index e0054f9..eb8568c 100644 --- a/en/src/ownership/ownership.md +++ b/en/src/ownership/ownership.md @@ -5,9 +5,9 @@ fn main() { // Use as many approaches as you can to make it work - let x = String::from("hello, world"); + let x = String::from("Hello world"); let y = x; - println!("{},{}",x,y); + println!("{}, {}",x, y); } ``` @@ -15,7 +15,7 @@ fn main() { ```rust,editable // Don't modify code in main! fn main() { - let s1 = String::from("hello, world"); + let s1 = String::from("Hello world"); let s2 = take_ownership(s1); println!("{}", s2); @@ -38,7 +38,7 @@ fn main() { // Only modify the code below! fn give_ownership() -> String { - let s = String::from("hello, world"); + let s = String::from("Hello world"); // Convert String to Vec let _s = s.into_bytes(); s @@ -47,9 +47,9 @@ fn give_ownership() -> String { 4. 🌟🌟 ```rust,editable -// Fix the error without removing code line +// Fix the error without removing any code fn main() { - let s = String::from("hello, world"); + let s = String::from("Hello World"); print_str(s); @@ -77,13 +77,13 @@ Mutability can be changed when ownership is transferred. 6. 🌟 ```rust,editable +// make the necessary variable mutable fn main() { - let s = String::from("hello, "); + let s = String::from("Hello "); - // Modify this line only ! let s1 = s; - s1.push_str("world"); + s1.push_str("World!"); println!("Success!"); } @@ -95,7 +95,7 @@ fn main() { fn main() { let x = Box::new(5); - let ... // Implement this line, dont change other lines! + let ... // update this line, don't change other lines! *y = 4; @@ -167,4 +167,4 @@ fn main() { ``` -> You can find the solutions [here](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)(under the solutions path), but only use it when you need it \ No newline at end of file +> You can find the solutions [here](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)(under the solutions path), but only use it when you need it From b13c9719691c78486325bd0939696de66f270ddb Mon Sep 17 00:00:00 2001 From: Maddux Vitrano <102924798+Madduxv@users.noreply.github.com> Date: Thu, 14 Dec 2023 01:10:30 -0600 Subject: [PATCH 2/7] Fixed typos in char-bool.md --- solutions/basic-types/char-bool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/basic-types/char-bool.md b/solutions/basic-types/char-bool.md index 8074656..17bf7b0 100644 --- a/solutions/basic-types/char-bool.md +++ b/solutions/basic-types/char-bool.md @@ -75,7 +75,7 @@ use std::mem::size_of_val; fn main() { let unit: () = (); - // unit type does't occupy any memeory space + // unit type doesn't occupy any memory space assert!(size_of_val(&unit) == 0); } ``` From 9a9f5dc57f660b7f65f9db34946ee3046ab2dad9 Mon Sep 17 00:00:00 2001 From: luofu Date: Thu, 21 Dec 2023 11:40:34 +0800 Subject: [PATCH 3/7] (): MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I replaced the URL for the latest hand training event 5 (hide your secret in PNG) 我替换了最新的练手项目5( 在 PNG 中隐藏你的秘密)的url --- zh-CN/src/elegant-code-base.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-CN/src/elegant-code-base.md b/zh-CN/src/elegant-code-base.md index 938fc60..6798982 100644 --- a/zh-CN/src/elegant-code-base.md +++ b/zh-CN/src/elegant-code-base.md @@ -27,7 +27,7 @@ ### 5. 在 PNG 中隐藏你的秘密 -[这本书](https://picklenerd.github.io/pngme_book/) 将带领大家编写一个命令行程序,功能是在 PNG 文件中隐藏一些秘密信息,首要目标是让我们熟悉 Rust 代码。 +[这本书](https://jrdngr.github.io/pngme_book/) 将带领大家编写一个命令行程序,功能是在 PNG 文件中隐藏一些秘密信息,首要目标是让我们熟悉 Rust 代码。 ### 6. 使用 Rust 写一个小型 OS From ec707fb3abb41a8f8c684b2c74b948776d7603c1 Mon Sep 17 00:00:00 2001 From: luofu Date: Fri, 22 Dec 2023 10:42:02 +0800 Subject: [PATCH 4/7] (): MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submitted a good hand training project - sokoban 提交了一个不错的练手项目 - 推箱子 --- zh-CN/src/elegant-code-base.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zh-CN/src/elegant-code-base.md b/zh-CN/src/elegant-code-base.md index 6798982..14566ca 100644 --- a/zh-CN/src/elegant-code-base.md +++ b/zh-CN/src/elegant-code-base.md @@ -46,4 +46,7 @@ [这本开源书](https://github.com/rust-hosted-langs/book) 是一个使用 Rust 语言实现编译型语言的教程。 +### 10. Rust编写推箱子游戏教程 +[sokoban](https://sokoban.iolivia.me/zh_cn/c01-00-intro) 是一个使用Rust语言实现sokoban游戏的教程。虽然社区已停止活跃(Initial Commits on Sep 3, 2019,GitHub仓库最后一条commit是last year),但是项目是完善的-release v0.1.0,拿来练手是个不错的选择。 + **To be continued...** \ No newline at end of file From 7ac53b8091941ccb1df7f5056fc9bc4b91171b57 Mon Sep 17 00:00:00 2001 From: Hugo Masclet Date: Mon, 25 Dec 2023 21:37:03 +0100 Subject: [PATCH 5/7] Rename first_word to first_letter --- en/src/compound-types/slice.md | 8 ++++---- solutions/compound-types/slice.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/en/src/compound-types/slice.md b/en/src/compound-types/slice.md index 23aa344..152e61c 100644 --- a/en/src/compound-types/slice.md +++ b/en/src/compound-types/slice.md @@ -84,15 +84,15 @@ fn main() { fn main() { let mut s = String::from("hello world"); - // Here, &s is `&String` type, but `first_word` need a `&str` type. + // Here, &s is `&String` type, but `first_letter` needs a `&str` type. // It works because `&String` can be implicitly converted to `&str. If you want to know more, this is called `Deref coercion`. - let word = first_word(&s); + let letter = first_letter(&s); s.clear(); // error! - println!("the first word is: {}", word); + println!("the first letter is: {}", letter); } -fn first_word(s: &str) -> &str { +fn first_letter(s: &str) -> &str { &s[..1] } ``` diff --git a/solutions/compound-types/slice.md b/solutions/compound-types/slice.md index 32e84cb..371a803 100644 --- a/solutions/compound-types/slice.md +++ b/solutions/compound-types/slice.md @@ -62,16 +62,16 @@ fn main() { fn main() { let mut s = String::from("hello world"); - // here, &s is `&String` type, but `first_word` need a `&str` type. + // here, &s is `&String` type, but `first_letter` needs a `&str` type. // it works because `&String` can be implicitly converted to `&str, If you want know more ,this is called `Deref` - let word = first_word(&s); + let letter = first_letter(&s); - println!("the first word is: {}", word); + println!("the first letter is: {}", letter); s.clear(); } -fn first_word(s: &str) -> &str { +fn first_letter(s: &str) -> &str { &s[..1] } ``` From a26ba7366e64674ffedf2f5170fcab615fcc794e Mon Sep 17 00:00:00 2001 From: Sunface Date: Wed, 3 Jan 2024 09:09:49 +0800 Subject: [PATCH 6/7] Update zh-CN/src/elegant-code-base.md --- zh-CN/src/elegant-code-base.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-CN/src/elegant-code-base.md b/zh-CN/src/elegant-code-base.md index 14566ca..d5438b7 100644 --- a/zh-CN/src/elegant-code-base.md +++ b/zh-CN/src/elegant-code-base.md @@ -47,6 +47,6 @@ [这本开源书](https://github.com/rust-hosted-langs/book) 是一个使用 Rust 语言实现编译型语言的教程。 ### 10. Rust编写推箱子游戏教程 -[sokoban](https://sokoban.iolivia.me/zh_cn/c01-00-intro) 是一个使用Rust语言实现sokoban游戏的教程。虽然社区已停止活跃(Initial Commits on Sep 3, 2019,GitHub仓库最后一条commit是last year),但是项目是完善的-release v0.1.0,拿来练手是个不错的选择。 +[sokoban](https://sokoban.iolivia.me/zh_cn/c01-00-intro) 是一个使用 Rust 语言实现 sokoban 游戏的教程。虽然社区已停止活跃( Initial Commits on Sep 3, 2019,GitHub 仓库最后一条 commit 是 last year ),但是项目是完善的 release v0.1.0,拿来练手是个不错的选择。 **To be continued...** \ No newline at end of file From e57bae6febf3b5ae6e31abc1506c4f1fd0c06902 Mon Sep 17 00:00:00 2001 From: sunface Date: Sat, 6 Jan 2024 09:30:06 +0800 Subject: [PATCH 7/7] fix: new version mdbook layout issue --- en/deploy.sh | 6 +- en/theme/index.hbs | 137 +++++++++++++++++++++++++++--------------- zh-CN/deploy.sh | 0 zh-CN/theme/index.hbs | 137 +++++++++++++++++++++++++++--------------- 4 files changed, 177 insertions(+), 103 deletions(-) mode change 100644 => 100755 zh-CN/deploy.sh diff --git a/en/deploy.sh b/en/deploy.sh index 880ab5c..69b6eeb 100755 --- a/en/deploy.sh +++ b/en/deploy.sh @@ -16,8 +16,4 @@ git branch -M gh-pages git remote add origin https://github.com/sunface/rust-by-practice ## push to github pages -git push -u -f origin gh-pages - -## deploy zh-CN -cd ../../zh-CN -./deploy \ No newline at end of file +git push -u -f origin gh-pages \ No newline at end of file diff --git a/en/theme/index.hbs b/en/theme/index.hbs index 3fc804d..ac76bff 100644 --- a/en/theme/index.hbs +++ b/en/theme/index.hbs @@ -1,11 +1,11 @@ - + {{ title }} {{#if is_print }} - + {{/if}} {{#if base_url}} @@ -15,10 +15,9 @@ {{> head}} - - + {{#if favicon_svg}} @@ -51,25 +50,27 @@ {{#if mathjax_support}} - + {{/if}} - - + +
- - - + + - + + +
{{> header}} -