From 2e9f8188fe6a214c9da07f6267209c0e7490b360 Mon Sep 17 00:00:00 2001 From: TimLai666 <43640816+TimLai666@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exercises/21_macros/README.md | 14 +++++--------- exercises/21_macros/macros1.rs | 5 ++--- exercises/21_macros/macros2.rs | 5 ++--- exercises/21_macros/macros3.rs | 7 +++---- exercises/21_macros/macros4.rs | 7 +++---- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/exercises/21_macros/README.md b/exercises/21_macros/README.md index 337816d6..44cf037a 100644 --- a/exercises/21_macros/README.md +++ b/exercises/21_macros/README.md @@ -1,14 +1,10 @@ -# Macros +# 巨集(Macros) -Rust's macro system is very powerful, but also kind of difficult to wrap your -head around. We're not going to teach you how to write your own fully-featured -macros. Instead, we'll show you how to use and create them. +Rust 的巨集系統非常強大,但也有點難以理解。我們不會教您如何編寫自己的全功能巨集。相反,我們將向您展示如何使用和創建它們。 -If you'd like to learn more about writing your own macros, the -[macrokata](https://github.com/tfpk/macrokata) project has a similar style -of exercises to Rustlings, but is all about learning to write Macros. +如果您想了解更多關於編寫自己巨集的知識,可以參考 [macrokata](https://github.com/tfpk/macrokata) 專案,它的練習風格類似於 Rustlings,但專注於學習編寫巨集。 -## Further information +## 進一步了解 -- [Macros](https://doc.rust-lang.org/book/ch19-06-macros.html) +- [巨集](https://doc.rust-lang.org/book/ch19-06-macros.html) - [The Little Book of Rust Macros](https://veykril.github.io/tlborm/) diff --git a/exercises/21_macros/macros1.rs b/exercises/21_macros/macros1.rs index 678de6ee..5d1ac1f0 100644 --- a/exercises/21_macros/macros1.rs +++ b/exercises/21_macros/macros1.rs @@ -1,13 +1,12 @@ // macros1.rs // -// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint macros1` 或使用 `hint` watch 子命令來獲取提示。 // I AM NOT DONE macro_rules! my_macro { () => { - println!("Check out my macro!"); + println!("看看我的巨集!"); }; } diff --git a/exercises/21_macros/macros2.rs b/exercises/21_macros/macros2.rs index 788fc16a..5dc8aef9 100644 --- a/exercises/21_macros/macros2.rs +++ b/exercises/21_macros/macros2.rs @@ -1,7 +1,6 @@ // macros2.rs // -// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint macros2` 或使用 `hint` watch 子命令來獲取提示。 // I AM NOT DONE @@ -11,6 +10,6 @@ fn main() { macro_rules! my_macro { () => { - println!("Check out my macro!"); + println!("看看我的巨集!"); }; } diff --git a/exercises/21_macros/macros3.rs b/exercises/21_macros/macros3.rs index b795c149..3250ec8e 100644 --- a/exercises/21_macros/macros3.rs +++ b/exercises/21_macros/macros3.rs @@ -1,16 +1,15 @@ // macros3.rs // -// Make me compile, without taking the macro out of the module! +// 讓我能夠編譯通過,不用把巨集移出模組! // -// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint macros3` 或使用 `hint` watch 子命令來獲取提示。 // I AM NOT DONE mod macros { macro_rules! my_macro { () => { - println!("Check out my macro!"); + println!("看看我的巨集!"); }; } } diff --git a/exercises/21_macros/macros4.rs b/exercises/21_macros/macros4.rs index 71b45a09..d86b30f3 100644 --- a/exercises/21_macros/macros4.rs +++ b/exercises/21_macros/macros4.rs @@ -1,17 +1,16 @@ // macros4.rs // -// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a -// hint. +// 執行 `rustlings hint macros4` 或使用 `hint` watch 子指令來獲取提示。 // I AM NOT DONE #[rustfmt::skip] macro_rules! my_macro { () => { - println!("Check out my macro!"); + println!("看看我的巨集!"); } ($val:expr) => { - println!("Look at this other macro: {}", $val); + println!("看看這個其他的巨集: {}", $val); } }