diff --git a/po/zh-TW.po b/po/zh-TW.po index 12e7c03c74db..73922ee132c2 100644 --- a/po/zh-TW.po +++ b/po/zh-TW.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" "POT-Creation-Date: 2024-03-06T16:11:58-08:00\n" -"PO-Revision-Date: 2023-10-09 19:59-0700\n" +"PO-Revision-Date: 2024-10-12 17:23+0800\n" "Last-Translator: \n" "Language-Team: \n" "Language: zh_TW\n" @@ -10,7 +10,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4\n" +"X-Generator: Poedit 3.5\n" #: src/SUMMARY.md src/index.md msgid "Welcome to Comprehensive Rust 🦀" @@ -104,11 +104,10 @@ msgstr "練習:費波那契數列" #: src/control-flow-basics/solution.md src/tuples-and-arrays/solution.md #: src/references/solution.md src/user-defined-types/solution.md #: src/pattern-matching/solution.md src/methods-and-traits/solution.md -#: src/generics/solution.md src/std-types/solution.md -#: src/std-traits/solution.md src/memory-management/solution.md -#: src/smart-pointers/solution.md src/borrowing/solution.md -#: src/slices-and-lifetimes/solution.md src/iterators/solution.md -#: src/modules/solution.md src/testing/solution.md +#: src/generics/solution.md src/std-types/solution.md src/std-traits/solution.md +#: src/memory-management/solution.md src/smart-pointers/solution.md +#: src/borrowing/solution.md src/slices-and-lifetimes/solution.md +#: src/iterators/solution.md src/modules/solution.md src/testing/solution.md #: src/error-handling/solution.md src/unsafe-rust/solution.md msgid "Solution" msgstr "解決方案" @@ -118,12 +117,10 @@ msgid "Control Flow Basics" msgstr "基本的控制流程概念" #: src/SUMMARY.md -#, fuzzy msgid "`if` Expressions" msgstr "`if` 表達式" #: src/SUMMARY.md src/control-flow-basics/loops.md -#, fuzzy msgid "Loops" msgstr "`for` 迴圈" @@ -816,14 +813,12 @@ msgid "Shared Enums" msgstr "共用列舉" #: src/SUMMARY.md src/android/interoperability/cpp/rust-result.md -#, fuzzy msgid "Rust Error Handling" -msgstr "錯誤處理" +msgstr "Rust 的錯誤處理" #: src/SUMMARY.md src/android/interoperability/cpp/cpp-exception.md -#, fuzzy msgid "C++ Error Handling" -msgstr "錯誤處理" +msgstr "C++ 的錯誤處理" #: src/SUMMARY.md src/android/interoperability/cpp/type-mapping.md msgid "Additional Types" @@ -893,9 +888,8 @@ msgid "`chromium::import!` Macro" msgstr "`chromium::import!` 巨集" #: src/SUMMARY.md src/chromium/interoperability-with-cpp.md -#, fuzzy msgid "Interoperability with C++" -msgstr "互通性" +msgstr "與 C++ 的互通性" #: src/SUMMARY.md src/chromium/interoperability-with-cpp/example-bindings.md #, fuzzy @@ -961,8 +955,7 @@ msgstr "建構用於產生程式碼的指令碼" msgid "Build Scripts Which Build C++ or Take Arbitrary Actions" msgstr "建構用於建立 C++ 或執行任意動作的指令碼" -#: src/SUMMARY.md -#: src/chromium/adding-third-party-crates/depending-on-a-crate.md +#: src/SUMMARY.md src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "Depending on a Crate" msgstr "使用 Crate" @@ -983,7 +976,6 @@ msgid "Bringing It Together - Exercise" msgstr "融會貫通 - 練習題" #: src/SUMMARY.md src/exercises/chromium/solutions.md -#, fuzzy msgid "Exercise Solutions" msgstr "練習題的參考答案" @@ -1190,8 +1182,7 @@ msgid "`Mutex`" msgstr "`Mutex`" #: src/SUMMARY.md src/memory-management/review.md -#: src/error-handling/try-conversions.md -#: src/concurrency/shared_state/example.md +#: src/error-handling/try-conversions.md src/concurrency/shared_state/example.md msgid "Example" msgstr "範例" @@ -1266,9 +1257,8 @@ msgid "Async Traits" msgstr "非同步特徵" #: src/SUMMARY.md src/async/pitfalls/cancellation.md -#, fuzzy msgid "Cancellation" -msgstr "安裝" +msgstr "取消" #: src/SUMMARY.md src/exercises/concurrency/chat-app.md #: src/exercises/concurrency/solutions-afternoon.md @@ -1297,52 +1287,51 @@ msgstr "出處清單" #: src/index.md msgid "" -"[![Build workflow](https://img.shields.io/github/actions/workflow/status/" -"google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [!" -"[GitHub contributors](https://img.shields.io/github/contributors/google/" -"comprehensive-rust?style=flat-square)](https://github.com/google/" -"comprehensive-rust/graphs/contributors) [![GitHub stars](https://img.shields." -"io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." -"com/google/comprehensive-rust/stargazers)" -msgstr "" -"[![Build workflow](https://img.shields.io/github/actions/workflow/status/" -"google/comprehensive-rust/build.yml?style=flat-square)](https://github.com/" -"google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [!" -"[GitHub contributors](https://img.shields.io/github/contributors/google/" -"comprehensive-rust?style=flat-square)](https://github.com/google/" -"comprehensive-rust/graphs/contributors) [![GitHub stars](https://img.shields." -"io/github/stars/google/comprehensive-rust?style=flat-square)](https://github." -"com/google/comprehensive-rust/stargazers)" +"[![Build workflow](https://img.shields.io/github/actions/workflow/status/google/" +"comprehensive-rust/build.yml?style=flat-square)](https://github.com/google/" +"comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [![GitHub " +"contributors](https://img.shields.io/github/contributors/google/comprehensive-" +"rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/" +"contributors) [![GitHub stars](https://img.shields.io/github/stars/google/" +"comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-" +"rust/stargazers)" +msgstr "" +"[![Build workflow](https://img.shields.io/github/actions/workflow/status/google/" +"comprehensive-rust/build.yml?style=flat-square)](https://github.com/google/" +"comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain) [![GitHub " +"contributors](https://img.shields.io/github/contributors/google/comprehensive-" +"rust?style=flat-square)](https://github.com/google/comprehensive-rust/graphs/" +"contributors) [![GitHub stars](https://img.shields.io/github/stars/google/" +"comprehensive-rust?style=flat-square)](https://github.com/google/comprehensive-" +"rust/stargazers)" #: src/index.md msgid "" -"This is a free Rust course developed by the Android team at Google. The " -"course covers the full spectrum of Rust, from basic syntax to advanced " -"topics like generics and error handling." +"This is a free Rust course developed by the Android team at Google. The course " +"covers the full spectrum of Rust, from basic syntax to advanced topics like " +"generics and error handling." msgstr "" -"這個免費的 Rust 課程是由 Google 的 Android 團隊負責開發。本課程涵蓋 Rust 的全" -"部內容,從基礎語法到進階主題 (泛型和錯誤處理等),應有盡有。" +"這個免費的 Rust 課程是由 Google 的 Android 團隊負責開發。本課程涵蓋 Rust 的全部" +"內容,從基礎語法到進階主題 (泛型和錯誤處理等),應有盡有。" #: src/index.md msgid "" "The latest version of the course can be found at . If you are reading somewhere else, please check there " -"for updates." +"comprehensive-rust/>. If you are reading somewhere else, please check there for " +"updates." msgstr "" -"如需最新版課程,請造訪 。假如您" -"是在其他網址閱讀課程資料,別忘了查看這個連結的內容是否有更新。" +"如需最新版課程,請造訪 。假如您是" +"在其他網址閱讀課程資料,別忘了查看這個連結的內容是否有更新。" #: src/index.md msgid "The course is also available [as a PDF](comprehensive-rust.pdf)." -msgstr "" +msgstr "本課程也有提供 [PDF](comprehensive-rust.pdf)。" #: src/index.md msgid "" -"The goal of the course is to teach you Rust. We assume you don't know " -"anything about Rust and hope to:" -msgstr "" -"本課程旨在教授 Rust 的知識。我們會假設您是從零開始學習 Rust,希望能夠:" +"The goal of the course is to teach you Rust. We assume you don't know anything " +"about Rust and hope to:" +msgstr "本課程旨在教授 Rust 的知識。我們會假設您是從零開始學習 Rust,希望能夠:" #: src/index.md msgid "Give you a comprehensive understanding of the Rust syntax and language." @@ -1357,9 +1346,8 @@ msgid "Show you common Rust idioms." msgstr "向您介紹常見的 Rust 慣用語法。" #: src/index.md -#, fuzzy msgid "We call the first four course days Rust Fundamentals." -msgstr "我們將前三天的課程稱為「Rust 基礎知識」。" +msgstr "我們將前四天的課程稱為「Rust 基礎知識」。" #: src/index.md msgid "" @@ -1375,15 +1363,14 @@ msgstr "" "(Android 開放原始碼計畫) 使用 Rust,並介紹與 C、C++ 和 Java 的互通性。" #: src/index.md -#, fuzzy msgid "" -"[Chromium](chromium.md): a half-day course on using Rust within Chromium " -"based browsers. This includes interoperability with C++ and how to include " -"third-party crates in Chromium." +"[Chromium](chromium.md): a half-day course on using Rust within Chromium based " +"browsers. This includes interoperability with C++ and how to include third-" +"party crates in Chromium." msgstr "" -"[Chromium](chromium.md): 是半天的深入探索課程,會說明如何在 Chromium 瀏覽器" -"中使用 Rust。這包括在 Chromium 的 `gn` 建構系統中使用 Rust,以提供與第三方程" -"式庫 (「Crate」) 和 C++ 的互通性。" +"[Chromium](chromium.md): 是半天的探索課程,會說明如何在以 Chromium 為基礎打造的" +"瀏覽器中使用 Rust。這包括在 Chromium 中與C++ 的互通性以及如何引入第三方程式庫 " +"(Crate)。" #: src/index.md msgid "" @@ -1391,19 +1378,18 @@ msgid "" "(embedded) development. Both microcontrollers and application processors are " "covered." msgstr "" -"[Bare-metal](bare-metal.md):這是半天的課程,會說明如何使用 Rust 在 bare-" -"metal (嵌入式系統) 上台開發。課程內容包含微控制器和處理器。" +"[Bare-metal](bare-metal.md):這是全天的課程,會說明如何使用 Rust 在 bare-metal " +"(嵌入式系統) 上台開發。課程內容包含微控制器和處理器。" #: src/index.md msgid "" "[Concurrency](concurrency.md): a whole-day class on concurrency in Rust. We " "cover both classical concurrency (preemptively scheduling using threads and " -"mutexes) and async/await concurrency (cooperative multitasking using " -"futures)." +"mutexes) and async/await concurrency (cooperative multitasking using futures)." msgstr "" -"[並行](concurrency.md):這個全天課程著重於 Rust 中的並行問題。我們將探討傳統" -"並行 (使用執行緒和互斥鎖進行先占式排程) 以及 async/await 並行 (使用 future 進" -"行合作多工處理)。" +"[並行](concurrency.md):這個全天課程著重於 Rust 中的並行問題。我們將探討傳統並" +"行 (使用執行緒和互斥鎖進行先占式排程) 以及 async/await 並行 (使用 future 進行合" +"作多工處理)。" #: src/index.md msgid "Non-Goals" @@ -1411,8 +1397,8 @@ msgstr "非課程目標" #: src/index.md msgid "" -"Rust is a large language and we won't be able to cover all of it in a few " -"days. Some non-goals of this course are:" +"Rust is a large language and we won't be able to cover all of it in a few days. " +"Some non-goals of this course are:" msgstr "" "Rust 是大型的程式語言,無法在幾天內就介紹完畢。因此,本課程不包含下列內容:" @@ -1423,8 +1409,8 @@ msgid "" "(https://doc.rust-lang.org/rust-by-example/macros.html) instead." msgstr "" "學習如何開發巨集 (macro)。請直接閱讀 [Rust Book 的 Chapter 19.5](https://doc." -"rust-lang.org/book/ch19-06-macros.html) 和 [Rust by Example](https://doc." -"rust-lang.org/rust-by-example/macros.html)." +"rust-lang.org/book/ch19-06-macros.html) 和 [Rust by Example](https://doc.rust-" +"lang.org/rust-by-example/macros.html)." #: src/index.md msgid "Assumptions" @@ -1432,29 +1418,29 @@ msgstr "課程要求" #: src/index.md msgid "" -"The course assumes that you already know how to program. Rust is a " -"statically-typed language and we will sometimes make comparisons with C and " -"C++ to better explain or contrast the Rust approach." +"The course assumes that you already know how to program. Rust is a statically-" +"typed language and we will sometimes make comparisons with C and C++ to better " +"explain or contrast the Rust approach." msgstr "" -"本課程假設您已瞭解如何設計程式。Rust 是一種靜態的程式設計類型,我們有時會將其" -"與 C 和 C++ 比較,以便進一步解釋或凸顯 Rust 做法上的差別。" +"本課程假設您已瞭解如何設計程式。Rust 是一種靜態的程式設計類型,我們有時會將其與 " +"C 和 C++ 比較,以便進一步解釋或凸顯 Rust 做法上的差別。" #: src/index.md msgid "" "If you know how to program in a dynamically-typed language such as Python or " "JavaScript, then you will be able to follow along just fine too." msgstr "" -"如果您知道如何以 Python 或 JavaScript 等動態程式語言編寫程式,也很適合跟著我" -"們學習 Rust。" +"如果您知道如何以 Python 或 JavaScript 等動態程式語言編寫程式,也很適合跟著我們學" +"習 Rust。" #: src/index.md msgid "" "This is an example of a _speaker note_. We will use these to add additional " -"information to the slides. This could be key points which the instructor " -"should cover as well as answers to typical questions which come up in class." +"information to the slides. This could be key points which the instructor should " +"cover as well as answers to typical questions which come up in class." msgstr "" -"這是「演講者備忘稿」的範例。我們會透過這些備忘稿補充投影片中未提到的資訊。這" -"可能包括老師應提及的重點,以及課堂上典型問題的解答。" +"這是「演講者備忘稿」的範例。我們會透過這些備忘稿補充投影片中未提到的資訊。這可能" +"包括老師應提及的重點,以及課堂上典型問題的解答。" #: src/running-the-course.md src/running-the-course/course-structure.md msgid "This page is for the course instructor." @@ -1462,22 +1448,19 @@ msgstr "本頁面的適用對象為課程講師。" #: src/running-the-course.md msgid "" -"Here is a bit of background information about how we've been running the " -"course internally at Google." +"Here is a bit of background information about how we've been running the course " +"internally at Google." msgstr "以下提供一些背景資訊,說明 Google 內部近期採用的授課方式。" #: src/running-the-course.md -#, fuzzy msgid "" -"We typically run classes from 9:00 am to 4:00 pm, with a 1 hour lunch break " -"in the middle. This leaves 3 hours for the morning class and 3 hours for the " -"afternoon class. Both sessions contain multiple breaks and time for students " -"to work on exercises." +"We typically run classes from 9:00 am to 4:00 pm, with a 1 hour lunch break in " +"the middle. This leaves 3 hours for the morning class and 3 hours for the " +"afternoon class. Both sessions contain multiple breaks and time for students to " +"work on exercises." msgstr "" -"我們一般會從上午 10 點上課到下午 4 點,中間 1 小時午休。也就是說,上下午課程" -"各為 2.5 小時。請注意,這只是建議的上課時間:您也可以將上午的課程訂為 3 小" -"時,讓學員有更多時間練習。延長課程時間的缺點是,學員上了整整 6 小時的課,到了" -"下午可能會非常疲倦。" +"我們一般會從上午 10 點上課到下午 4 點,中間 1 小時午休。也就是說,上下午課程各" +"為 3 小時。各階段的課程中都包含休息以及讓學員練習的時間。" #: src/running-the-course.md msgid "Before you run the course, you will want to:" @@ -1485,109 +1468,104 @@ msgstr "在講授課程前,建議您注意下列事項:" #: src/running-the-course.md msgid "" -"Make yourself familiar with the course material. We've included speaker " -"notes to help highlight the key points (please help us by contributing more " -"speaker notes!). When presenting, you should make sure to open the speaker " -"notes in a popup (click the link with a little arrow next to \"Speaker " -"Notes\"). This way you have a clean screen to present to the class." +"Make yourself familiar with the course material. We've included speaker notes " +"to help highlight the key points (please help us by contributing more speaker " +"notes!). When presenting, you should make sure to open the speaker notes in a " +"popup (click the link with a little arrow next to \"Speaker Notes\"). This way " +"you have a clean screen to present to the class." msgstr "" -"請熟悉課程教材。我們已附上演講者備忘稿,協助突顯重點,也請您不吝提供更多演講" -"者備忘稿內容!分享螢幕畫面時,請務必在彈出式視窗中開啟演講者備忘稿 (按一下" -"「Speaker Notes」旁小箭頭的連結)。如此一來,您就能在課堂上分享簡潔的螢幕畫" -"面。" +"請熟悉課程教材。我們已附上演講者備忘稿,協助突顯重點,也請您不吝提供更多演講者備" +"忘稿內容!分享螢幕畫面時,請務必在彈出式視窗中開啟演講者備忘稿 (按一下「Speaker " +"Notes」旁小箭頭的連結)。如此一來,您就能在課堂上分享簡潔的螢幕畫面。" #: src/running-the-course.md -#, fuzzy msgid "" "Decide on the dates. Since the course takes four days, we recommend that you " -"schedule the days over two weeks. Course participants have said that they " -"find it helpful to have a gap in the course since it helps them process all " -"the information we give them." +"schedule the days over two weeks. Course participants have said that they find " +"it helpful to have a gap in the course since it helps them process all the " +"information we give them." msgstr "" -"請決定授課日期。由於課程長度至少為三個整天,建議您將授課日分散安排在兩週內。" -"課程參與者曾表示,如果課程中間有間隔,可協助他們消化我們提供的所有資訊,對學" -"習效果有助益。" +"請決定授課日期。由於課程長度為四個整天,建議您將授課日分散安排在兩週內。課程參與" +"者曾表示,如果課程中間有間隔,可協助他們消化我們提供的所有資訊,對學習效果有助" +"益。" #: src/running-the-course.md msgid "" -"Find a room large enough for your in-person participants. We recommend a " -"class size of 15-25 people. That's small enough that people are comfortable " -"asking questions --- it's also small enough that one instructor will have " -"time to answer the questions. Make sure the room has _desks_ for yourself " -"and for the students: you will all need to be able to sit and work with your " -"laptops. In particular, you will be doing a lot of live-coding as an " -"instructor, so a lectern won't be very helpful for you." +"Find a room large enough for your in-person participants. We recommend a class " +"size of 15-25 people. That's small enough that people are comfortable asking " +"questions --- it's also small enough that one instructor will have time to " +"answer the questions. Make sure the room has _desks_ for yourself and for the " +"students: you will all need to be able to sit and work with your laptops. In " +"particular, you will be doing a lot of live-coding as an instructor, so a " +"lectern won't be very helpful for you." msgstr "" -"找到可容納現場參與者的場地。建議的開班人數為 15 至 25 人。這樣的小班制教學可" -"讓學員自在地提問,講師也有時間可以回答問題。請確認上課場地有_書桌\\_,可供講" -"師和學員使用:您們都會需要能坐著使用筆電。 講師尤其會需要現場編寫許多程式碼," -"因此使用講台可能會造成不便。" +"找到可容納現場參與者的場地。建議的開班人數為 15 至 25 人。這樣的小班制教學可讓學" +"員自在地提問,講師也有時間可以回答問題。請確認上課場地有_書桌\\_,可供講師和學員" +"使用:您們都會需要能坐著使用筆電。 講師尤其會需要現場編寫許多程式碼,因此使用講" +"台可能會造成不便。" #: src/running-the-course.md msgid "" -"On the day of your course, show up to the room a little early to set things " -"up. We recommend presenting directly using `mdbook serve` running on your " -"laptop (see the [installation instructions](https://github.com/google/" -"comprehensive-rust#building)). This ensures optimal performance with no lag " -"as you change pages. Using your laptop will also allow you to fix typos as " -"you or the course participants spot them." +"On the day of your course, show up to the room a little early to set things up. " +"We recommend presenting directly using `mdbook serve` running on your laptop " +"(see the [installation instructions](https://github.com/google/comprehensive-" +"rust#building)). This ensures optimal performance with no lag as you change " +"pages. Using your laptop will also allow you to fix typos as you or the course " +"participants spot them." msgstr "" -"在講課當天提早到上課場地完成設定。建議您直接在筆電上執行 `mdbook serve` 分享" -"螢幕畫面 (請參閱[安裝操作說明](https://github.com/google/comprehensive-" -"rust#building))。這可確保提供最佳效能,不會在您切換頁面時發生延遲。使用筆電也" -"可讓您修正自己或課程參與者發現的錯字。" +"在講課當天提早到上課場地完成設定。建議您直接在筆電上執行 `mdbook serve` 分享螢幕" +"畫面 (請參閱[安裝操作說明](https://github.com/google/comprehensive-" +"rust#building))。這可確保提供最佳效能,不會在您切換頁面時發生延遲。使用筆電也可" +"讓您修正自己或課程參與者發現的錯字。" #: src/running-the-course.md msgid "" -"Let people solve the exercises by themselves or in small groups. We " -"typically spend 30-45 minutes on exercises in the morning and in the " -"afternoon (including time to review the solutions). Make sure to ask people " -"if they're stuck or if there is anything you can help with. When you see " -"that several people have the same problem, call it out to the class and " -"offer a solution, e.g., by showing people where to find the relevant " -"information in the standard library." +"Let people solve the exercises by themselves or in small groups. We typically " +"spend 30-45 minutes on exercises in the morning and in the afternoon (including " +"time to review the solutions). Make sure to ask people if they're stuck or if " +"there is anything you can help with. When you see that several people have the " +"same problem, call it out to the class and offer a solution, e.g., by showing " +"people where to find the relevant information in the standard library." msgstr "" -"讓學員獨自或分成小組做習題。我們通常會在早上和下午各安排 30 至 45 分鐘的時間" -"做習題,這包含檢討解題方式的時間。請務必詢問學員是否遇到難題,或需要您的協" -"助。如果發現多位學員遇到相同問題,請向全班說明該問題,並提供解決方式:例如示" -"範如何在標準程式庫 (The Rust Standard Library) 找到相關資訊。" +"讓學員獨自或分成小組做習題。我們通常會在早上和下午各安排 30 至 45 分鐘的時間做習" +"題,這包含檢討解題方式的時間。請務必詢問學員是否遇到難題,或需要您的協助。如果發" +"現多位學員遇到相同問題,請向全班說明該問題,並提供解決方式:例如示範如何在標準程" +"式庫 (The Rust Standard Library) 找到相關資訊。" #: src/running-the-course.md msgid "" -"That is all, good luck running the course! We hope it will be as much fun " -"for you as it has been for us!" +"That is all, good luck running the course! We hope it will be as much fun for " +"you as it has been for us!" msgstr "以上為所有注意事項,祝您授課順利,並和我們一樣樂在其中!" #: src/running-the-course.md msgid "" "Please [provide feedback](https://github.com/google/comprehensive-rust/" -"discussions/86) afterwards so that we can keep improving the course. We " -"would love to hear what worked well for you and what can be made better. " -"Your students are also very welcome to [send us feedback](https://github.com/" -"google/comprehensive-rust/discussions/100)!" +"discussions/86) afterwards so that we can keep improving the course. We would " +"love to hear what worked well for you and what can be made better. Your " +"students are also very welcome to [send us feedback](https://github.com/google/" +"comprehensive-rust/discussions/100)!" msgstr "" "請在授課後[提供意見回饋](https://github.com/google/comprehensive-rust/" -"discussions/86),協助我們持續改善課程。您可以與我們分享您滿意的部分,以及值得" -"改善的地方。也歡迎您的學生[提供意見回饋](https://github.com/google/" -"comprehensive-rust/discussions/100)!" +"discussions/86),協助我們持續改善課程。您可以與我們分享您滿意的部分,以及值得改" +"善的地方。也歡迎您的學生[提供意見回饋](https://github.com/google/comprehensive-" +"rust/discussions/100)!" #: src/running-the-course/course-structure.md msgid "Rust Fundamentals" msgstr "Rust 基礎知識" #: src/running-the-course/course-structure.md -#, fuzzy msgid "" -"The first four days make up [Rust Fundamentals](../welcome-day-1.md). The " -"days are fast paced and we cover a lot of ground!" +"The first four days make up [Rust Fundamentals](../welcome-day-1.md). The days " +"are fast paced and we cover a lot of ground!" msgstr "" -"我們會在前三天介紹 [Rust 基礎知識](../welcome-day-1.md)。這幾天的步調會稍快," -"因為要探討許多層面:" +"我們會在前四天介紹 [Rust 基礎知識](../welcome-day-1.md)。這幾天的步調會稍快,因" +"為要探討許多層面!" #: src/running-the-course/course-structure.md -#, fuzzy msgid "Course schedule:" -msgstr "課程架構" +msgstr "課程安排:" #: src/running-the-course/course-structure.md msgid "Day 1 Morning (2 hours and 10 minutes, including breaks)" @@ -1682,8 +1660,7 @@ msgid "[Borrowing](../borrowing.md) (50 minutes)" msgstr "[借用](../borrowing.md) (50 分鐘)" #: src/running-the-course/course-structure.md -msgid "" -"[Slices and Lifetimes](../slices-and-lifetimes.md) (1 hour and 10 minutes)" +msgid "[Slices and Lifetimes](../slices-and-lifetimes.md) (1 hour and 10 minutes)" msgstr "[切片 (slice) 和生命週期](../slices-and-lifetimes.md) (1 小時 10 分鐘)" #: src/running-the-course/course-structure.md @@ -1723,121 +1700,111 @@ msgid "Deep Dives" msgstr "深入探索" #: src/running-the-course/course-structure.md -#, fuzzy msgid "" "In addition to the 4-day class on Rust Fundamentals, we cover some more " "specialized topics:" -msgstr "除了為期 3 天的 Rust 基礎知識課程,我們也涵蓋更多專門主題:" +msgstr "除了為期 4 天的 Rust 基礎知識課程,我們也涵蓋更多專門主題:" #: src/running-the-course/course-structure.md -#, fuzzy msgid "Rust in Android" msgstr "Android 中的 Rust" #: src/running-the-course/course-structure.md msgid "" "The [Rust in Android](../android.md) deep dive is a half-day course on using " -"Rust for Android platform development. This includes interoperability with " -"C, C++, and Java." +"Rust for Android platform development. This includes interoperability with C, C+" +"+, and Java." msgstr "" -"[Android 中的 Rust](../android.md)是半天的課程,會說明如何針對 Android 平台開" -"發作業使用 Rust,以及與 C、C++ 和 Java 的互通性。" +"[Android 中的 Rust](../android.md)是半天的課程,會說明如何針對 Android 平台開發" +"作業使用 Rust,以及與 C、C++ 和 Java 的互通性。" #: src/running-the-course/course-structure.md msgid "" -"You will need an [AOSP checkout](https://source.android.com/docs/setup/" -"download/downloading). Make a checkout of the [course repository](https://" -"github.com/google/comprehensive-rust) on the same machine and move the `src/" -"android/` directory into the root of your AOSP checkout. This will ensure " -"that the Android build system sees the `Android.bp` files in `src/android/`." +"You will need an [AOSP checkout](https://source.android.com/docs/setup/download/" +"downloading). Make a checkout of the [course repository](https://github.com/" +"google/comprehensive-rust) on the same machine and move the `src/android/` " +"directory into the root of your AOSP checkout. This will ensure that the " +"Android build system sees the `Android.bp` files in `src/android/`." msgstr "" -"您會需要檢出 (checkout) [AOSP (Android 開放原始碼專案)](https://source." -"android.com/docs/setup/download/downloading)。請檢查[課程存放區](https://" -"comprehensive-rust)上相同的機器,並將 `src/android/` 目錄移至檢出的 AOSP 根目" -"錄下。這可確保 Android 建構系統能夠在 `src/android/` 中看到 `Android.bp` 的檔" -"案。" +"您會需要檢出 (checkout) [AOSP (Android 開放原始碼專案)](https://source.android." +"com/docs/setup/download/downloading)。請檢查[課程存放區](https://comprehensive-" +"rust)上相同的機器,並將 `src/android/` 目錄移至檢出的 AOSP 根目錄下。這可確保 " +"Android 建構系統能夠在 `src/android/` 中看到 `Android.bp` 的檔案。" #: src/running-the-course/course-structure.md msgid "" "Ensure that `adb sync` works with your emulator or real device and pre-build " -"all Android examples using `src/android/build_all.sh`. Read the script to " -"see the commands it runs and make sure they work when you run them by hand." +"all Android examples using `src/android/build_all.sh`. Read the script to see " +"the commands it runs and make sure they work when you run them by hand." msgstr "" -"請確保 `adb sync` 可與模擬器或實際裝置搭配使用,並運用 `src/android/" -"build_all.sh` 預先建構所有 Android 範例。請閱讀指令碼,瞭解指令碼執行的指令," -"並確保可以手動執行指令。" +"請確保 `adb sync` 可與模擬器或實際裝置搭配使用,並運用 `src/android/build_all." +"sh` 預先建構所有 Android 範例。請閱讀指令碼,瞭解指令碼執行的指令,並確保可以手" +"動執行指令。" #: src/running-the-course/course-structure.md -#, fuzzy msgid "Rust in Chromium" -msgstr "在 Chromium 中的 Rust" +msgstr "Chromium 中的 Rust" #: src/running-the-course/course-structure.md msgid "" -"The [Rust in Chromium](../chromium.md) deep dive is a half-day course on " -"using Rust as part of the Chromium browser. It includes using Rust in " -"Chromium's `gn` build system, bringing in third-party libraries (\"crates\") " -"and C++ interoperability." +"The [Rust in Chromium](../chromium.md) deep dive is a half-day course on using " +"Rust as part of the Chromium browser. It includes using Rust in Chromium's `gn` " +"build system, bringing in third-party libraries (\"crates\") and C++ " +"interoperability." msgstr "" "[Chromium 中的 Rust](../chromium.md) 是半天的深入探索課程,會說明如何在 " -"Chromium 瀏覽器中使用 Rust。這包括在 Chromium 的 `gn` 建構系統中使用 Rust,以" -"提供與第三方程式庫 (「Crate」) 和 C++ 的互通性。" +"Chromium 瀏覽器中使用 Rust。這包括在 Chromium 的 `gn` 建構系統中使用 Rust,以提" +"供與第三方程式庫 (「Crate」) 和 C++ 的互通性。" #: src/running-the-course/course-structure.md msgid "" "You will need to be able to build Chromium --- a debug, component build is " -"[recommended](../chromium/setup.md) for speed but any build will work. " -"Ensure that you can run the Chromium browser that you've built." +"[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/setup.md)使用偵錯元件版" -"本來加快執行速度,但其他版本也適用。請確保您能夠執行所建構的 Chromium 瀏覽" -"器。" +"您需具備 Chromium 的建構知識。我們[建議](../chromium/setup.md)使用偵錯元件版本來" +"加快執行速度,但其他版本也適用。請確保您能夠執行所建構的 Chromium 瀏覽器。" #: src/running-the-course/course-structure.md -#, fuzzy msgid "Bare-Metal Rust" -msgstr "裸機" +msgstr "裸機開發(Bare-Metal)" #: src/running-the-course/course-structure.md -#, fuzzy msgid "" -"The [Bare-Metal Rust](../bare-metal.md) deep dive is a full day class on " -"using Rust for bare-metal (embedded) development. Both microcontrollers and " +"The [Bare-Metal Rust](../bare-metal.md) deep dive is a full day class on using " +"Rust for bare-metal (embedded) development. Both microcontrollers and " "application processors are covered." msgstr "" -"[裸機深入探索](../bare-metal.md)是一整天的課程,會說明如何使用 Rust 進行裸機 " -"(嵌入式) 開發作業,也會介紹微控制器和應用程式處理器。" +"[裸機深入探索](../bare-metal.md)是一整天的課程,會說明如何使用 Rust 進行裸機 (嵌" +"入式) 開發作業,也會介紹微控制器和應用程式處理器。" #: src/running-the-course/course-structure.md msgid "" -"For the microcontroller part, you will need to buy the [BBC micro:bit]" -"(https://microbit.org/) v2 development board ahead of time. Everybody will " -"need to install a number of packages as described on the [welcome page](../" -"bare-metal.md)." +"For the microcontroller part, you will need to buy the [BBC micro:bit](https://" +"microbit.org/) v2 development board ahead of time. Everybody will need to " +"install a number of packages as described on the [welcome page](../bare-metal." +"md)." msgstr "" -"針對微控制器,您會需要預先購買 [BBC micro:bit](https://microbit.org/) 第 2 版" -"開發板。此外,所有人都需要按照[歡迎頁面](../bare-metal.md)上的指示安裝多種套" -"件。" +"針對微控制器,您會需要預先購買 [BBC micro:bit](https://microbit.org/) 第 2 版開" +"發板。此外,所有人都需要按照[歡迎頁面](../bare-metal.md)上的指示安裝多種套件。" #: src/running-the-course/course-structure.md -#, fuzzy msgid "Concurrency in Rust" -msgstr "歡迎使用 Rust 的並行程式設計" +msgstr "Rust 的並行程式設計" #: src/running-the-course/course-structure.md -#, fuzzy msgid "" -"The [Concurrency in Rust](../concurrency.md) deep dive is a full day class " -"on classical as well as `async`/`await` concurrency." +"The [Concurrency in Rust](../concurrency.md) deep dive is a full day class on " +"classical as well as `async`/`await` concurrency." msgstr "" -"[並行深入探索](../concurrency.md)是一整天的課程,會說明傳統並行與 `async`/" -"`await` 並行。" +"[並行程式設計](../concurrency.md)是一整天的課程,會說明傳統並行與使用 `async`/" +"`await` 的並行。" #: src/running-the-course/course-structure.md msgid "" -"You will need a fresh crate set up and the dependencies downloaded and ready " -"to go. You can then copy/paste the examples into `src/main.rs` to experiment " -"with them:" +"You will need a fresh crate set up and the dependencies downloaded and ready to " +"go. You can then copy/paste the examples into `src/main.rs` to experiment with " +"them:" msgstr "" "您會需要設定新的 Crate,然後下載並準備執行依附元件。接著就能將範例複製貼上至 " "`src/main.rs`,使用這些範例進行實驗:" @@ -1895,51 +1862,47 @@ msgid "" msgstr "本課程已由一群優秀的志工翻譯成其他語言:" #: src/running-the-course/translations.md -#, fuzzy msgid "" -"[Brazilian Portuguese](https://google.github.io/comprehensive-rust/pt-BR/) " -"by [@rastringer](https://github.com/rastringer), [@hugojacob](https://github." -"com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes), and " -"[@henrif75](https://github.com/henrif75)." +"[Brazilian Portuguese](https://google.github.io/comprehensive-rust/pt-BR/) by " +"[@rastringer](https://github.com/rastringer), [@hugojacob](https://github.com/" +"hugojacob), [@joaovicmendes](https://github.com/joaovicmendes), and [@henrif75]" +"(https://github.com/henrif75)." msgstr "" -"\\[巴西葡萄牙文\\]\\][pt-BR](https://google.github.io/comprehensive-rust/pt-" -"BR/)譯者:[@rastringer](https://github.com/rastringer) 和 [@hugojacob]" -"(https://github.com/hugojacob)。" +"\\[巴西葡萄牙文\\]\\][pt-BR](https://google.github.io/comprehensive-rust/pt-BR/)" +"譯者:[@rastringer](https://github.com/rastringer)、[@hugojacob](https://github." +"com/hugojacob)、[@joaovicmendes](https://github.com/joaovicmendes)和 [@henrif75]" +"(https://github.com/henrif75)." #: src/running-the-course/translations.md msgid "" -"[Chinese (Simplified)](https://google.github.io/comprehensive-rust/zh-CN/) " -"by [@suetfei](https://github.com/suetfei), [@wnghl](https://github.com/" -"wnghl), [@anlunx](https://github.com/anlunx), [@kongy](https://github.com/" -"kongy), [@noahdragon](https://github.com/noahdragon), [@superwhd](https://" -"github.com/superwhd), [@SketchK](https://github.com/SketchK), and [@nodmp]" -"(https://github.com/nodmp)." +"[Chinese (Simplified)](https://google.github.io/comprehensive-rust/zh-CN/) by " +"[@suetfei](https://github.com/suetfei), [@wnghl](https://github.com/wnghl), " +"[@anlunx](https://github.com/anlunx), [@kongy](https://github.com/kongy), " +"[@noahdragon](https://github.com/noahdragon), [@superwhd](https://github.com/" +"superwhd), [@SketchK](https://github.com/SketchK), and [@nodmp](https://github." +"com/nodmp)." msgstr "" "[中文 (簡體)](https://google.github.io/comprehensive-rust/zh-CN/)譯者:" "[@suetfei](https://github.com/suetfei)、[@wnghl](https://github.com/wnghl)、" "[@anlunx](https://github.com/anlunx)、[@kongy](https://github.com/kongy)、" "[@noahdragon](https://github.com/noahdragon、[@superwhd](https://github.com/" -"superwhd)、[@SketchK](https://github.com/SketchK) 和 [@nodmp](https://" -"github) .com/nodmp)。" +"superwhd)、[@SketchK](https://github.com/SketchK) 和 [@nodmp](https://github) ." +"com/nodmp)。" #: src/running-the-course/translations.md -#, fuzzy msgid "" -"[Chinese (Traditional)](https://google.github.io/comprehensive-rust/zh-TW/) " -"by [@hueich](https://github.com/hueich), [@victorhsieh](https://github.com/" +"[Chinese (Traditional)](https://google.github.io/comprehensive-rust/zh-TW/) by " +"[@hueich](https://github.com/hueich), [@victorhsieh](https://github.com/" "victorhsieh), [@mingyc](https://github.com/mingyc), [@kuanhungchen](https://" "github.com/kuanhungchen), and [@johnathan79717](https://github.com/" "johnathan79717)." msgstr "" -"[中文 (簡體)](https://google.github.io/comprehensive-rust/zh-CN/)譯者:" -"[@suetfei](https://github.com/suetfei)、[@wnghl](https://github.com/wnghl)、" -"[@anlunx](https://github.com/anlunx)、[@kongy](https://github.com/kongy)、" -"[@noahdragon](https://github.com/noahdragon、[@superwhd](https://github.com/" -"superwhd)、[@SketchK](https://github.com/SketchK) 和 [@nodmp](https://" -"github) .com/nodmp)。" +"[中文 (繁體)](https://google.github.io/comprehensive-rust/zh-TW/)譯者:[@hueich]" +"(https://github.com/hueich) 、 [@victorhsieh](https://github.com/victorhsieh)、" +"[@mingyc](https://github.com/mingyc)、[@kuanhungchen](https://github.com/" +"kuanhungchen) 和 [@johnathan79717](https://github.com/johnathan79717)。" #: src/running-the-course/translations.md -#, fuzzy msgid "" "[Korean](https://google.github.io/comprehensive-rust/ko/) by [@keispace]" "(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp), " @@ -1947,17 +1910,17 @@ msgid "" "com/namhyung)." msgstr "" "[韓文](https://google.github.io/comprehensive-rust/ko/)譯者:[@keispace]" -"(https://github.com/keispace)、[@jiyongp](https://github.com/jiyongp) 和 " -"[@jooyunghan](https://github.com/jooyunghan)。" +"(https://github.com/keispace) 、 [@jiyongp](https://github.com/jiyongp) 、 " +"[@jooyunghan](https://github.com/jooyunghan) 和 [@namhyung](https://github.com/" +"namhyung)。" #: src/running-the-course/translations.md -#, fuzzy msgid "" -"[Spanish](https://google.github.io/comprehensive-rust/es/) by [@deavid]" -"(https://github.com/deavid)." +"[Spanish](https://google.github.io/comprehensive-rust/es/) by [@deavid](https://" +"github.com/deavid)." msgstr "" -"[法文](https://google.github.io/comprehensive-rust/fr/)譯者:[@KookaS]" -"(https://github.com/KookaS) 和 [@vcaen](https://github.com/vcaen)。" +"[西文](https://google.github.io/comprehensive-rust/es/)譯者:[@deavid](https://" +"github.com/deavid)。" #: src/running-the-course/translations.md msgid "" @@ -1975,29 +1938,28 @@ msgid "" msgstr "目前有許多正在翻譯的語言版本。以下連結為最近更新的翻譯:" #: src/running-the-course/translations.md -#, fuzzy msgid "" "[Bengali](https://google.github.io/comprehensive-rust/bn/) by [@raselmandol]" "(https://github.com/raselmandol)." msgstr "" -"[德文](https://google.github.io/comprehensive-rust/de/)譯者:[@Throvn]" -"(https://github.com/Throvn)和 [@ronaldfw](https://github.com/ronaldfw)。" +"[孟加拉語](https://google.github.io/comprehensive-rust/bn/)譯者:[@raselmandol]" +"(https://github.com/raselmandol)。" #: src/running-the-course/translations.md msgid "" -"[French](https://google.github.io/comprehensive-rust/fr/) by [@KookaS]" -"(https://github.com/KookaS) and [@vcaen](https://github.com/vcaen)." +"[French](https://google.github.io/comprehensive-rust/fr/) by [@KookaS](https://" +"github.com/KookaS) and [@vcaen](https://github.com/vcaen)." msgstr "" -"[法文](https://google.github.io/comprehensive-rust/fr/)譯者:[@KookaS]" -"(https://github.com/KookaS) 和 [@vcaen](https://github.com/vcaen)。" +"[法文](https://google.github.io/comprehensive-rust/fr/)譯者:[@KookaS](https://" +"github.com/KookaS) 和 [@vcaen](https://github.com/vcaen)。" #: src/running-the-course/translations.md msgid "" -"[German](https://google.github.io/comprehensive-rust/de/) by [@Throvn]" -"(https://github.com/Throvn) and [@ronaldfw](https://github.com/ronaldfw)." +"[German](https://google.github.io/comprehensive-rust/de/) by [@Throvn](https://" +"github.com/Throvn) and [@ronaldfw](https://github.com/ronaldfw)." msgstr "" -"[德文](https://google.github.io/comprehensive-rust/de/)譯者:[@Throvn]" -"(https://github.com/Throvn)和 [@ronaldfw](https://github.com/ronaldfw)。" +"[德文](https://google.github.io/comprehensive-rust/de/)譯者:[@Throvn](https://" +"github.com/Throvn)和 [@ronaldfw](https://github.com/ronaldfw)。" #: src/running-the-course/translations.md msgid "" @@ -2009,36 +1971,34 @@ msgstr "" "JPN\\] 和 [@momotaro1105](https://github.com/momotaro1105)。" #: src/running-the-course/translations.md -#, fuzzy msgid "" -"[Italian](https://google.github.io/comprehensive-rust/it/) by " -"[@henrythebuilder](https://github.com/henrythebuilder) and [@detro](https://" -"github.com/detro)." +"[Italian](https://google.github.io/comprehensive-rust/it/) by [@henrythebuilder]" +"(https://github.com/henrythebuilder) and [@detro](https://github.com/detro)." msgstr "" -"[德文](https://google.github.io/comprehensive-rust/de/)譯者:[@Throvn]" -"(https://github.com/Throvn)和 [@ronaldfw](https://github.com/ronaldfw)。" +"[義大利文](https://google.github.io/comprehensive-rust/it/)譯者:" +"[@henrythebuilder](https://github.com/henrythebuilder) 和 [@detro](https://" +"github.com/detro)。" #: src/running-the-course/translations.md msgid "" "If you want to help with this effort, please see [our instructions](https://" -"github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md) for how to " -"get going. Translations are coordinated on the [issue tracker](https://" -"github.com/google/comprehensive-rust/issues/282)." +"github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md) for how to get " +"going. Translations are coordinated on the [issue tracker](https://github.com/" +"google/comprehensive-rust/issues/282)." msgstr "" -"如果想協助翻譯,請參閱\\[操作說明\\],瞭解如何開始翻譯。譯者可以在\\[問題追蹤" -"工具\\]上討論及統整翻譯。" +"如果想協助翻譯,請參閱\\[操作說明\\],瞭解如何開始翻譯。譯者可以在\\[問題追蹤工" +"具\\]上討論及統整翻譯。" #: src/cargo.md msgid "" -"When you start reading about Rust, you will soon meet [Cargo](https://doc." -"rust-lang.org/cargo/), the standard tool used in the Rust ecosystem to build " -"and run Rust applications. Here we want to give a brief overview of what " -"Cargo is and how it fits into the wider ecosystem and how it fits into this " -"training." +"When you start reading about Rust, you will soon meet [Cargo](https://doc.rust-" +"lang.org/cargo/), the standard tool used in the Rust ecosystem to build and run " +"Rust applications. Here we want to give a brief overview of what Cargo is and " +"how it fits into the wider ecosystem and how it fits into this training." msgstr "" -"您開始閱讀 Rust 內容後,很快就會認識 [Cargo](https://doc.rust-lang.org/" -"cargo/),這是在 Rust 生態系統中使用的標準工具,用於建構及執行 Rust 應用程式。" -"以下簡要介紹 Cargo,以及如何在更廣大的生態系統和本訓練課程中運用 Cargo。" +"您開始閱讀 Rust 內容後,很快就會認識 [Cargo](https://doc.rust-lang.org/cargo/)," +"這是在 Rust 生態系統中使用的標準工具,用於建構及執行 Rust 應用程式。以下簡要介" +"紹 Cargo,以及如何在更廣大的生態系統和本訓練課程中運用 Cargo。" #: src/cargo.md msgid "Installation" @@ -2052,39 +2012,39 @@ msgstr "**請按照 中的指示操作。**" #, fuzzy msgid "" "This will give you the Cargo build tool (`cargo`) and the Rust compiler " -"(`rustc`). You will also get `rustup`, a command line utility that you can " -"use to install to different compiler versions." +"(`rustc`). You will also get `rustup`, a command line utility that you can use " +"to install to different compiler versions." msgstr "" -"除了安裝 Cargo 和 rustc 之外,Rustup 還會將自己安裝為指令列公用程式,方便您安" -"裝/切換工具鏈、設定跨平台程式碼編譯等。" +"除了安裝 Cargo 和 rustc 之外,Rustup 還會將自己安裝為指令列公用程式,方便您安裝/" +"切換工具鏈、設定跨平台程式碼編譯等。" #: src/cargo.md msgid "" "After installing Rust, you should configure your editor or IDE to work with " -"Rust. Most editors do this by talking to [rust-analyzer](https://rust-" -"analyzer.github.io/), which provides auto-completion and jump-to-definition " +"Rust. Most editors do this by talking to [rust-analyzer](https://rust-analyzer." +"github.io/), which provides auto-completion and jump-to-definition " "functionality for [VS Code](https://code.visualstudio.com/), [Emacs](https://" -"rust-analyzer.github.io/manual.html#emacs), [Vim/Neovim](https://rust-" -"analyzer.github.io/manual.html#vimneovim), and many others. There is also a " -"different IDE available called [RustRover](https://www.jetbrains.com/rust/)." +"rust-analyzer.github.io/manual.html#emacs), [Vim/Neovim](https://rust-analyzer." +"github.io/manual.html#vimneovim), and many others. There is also a different " +"IDE available called [RustRover](https://www.jetbrains.com/rust/)." msgstr "" -"安裝 Rust 後,您應設定編輯器或 IDE,以便與 Rust 搭配使用。為此,大多數編輯器" -"會與 [rust-analyzer](https://rust-analyzer.github.io/) 通訊,後者提供適用於 " -"[VS Code](https://code.visualstudio.com/)、[Emacs](https://rust-analyzer." -"github.io/manual.html#emacs)、[Vim/Neovim](https://rust-analyzer.github.io/" -"manual.html#vimneovim) 等的自動完成和跳至定義功能。此外,您也可以使用稱做 " -"[RustRover](https://www.jetbrains.com/rust/) 的不同 IDE。" +"安裝 Rust 後,您應設定編輯器或 IDE,以便與 Rust 搭配使用。為此,大多數編輯器會" +"與 [rust-analyzer](https://rust-analyzer.github.io/) 通訊,後者提供適用於 [VS " +"Code](https://code.visualstudio.com/)、[Emacs](https://rust-analyzer.github.io/" +"manual.html#emacs)、[Vim/Neovim](https://rust-analyzer.github.io/manual." +"html#vimneovim) 等的自動完成和跳至定義功能。此外,您也可以使用稱做 [RustRover]" +"(https://www.jetbrains.com/rust/) 的不同 IDE。" #: src/cargo.md -#, fuzzy msgid "" "On Debian/Ubuntu, you can also install Cargo, the Rust source and the [Rust " -"formatter](https://github.com/rust-lang/rustfmt) via `apt`. However, this " -"gets you an outdated rust version and may lead to unexpected behavior. The " -"command would be:" +"formatter](https://github.com/rust-lang/rustfmt) via `apt`. However, this gets " +"you an outdated rust version and may lead to unexpected behavior. The command " +"would be:" msgstr "" -"您可以在 Debian/Ubuntu 上使用下列程式碼,安裝 Cargo、Rust 原始碼和 [Rust 格式" -"設定工具](https://github.com/rust-lang/rustfmt):" +"您可以在 Debian/Ubuntu 上使用 apt 安裝 Cargo、Rust 原始碼和 [Rust 格式設定工具]" +"(https://github.com/rust-lang/rustfmt)。 注意:使用此方法下載可能會有過時的 " +"rust 版本且造成不預期的行為,其指令如下:" #: src/cargo/rust-ecosystem.md msgid "The Rust Ecosystem" @@ -2102,29 +2062,27 @@ msgid "" msgstr "`rustc`:Rust 編譯器,可將 `.rs` 檔案轉換成二進位檔和其他中繼格式。" #: src/cargo/rust-ecosystem.md -#, fuzzy msgid "" "`cargo`: the Rust dependency manager and build tool. Cargo knows how to " -"download dependencies, usually hosted on , and it will " -"pass them to `rustc` when building your project. Cargo also comes with a " -"built-in test runner which is used to execute unit tests." +"download dependencies, usually hosted on , and it will pass " +"them to `rustc` when building your project. Cargo also comes with a built-in " +"test runner which is used to execute unit tests." msgstr "" "`cargo`:Rust 依附元件管理工具和建構工具。Cargo 知道如何下載 上代管的依附元件,且會在建構您的專案時,將這些依附元件傳送至 `rustc`。" -"Cargo 也提供內建測試執行元件,可用於執行單元測試。" +"io> 上代管的依附元件,且會在建構您的專案時,將這些依附元件傳送至 `rustc`。Cargo " +"也提供內建測試執行元件,可用於執行單元測試。" #: src/cargo/rust-ecosystem.md -#, fuzzy msgid "" "`rustup`: the Rust toolchain installer and updater. This tool is used to " -"install and update `rustc` and `cargo` when new versions of Rust are " -"released. In addition, `rustup` can also download documentation for the " -"standard library. You can have multiple versions of Rust installed at once " -"and `rustup` will let you switch between them as needed." +"install and update `rustc` and `cargo` when new versions of Rust are released. " +"In addition, `rustup` can also download documentation for the standard library. " +"You can have multiple versions of Rust installed at once and `rustup` will let " +"you switch between them as needed." msgstr "" -"`rustup`:Rust 工具鍊安裝程式和更新程式。新版 Rust 推出時,這項工具可用來安裝" -"及更新 `rustc` 和 `cargo`。此外,`rustup` 也可以下載標準程式庫的說明文件。您" -"可以一次安裝多個 Rust 版本,並視需要使用 `rustup` 切換版本。" +"`rustup`:Rust 工具鍊安裝程式和更新程式。新版 Rust 推出時,這項工具可用來安裝及" +"更新 `rustc` 和 `cargo`。此外,`rustup` 也可以下載標準程式庫的說明文件。您可以一" +"次安裝多個 Rust 版本,並視需要使用 `rustup` 切換版本。" #: src/cargo/rust-ecosystem.md src/types-and-values/hello-world.md #: src/references/exclusive.md src/pattern-matching/destructuring.md @@ -2136,18 +2094,16 @@ msgstr "重要須知:" #: src/cargo/rust-ecosystem.md msgid "" "Rust has a rapid release schedule with a new release coming out every six " -"weeks. New releases maintain backwards compatibility with old releases --- " -"plus they enable new functionality." +"weeks. New releases maintain backwards compatibility with old releases --- plus " +"they enable new functionality." msgstr "" -"Rust 的發布時程相當緊湊,每六週就會推出新版本。新版本可與舊版本回溯相容,且會" -"啟用新功能。" +"Rust 的發布時程相當緊湊,每六週就會推出新版本。新版本可與舊版本回溯相容,且會啟" +"用新功能。" #: src/cargo/rust-ecosystem.md -msgid "" -"There are three release channels: \"stable\", \"beta\", and \"nightly\"." +msgid "There are three release channels: \"stable\", \"beta\", and \"nightly\"." msgstr "" -"發布版本 (release channel) 分為三種:「穩定版」、「Beta 版」和「Nightly " -"版」。" +"發布版本 (release channel) 分為三種:「穩定版」、「Beta 版」和「Nightly 版」。" #: src/cargo/rust-ecosystem.md msgid "" @@ -2165,25 +2121,24 @@ msgstr "" #: src/cargo/rust-ecosystem.md msgid "" -"Rust also has [editions](https://doc.rust-lang.org/edition-guide/): the " -"current edition is Rust 2021. Previous editions were Rust 2015 and Rust 2018." +"Rust also has [editions](https://doc.rust-lang.org/edition-guide/): the current " +"edition is Rust 2021. Previous editions were Rust 2015 and Rust 2018." msgstr "" -"Rust 還具有\\[版本\\] (edition):目前版本為 Rust 2021。先前版本為 Rust 2015 " -"和 Rust 2018。" +"Rust 還具有\\[版本\\] (edition):目前版本為 Rust 2021。先前版本為 Rust 2015 和 " +"Rust 2018。" #: src/cargo/rust-ecosystem.md msgid "" -"The editions are allowed to make backwards incompatible changes to the " -"language." +"The editions are allowed to make backwards incompatible changes to the language." msgstr "這些版本可針對語言進行回溯不相容的變更。" #: src/cargo/rust-ecosystem.md msgid "" -"To prevent breaking code, editions are opt-in: you select the edition for " -"your crate via the `Cargo.toml` file." +"To prevent breaking code, editions are opt-in: you select the edition for your " +"crate via the `Cargo.toml` file." msgstr "" -"為避免破壞程式碼,版本皆為自行選擇採用:您可以透過 `Cargo.toml` 檔案選擇所需" -"版本。" +"為避免破壞程式碼,版本皆為自行選擇採用:您可以透過 `Cargo.toml` 檔案選擇所需版" +"本。" #: src/cargo/rust-ecosystem.md msgid "" @@ -2198,14 +2153,11 @@ msgid "" msgstr "請說明很少會略過 `cargo` 直接使用編譯器,大部分使用者都不會這麼做。" #: src/cargo/rust-ecosystem.md -#, fuzzy msgid "" "It might be worth alluding that Cargo itself is an extremely powerful and " -"comprehensive tool. It is capable of many advanced features including but " -"not limited to:" -msgstr "" -"可以考慮暗示 Cargo 本身是極其強大且功能全面的工具,具有許多進階功能,包括但不" -"限於:" +"comprehensive tool. It is capable of many advanced features including but not " +"limited to:" +msgstr "Cargo 本身是極其強大且功能全面的工具,具有許多進階功能,包括但不限於:" #: src/cargo/rust-ecosystem.md msgid "Project/package structure" @@ -2221,8 +2173,7 @@ msgstr "開發人員依附元件和執行階段依附元件管理/快取" #: src/cargo/rust-ecosystem.md msgid "" -"[build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts." -"html)" +"[build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts.html)" msgstr "\\[建構指令碼\\]" #: src/cargo/rust-ecosystem.md @@ -2233,15 +2184,14 @@ msgstr "\\[全域安裝\\]" #: src/cargo/rust-ecosystem.md msgid "" -"It is also extensible with sub command plugins as well (such as [cargo " -"clippy](https://github.com/rust-lang/rust-clippy))." +"It is also extensible with sub command plugins as well (such as [cargo clippy]" +"(https://github.com/rust-lang/rust-clippy))." msgstr "" -"此外,還可以擴充使用子指令外掛程式,例如 [cargo clippy](https://github.com/" -"rust-lang/rust-clippy)" +"此外,還可以擴充使用子指令外掛程式,例如 [cargo clippy](https://github.com/rust-" +"lang/rust-clippy)" #: src/cargo/rust-ecosystem.md -msgid "" -"Read more from the [official Cargo Book](https://doc.rust-lang.org/cargo/)" +msgid "Read more from the [official Cargo Book](https://doc.rust-lang.org/cargo/)" msgstr "詳情請參閱\\[官方的 Cargo 手冊\\]。" #: src/cargo/code-samples.md @@ -2254,17 +2204,17 @@ msgid "" "which can be executed through your browser. This makes the setup much easier " "and ensures a consistent experience for everyone." msgstr "" -"在本訓練課程中,我們主要會透過範例瞭解 Rust 語言,這些範例可在瀏覽器中執行。" -"這麼做可讓設定程序更輕鬆,並確保所有人獲得一致的體驗。" +"在本訓練課程中,我們主要會透過範例瞭解 Rust 語言,這些範例可在瀏覽器中執行。這麼" +"做可讓設定程序更輕鬆,並確保所有人獲得一致的體驗。" #: src/cargo/code-samples.md msgid "" -"Installing Cargo is still encouraged: it will make it easier for you to do " -"the exercises. On the last day, we will do a larger exercise which shows you " -"how to work with dependencies and for that you need Cargo." +"Installing Cargo is still encouraged: it will make it easier for you to do the " +"exercises. On the last day, we will do a larger exercise which shows you how to " +"work with dependencies and for that you need Cargo." msgstr "" -"我們仍建議安裝 Cargo,方便您更輕鬆做習題。在最後一天,我們會做規模較大的習" -"題,讓您瞭解如何使用依附元件,而這需要使用 Cargo。" +"我們仍建議安裝 Cargo,方便您更輕鬆做習題。在最後一天,我們會做規模較大的習題,讓" +"您瞭解如何使用依附元件,而這需要使用 Cargo。" #: src/cargo/code-samples.md msgid "The code blocks in this course are fully interactive:" @@ -2286,25 +2236,24 @@ msgstr " 鍵即可執行程式碼。" msgid "" "Most code samples are editable like shown above. A few code samples are not " "editable for various reasons:" -msgstr "" -"大部分程式碼範例都可供編輯,如上所示。有些程式碼範例無法編輯,原因如下:" +msgstr "大部分程式碼範例都可供編輯,如上所示。有些程式碼範例無法編輯,原因如下:" #: src/cargo/code-samples.md msgid "" "The embedded playgrounds cannot execute unit tests. Copy-paste the code and " "open it in the real Playground to demonstrate unit tests." msgstr "" -"嵌入式遊樂場無法執行單元測試。請複製貼上程式碼,然後在實際的 Playground 中開" -"啟,即可示範單元測試。" +"嵌入式遊樂場無法執行單元測試。請複製貼上程式碼,然後在實際的 Playground 中開啟," +"即可示範單元測試。" #: src/cargo/code-samples.md msgid "" -"The embedded playgrounds lose their state the moment you navigate away from " -"the page! This is the reason that the students should solve the exercises " -"using a local Rust installation or via the Playground." +"The embedded playgrounds lose their state the moment you navigate away from the " +"page! This is the reason that the students should solve the exercises using a " +"local Rust installation or via the Playground." msgstr "" -"當您一離開頁面,嵌入式遊樂場就會失去目前狀態!因此,學生應使用本機 Rust 安裝" -"項目或透過 Playground 來做習題。" +"當您一離開頁面,嵌入式遊樂場就會失去目前狀態!因此,學生應使用本機 Rust 安裝項目" +"或透過 Playground 來做習題。" #: src/cargo/running-locally.md msgid "Running Code Locally with Cargo" @@ -2312,30 +2261,28 @@ msgstr "使用 Cargo 在本機執行程式碼" #: src/cargo/running-locally.md msgid "" -"If you want to experiment with the code on your own system, then you will " -"need to first install Rust. Do this by following the [instructions in the " -"Rust Book](https://doc.rust-lang.org/book/ch01-01-installation.html). This " -"should give you a working `rustc` and `cargo`. At the time of writing, the " -"latest stable Rust release has these version numbers:" +"If you want to experiment with the code on your own system, then you will need " +"to first install Rust. Do this by following the [instructions in the Rust Book]" +"(https://doc.rust-lang.org/book/ch01-01-installation.html). This should give " +"you a working `rustc` and `cargo`. At the time of writing, the latest stable " +"Rust release has these version numbers:" msgstr "" -"如果想在自己的系統上進行程式碼實驗,您會需要先安裝 Rust。請按照 [Rust 手冊中" -"的指示](https://doc.rust-lang.org/book/ch01-01-installation.html)操作。您應會" -"獲得正常運作的 `rustc` 和 `cargo`。截至本文撰寫時間,最新的 Rust 穩定版具有下" -"列版本編號:" +"如果想在自己的系統上進行程式碼實驗,您會需要先安裝 Rust。請按照 [Rust 手冊中的指" +"示](https://doc.rust-lang.org/book/ch01-01-installation.html)操作。您應會獲得正" +"常運作的 `rustc` 和 `cargo`。截至本文撰寫時間,最新的 Rust 穩定版具有下列版本編" +"號:" #: src/cargo/running-locally.md msgid "" -"You can use any later version too since Rust maintains backwards " -"compatibility." +"You can use any later version too since Rust maintains backwards compatibility." msgstr "由於 Rust 保有回溯相容性,您也可以使用任何後續版本。" #: src/cargo/running-locally.md msgid "" -"With this in place, follow these steps to build a Rust binary from one of " -"the examples in this training:" +"With this in place, follow these steps to build a Rust binary from one of the " +"examples in this training:" msgstr "" -"完成上述步驟後,請按照下列步驟操作,在本訓練課程的任一範例中建構 Rust 二進位" -"檔:" +"完成上述步驟後,請按照下列步驟操作,在本訓練課程的任一範例中建構 Rust 二進位檔:" #: src/cargo/running-locally.md msgid "Click the \"Copy to clipboard\" button on the example you want to copy." @@ -2353,11 +2300,11 @@ msgstr "前往 `exercise/`,使用 `cargo run` 建構並執行二進位檔:" #: src/cargo/running-locally.md msgid "" -"Replace the boiler-plate code in `src/main.rs` with your own code. For " -"example, using the example on the previous page, make `src/main.rs` look like" +"Replace the boiler-plate code in `src/main.rs` with your own code. For example, " +"using the example on the previous page, make `src/main.rs` look like" msgstr "" -"將 `src/main.rs` 中的樣板程式碼替換為自己的程式碼。以上一頁的範例為例,替換後" -"的 `src/main.rs` 會類似如下:" +"將 `src/main.rs` 中的樣板程式碼替換為自己的程式碼。以上一頁的範例為例,替換後的 " +"`src/main.rs` 會類似如下:" #: src/cargo/running-locally.md msgid "Use `cargo run` to build and run your updated binary:" @@ -2365,23 +2312,23 @@ msgstr "使用 `cargo run` 建構並執行更新版二進位檔:" #: src/cargo/running-locally.md msgid "" -"Use `cargo check` to quickly check your project for errors, use `cargo " -"build` to compile it without running it. You will find the output in `target/" -"debug/` for a normal debug build. Use `cargo build --release` to produce an " -"optimized release build in `target/release/`." +"Use `cargo check` to quickly check your project for errors, use `cargo build` " +"to compile it without running it. You will find the output in `target/debug/` " +"for a normal debug build. Use `cargo build --release` to produce an optimized " +"release build in `target/release/`." msgstr "" -"使用 `cargo check` 快速檢查專案中是否有錯誤,並使用 `cargo build` 在不執行的" -"情況下編譯專案。您會在 `target/debug/` 中看到一般偵錯版本的輸出內容。使用 " -"`cargo build --release`,在 `target/release/` 中產生經過最佳化的發布子版本。" +"使用 `cargo check` 快速檢查專案中是否有錯誤,並使用 `cargo build` 在不執行的情況" +"下編譯專案。您會在 `target/debug/` 中看到一般偵錯版本的輸出內容。使用 `cargo " +"build --release`,在 `target/release/` 中產生經過最佳化的發布子版本。" #: src/cargo/running-locally.md msgid "" -"You can add dependencies for your project by editing `Cargo.toml`. When you " -"run `cargo` commands, it will automatically download and compile missing " +"You can add dependencies for your project by editing `Cargo.toml`. When you run " +"`cargo` commands, it will automatically download and compile missing " "dependencies for you." msgstr "" -"只要編輯 `Cargo.toml`,即可為專案新增依附元件。執行 `cargo` 指令時,系統會自" -"動下載及編譯缺少的依附元件。" +"只要編輯 `Cargo.toml`,即可為專案新增依附元件。執行 `cargo` 指令時,系統會自動下" +"載及編譯缺少的依附元件。" #: src/cargo/running-locally.md msgid "" @@ -2389,8 +2336,8 @@ msgid "" "editor. It will make their life easier since they will have a normal " "development environment." msgstr "" -"建議您鼓勵課程參與者安裝 Cargo 及使用本機編輯器。這麼做能提供正常的開發環境," -"降低操作難度。" +"建議您鼓勵課程參與者安裝 Cargo 及使用本機編輯器。這麼做能提供正常的開發環境,降" +"低操作難度。" #: src/welcome-day-1.md msgid "Welcome to Day 1" @@ -2398,16 +2345,14 @@ msgstr "歡迎參加第 1 天課程" #: src/welcome-day-1.md msgid "" -"This is the first day of Rust Fundamentals. We will cover a lot of ground " -"today:" +"This is the first day of Rust Fundamentals. We will cover a lot of ground today:" msgstr "今天是學習 Rust 基礎知識的第一天,我們會探討許多內容:" #: src/welcome-day-1.md msgid "" "Basic Rust syntax: variables, scalar and compound types, enums, structs, " "references, functions, and methods." -msgstr "" -"基本的 Rust 語法:變數、純量和複合型別、列舉、結構體、參照、函式和方法。" +msgstr "基本的 Rust 語法:變數、純量和複合型別、列舉、結構體、參照、函式和方法。" #: src/welcome-day-1.md #, fuzzy @@ -2466,27 +2411,24 @@ msgid "Please remind the students that:" msgstr "請提醒學生以下事項:" #: src/welcome-day-1.md -msgid "" -"They should ask questions when they get them, don't save them to the end." +msgid "They should ask questions when they get them, don't save them to the end." msgstr "應該一有問題就提問,不要留到最後。" #: src/welcome-day-1.md msgid "" -"The class is meant to be interactive and discussions are very much " -"encouraged!" +"The class is meant to be interactive and discussions are very much encouraged!" 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." +"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 "" @@ -2495,33 +2437,32 @@ msgstr "我們討論的議題,可能會超前投影片進度。" #: src/welcome-day-1.md msgid "" -"This is perfectly okay! Repetition is an important part of learning. " -"Remember that the slides are just a support and you are free to skip them as " -"you like." +"This is perfectly okay! Repetition is an important part of learning. Remember " +"that the slides are just a support and you are free to skip them as you like." msgstr "" -"這完全沒問題!複習是學習的重要一環。請記得,投影片只是輔助,您可以視情況略過" -"不需要的部分。" +"這完全沒問題!複習是學習的重要一環。請記得,投影片只是輔助,您可以視情況略過不需" +"要的部分。" #: src/welcome-day-1.md msgid "" -"The idea for the first day is to show the \"basic\" things in Rust that " -"should have immediate parallels in other languages. The more advanced parts " -"of Rust come on the subsequent days." +"The idea for the first day is to show the \"basic\" things in Rust that should " +"have immediate parallels in other languages. The more advanced parts of Rust " +"come on the subsequent days." msgstr "" -"第一天的規畫是說明 Rust 中能夠直接對應到其他語言的「基礎」概念。後續幾天則會" -"介紹更進階的部分。" +"第一天的規畫是說明 Rust 中能夠直接對應到其他語言的「基礎」概念。後續幾天則會介紹" +"更進階的部分。" #: src/welcome-day-1.md msgid "" "If you're teaching this in a classroom, this is a good place to go over the " -"schedule. Note that there is an exercise at the end of each segment, " -"followed by a break. Plan to cover the exercise solution after the break. " -"The times listed here are a suggestion in order to keep the course on " -"schedule. Feel free to be flexible and adjust as necessary!" +"schedule. Note that there is an exercise at the end of each segment, followed " +"by a break. Plan to cover the exercise solution after the break. 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 "" -"如果您是在教室授課,就很適合參考這裡的時間表。請注意,每個主題結束後都有練" -"習,然後才是休息時間。請規劃在休息後講解練習的解決方案。此處列出的時程建議是" -"要確保課程進度。您可以視需要彈性調整!" +"如果您是在教室授課,就很適合參考這裡的時間表。請注意,每個主題結束後都有練習,然" +"後才是休息時間。請規劃在休息後講解練習的解決方案。此處列出的時程建議是要確保課程" +"進度。您可以視需要彈性調整!" #: src/hello-world.md src/types-and-values.md src/control-flow-basics.md #: src/tuples-and-arrays.md src/references.md src/user-defined-types.md @@ -2551,8 +2492,8 @@ msgstr "講解這個主題大約需要 15 分鐘" #: src/hello-world/what-is-rust.md msgid "" -"Rust is a new programming language which had its [1.0 release in 2015]" -"(https://blog.rust-lang.org/2015/05/15/Rust-1.0.html):" +"Rust is a new programming language which had its [1.0 release in 2015](https://" +"blog.rust-lang.org/2015/05/15/Rust-1.0.html):" msgstr "" "Rust 是一款新的程式設計語言,[在 2015 年推出 1.0 版](https://blog.rust-lang." "org/2015/05/15/Rust-1.0.html):" @@ -2618,8 +2559,7 @@ msgid "High level of control." msgstr "提供高度主控權。" #: src/hello-world/what-is-rust.md -msgid "" -"Can be scaled down to very constrained devices such as microcontrollers." +msgid "Can be scaled down to very constrained devices such as microcontrollers." msgstr "可縮減到十分受限的裝置規模,例如微控制器。" #: src/hello-world/what-is-rust.md @@ -2673,8 +2613,8 @@ msgid "" "_No undefined runtime behavior_ - what a Rust statement does is never left " "unspecified" msgstr "" -"「不會出現未定義的執行階段行為 (undefined runtime behavior)」 - Rust 陳述式的" -"行為一律會有定義" +"「不會出現未定義的執行階段行為 (undefined runtime behavior)」 - Rust 陳述式的行" +"為一律會有定義" #: src/hello-world/benefits.md msgid "Array access is bounds checked." @@ -2724,50 +2664,50 @@ msgstr "卓越的語言伺服器通訊協定支援。" #: src/hello-world/benefits.md msgid "" -"Do not spend much time here. All of these points will be covered in more " -"depth later." +"Do not spend much time here. All of these points will be covered in more depth " +"later." msgstr "這裡不要花太多時間。這幾點稍後全都會深入介紹。" #: src/hello-world/benefits.md msgid "" -"Make sure to ask the class which languages they have experience with. " -"Depending on the answer you can highlight different features of Rust:" +"Make sure to ask the class which languages they have experience with. Depending " +"on the answer you can highlight different features of Rust:" msgstr "" -"請務必詢問全班同學,瞭解他們具備哪些語言的使用經驗。根據學生答覆,您可以強調" -"不同的 Rust 功能:" +"請務必詢問全班同學,瞭解他們具備哪些語言的使用經驗。根據學生答覆,您可以強調不同" +"的 Rust 功能:" #: src/hello-world/benefits.md msgid "" -"Experience with C or C++: Rust eliminates a whole class of _runtime errors_ " -"via the borrow checker. You get performance like in C and C++, but you don't " -"have the memory unsafety issues. In addition, you get a modern language with " +"Experience with C or C++: Rust eliminates a whole class of _runtime errors_ via " +"the borrow checker. You get performance like in C and C++, but you don't have " +"the memory unsafety issues. In addition, you get a modern language with " "constructs like pattern matching and built-in dependency management." msgstr "" -"具備 C 或 C++ 經驗:Rust 會透過借用檢查器,徹底刪除一整類的「執行階段錯誤」。" -"這不僅可讓您獲得像是 C 和 C++ 的效能,也不會造成記憶體安全問題。此外,您還能" -"取得具備模式配對、內建依附元件管理機制等結構的新型語言。" +"具備 C 或 C++ 經驗:Rust 會透過借用檢查器,徹底刪除一整類的「執行階段錯誤」。這" +"不僅可讓您獲得像是 C 和 C++ 的效能,也不會造成記憶體安全問題。此外,您還能取得具" +"備模式配對、內建依附元件管理機制等結構的新型語言。" #: src/hello-world/benefits.md msgid "" -"Experience with Java, Go, Python, JavaScript...: You get the same memory " -"safety as in those languages, plus a similar high-level language feeling. In " -"addition you get fast and predictable performance like C and C++ (no garbage " -"collector) as well as access to low-level hardware (should you need it)" +"Experience with Java, Go, Python, JavaScript...: You get the same memory safety " +"as in those languages, plus a similar high-level language feeling. In addition " +"you get fast and predictable performance like C and C++ (no garbage collector) " +"as well as access to low-level hardware (should you need it)" msgstr "" -"具備 Java、Go、Python、JavaScript...經驗:Rust 能讓您享有與這些語言相同的記憶" -"體安全性,而且還可帶來使用類似高階語言的感受。此外,您也能獲得像 C 和 C++ 一" -"樣快速可預期的成效 (無垃圾收集器),以及低階硬體的存取權限 (如有需要)。" +"具備 Java、Go、Python、JavaScript...經驗:Rust 能讓您享有與這些語言相同的記憶體" +"安全性,而且還可帶來使用類似高階語言的感受。此外,您也能獲得像 C 和 C++ 一樣快速" +"可預期的成效 (無垃圾收集器),以及低階硬體的存取權限 (如有需要)。" #: src/hello-world/playground.md 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:" +"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 " -"程式,也是本課程中範例和練習的基礎。不妨試著執行 Rust Playground 開頭的" -"「hello-world」程式。Playground 兼具以下幾項便利功能:" +"[Rust Playground](https://play.rust-lang.org/) 支援以簡便方式執行精簡的 Rust 程" +"式,也是本課程中範例和練習的基礎。不妨試著執行 Rust Playground 開頭的「hello-" +"world」程式。Playground 兼具以下幾項便利功能:" #: src/hello-world/playground.md msgid "" @@ -2781,27 +2721,26 @@ msgid "" "checks, less optimization) and Release (fewer runtime checks, lots of " "optimization). These are accessible under \"Debug\" at the top." msgstr "" -"Rust 有兩個主要的「設定檔」可產生程式碼,分別是「Debug」(加強執行階段檢查,最" -"佳化程度較低) 和「Release」(減少執行階段檢查,大規模最佳化)。這些設定檔位於頂" -"端的「Debug」下方。" +"Rust 有兩個主要的「設定檔」可產生程式碼,分別是「Debug」(加強執行階段檢查,最佳" +"化程度較低) 和「Release」(減少執行階段檢查,大規模最佳化)。這些設定檔位於頂端的" +"「Debug」下方。" #: src/hello-world/playground.md msgid "" -"If you're interested, use \"ASM\" under \"...\" to see the generated " -"assembly code." +"If you're interested, use \"ASM\" under \"...\" to see the generated assembly " +"code." msgstr "感興趣的話,不妨點選「...」下的「ASM」查看產生的組語程式碼。" #: src/hello-world/playground.md 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 " -"out during the rest of the course. This is particularly helpful for advanced " -"students who want to know more about Rust's optimizations or generated " -"assembly." +"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 out " +"during the rest of the course. This is particularly helpful for advanced " +"students who want to know more about Rust's optimizations or generated assembly." msgstr "" -"學員準備休息時,請鼓勵他們開啟 Playground 略微試驗一下。在剩餘的課堂時間,建" -"議他們持續開啟 Playground 分頁嘗試操作。如果學生程度較高,想進一步瞭解 Rust " -"的最佳化作業或產生的組語,就特別適合採用這個授課方式。" +"學員準備休息時,請鼓勵他們開啟 Playground 略微試驗一下。在剩餘的課堂時間,建議他" +"們持續開啟 Playground 分頁嘗試操作。如果學生程度較高,想進一步瞭解 Rust 的最佳化" +"作業或產生的組語,就特別適合採用這個授課方式。" #: src/types-and-values.md msgid "[Hello, World](./types-and-values/hello-world.md) (5 minutes)" @@ -2872,12 +2811,11 @@ msgstr "Rust 字串採用 UTF-8 編碼,可包含任何萬國碼字元。" #: src/types-and-values/hello-world.md 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." +"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 程式碼。在接下來的四天裡,他們會大量接" +"觸到這些內容,所以我們得從他們熟悉的小地方著手。" #: src/types-and-values/hello-world.md msgid "" @@ -2902,13 +2840,12 @@ msgstr "" #: src/types-and-values/hello-world.md msgid "" -"Macros being 'hygienic' means they don't accidentally capture identifiers " -"from the scope they are used in. Rust macros are actually only [partially " -"hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene." -"html)." +"Macros being 'hygienic' means they don't accidentally capture identifiers from " +"the scope they are used in. Rust macros are actually only [partially hygienic]" +"(https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html)." msgstr "" -"所謂「衛生」巨集,是指這類巨集不會誤從自身所用於的範圍內擷取 ID。Rust 巨集實" -"際上只能算是[部分衛生](https://veykril.github.io/tlborm/decl-macros/minutiae/" +"所謂「衛生」巨集,是指這類巨集不會誤從自身所用於的範圍內擷取 ID。Rust 巨集實際上" +"只能算是[部分衛生](https://veykril.github.io/tlborm/decl-macros/minutiae/" "hygiene.html)的巨集。" #: src/types-and-values/hello-world.md @@ -2918,9 +2855,9 @@ msgid "" "while it is not a functional language, it includes a range of [functional " "concepts](https://doc.rust-lang.org/book/ch13-00-functional-features.html)." msgstr "" -"Rust 是多範式的語言。舉例來說,它具備強大的[物件導向程式設計功能](https://" -"doc.rust-lang.org/book/ch17-00-oop.html),雖然並非函式語言,卻涉及各式各樣的" -"[函式概念](https://doc.rust-lang.org/book/ch13-00-functional-features.html)。" +"Rust 是多範式的語言。舉例來說,它具備強大的[物件導向程式設計功能](https://doc." +"rust-lang.org/book/ch17-00-oop.html),雖然並非函式語言,卻涉及各式各樣的[函式概" +"念](https://doc.rust-lang.org/book/ch13-00-functional-features.html)。" #: src/types-and-values/variables.md #, fuzzy @@ -2944,25 +2881,24 @@ msgstr "" #: src/types-and-values/variables.md msgid "" -"Uncomment the `x = 20` to demonstrate that variables are immutable by " -"default. Add the `mut` keyword to allow changes." +"Uncomment the `x = 20` to demonstrate that variables are immutable by default. " +"Add the `mut` keyword to allow changes." msgstr "" -"取消註解 `x = 20`,證明變數預設為不可變動。如要允許變更,請加入 `mut` 關鍵" -"字。" +"取消註解 `x = 20`,證明變數預設為不可變動。如要允許變更,請加入 `mut` 關鍵字。" #: src/types-and-values/variables.md msgid "" -"The `i32` here is the type of the variable. This must be known at compile " -"time, but type inference (covered later) allows the programmer to omit it in " -"many cases." +"The `i32` here is the type of the variable. This must be known at compile time, " +"but type inference (covered later) allows the programmer to omit it in many " +"cases." msgstr "" -"這裡的 `i32` 是變數型別。這是編譯器必須在編譯期間掌握的資訊,但透過型別推斷 " -"(稍後會說明),程式設計師在許多情況下都能省略其型別宣告。" +"這裡的 `i32` 是變數型別。這是編譯器必須在編譯期間掌握的資訊,但透過型別推斷 (稍" +"後會說明),程式設計師在許多情況下都能省略其型別宣告。" #: src/types-and-values/values.md msgid "" -"Here are some basic built-in types, and the syntax for literal values of " -"each type." +"Here are some basic built-in types, and the syntax for literal values of each " +"type." msgstr "以下列出一些基本的內建型別,以及適用於各型的字面常量的語法。" #: src/types-and-values/values.md src/unsafe-rust/exercise.md @@ -3060,8 +2996,8 @@ msgstr "除此之外,還有一些其他語法:" #: src/types-and-values/values.md msgid "" "All underscores in numbers can be left out, they are for legibility only. So " -"`1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written " -"as `123i64`." +"`1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written as " +"`123i64`." msgstr "" "數字中的底線全都可以省略,寫出來只是為了方便閱讀。換句話說,`1_000` 可以寫成 " "`1000` (或 `10_00`),而 `123_i64` 則可寫成 `123i64`。" @@ -3072,12 +3008,12 @@ msgstr "\"result: {}\"" #: src/types-and-values/arithmetic.md msgid "" -"This is the first time we've seen a function other than `main`, but the " -"meaning should be clear: it takes three integers, and returns an integer. " -"Functions will be covered in more detail later." +"This is the first time we've seen a function other than `main`, but the meaning " +"should be clear: it takes three integers, and returns an integer. Functions " +"will be covered in more detail later." msgstr "" -"這是我們第一次看到 `main` 以外的函式,但此函式的含意應該很清楚,那就是它需要" -"三個整數,且會傳回整數。我們稍後會詳細說明函式的細節。" +"這是我們第一次看到 `main` 以外的函式,但此函式的含意應該很清楚,那就是它需要三個" +"整數,且會傳回整數。我們稍後會詳細說明函式的細節。" #: src/types-and-values/arithmetic.md msgid "Arithmetic is very similar to other languages, with similar precedence." @@ -3089,36 +3025,33 @@ msgid "" "actually undefined, and might do different things on different platforms or " "compilers. In Rust, it's defined." msgstr "" -"那麼整數溢位現象呢?在 C 和 C++ 中,「有號」整數的溢位現象實際上並未定義,而" -"且在不同的平台或編譯器上可能有不同行為。但在 Rust 中,整數溢位會經過定義。" +"那麼整數溢位現象呢?在 C 和 C++ 中,「有號」整數的溢位現象實際上並未定義,而且在" +"不同的平台或編譯器上可能有不同行為。但在 Rust 中,整數溢位會經過定義。" #: src/types-and-values/arithmetic.md 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 " -"options, such as overflowing, saturating, and carrying. These are accessed " -"with method syntax, e.g., `(a * b).saturating_add(b * c).saturating_add(c * " -"a)`." +"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 options, such as " +"overflowing, saturating, and carrying. These are accessed with method syntax, e." +"g., `(a * b).saturating_add(b * c).saturating_add(c * a)`." msgstr "" "將 `i32` 變更為 `i16`,即可查看整數溢位現象,這在偵錯版本中會造成恐慌 " -"(checked),並納入發布子版本中。此外,Rust 還提供溢位、飽和與進位等其他選項," -"可透過方法語法存取,例如 `(a * b).saturating_add(b * c).saturating_add(c * " -"a)`。" +"(checked),並納入發布子版本中。此外,Rust 還提供溢位、飽和與進位等其他選項,可透" +"過方法語法存取,例如 `(a * b).saturating_add(b * c).saturating_add(c * a)`。" #: src/types-and-values/arithmetic.md msgid "" "In fact, the compiler will detect overflow of constant expressions, which is " "why the example requires a separate function." -msgstr "" -"事實上,編譯器會偵測常數運算式的溢位,這也是本例中需要另一個函式的原因。" +msgstr "事實上,編譯器會偵測常數運算式的溢位,這也是本例中需要另一個函式的原因。" #: src/types-and-values/strings.md msgid "" -"Rust has two types to represent strings, both of which will be covered in " -"more depth later. Both _always_ store UTF-8 encoded strings." +"Rust has two types to represent strings, both of which will be covered in more " +"depth later. Both _always_ store UTF-8 encoded strings." msgstr "" -"Rust 用來代表字串的型別有兩種,稍後會深入介紹。兩者「一律」都儲存 UTF-8 編碼" -"字串。" +"Rust 用來代表字串的型別有兩種,稍後會深入介紹。兩者「一律」都儲存 UTF-8 編碼字" +"串。" #: src/types-and-values/strings.md #, fuzzy @@ -3160,8 +3093,8 @@ msgid "" "This slide introduces strings. Everything here will be covered in more depth " "later, but this is enough for subsequent slides and exercises to use strings." msgstr "" -"這張投影片用於介紹字串。我們稍後會深入介紹此處提及的所有內容,但目前這些就已" -"足夠用於後續的投影片和使用字串的練習題中。" +"這張投影片用於介紹字串。我們稍後會深入介紹此處提及的所有內容,但目前這些就已足夠" +"用於後續的投影片和使用字串的練習題中。" #: src/types-and-values/strings.md msgid "Invalid UTF-8 in a string is UB, and this not allowed in safe Rust." @@ -3169,38 +3102,37 @@ msgstr "字串中的無效 UTF-8 屬於 UB,而安全的 Rust 環境不允許 #: src/types-and-values/strings.md msgid "" -"`String` is a user-defined type with a constructor (`::new()`) and methods " -"like `s.push_str(..)`." +"`String` is a user-defined type with a constructor (`::new()`) and methods like " +"`s.push_str(..)`." msgstr "" -"`String` 是使用者定義的型別,具備建構函式 (`::new()`) 和 `s.push_str(..)` 等" -"方法。" +"`String` 是使用者定義的型別,具備建構函式 (`::new()`) 和 `s.push_str(..)` 等方" +"法。" #: src/types-and-values/strings.md msgid "" -"The `&` in `&str` indicates that this is a reference. We will cover " -"references later, so for now just think of `&str` as a unit meaning \"a read-" -"only string\"." +"The `&` in `&str` indicates that this is a reference. We will cover references " +"later, so for now just think of `&str` as a unit meaning \"a read-only string\"." msgstr "" -"`&str` 中的 `&` 表示這是參照。我們稍後會講解何謂參照,因此現在只需將 `&str` " -"視為代表「唯讀字串」的單位就行了。" +"`&str` 中的 `&` 表示這是參照。我們稍後會講解何謂參照,因此現在只需將 `&str` 視為" +"代表「唯讀字串」的單位就行了。" #: src/types-and-values/strings.md msgid "" -"The commented-out line is indexing into the string by byte position. " -"`12..13` does not end on a character boundary, so the program panics. Adjust " -"it to a range that does, based on the error message." +"The commented-out line is indexing into the string by byte position. `12..13` " +"does not end on a character boundary, so the program panics. Adjust it to a " +"range that does, based on the error message." msgstr "" -"被註解掉的那行程式碼會按照位元組位置建立索引到字串中。`12..13` 的結尾不是字元" -"邊界,因此程式會發生恐慌。請根據錯誤訊息,將其調整至結尾為字元邊界的範圍。" +"被註解掉的那行程式碼會按照位元組位置建立索引到字串中。`12..13` 的結尾不是字元邊" +"界,因此程式會發生恐慌。請根據錯誤訊息,將其調整至結尾為字元邊界的範圍。" #: src/types-and-values/strings.md msgid "" -"Raw strings allow you to create a `&str` value with escapes disabled: " -"`r\"\\n\" == \"\\\\n\"`. You can embed double-quotes by using an equal " -"amount of `#` on either side of the quotes:" +"Raw strings allow you to create a `&str` value with escapes disabled: `r\"\\n\" " +"== \"\\\\n\"`. You can embed double-quotes by using an equal amount of `#` on " +"either side of the quotes:" msgstr "" -"原形字串可讓您建立停用逸出功能的 `&str` 值:`r\"\\n\" == \"\\\\n\"`。只要在引" -"號兩側使用等量的 `#`,即可嵌入雙引號:" +"原形字串可讓您建立停用逸出功能的 `&str` 值:`r\"\\n\" == \"\\\\n\"`。只要在引號" +"兩側使用等量的 `#`,即可嵌入雙引號:" #: src/types-and-values/strings.md msgid "" @@ -3214,31 +3146,29 @@ msgstr "Rust 會觀察變數的「使用」方式,藉此判斷型別:" #: src/types-and-values/inference.md msgid "" -"This slide demonstrates how the Rust compiler infers types based on " -"constraints given by variable declarations and usages." -msgstr "" -"這張投影片展示了 Rust 編譯器如何根據變數宣告和用法設下的限制來推斷型別。" +"This slide demonstrates how the Rust compiler infers types based on constraints " +"given by variable declarations and usages." +msgstr "這張投影片展示了 Rust 編譯器如何根據變數宣告和用法設下的限制來推斷型別。" #: src/types-and-values/inference.md msgid "" -"It is very important to emphasize that variables declared like this are not " -"of some sort of dynamic \"any type\" that can hold any data. The machine " -"code generated by such declaration is identical to the explicit declaration " -"of a type. The compiler does the job for us and helps us write more concise " -"code." +"It is very important to emphasize that variables declared like this are not of " +"some sort of dynamic \"any type\" that can hold any data. The machine code " +"generated by such declaration is identical to the explicit declaration of a " +"type. The compiler does the job for us and helps us write more concise code." msgstr "" -"請務必強調,以這種方式宣告的變數,並非「任一型別」這類可存放任何資料的動態型" -"別。此類宣告產生的機器碼與型別的明確宣告相同。編譯器會替我們執行工作,並協助" -"編寫更精簡的程式碼。" +"請務必強調,以這種方式宣告的變數,並非「任一型別」這類可存放任何資料的動態型別。" +"此類宣告產生的機器碼與型別的明確宣告相同。編譯器會替我們執行工作,並協助編寫更精" +"簡的程式碼。" #: src/types-and-values/inference.md msgid "" -"When nothing constrains the type of an integer literal, Rust defaults to " -"`i32`. This sometimes appears as `{integer}` in error messages. Similarly, " -"floating-point literals default to `f64`." +"When nothing constrains the type of an integer literal, Rust defaults to `i32`. " +"This sometimes appears as `{integer}` in error messages. Similarly, floating-" +"point literals default to `f64`." msgstr "" -"當整數常量的型別無任何限制時,Rust 會預設使用 `i32`。這有時會在錯誤訊息中顯示" -"為「{integer}」。同樣地,浮點常量會預設為 `f64`。" +"當整數常量的型別無任何限制時,Rust 會預設使用 `i32`。這有時會在錯誤訊息中顯示為" +"「{integer}」。同樣地,浮點常量會預設為 `f64`。" #: src/types-and-values/inference.md msgid "// ERROR: no implementation for `{float} == {integer}`\n" @@ -3247,18 +3177,17 @@ msgstr "// ERROR: no implementation for `{float} == {integer}`\n" #: src/types-and-values/exercise.md 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 " -"n-2'th Fibonacci numbers." +"Fibonacci number is calculated recursively as the sum of the n-1'th and n-2'th " +"Fibonacci numbers." msgstr "" -"第一和第二個費波那契數都是 `1`。當 n>2 時,第 n 個費波那契數會以遞迴方式計算" -"為第 n-1 和第 n-2 個費波那契數的和。" +"第一和第二個費波那契數都是 `1`。當 n>2 時,第 n 個費波那契數會以遞迴方式計算為" +"第 n-1 和第 n-2 個費波那契數的和。" #: src/types-and-values/exercise.md msgid "" -"Write a function `fib(n)` that calculates the n'th Fibonacci number. When " -"will this function panic?" -msgstr "" -"編寫用於計算第 n 個費波那契數的 `fib(n)` 函式。這個函式何時會發生恐慌?" +"Write a function `fib(n)` that calculates the n'th Fibonacci number. When will " +"this function panic?" +msgstr "編寫用於計算第 n 個費波那契數的 `fib(n)` 函式。這個函式何時會發生恐慌?" #: src/types-and-values/exercise.md msgid "// The base case.\n" @@ -3287,16 +3216,15 @@ msgid "[Loops](./control-flow-basics/loops.md) (5 minutes)" msgstr "[迴圈](./control-flow-basics/loops.md) (5 分鐘)" #: src/control-flow-basics.md -msgid "" -"[break and continue](./control-flow-basics/break-continue.md) (4 minutes)" +msgid "[break and continue](./control-flow-basics/break-continue.md) (4 minutes)" 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 "" -"[區塊 (block) 和範疇 (scope)](./control-flow-basics/blocks-and-scopes.md) (5 " -"分鐘)" +"[區塊 (block) 和範疇 (scope)](./control-flow-basics/blocks-and-scopes.md) (5 分" +"鐘)" #: src/control-flow-basics.md msgid "[Functions](./control-flow-basics/functions.md) (3 minutes)" @@ -3321,11 +3249,11 @@ msgstr "`if` 表達式" #: src/control-flow-basics/if.md msgid "" -"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/" -"if-expr.html#if-expressions) exactly like `if` statements in other languages:" +"You use [`if` expressions](https://doc.rust-lang.org/reference/expressions/if-" +"expr.html#if-expressions) exactly like `if` statements in other languages:" msgstr "" -"你可以像在其他語言中使用 `if` 陳述式那樣地使用 [`if` 表達式](https://doc." -"rust-lang.org/reference/expressions/if-expr.html#if-expressions):" +"你可以像在其他語言中使用 `if` 陳述式那樣地使用 [`if` 表達式](https://doc.rust-" +"lang.org/reference/expressions/if-expr.html#if-expressions):" #: src/control-flow-basics/if.md msgid "\"zero!\"" @@ -3344,8 +3272,8 @@ msgid "" "In addition, you can use `if` as an expression. The last expression of each " "block becomes the value of the `if` expression:" msgstr "" -"此外,你也可以將 `if` 當作表達式使用。每個區塊中的最後一行式子將成為 `if` 表" -"達式的賦值:" +"此外,你也可以將 `if` 當作表達式使用。每個區塊中的最後一行式子將成為 `if` 表達式" +"的賦值:" #: src/control-flow-basics/if.md msgid "\"small\"" @@ -3363,20 +3291,20 @@ msgstr "\"number size: {}\"" #, 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." +"branch blocks must have the same type. Show what happens if you add `;` after " +"`\"small\"` in the second example." msgstr "" -"因為 `if` 被當作表達式使用,它必須擁有一個特定的型別,因此兩個分支區塊必須擁" -"有同樣的型別。試著在第二個範例中的 `x / 2` 之後加上 `;`,並觀察其結果。" +"因為 `if` 被當作表達式使用,它必須擁有一個特定的型別,因此兩個分支區塊必須擁有同" +"樣的型別。試著在第二個範例中的 `x / 2` 之後加上 `;`,並觀察其結果。" #: src/control-flow-basics/if.md msgid "" -"When `if` is used in an expression, the expression must have a `;` to " -"separate it from the next statement. Remove the `;` before `println!` to see " -"the compiler error." +"When `if` is used in an expression, the expression must have a `;` to separate " +"it from the next statement. Remove the `;` before `println!` to see the " +"compiler error." msgstr "" -"在運算式中使用 `if` 時,運算式須有 `;`,才能與下一個陳述式分隔。移除 " -"`println!` 前的 `;` 即可查看編譯器錯誤。" +"在運算式中使用 `if` 時,運算式須有 `;`,才能與下一個陳述式分隔。移除 `println!` " +"前的 `;` 即可查看編譯器錯誤。" #: src/control-flow-basics/loops.md msgid "There are three looping keywords in Rust: `while`, `loop`, and `for`:" @@ -3388,9 +3316,9 @@ msgstr "`while`" #: src/control-flow-basics/loops.md 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." +"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)的運作方式與其他語言非常相似:" @@ -3402,11 +3330,11 @@ 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:" +"The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) iterates over " +"ranges of values or the items in a collection:" msgstr "" -"[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) 是具有所有權的指" -"向堆積上的資料的指標:" +"[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) 是具有所有權的指向" +"堆積上的資料的指標:" #: src/control-flow-basics/loops/for.md msgid "\"elem: {elem}\"" @@ -3421,11 +3349,10 @@ msgstr "" #: src/control-flow-basics/loops/for.md msgid "" -"Note that the `for` loop only iterates to `4`. Show the `1..=5` syntax for " -"an inclusive range." +"Note that the `for` loop only iterates to `4`. Show the `1..=5` syntax for an " +"inclusive range." msgstr "" -"請注意,`for` 迴圈只會疊代至 `4`。您可以示範 `1..=5` 語法,這代表含頭尾的範" -"圍。" +"請注意,`for` 迴圈只會疊代至 `4`。您可以示範 `1..=5` 語法,這代表含頭尾的範圍。" #: src/control-flow-basics/loops/loop.md #, fuzzy @@ -3433,8 +3360,7 @@ 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) 用於定義解構函" -"式。" +"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) 用於定義解構函式。" #: src/control-flow-basics/loops/loop.md msgid "\"{i}\"" @@ -3451,13 +3377,12 @@ msgstr "" #: 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." +"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))," #: src/control-flow-basics/break-continue.md src/std-traits/exercise.md #: src/std-traits/solution.md src/smart-pointers/trait-objects.md @@ -3470,11 +3395,11 @@ msgstr "" #: src/control-flow-basics/break-continue/labels.md msgid "" -"Both `continue` and `break` can optionally take a label argument which is " -"used to break out of nested loops:" +"Both `continue` and `break` can optionally take a label argument which is used " +"to break out of nested loops:" msgstr "" -"`continue` 以及 `break` 都可以選擇性地接收一個迴圈標籤,用來跳出巢狀迴圈中的" -"某一層:" +"`continue` 以及 `break` 都可以選擇性地接收一個迴圈標籤,用來跳出巢狀迴圈中的某一" +"層:" #: src/control-flow-basics/break-continue/labels.md msgid "\"elements searched: {elements_searched}\"" @@ -3486,8 +3411,8 @@ msgid "" "value. This is because it's guaranteed to be entered at least once (unlike " "`while` and `for` loops)." msgstr "" -"請注意,`loop` 是唯一會傳回重要值的迴圈結構。這是因為系統保證至少會輸入一次此" -"迴圈結構,這一點不同於 `while` 和 `for` 迴圈。" +"請注意,`loop` 是唯一會傳回重要值的迴圈結構。這是因為系統保證至少會輸入一次此迴" +"圈結構,這一點不同於 `while` 和 `for` 迴圈。" #: src/control-flow-basics/blocks-and-scopes.md msgid "Blocks" @@ -3500,8 +3425,8 @@ msgid "" "Each block has a value and a type, which are those of the last expression of " "the block:" msgstr "" -"Rust 中的區塊 (Block) 包含一個數值以及一個型別:數值即為該區塊中的最後一行表" -"達式:" +"Rust 中的區塊 (Block) 包含一個數值以及一個型別:數值即為該區塊中的最後一行表達" +"式:" #: src/control-flow-basics/blocks-and-scopes.md msgid "\"y: {y}\"" @@ -3510,8 +3435,7 @@ 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 " -"`()`." +"If the last expression ends with `;`, then the resulting value and type is `()`." msgstr "然而,如果最後一行表達式的結尾為 `;`,則最後的數值及型別皆為 `()`。" #: src/control-flow-basics/blocks-and-scopes.md @@ -3519,8 +3443,8 @@ msgid "" "You can show how the value of the block changes by changing the last line in " "the block. For instance, adding/removing a semicolon or using a `return`." msgstr "" -"你可以藉由改變區塊中的最後一行來觀察區塊數值的變化。舉例來說,新增或刪除一個" -"分號,或者使用 `return`。" +"你可以藉由改變區塊中的最後一行來觀察區塊數值的變化。舉例來說,新增或刪除一個分" +"號,或者使用 `return`。" #: src/control-flow-basics/blocks-and-scopes/scopes.md msgid "A variable's scope is limited to the enclosing block." @@ -3528,8 +3452,8 @@ msgstr "變數的有效範疇受限於封閉其變數的區塊。" #: src/control-flow-basics/blocks-and-scopes/scopes.md msgid "" -"You can shadow variables, both those from outer scopes and variables from " -"the same scope:" +"You can shadow variables, both those from outer scopes and variables from the " +"same scope:" msgstr "您可以遮蔽變量,包括來自外部範圍以及來自同一範圍的變量:" #: src/control-flow-basics/blocks-and-scopes/scopes.md @@ -3555,21 +3479,21 @@ msgstr "\"after: {a}\"" #: src/control-flow-basics/blocks-and-scopes/scopes.md 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." +"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." msgstr "" -"請說明變數的範疇受到限制,做法是在最後一個範例的內部區塊中新增 `b`,然後嘗試" -"在該區塊外部存取 `b`。" +"請說明變數的範疇受到限制,做法是在最後一個範例的內部區塊中新增 `b`,然後嘗試在該" +"區塊外部存取 `b`。" #: 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." +"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 "" -"定義:遮蔽與可變數不同,因為在遮蔽之後,兩個變數的記憶體位置會同時存在。這兩" -"者可以使用同一個名稱,具體取決於您在程式碼中使用的位置。" +"定義:遮蔽與可變數不同,因為在遮蔽之後,兩個變數的記憶體位置會同時存在。這兩者可" +"以使用同一個名稱,具體取決於您在程式碼中使用的位置。" #: src/control-flow-basics/blocks-and-scopes/scopes.md #, fuzzy @@ -3584,57 +3508,56 @@ msgstr "遮蔽一開始看起來模糊不清,但對於保留 `.unwrap()` 之 #: src/control-flow-basics/functions.md msgid "" -"Declaration parameters are followed by a type (the reverse of some " -"programming languages), then a return type." +"Declaration parameters are followed by a type (the reverse of some programming " +"languages), then a return type." 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`)." +"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 "" -"函式主體 (或任何區塊) 中的最後一個運算式會成為回傳值。您只要省略運算式結尾的 " -"`;` 即可。" +"函式主體 (或任何區塊) 中的最後一個運算式會成為回傳值。您只要省略運算式結尾的 `;" +"` 即可。" #: src/control-flow-basics/functions.md msgid "" "Some functions have no return value, and return the 'unit type', `()`. The " "compiler will infer this if the `-> ()` return type is omitted." msgstr "" -"某些函式沒有回傳值,會傳回 `()` 這個「單位型別」。如果省略 `-> ()` 傳回型別," -"編譯器則會推斷出這點。" +"某些函式沒有回傳值,會傳回 `()` 這個「單位型別」。如果省略 `-> ()` 傳回型別,編" +"譯器則會推斷出這點。" #: src/control-flow-basics/functions.md #, fuzzy -msgid "" -"Overloading is not supported -- each function has a single implementation." +msgid "Overloading is not supported -- each function has a single implementation." msgstr "每個函式都有單一實作項目:" #: src/control-flow-basics/functions.md msgid "" -"Always takes a fixed number of parameters. Default arguments are not " -"supported. Macros can be used to support variadic functions." +"Always takes a fixed number of parameters. Default arguments are not supported. " +"Macros can be used to support variadic functions." 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." +"Always takes a single set of parameter types. These types can be generic, which " +"will be covered later." msgstr "一律採用單組參數型別。" #: src/control-flow-basics/macros.md msgid "" -"Macros are expanded into Rust code during compilation, and can take a " -"variable number of arguments. They are distinguished by a `!` at the end. " -"The Rust standard library includes an assortment of useful macros." +"Macros are expanded into Rust code during compilation, and can take a variable " +"number of arguments. They are distinguished by a `!` at the end. The Rust " +"standard library includes an assortment of useful macros." msgstr "" -"巨集會在編譯期間展開為 Rust 程式碼,並可接受可變數量的引數。我們可透過結尾的 " -"`!` 來辨別巨集。Rust 標準程式庫包含各式實用巨集。" +"巨集會在編譯期間展開為 Rust 程式碼,並可接受可變數量的引數。我們可透過結尾的 `!" +"` 來辨別巨集。Rust 標準程式庫包含各式實用巨集。" #: src/control-flow-basics/macros.md #, fuzzy @@ -3642,8 +3565,8 @@ 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): " -"內的特徵實作:" +"運算子超載會透過 [`std::ops`](https://doc.rust-lang.org/std/ops/index.html): 內" +"的特徵實作:" #: src/control-flow-basics/macros.md msgid "" @@ -3664,8 +3587,7 @@ msgstr "`todo!()` 可將一小段程式碼標示為尚未實作,但執行後 #: src/control-flow-basics/macros.md msgid "" -"`unreachable!()` marks a bit of code as unreachable. If executed, it will " -"panic." +"`unreachable!()` marks a bit of code as unreachable. If executed, it will panic." msgstr "`unavailable!()` 可將一小段程式碼標示為無法存取,但執行後會發生恐慌。" #: src/control-flow-basics/macros.md @@ -3674,12 +3596,12 @@ msgstr "\"{n}! = {}\"" #: src/control-flow-basics/macros.md msgid "" -"The takeaway from this section is that these common conveniences exist, and " -"how to use them. Why they are defined as macros, and what they expand to, is " -"not especially critical." +"The takeaway from this section is that these common conveniences exist, and how " +"to use them. Why they are defined as macros, and what they expand to, is not " +"especially critical." msgstr "" -"本節的重點在於,上述的便利性不僅常見,而且確實存在,學員需瞭解如何運用。至於" -"為何將便利性定義為巨集,以及巨集展開後會變成什麼內容,則沒有那麼重要。" +"本節的重點在於,上述的便利性不僅常見,而且確實存在,學員需瞭解如何運用。至於為何" +"將便利性定義為巨集,以及巨集展開後會變成什麼內容,則沒有那麼重要。" #: src/control-flow-basics/macros.md msgid "" @@ -3693,8 +3615,7 @@ msgid "" "defined as follows, for an arbitrary n" msgstr "" "[考拉茲序列](https://zh.wikipedia.org/wiki/" -"%E8%80%83%E6%8B%89%E5%85%B9%E7%8C%9C%E6%83%B3)的定義如下,對於任意大於零的數 " -"n" +"%E8%80%83%E6%8B%89%E5%85%B9%E7%8C%9C%E6%83%B3)的定義如下,對於任意大於零的數 n" #: src/control-flow-basics/exercise.md msgid "1" @@ -3897,8 +3818,7 @@ msgstr "[陣列疊代](./tuples-and-arrays/iteration.md) (3 分鐘)" #: src/tuples-and-arrays.md msgid "" -"[Patterns and Destructuring](./tuples-and-arrays/destructuring.md) (5 " -"minutes)" +"[Patterns and Destructuring](./tuples-and-arrays/destructuring.md) (5 minutes)" msgstr "[解構](./tuples-and-arrays/destructuring.md) (5 分鐘)" #: src/tuples-and-arrays.md @@ -3912,24 +3832,23 @@ 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 " -"its type_, which means that `[u8; 3]` and `[u8; 4]` are considered two " -"different types. Slices, which have a size determined at runtime, are " -"covered later." +"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 its type_, " +"which means that `[u8; 3]` and `[u8; 4]` are considered two different types. " +"Slices, which have a size determined at runtime, are covered later." msgstr "" "陣列型別 `[T; N]` 的值會保留同樣屬於 `T` 型別的 `N` (編譯時間常數) 元素。請注" -"意,陣列的長度是「其型別的一部分」,也就是說 `[u8; 3]` 和 `[u8; 4]` 視為兩種" -"不同型別。" +"意,陣列的長度是「其型別的一部分」,也就是說 `[u8; 3]` 和 `[u8; 4]` 視為兩種不同" +"型別。" #: src/tuples-and-arrays/arrays.md msgid "" "Try accessing an out-of-bounds array element. Array accesses are checked at " -"runtime. Rust can usually optimize these checks away, and they can be " -"avoided using unsafe Rust." +"runtime. Rust can usually optimize these checks away, and they can be avoided " +"using unsafe Rust." msgstr "" -"請嘗試存取超出範圍的陣列元素。系統會在執行階段檢查存取陣列的行為。Rust 通常可" -"對這類檢查進行最佳化處理,避免使用不安全的 Rust 執行這些檢查。" +"請嘗試存取超出範圍的陣列元素。系統會在執行階段檢查存取陣列的行為。Rust 通常可對" +"這類檢查進行最佳化處理,避免使用不安全的 Rust 執行這些檢查。" #: src/tuples-and-arrays/arrays.md msgid "We can use literals to assign values to arrays." @@ -3939,14 +3858,13 @@ msgstr "我們可以使用常值將值指派給陣列。" #, fuzzy msgid "" "The `println!` macro asks for the debug implementation with the `?` format " -"parameter: `{}` gives the default output, `{:?}` gives the debug output. " -"Types such as integers and strings implement the default output, but arrays " -"only implement the debug output. This means that we must use debug output " -"here." +"parameter: `{}` gives the default output, `{:?}` gives the debug output. Types " +"such as integers and strings implement the default output, but arrays only " +"implement the debug output. This means that we must use debug output here." msgstr "" -"在主函式中,輸出陳述式會使用 `?` 格式參數要求偵錯實作:`{}` 提供預設輸出內" -"容,`{:?}` 則提供偵錯輸出內容。我們也可以使用 `{a}` 和 `{a:?}` 而不需指定格式" -"字串後方的值。" +"在主函式中,輸出陳述式會使用 `?` 格式參數要求偵錯實作:`{}` 提供預設輸出內容," +"`{:?}` 則提供偵錯輸出內容。我們也可以使用 `{a}` 和 `{a:?}` 而不需指定格式字串後" +"方的值。" #: src/tuples-and-arrays/arrays.md msgid "" @@ -3964,14 +3882,14 @@ msgstr "元組會將不同型別的值組成複合型別。" #: src/tuples-and-arrays/tuples.md msgid "" -"Fields of a tuple can be accessed by the period and the index of the value, " -"e.g. `t.0`, `t.1`." +"Fields of a tuple can be accessed by the period and the index of the value, e." +"g. `t.0`, `t.1`." msgstr "元組的欄位可透過點號和值的索引存取,例如 `t.0`、`t.1`。" #: src/tuples-and-arrays/tuples.md msgid "" -"The empty tuple `()` is referred to as the \"unit type\" and signifies " -"absence of a return value, akin to `void` in other languages." +"The empty tuple `()` is referred to as the \"unit type\" and signifies absence " +"of a return value, akin to `void` in other languages." msgstr "" #: src/tuples-and-arrays/iteration.md @@ -3980,19 +3898,19 @@ msgstr "`for` 陳述式支援對陣列進行疊代 (對元組則不支援)。" #: src/tuples-and-arrays/iteration.md msgid "" -"This functionality uses the `IntoIterator` trait, but we haven't covered " -"that yet." +"This functionality uses the `IntoIterator` trait, but we haven't covered that " +"yet." msgstr "這項功能使用 `IntoIterator` 特徵,但這部分我們尚未介紹。" #: src/tuples-and-arrays/iteration.md msgid "" -"The `assert_ne!` macro is new here. There are also `assert_eq!` and `assert!" -"` macros. These are always checked while, debug-only variants like " -"`debug_assert!` compile to nothing in release builds." +"The `assert_ne!` macro is new here. There are also `assert_eq!` and `assert!` " +"macros. These are always checked while, debug-only variants like `debug_assert!" +"` compile to nothing in release builds." msgstr "" -"`assert_ne!` 是這裡的新巨集。此外還有 `assert_eq!` 和 `assert!` 巨集。系統一" -"律會檢查這些巨集,但如果是 `debug_assert!` 這類僅供偵錯的變體,在發布子版本中" -"會編譯為空白內容。" +"`assert_ne!` 是這裡的新巨集。此外還有 `assert_eq!` 和 `assert!` 巨集。系統一律會" +"檢查這些巨集,但如果是 `debug_assert!` 這類僅供偵錯的變體,在發布子版本中會編譯" +"為空白內容。" #: src/tuples-and-arrays/destructuring.md msgid "" @@ -4003,7 +3921,7 @@ 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 "" @@ -4017,26 +3935,26 @@ msgstr "" #: src/tuples-and-arrays/destructuring.md msgid "\"a: {a}, b: {b}\"" -msgstr "" +msgstr "“a: {a}, b: {b}”" #: src/tuples-and-arrays/destructuring.md msgid "" "The patterns used here are \"irrefutable\", meaning that the compiler can " -"statically verify that the value on the right of `=` has the same structure " -"as the pattern." +"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." +"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 "" #: src/tuples-and-arrays/destructuring.md msgid "" "Rust also supports using patterns in conditionals, allowing for equality " -"comparison and destructuring to happen at the same time. This form of " -"pattern matching will be discussed in more detail later." +"comparison and destructuring to happen at the same time. This form of pattern " +"matching will be discussed in more detail later." msgstr "" #: src/tuples-and-arrays/destructuring.md @@ -4060,8 +3978,8 @@ 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` 函式:" +"使用上述程式碼編寫可用用於美化矩陣排版的 `pretty_print` 函式,以及用於轉置矩陣 " +"(將列轉換為欄) 的 `transpose` 函式:" #: src/tuples-and-arrays/exercise.md msgid "Hard-code both functions to operate on 3 × 3 matrices." @@ -4112,17 +4030,17 @@ msgid "" "responsibility for the value, and is also called \"borrowing\". Shared " "references are read-only, and the referenced data cannot change." msgstr "" -"所謂參照,是一種可存取另一值而不對該值負責的方法,也稱為「借用 " -"(borrowing)」。共用的參照僅供唯讀,且其參照的資料無法變更。" +"所謂參照,是一種可存取另一值而不對該值負責的方法,也稱為「借用 (borrowing)」。共" +"用的參照僅供唯讀,且其參照的資料無法變更。" #: src/references/shared.md msgid "" -"A shared reference to a type `T` has type `&T`. A reference value is made " -"with the `&` operator. The `*` operator \"dereferences\" a reference, " -"yielding its value." +"A shared reference to a type `T` has type `&T`. A reference value is made with " +"the `&` operator. The `*` operator \"dereferences\" a reference, yielding its " +"value." msgstr "" -"如果是對 `T` 型別的共用參照,就屬於 `&T` 型別。系統會使用 `&` 運算子建立參照" -"值。`*` 運算子則用於將參照「解除參照」,產生參照的值。" +"如果是對 `T` 型別的共用參照,就屬於 `&T` 型別。系統會使用 `&` 運算子建立參照值。" +"`*` 運算子則用於將參照「解除參照」,產生參照的值。" #: src/references/shared.md msgid "Rust will statically forbid dangling references:" @@ -4132,24 +4050,23 @@ msgstr "Rust 會以靜態方式禁止迷途參照:" msgid "" "A reference is said to \"borrow\" the value it refers to, and this is a good " "model for students not familiar with pointers: code can use the reference to " -"access the value, but is still \"owned\" by the original variable. The " -"course will get into more detail on ownership in day 3." +"access the value, but is still \"owned\" by the original variable. The course " +"will get into more detail on ownership in day 3." msgstr "" -"參照可說是「借用」自身參照的值,對不熟悉指標的學生而言,這是不錯的模型,因為" -"程式碼可以使用參照來存取值,但仍歸原始的變數所「擁有」。本課程將在第 3 天進一" -"步說明擁有權。" +"參照可說是「借用」自身參照的值,對不熟悉指標的學生而言,這是不錯的模型,因為程式" +"碼可以使用參照來存取值,但仍歸原始的變數所「擁有」。本課程將在第 3 天進一步說明" +"擁有權。" #: src/references/shared.md msgid "" -"References are implemented as pointers, and a key advantage is that they can " -"be much smaller than the thing they point to. Students familiar with C or C+" -"+ will recognize references as pointers. Later parts of the course will " -"cover how Rust prevents the memory-safety bugs that come from using raw " -"pointers." +"References are implemented as pointers, and a key advantage is that they can be " +"much smaller than the thing they point to. Students familiar with C or C++ will " +"recognize references as pointers. Later parts of the course will cover how Rust " +"prevents the memory-safety bugs that come from using raw pointers." msgstr "" -"參照需以指標的形式實作,主要優點是大小會比指向的目標小得多。熟悉 C 或 C++ 的" -"學生會覺得參照很像指標。在稍後的課程中,我們將介紹 Rust 如何避免使用原始指標" -"導致的記憶體安全錯誤。" +"參照需以指標的形式實作,主要優點是大小會比指向的目標小得多。熟悉 C 或 C++ 的學生" +"會覺得參照很像指標。在稍後的課程中,我們將介紹 Rust 如何避免使用原始指標導致的記" +"憶體安全錯誤。" #: src/references/shared.md msgid "" @@ -4160,23 +4077,20 @@ 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++." +"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()`)。" #: src/references/shared.md msgid "" -"In this example, `r` is mutable so that it can be reassigned (`r = &b`). " -"Note that this re-binds `r`, so that it refers to something else. This is " -"different from C++, where assignment to a reference changes the referenced " -"value." +"In this example, `r` is mutable so that it can be reassigned (`r = &b`). Note " +"that this re-binds `r`, so that it refers to something else. This is different " +"from C++, where assignment to a reference changes the referenced value." msgstr "" -"這個範例中的 `r` 可變動,因此可以重新指派 (`r = &b`)。請注意,這會重新繫結 " -"`r`,因此會參照其他內容。此方式與 C++ 不同,在 C++ 中,對參照的賦值會變更參照" -"的值。" +"這個範例中的 `r` 可變動,因此可以重新指派 (`r = &b`)。請注意,這會重新繫結 `r`," +"因此會參照其他內容。此方式與 C++ 不同,在 C++ 中,對參照的賦值會變更參照的值。" #: src/references/shared.md msgid "" @@ -4188,13 +4102,13 @@ msgstr "" #: src/references/shared.md msgid "" "Rust is tracking the lifetimes of all references to ensure they live long " -"enough. Dangling references cannot occur in safe Rust. `x_axis` would return " -"a reference to `point`, but `point` will be deallocated when the function " +"enough. Dangling references cannot occur in safe Rust. `x_axis` would return a " +"reference to `point`, but `point` will be deallocated when the function " "returns, so this will not compile." msgstr "" -"Rust 會追蹤所有參照的生命週期,確保其存留時間夠長。在安全的 Rust 中不會發生迷" -"途參照。`x_axis` 會傳回對 `point` 的參照,但在函式傳回時會釋放 `point` ,因此" -"不會編譯。" +"Rust 會追蹤所有參照的生命週期,確保其存留時間夠長。在安全的 Rust 中不會發生迷途" +"參照。`x_axis` 會傳回對 `point` 的參照,但在函式傳回時會釋放 `point` ,因此不會" +"編譯。" #: src/references/shared.md msgid "We will talk more about borrowing when we get to ownership." @@ -4205,19 +4119,17 @@ msgid "" "Exclusive references, also known as mutable references, allow changing the " "value they refer to. They have type `&mut T`." msgstr "" -"專屬參照 (也稱做可變動參照) 允許變更自身參照的值。這類參照屬於 `&mut T` 型" -"別。" +"專屬參照 (也稱做可變動參照) 允許變更自身參照的值。這類參照屬於 `&mut T` 型別。" #: src/references/exclusive.md msgid "" -"\"Exclusive\" means that only this reference can be used to access the " -"value. No other references (shared or exclusive) can exist at the same time, " -"and the referenced value cannot be accessed while the exclusive reference " -"exists. Try making an `&point.0` or changing `point.0` while `x_coord` is " -"alive." +"\"Exclusive\" means that only this reference can be used to access the value. " +"No other references (shared or exclusive) can exist at the same time, and the " +"referenced value cannot be accessed while the exclusive reference exists. Try " +"making an `&point.0` or changing `point.0` while `x_coord` is alive." msgstr "" -"「專屬」表示只有這個參照可用來存取值。任何其他參照 (不論是共用或專屬參照) 都" -"不可以同時存在,此外,在專屬參照存在的情況下,就無法存取參照的值。請嘗試在 " +"「專屬」表示只有這個參照可用來存取值。任何其他參照 (不論是共用或專屬參照) 都不可" +"以同時存在,此外,在專屬參照存在的情況下,就無法存取參照的值。請嘗試在 " "`x_coord` 運作時建立 `&point.0` 或變更 `point.0`。" #: src/references/exclusive.md @@ -4225,33 +4137,30 @@ msgstr "" 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." +"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 ref_x: &i32` 和 `let ref_x: &mut i32` 的差異。前者代表可變動" +"的參照,可綁定至不同的值;後者則代表可變動值的參照。" #: src/references/exercise.md msgid "" -"We will create a few utility functions for 3-dimensional geometry, " -"representing a point as `[f64;3]`. It is up to you to determine the function " -"signatures." +"We will create a few utility functions for 3-dimensional geometry, representing " +"a point as `[f64;3]`. It is up to you to determine the function signatures." msgstr "" -"我們會建立幾個 3D 幾何圖形的公用函式,將點表示為 `[f64;3]`。函式簽章則由您自" -"行決定。" +"我們會建立幾個 3D 幾何圖形的公用函式,將點表示為 `[f64;3]`。函式簽章則由您自行決" +"定。" #: src/references/exercise.md msgid "" "// Calculate the magnitude of a vector by summing the squares of its " "coordinates\n" -"// and taking the square root. Use the `sqrt()` method to calculate the " -"square\n" +"// and taking the square root. Use the `sqrt()` method to calculate the square\n" "// root, like `v.sqrt()`.\n" msgstr "" "// Calculate the magnitude of a vector by summing the squares of its " "coordinates\n" -"// and taking the square root. Use the `sqrt()` method to calculate the " -"square\n" +"// and taking the square root. Use the `sqrt()` method to calculate the square\n" "// root, like `v.sqrt()`.\n" #: src/references/exercise.md @@ -4284,11 +4193,9 @@ msgstr "/// Calculate the magnitude of the given vector.\n" #: src/references/solution.md msgid "" -"/// Change the magnitude of the vector to 1.0 without changing its " -"direction.\n" +"/// Change the magnitude of the vector to 1.0 without changing its direction.\n" msgstr "" -"/// Change the magnitude of the vector to 1.0 without changing its " -"direction.\n" +"/// Change the magnitude of the vector to 1.0 without changing its direction.\n" #: src/user-defined-types.md msgid "[Named Structs](./user-defined-types/named-structs.md) (10 minutes)" @@ -4303,8 +4210,7 @@ msgid "[Enums](./user-defined-types/enums.md) (5 minutes)" msgstr "[列舉](./user-defined-types/enums.md) (5 分鐘)" #: src/user-defined-types.md -msgid "" -"[Static and Const](./user-defined-types/static-and-const.md) (5 minutes)" +msgid "[Static and Const](./user-defined-types/static-and-const.md) (5 minutes)" msgstr "[靜態和常數](./user-defined-types/static-and-const.md) (5 分鐘)" #: src/user-defined-types.md @@ -4312,8 +4218,7 @@ msgid "[Type Aliases](./user-defined-types/aliases.md) (2 minutes)" msgstr "[型別別名](./user-defined-types/aliases.md) (2 分鐘)" #: src/user-defined-types.md -msgid "" -"[Exercise: Elevator Events](./user-defined-types/exercise.md) (15 minutes)" +msgid "[Exercise: Elevator Events](./user-defined-types/exercise.md) (15 minutes)" msgstr "[練習:電梯事件](./user-defined-types/exercise.md) (15 分鐘)" #: src/user-defined-types.md src/borrowing.md @@ -4361,24 +4266,22 @@ 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." +"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." +"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 "" -"針對某些型別實作特徵時,可能會使用大小為零的結構體 `e.g., struct Foo;`,但其" -"中沒有任何需要儲存在值本身的資料。" +"針對某些型別實作特徵時,可能會使用大小為零的結構體 `e.g., struct Foo;`,但其中沒" +"有任何需要儲存在值本身的資料。" #: src/user-defined-types/named-structs.md msgid "" -"The next slide will introduce Tuple structs, used when the field names are " -"not important." +"The next slide will introduce Tuple structs, used when the field names are not " +"important." msgstr "在下一張投影片中,我們會介紹元組結構體,可於欄位名稱不重要時使用。" #: src/user-defined-types/named-structs.md @@ -4391,12 +4294,12 @@ 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." +"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` 語法可讓我們從舊的結構體中複製大部分欄位,而不必明確輸入所有欄位。" -"此元素一律須位於最後。" +"`..peter` 語法可讓我們從舊的結構體中複製大部分欄位,而不必明確輸入所有欄位。此元" +"素一律須位於最後。" #: src/user-defined-types/tuple-structs.md msgid "If the field names are unimportant, you can use a tuple struct:" @@ -4423,10 +4326,9 @@ msgstr "// ...\n" #: src/user-defined-types/tuple-structs.md msgid "" -"Newtypes are a great way to encode additional information about the value in " -"a primitive type, for example:" -msgstr "" -"如要對原始型別中值的額外資訊進行編碼,Newtypes 是絕佳的方式,舉例來說:" +"Newtypes are a great way to encode additional information about the value in a " +"primitive type, for example:" +msgstr "如要對原始型別中值的額外資訊進行編碼,Newtypes 是絕佳的方式,舉例來說:" #: src/user-defined-types/tuple-structs.md msgid "The number is measured in some units: `Newtons` in the example above." @@ -4435,8 +4337,8 @@ 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)`." +"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)\\` 。" @@ -4445,13 +4347,12 @@ msgstr "" msgid "" "Demonstrate how to add a `f64` value to a `Newtons` type by accessing the " "single field in the newtype." -msgstr "" -"示範如何透過存取 newtype 中的單一欄位,將 “f64” 值新增至 `Newtons` 類型。" +msgstr "示範如何透過存取 newtype 中的單一欄位,將 “f64” 值新增至 `Newtons` 類型。" #: src/user-defined-types/tuple-structs.md msgid "" -"Rust generally doesn’t like inexplicit things, like automatic unwrapping or " -"for instance using booleans as integers." +"Rust generally doesn’t like inexplicit things, like automatic unwrapping or for " +"instance using booleans as integers." msgstr "Rust 通常不太能接受不明確的內容,例如自動展開或使用布林值做為整數。" #: src/user-defined-types/tuple-structs.md @@ -4498,17 +4399,16 @@ msgid "" "`Direction` is a type with variants. There are two values of `Direction`: " "`Direction::Left` and `Direction::Right`." msgstr "" -"`Direction` 是含變體的型別,有`Direction::Left` 和 `Direction::Right` 這兩個" -"值。" +"`Direction` 是含變體的型別,有`Direction::Left` 和 `Direction::Right` 這兩個值。" #: src/user-defined-types/enums.md 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." +"`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` 值。" +"`PlayerMove` 是含三種變體的型別。除了酬載之外,Rust 還會儲存判別值,以便在執行階" +"段瞭解哪個變體屬於 `PlayerMove` 值。" #: src/user-defined-types/enums.md #, fuzzy @@ -4518,21 +4418,21 @@ 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)." +"In both, you can have a simple version without fields (unit struct) or one with " +"different types of fields (variant payloads)." 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." +"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." @@ -4545,13 +4445,13 @@ msgstr "如有需要,Rust 會儲存最小所需大小的整數" #: src/user-defined-types/enums.md msgid "" "If the allowed variant values do not cover all bit patterns, it will use " -"invalid bit patterns to encode the discriminant (the \"niche " -"optimization\"). For example, `Option<&u8>` stores either a pointer to an " -"integer or `NULL` for the `None` variant." +"invalid bit patterns to encode the discriminant (the \"niche optimization\"). " +"For example, `Option<&u8>` stores either a pointer to an integer or `NULL` for " +"the `None` variant." msgstr "" "如果允許的變體值未涵蓋所有位元模式,Rust 會使用無效的位元模式來編碼判別值 (即" -"「區位最佳化」)。舉例來說,`Option<&u8>` 可儲存指向整數的指標,也可儲存 " -"`None` 變體適用的 `NULL`。" +"「區位最佳化」)。舉例來說,`Option<&u8>` 可儲存指向整數的指標,也可儲存 `None` " +"變體適用的 `NULL`。" #: src/user-defined-types/enums.md msgid "" @@ -4560,8 +4460,7 @@ msgstr "您可以視需要控制判別值,例如為了與 C 相容:" #: src/user-defined-types/enums.md msgid "" -"Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " -"bytes." +"Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 bytes." msgstr "" "如果沒有 `repr`,判別值型別會需要 2 個位元組,因為 10001 適合 2 個位元組。" @@ -4573,37 +4472,35 @@ msgstr "探索更多內容" #: src/user-defined-types/enums.md msgid "" -"Rust has several optimizations it can employ to make enums take up less " -"space." +"Rust has several optimizations it can employ to make enums take up less space." msgstr "Rust 支援多種最佳化做法,可用於縮減列舉占用的空間。" #: src/user-defined-types/enums.md msgid "" "Null pointer optimization: For [some types](https://doc.rust-lang.org/std/" -"option/#representation), Rust guarantees that `size_of::()` equals " -"`size_of::>()`." +"option/#representation), Rust guarantees that `size_of::()` equals `size_of::" +">()`." msgstr "" "空值指標最佳化:針對[部分型別](https://doc.rust-lang.org/std/option/" "#representation),Rust 保證 `size_of::()` 等於 `size_of::>()`." #: src/user-defined-types/enums.md 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." +"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-and-const.md #, fuzzy msgid "" -"Static and constant variables are two different ways to create globally-" -"scoped values that cannot be moved or reallocated during the execution of " -"the program." +"Static and constant variables are two different ways to create globally-scoped " +"values that cannot be moved or reallocated during the execution of the program." msgstr "" -"靜態和常數變數是建立全域範圍值的兩種不同方式,這個值無法在程式執行期間移動或" -"重新分配。" +"靜態和常數變數是建立全域範圍值的兩種不同方式,這個值無法在程式執行期間移動或重新" +"分配。" #: src/user-defined-types/static-and-const.md msgid "`const`" @@ -4611,25 +4508,25 @@ msgstr "`const`" #: src/user-defined-types/static-and-const.md msgid "" -"Constant variables are evaluated at compile time and their values are " -"inlined wherever they are used:" +"Constant variables are evaluated at compile time and their values are inlined " +"wherever they are used:" msgstr "常數變數會在編譯期間評估,且無論用於何處,其值都會內嵌:" #: src/user-defined-types/static-and-const.md msgid "" -"According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-" -"vs-static.html) these are inlined upon use." +"According to the [Rust RFC Book](https://rust-lang.github.io/rfcs/0246-const-vs-" +"static.html) these are inlined upon use." msgstr "" "根據《[Rust RFC 手冊](https://rust-lang.github.io/rfcs/0246-const-vs-static." "html)》所述,這類值會在使用時內嵌。" #: src/user-defined-types/static-and-const.md msgid "" -"Only functions marked `const` can be called at compile time to generate " -"`const` values. `const` functions can however be called at runtime." +"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/static-and-const.md msgid "`static`" @@ -4653,17 +4550,17 @@ msgstr "\"{BANNER}\"" #: src/user-defined-types/static-and-const.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 " -"associated memory location. This is useful for unsafe and embedded code, and " -"the variable lives through the entirety of the program execution. When a " -"globally-scoped value does not have a reason to need object identity, " -"`const` is generally preferred." +"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 associated " +"memory location. This is useful for unsafe and embedded code, and the variable " +"lives through the entirety of the program execution. When a globally-scoped " +"value does not have a reason to need object identity, `const` is generally " +"preferred." msgstr "" "如《[Rust RFC 手冊](https://rust-lang.github.io/rfcs/0246-const-vs-static." -"html)》所述,這類值在使用時不會內嵌,且具備實際相關聯的記憶體位置。這對不安全" -"和嵌入的程式碼很有幫助,且變數在程式執行全程都會持續運作。當全域範圍值沒有需" -"要物件識別子的理由時,通常首選會是使用 `const`。" +"html)》所述,這類值在使用時不會內嵌,且具備實際相關聯的記憶體位置。這對不安全和" +"嵌入的程式碼很有幫助,且變數在程式執行全程都會持續運作。當全域範圍值沒有需要物件" +"識別子的理由時,通常首選會是使用 `const`。" #: src/user-defined-types/static-and-const.md msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`." @@ -4677,18 +4574,17 @@ msgstr "另一方面,`static` 則更類似於 C++ 中的 `const` 或可變動 #: src/user-defined-types/static-and-const.md msgid "" -"`static` provides object identity: an address in memory and state as " -"required by types with interior mutability such as `Mutex`." +"`static` provides object identity: an address in memory and state as required " +"by types with interior mutability such as `Mutex`." msgstr "" "`static` 提供物件識別子,也就是記憶體中的位址,和具有內部可變動性型別 (例如 " "`Mutex`) 所需的狀態。" #: src/user-defined-types/static-and-const.md msgid "" -"It isn't super common that one would need a runtime evaluated constant, but " -"it is helpful and safer than using a static." -msgstr "" -"需要在執行階段評估常數的情況雖不常見,但這會比使用靜態項目更有用且安全。" +"It isn't super common that one would need a runtime evaluated constant, but it " +"is helpful and safer than using a static." +msgstr "需要在執行階段評估常數的情況雖不常見,但這會比使用靜態項目更有用且安全。" #: src/user-defined-types/static-and-const.md msgid "Properties table:" @@ -4753,15 +4649,15 @@ msgstr "無論在何處使用都會內嵌" #: src/user-defined-types/static-and-const.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." +"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`。內部可變動性則可透過" -"原子或類似的 [`Mutex`](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) 實" +"現。也可能有可變動的靜態項目,但這些需要手動同步,因此每當存取這類項目時就需要動" +"用 `unsafe` 程式碼。我們會在「不安全的 Rust」章節中探討[可變動的靜態項目](../" +"unsafe/mutable-static-variables.md)。" #: src/user-defined-types/static-and-const.md #, fuzzy @@ -4785,27 +4681,24 @@ msgstr "別名在 C 語言的程式設計師眼中類似於 `typedef`。" #: src/user-defined-types/exercise.md msgid "" "We will create a data structure to represent an event in an elevator control " -"system. It is up to you to define the types and functions to construct " -"various events. Use `#[derive(Debug)]` to allow the types to be formatted " -"with `{:?}`." +"system. It is up to you to define the types and functions to construct various " +"events. Use `#[derive(Debug)]` to allow the types to be formatted with `{:?}`." msgstr "" -"我們會建立資料結構,用來代表電梯控制系統中的事件。您可以自行定義類型和函式," -"建構各種事件。請使用 `#[derive(Debug)]` 來允許型別採用 `{:?}` 的格式。" +"我們會建立資料結構,用來代表電梯控制系統中的事件。您可以自行定義類型和函式,建構" +"各種事件。請使用 `#[derive(Debug)]` 來允許型別採用 `{:?}` 的格式。" #: src/user-defined-types/exercise.md 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." +"`main` runs without errors. The next part of the course will cover getting data " +"out of these structures." msgstr "" -"這項練習只需建立及填入資料結構,`main` 就能在不發生錯誤的情況下執行。本課程的" -"下一部分將介紹如何從這些結構中取得資料。" +"這項練習只需建立及填入資料結構,`main` 就能在不發生錯誤的情況下執行。本課程的下" +"一部分將介紹如何從這些結構中取得資料。" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md -msgid "" -"/// An event in the elevator system that the controller must react to.\n" -msgstr "" -"/// An event in the elevator system that the controller must react to.\n" +msgid "/// An event in the elevator system that the controller must react to.\n" +msgstr "/// An event in the elevator system that the controller must react to.\n" #: src/user-defined-types/exercise.md msgid "// TODO: add required variants\n" @@ -4829,11 +4722,9 @@ msgstr "/// The car doors have closed.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "" -"/// A directional button was pressed in an elevator lobby on the given " -"floor.\n" +"/// A directional button was pressed in an elevator lobby on the given floor.\n" msgstr "" -"/// A directional button was pressed in an elevator lobby on the given " -"floor.\n" +"/// A directional button was pressed in an elevator lobby on the given floor.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// A floor button was pressed in the elevator car.\n" @@ -4924,8 +4815,7 @@ msgid "Generics: parameterizing types on other types." msgstr "泛型:在其他型別上將型別參數化。" #: src/welcome-day-2.md -msgid "" -"Standard library types and traits: a tour of Rust's rich standard library." +msgid "Standard library types and traits: a tour of Rust's rich standard library." msgstr "標準程式庫的型別和特徵:一覽 Rust 豐富的標準程式庫。" #: src/welcome-day-2.md @@ -4966,8 +4856,7 @@ msgstr "[Let 控制流程](./pattern-matching/let-control-flow.md) (10 分鐘)" #: src/pattern-matching.md msgid "" -"[Exercise: Expression Evaluation](./pattern-matching/exercise.md) (30 " -"minutes)" +"[Exercise: Expression Evaluation](./pattern-matching/exercise.md) (30 minutes)" msgstr "[練習:運算式求值](./pattern-matching/exercise.md) (30 分鐘)" #: src/pattern-matching.md src/memory-management.md @@ -4977,11 +4866,11 @@ 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." +"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++:" @@ -5046,9 +4935,9 @@ msgstr "" #: src/pattern-matching/match.md 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." +"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 @@ -5058,8 +4947,8 @@ msgid "" "the same type. The type is the last expression of the block, if any. In the " "example above, the type is `()`." msgstr "" -"和 `if let` 一樣,每個比對臂都必須具有相同型別。型別是區塊的最後一個運算式 " -"(如有)。在上述範例中,型別為 `()`。" +"和 `if let` 一樣,每個比對臂都必須具有相同型別。型別是區塊的最後一個運算式 (如" +"有)。在上述範例中,型別為 `()`。" #: src/pattern-matching/match.md msgid "" @@ -5095,22 +4984,21 @@ msgstr "`_` 是萬用字元" #: src/pattern-matching/match.md msgid "" -"Match guards as a separate syntax feature are important and necessary when " -"we wish to concisely express more complex ideas than patterns alone would " -"allow." +"Match guards as a separate syntax feature are important and necessary when we " +"wish to concisely express more complex ideas than patterns alone would allow." msgstr "" -"有些概念比模式本身所允許的更加複雜,如果我們希望簡要地表達這些想法,就必須把" -"配對守衛視為獨立的語法功能。" +"有些概念比模式本身所允許的更加複雜,如果我們希望簡要地表達這些想法,就必須把配對" +"守衛視為獨立的語法功能。" #: src/pattern-matching/match.md msgid "" -"They are not the same as separate `if` expression inside of the match arm. " -"An `if` expression inside of the branch block (after `=>`) happens after the " -"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." +"They are not the same as separate `if` expression inside of the match arm. An " +"`if` expression inside of the branch block (after `=>`) happens after the 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` 條件失敗,系統也不會考量原始 " +"這與配對分支內的個別 `if` 運算式不同。分支區塊中的 `if` 運算式 (位於 `=>` 之後) " +"會在選取配對分支後發生。即使該區塊內的 `if` 條件失敗,系統也不會考量原始 " "`match` 運算式的其他分支。" #: src/pattern-matching/match.md @@ -5142,11 +5030,11 @@ msgstr "\"y = {y}, other fields were ignored\"" #: src/pattern-matching/destructuring.md msgid "" "Patterns can also be used to bind variables to parts of your values. This is " -"how you inspect the structure of your types. Let us start with a simple " -"`enum` type:" +"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\"" @@ -5163,11 +5051,11 @@ msgstr "\"sorry, an error happened: {msg}\"" #: src/pattern-matching/destructuring.md msgid "" "Here we have used the arms to _destructure_ the `Result` value. In the first " -"arm, `half` is bound to the value inside the `Ok` variant. In the second " -"arm, `msg` is bound to the error message." +"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." @@ -5183,13 +5071,13 @@ 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`." +"The `if`/`else` expression is returning an enum that is later unpacked with a " +"`match`." msgstr "`if`/`else` 運算式會傳回列舉,之後列舉會透過 `match` 解除封裝。" #: src/pattern-matching/destructuring.md @@ -5198,8 +5086,8 @@ 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 @@ -5207,8 +5095,8 @@ msgid "" "The values in the enum variants can only be accessed after being pattern " "matched." msgstr "" -"只有在與模式配對相符後,才能存取列舉變數中的值。此模式會將參照繫結至 `=>` 後" -"方「配對分支」中的欄位。" +"只有在與模式配對相符後,才能存取列舉變數中的值。此模式會將參照繫結至 `=>` 後方" +"「配對分支」中的欄位。" #: src/pattern-matching/destructuring.md #, fuzzy @@ -5216,29 +5104,28 @@ 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 "" -"Save the result of `divide_in_two` in the `result` variable and `match` it " -"in a loop. That won't compile because `msg` is consumed when matched. To fix " -"it, match `&result` instead of `result`. That will make `msg` a reference so " -"it won't be consumed. This [\"match ergonomics\"](https://rust-lang.github." -"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." +"Save the result of `divide_in_two` in the `result` variable and `match` it in a " +"loop. That won't compile because `msg` is consumed when matched. To fix it, " +"match `&result` instead of `result`. That will make `msg` a reference so it " +"won't be consumed. This [\"match ergonomics\"](https://rust-lang.github.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`。" +"將 `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 "" -"Rust has a few control flow constructs which differ from other languages. " -"They are used for pattern matching:" +"Rust has a few control flow constructs which differ from other languages. They " +"are used for pattern matching:" msgstr "Rust 的某些控制流程結構與其他程式語言不同。這些結構會用於模式配對:" #: src/pattern-matching/let-control-flow.md @@ -5272,14 +5159,14 @@ msgstr "`let else` 運算式" #: src/pattern-matching/let-control-flow.md msgid "" -"For the common case of matching a pattern and returning from the function, " -"use [`let else`](https://doc.rust-lang.org/rust-by-example/flow_control/" -"let_else.html). The \"else\" case must diverge (`return`, `break`, or panic " -"- anything but falling off the end of the block)." +"For the common case of matching a pattern and returning from the function, use " +"[`let else`](https://doc.rust-lang.org/rust-by-example/flow_control/let_else." +"html). The \"else\" case must diverge (`return`, `break`, or panic - anything " +"but falling off the end of the block)." msgstr "" "如果是要配對模式並從函式傳回的常見情況,請使用 [`let else`](https://doc.rust-" -"lang.org/rust-by-example/flow_control/let_else.html)。如果是「其他」情況,則" -"必須發散 (`return`、`break` 或恐慌,也就是落在區塊結尾之外的任何情況)。" +"lang.org/rust-by-example/flow_control/let_else.html)。如果是「其他」情況,則必須" +"發散 (`return`、`break` 或恐慌,也就是落在區塊結尾之外的任何情況)。" #: src/pattern-matching/let-control-flow.md msgid "\"got None\"" @@ -5298,8 +5185,8 @@ msgid "\"result: {:?}\"" msgstr "\"result: {:?}\"" #: src/pattern-matching/let-control-flow.md src/generics/trait-bounds.md -#: src/smart-pointers/solution.md src/testing/solution.md -#: src/android/testing.md src/android/testing/googletest.md +#: src/smart-pointers/solution.md src/testing/solution.md src/android/testing.md +#: src/android/testing/googletest.md msgid "\"foo\"" msgstr "\"foo\"" @@ -5310,20 +5197,19 @@ msgid "" "repeatedly tests a value against a pattern:" msgstr "" "和 `if let` 的情況一樣,有一個 [`while let`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#predicate-pattern-loops) 變數可針對模式" -"重複測試值:" +"reference/expressions/loop-expr.html#predicate-pattern-loops) 變數可針對模式重複" +"測試值:" #: 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." +"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 "" -"`v.iter()` 傳回的疊代器會在每次呼叫 `next()` 時傳回 `Option`。疊代器會在" -"完成後才傳回 `Some(x)`,之後則會傳回 `None`。`while let` 可讓我們持續疊代所有" -"項目。" +"`v.iter()` 傳回的疊代器會在每次呼叫 `next()` 時傳回 `Option`。疊代器會在完" +"成後才傳回 `Some(x)`,之後則會傳回 `None`。`while let` 可讓我們持續疊代所有項" +"目。" #: src/pattern-matching/let-control-flow.md msgid "if-let" @@ -5332,8 +5218,8 @@ 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`." +"Unlike `match`, `if let` does not have to cover all branches. This can make it " +"more concise than `match`." msgstr "與 `match` 不同,`if let` 不會為模式比對支援成立條件子句。" #: src/pattern-matching/let-control-flow.md @@ -5351,12 +5237,12 @@ msgstr "let-else" #: src/pattern-matching/let-control-flow.md 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." +"`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:" @@ -5375,12 +5261,12 @@ 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." +"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 "" -"您可以將 `while let` 迴圈重寫為無限迴圈,並加上會在無法為 `iter.next()` 取消" -"包裝值的情況下結束的 if 陳述式。`while let` 可為上述情況提供語法糖。" +"您可以將 `while let` 迴圈重寫為無限迴圈,並加上會在無法為 `iter.next()` 取消包裝" +"值的情況下結束的 if 陳述式。`while let` 可為上述情況提供語法糖。" #: src/pattern-matching/exercise.md msgid "Let's write a simple recursive evaluator for arithmetic expressions." @@ -5388,8 +5274,8 @@ msgstr "我們現在要為算術運算式編寫簡單的遞迴評估器。" #: src/pattern-matching/exercise.md 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 " +"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 "" @@ -5401,9 +5287,8 @@ msgstr "" msgid "" "Some expressions cannot be evaluated and will return an error. The standard " "[`Result`](https://doc.rust-lang.org/std/result/enum.Result." -"html) type is an enum that represents either a successful value " -"(`Ok(Value)`) or an error (`Err(String)`). We will cover this type in detail " -"later." +"html) type is an enum that represents either a successful value (`Ok(Value)`) " +"or an error (`Err(String)`). We will cover this type in detail later." msgstr "" "部分運算式無法求值,且會傳回錯誤。標準 [`Result`](https://doc." "rust-lang.org/std/result/enum.Result.html) 型別是一種列舉,用於表示成功值 " @@ -5412,13 +5297,13 @@ msgstr "" #: src/pattern-matching/exercise.md msgid "" "Copy and paste the code into the Rust playground, and begin implementing " -"`eval`. The final product should pass the tests. It may be helpful to use " -"`todo!()` and get the tests to pass one-by-one. You can also skip a test " -"temporarily with `#[ignore]`:" +"`eval`. The final product should pass the tests. It may be helpful to use `todo!" +"()` and get the tests to pass one-by-one. You can also skip a test temporarily " +"with `#[ignore]`:" msgstr "" -"請複製程式碼並貼到 Rust Playground,然後開始實作 `eval`。最終成品應會通過測" -"試。使用 `todo!()` 讓測試逐一通過可能有所幫助,但您也可以使用 `#[ignore]` 暫" -"時略過測試:" +"請複製程式碼並貼到 Rust Playground,然後開始實作 `eval`。最終成品應會通過測試。" +"使用 `todo!()` 讓測試逐一通過可能有所幫助,但您也可以使用 `#[ignore]` 暫時略過測" +"試:" #: src/pattern-matching/exercise.md msgid "" @@ -5465,16 +5350,14 @@ msgid "[Deriving](./methods-and-traits/deriving.md) (3 minutes)" msgstr "[衍生](./methods-and-traits/deriving.md) (3 分鐘)" #: src/methods-and-traits.md -msgid "" -"[Exercise: Generic Logger](./methods-and-traits/exercise.md) (20 minutes)" +msgid "[Exercise: Generic Logger](./methods-and-traits/exercise.md) (20 minutes)" msgstr "[練習:泛型 Logger](./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` 區塊來執行這項操作:" +"Rust allows you to associate functions with your new types. You do this with an " +"`impl` block:" +msgstr "Rust 可讓您將函式與新型別建立關聯。您可以使用 `impl` 區塊來執行這項操作:" #: src/methods-and-traits/methods.md msgid "// No receiver, a static method\n" @@ -5515,8 +5398,8 @@ msgstr "// race.add_lap(42);\n" #: 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:" +"The `self` arguments specify the \"receiver\" - the object the method acts on. " +"There are several common receivers for a method:" msgstr "" "上述的 `&self` 表示方法會以不可變的方式借用物件。以下是其他可能的方法接收器:" @@ -5542,9 +5425,9 @@ 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 @@ -5568,17 +5451,17 @@ 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 "" "Developers may choose to use methods to take advantage of method receiver " -"syntax and to help keep them more organized. By using methods we can keep " -"all the implementation code in one predictable place." +"syntax and to help keep them more organized. By using methods we can keep all " +"the implementation code in one predictable place." msgstr "" -"開發人員可以選擇透過方法來充分利用方法接收器語法,以更有條理的方式進行整理。" -"藉由使用方法,我們可以將所有實作程式碼存放在可預測的位置。" +"開發人員可以選擇透過方法來充分利用方法接收器語法,以更有條理的方式進行整理。藉由" +"使用方法,我們可以將所有實作程式碼存放在可預測的位置。" #: src/methods-and-traits/methods.md msgid "Point out the use of the keyword `self`, a method receiver." @@ -5586,14 +5469,14 @@ 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." +"Show that it is an abbreviated term for `self: Self` and perhaps show how the " +"struct name could also be used." msgstr "說明 `self` 是 `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." +"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` 區塊所屬型別的型別別名,可用於該區塊的其他位置。" #: src/methods-and-traits/methods.md @@ -5601,27 +5484,26 @@ 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." +"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 兩次即可。" #: src/methods-and-traits/methods.md 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`." +"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`。" +"除了 `self` 的變體以外,您還可以使用[特殊的包裝函式型別](https://doc.rust-lang." +"org/reference/special-types-and-traits.html)做為接收器型別,例如 `Box`。" #: src/methods-and-traits/traits.md msgid "" @@ -5638,20 +5520,19 @@ msgstr "" #: src/methods-and-traits/traits.md msgid "" -"A trait defines a number of methods that types must have in order to " -"implement the trait." +"A trait defines a number of methods that types must have in order to implement " +"the trait." msgstr "特徵用於定義型別必須具有哪幾個方法,才能實作該特徵。" #: src/methods-and-traits/traits.md msgid "" -"In the \"Generics\" segment, next, we will see how to build functionality " -"that is generic over all types implementing a trait." +"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 -#, fuzzy msgid "Implementing Traits" -msgstr "實作不安全的特徵" +msgstr "實作特徵" #: src/methods-and-traits/traits/implementing.md msgid "\"Oh you're a cutie! What's your name? {}\"" @@ -5670,28 +5551,27 @@ msgstr "\"Fido\"" #: src/methods-and-traits/traits/implementing.md #, fuzzy msgid "" -"To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` " -"block." +"To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` block." msgstr "特徵會在 `impl for { .. }` 區塊中實作。" #: src/methods-and-traits/traits/implementing.md msgid "" -"Unlike Go interfaces, just having matching methods is not enough: a `Cat` " -"type with a `talk()` method would not automatically satisfy `Pet` unless it " -"is in an `impl Pet` block." +"Unlike Go interfaces, just having matching methods is not enough: a `Cat` type " +"with a `talk()` method would not automatically satisfy `Pet` unless it is in an " +"`impl Pet` block." msgstr "" #: src/methods-and-traits/traits/implementing.md 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`." +"implementations can rely on all the methods of the trait. In this case, `greet` " +"is provided, and relies on `talk`." msgstr "" #: src/methods-and-traits/traits/associated-types.md msgid "" -"Associated types allow are placeholder types which are filled in by the " -"trait implementation." +"Associated types allow are placeholder types which are filled in by the trait " +"implementation." msgstr "" #: src/methods-and-traits/traits/associated-types.md @@ -5744,13 +5624,13 @@ msgstr "" #: src/methods-and-traits/exercise.md msgid "" "Let's design a simple logging utility, using a trait `Logger` with a `log` " -"method. Code which might log its progress can then take an `&impl Logger`. " -"In testing, this might put messages in the test logfile, while in a " -"production build it would send messages to a log server." +"method. Code which might log its progress can then take an `&impl Logger`. In " +"testing, this might put messages in the test logfile, while in a production " +"build it would send messages to a log server." msgstr "" -"我們來設計一個簡單的記錄公用程式,使用 `Logger` 特徵搭配 `log` 方法。如果程式" -"碼可能會記錄相關進度,就可以採用 `&impl Logger`。在測試過程中,這可能會將訊息" -"置於測試記錄檔中;而在實際版本中,則會將訊息傳送至記錄伺服器。" +"我們來設計一個簡單的記錄公用程式,使用 `Logger` 特徵搭配 `log` 方法。如果程式碼" +"可能會記錄相關進度,就可以採用 `&impl Logger`。在測試過程中,這可能會將訊息置於" +"測試記錄檔中;而在實際版本中,則會將訊息傳送至記錄伺服器。" #: src/methods-and-traits/exercise.md msgid "" @@ -5764,11 +5644,11 @@ msgstr "" #: src/methods-and-traits/exercise.md msgid "" "This is a common pattern: a struct wrapping a trait implementation and " -"implementing that same trait, adding behavior in the process. What other " -"kinds of wrappers might be useful in a logging utility?" +"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" @@ -5817,11 +5697,11 @@ 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." +"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 支援泛型 (Generics),因此可以將一個演算法 (例如:排序) 抽象化而不需要依" -"賴特定型別。" +"Rust 支援泛型 (Generics),因此可以將一個演算法 (例如:排序) 抽象化而不需要依賴特" +"定型別。" #: src/generics/generic-functions.md msgid "/// Pick `even` or `odd` depending on the value of `n`.\n" @@ -5845,32 +5725,31 @@ msgstr "\"cat\"" #: src/generics/generic-functions.md msgid "" -"Rust infers a type for T based on the types of the arguments and return " -"value." +"Rust infers a type for T based on the types of the arguments and return value." msgstr "Rust 會根據引數型別和傳回的值來推斷 T 的型別。" #: src/generics/generic-functions.md msgid "" "This is similar to C++ templates, but Rust partially compiles the generic " -"function immediately, so that function must be valid for all types matching " -"the constraints. For example, try modifying `pick` to return `even + odd` if " -"`n == 0`. Even if only the `pick` instantiation with integers is used, Rust " -"still considers it invalid. C++ would let you do this." +"function immediately, so that function must be valid for all types matching the " +"constraints. For example, try modifying `pick` to return `even + odd` if `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++ 模板 (template) 類似,但 Rust 會立即對泛型函式進行部分編譯,因此函式" -"必須適用於所有符合限制條件的型別。舉例來說,如果 `n == 0`,請嘗試修改 `pick` " -"以傳回 `even + odd`。即使只使用具有整數的 `pick` 建立例項,Rust 仍會將其視為" -"無效。但 C++ 就能讓您這麼做。" +"這與 C++ 模板 (template) 類似,但 Rust 會立即對泛型函式進行部分編譯,因此函式必" +"須適用於所有符合限制條件的型別。舉例來說,如果 `n == 0`,請嘗試修改 `pick` 以傳" +"回 `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." +"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:" @@ -5890,17 +5769,16 @@ msgstr "\"coords: {:?}\"" #: src/generics/generic-data.md msgid "" -"_Q:_ Why `T` is specified twice in `impl Point {}`? Isn't that " -"redundant?" +"_Q:_ Why `T` is specified twice in `impl Point {}`? Isn't that redundant?" msgstr "_問題:_ 為什麼 `T` 在 `impl Point {}` 中重複出現了兩次?" #: src/generics/generic-data.md msgid "" -"This is because it is a generic implementation section for generic type. " -"They are independently generic." +"This is because it is a generic implementation section for generic type. They " +"are independently generic." msgstr "" -"因為這是一個泛型型別 `T` 的 `Point` 實作,而 `Point` 的型別為泛型 `T`。它們是" -"各自獨立的泛型。" +"因為這是一個泛型型別 `T` 的 `Point` 實作,而 `Point` 的型別為泛型 `T`。它們是各" +"自獨立的泛型。" #: src/generics/generic-data.md msgid "It means these methods are defined for any `T`." @@ -5922,18 +5800,17 @@ msgstr "" #: src/generics/generic-data.md msgid "" "Try declaring a new variable `let p = Point { x: 5, y: 10.0 };`. Update the " -"code to allow points that have elements of different types, by using two " -"type variables, e.g., `T` and `U`." +"code to allow points that have elements of different types, by using two type " +"variables, e.g., `T` and `U`." msgstr "" -"請嘗試宣告新變數 `let p = Point { x: 5, y: 10.0 };`。您可以使用兩種型別變數來" -"更新程式碼,允許含有不同型別元素的點,例如:`T` 和 `U`。" +"請嘗試宣告新變數 `let p = Point { x: 5, y: 10.0 };`。您可以使用兩種型別變數來更" +"新程式碼,允許含有不同型別元素的點,例如:`T` 和 `U`。" #: 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 "" -"使用泛型時,您通常會需要該型別實作 某些特徵,這樣才能呼叫該特徵的方法。" +msgstr "使用泛型時,您通常會需要該型別實作 某些特徵,這樣才能呼叫該特徵的方法。" #: src/generics/trait-bounds.md msgid "You can do this with `T: Trait` or `impl Trait`:" @@ -5969,19 +5846,18 @@ msgstr "這個子句具有額外功能,因此效能也更強大。" #: src/generics/trait-bounds.md msgid "" -"If someone asks, the extra feature is that the type on the left of \":\" can " -"be arbitrary, like `Option`." +"If someone asks, the extra feature is that the type on the left of \":\" can be " +"arbitrary, like `Option`." msgstr "" -"如果有人提問,請說明額外功能是指 \":\" 左側的類別可為任意值,例如 " -"`Option`。" +"如果有人提問,請說明額外功能是指 \":\" 左側的類別可為任意值,例如 `Option`。" #: src/generics/trait-bounds.md msgid "" "Note that Rust does not (yet) support specialization. For example, given the " "original `duplicate`, it is invalid to add a specialized `duplicate(a: u32)`." msgstr "" -"請注意,Rust 尚不支援特化。舉例來說,對於原始的 `duplicate`,您無法新增特化" -"的 `duplicate(a: u32)`。" +"請注意,Rust 尚不支援特化。舉例來說,對於原始的 `duplicate`,您無法新增特化的 " +"`duplicate(a: u32)`。" #: src/generics/impl-trait.md msgid "" @@ -6012,8 +5888,8 @@ 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." +"`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` 的涵義會因使用位置而有些微不同。" #: src/generics/impl-trait.md @@ -6028,38 +5904,37 @@ msgid "" "implements the trait, without naming the type. This can be useful when you " "don't want to expose the concrete type in a public API." msgstr "" -"對回傳型別來說,`impl Trait` 代表回傳型別就是實作特徵的 某些具體型別,因而不" -"必指名特定型別。如果您不想在公用 API 中公開具體型別, 這就非常有用。" +"對回傳型別來說,`impl Trait` 代表回傳型別就是實作特徵的 某些具體型別,因而不必指" +"名特定型別。如果您不想在公用 API 中公開具體型別, 這就非常有用。" #: src/generics/impl-trait.md msgid "" -"Inference is hard in return position. A function returning `impl Foo` picks " -"the concrete type it returns, without writing it out in the source. A " -"function returning a generic type like `collect() -> B` can return any " -"type satisfying `B`, and the caller may need to choose one, such as with " -"`let x: Vec<_> = foo.collect()` or with the turbofish, `foo.collect::" -">()`." +"Inference is hard in return position. A function returning `impl Foo` picks the " +"concrete type it returns, without writing it out in the source. A function " +"returning a generic type like `collect() -> B` can return any type " +"satisfying `B`, and the caller may need to choose one, such as with `let x: " +"Vec<_> = foo.collect()` or with the turbofish, `foo.collect::>()`." msgstr "" -"在回傳位置進行推論並不容易。回傳 `impl Foo` 的函式 會挑選自身回傳的具體型別," -"而不必在來源中寫出此資訊。回傳泛型型別 (例如 `collect() -> B`) 的函式則可" -"回傳 符合 `B` 的任何型別 ,而呼叫端可能需要選擇一個型別,例如使用 `let x: " -"Vec<_> = foo.collect()` 或 Turbofish:`foo.collect::>()`。" +"在回傳位置進行推論並不容易。回傳 `impl Foo` 的函式 會挑選自身回傳的具體型別,而" +"不必在來源中寫出此資訊。回傳泛型型別 (例如 `collect() -> B`) 的函式則可回傳 " +"符合 `B` 的任何型別 ,而呼叫端可能需要選擇一個型別,例如使用 `let x: Vec<_> = " +"foo.collect()` 或 Turbofish:`foo.collect::>()`。" #: src/generics/impl-trait.md msgid "" -"What is the type of `debuggable`? Try `let debuggable: () = ..` to see what " -"the error message shows." +"What is the type of `debuggable`? Try `let debuggable: () = ..` to see what the " +"error message shows." msgstr "" -"思考一下,`debuggable` 的型別為何?您可以嘗試使用 `let debuggable: () = ..` " -"查看錯誤訊息顯示的內容。" +"思考一下,`debuggable` 的型別為何?您可以嘗試使用 `let debuggable: () = ..` 查看" +"錯誤訊息顯示的內容。" #: src/generics/exercise.md msgid "" "In this short exercise, you will implement a generic `min` function that " "determines the minimum of two values, using a `LessThan` trait." msgstr "" -"在這個簡短練習中,您將使用 `LessThan` 特徵實作泛型 `min` 函式,藉此判定兩個值" -"中的最小值。" +"在這個簡短練習中,您將使用 `LessThan` 特徵實作泛型 `min` 函式,藉此判定兩個值中" +"的最小值。" #: src/generics/exercise.md src/generics/solution.md msgid "/// Return true if self is less than other.\n" @@ -6132,34 +6007,33 @@ msgid "" "For each of the slides in this section, spend some time reviewing the " "documentation pages, highlighting some of the more common methods." 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." +"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`." +"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." +"`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 "" @@ -6168,8 +6042,7 @@ msgid "" msgstr "`alloc` 包括需要全域堆積配置器的型別,例如 `Vec`、`Box` 和 `Arc`。" #: src/std-types/std.md -msgid "" -"Embedded Rust applications often only use `core`, and sometimes `alloc`." +msgid "Embedded Rust applications often only use `core`, and sometimes `alloc`." msgstr "嵌入式 Rust 應用程式通常只使用 `core`,偶爾會使用 `alloc`。" #: src/std-types/docs.md @@ -6182,26 +6055,25 @@ 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))," +"如果你想提早跳出迴圈,可以使用 [`break`]((https://doc.rust-lang.org/reference/" +"expressions/loop-expr.html#break-expressions))," #: src/std-types/docs.md msgid "" -"Primitive types like [`u8`](https://doc.rust-lang.org/stable/std/primitive." -"u8.html)." +"Primitive types like [`u8`](https://doc.rust-lang.org/stable/std/primitive.u8." +"html)." msgstr "" -"基本型別,例如 [`u8`](https://doc.rust-lang.org/stable/std/primitive.u8." -"html)。" +"基本型別,例如 [`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)." +"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)" +"[`str`](https://doc.rust-lang.org/std/primitive.str.html) 和 [`String`](https://" +"doc.rust-lang.org/std/string/struct.String.html)" #: src/std-types/docs.md msgid "In fact, you can document your own code:" @@ -6209,13 +6081,11 @@ msgstr "您其實可以將程式碼記錄下來:" #: src/std-types/docs.md msgid "" -"/// Determine whether the first argument is divisible by the second " -"argument.\n" +"/// Determine whether the first argument is divisible by the second argument.\n" "///\n" "/// If the second argument is zero, the result is false.\n" msgstr "" -"/// Determine whether the first argument is divisible by the second " -"argument.\n" +"/// Determine whether the first argument is divisible by the second argument.\n" "///\n" "/// If the second argument is zero, the result is false.\n" @@ -6223,38 +6093,34 @@ msgstr "" 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." +"(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,都會使用 [rustdoc]" -"(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) 工具自動記錄於 " -"[`docs.rs`](https://docs.rs) 中。這種記錄 API 中所有公開項目的模式是慣用做" -"法。" +"(https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) 工具自動記錄於 [`docs." +"rs`](https://docs.rs) 中。這種記錄 API 中所有公開項目的模式是慣用做法。" #: src/std-types/docs.md msgid "" -"To document an item from inside the item (such as inside a module), use `//!" -"` or `/*! .. */`, called \"inner doc comments\":" +"To document an item from inside the item (such as inside a module), use `//!` " +"or `/*! .. */`, called \"inner doc comments\":" msgstr "" "如要從項目內部 (例如在模組內) 記錄項目,請使用 `//!` 或 `/*! .. */`,這也稱做" "「內部文件註解」:" #: src/std-types/docs.md msgid "" -"//! This module contains functionality relating to divisibility of " -"integers.\n" +"//! This module contains functionality relating to divisibility of integers.\n" msgstr "" -"//! This module contains functionality relating to divisibility of " -"integers.\n" +"//! This module contains functionality relating to divisibility of integers.\n" #: src/std-types/docs.md #, fuzzy msgid "" -"Show students the generated docs for the `rand` crate at ." +"Show students the generated docs for the `rand` crate at ." msgstr "" -"向學生展示針對 `rand` Crate 產生的文件,路徑如下:[`docs.rs/rand`](https://" -"docs.rs/rand)。" +"向學生展示針對 `rand` Crate 產生的文件,路徑如下:[`docs.rs/rand`](https://docs." +"rs/rand)。" #: src/std-types/option.md #, fuzzy @@ -6263,13 +6129,13 @@ msgstr "例外狀況" #: src/std-types/option.md msgid "" -"We have already seen some use of `Option`. It stores either a value of " -"type `T` or nothing. For example, [`String::find`](https://doc.rust-lang.org/" -"stable/std/string/struct.String.html#method.find) returns an `Option`." +"We have already seen some use of `Option`. It stores either a value of 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\"" @@ -6305,8 +6171,7 @@ msgstr "" #: src/std-types/option.md msgid "" -"You can panic on None, but you can't \"accidentally\" forget to check for " -"None." +"You can panic on None, but you can't \"accidentally\" forget to check for None." msgstr "您可以讓程式在 None 發生恐慌,但不能「因錯而」忘記檢查 None。" #: src/std-types/option.md @@ -6314,13 +6179,13 @@ msgid "" "It's common to `unwrap`/`expect` all over the place when hacking something " "together, but production code typically handles `None` in a nicer fashion." msgstr "" -"如果是要設計某些臨時程式,通常會在各處 `unwrap`/`expect`,但實際運作的程式碼" -"一般會以較好的方式處理 `None`。" +"如果是要設計某些臨時程式,通常會在各處 `unwrap`/`expect`,但實際運作的程式碼一般" +"會以較好的方式處理 `None`。" #: src/std-types/option.md msgid "" -"The niche optimization means that `Option` often has the same size in " -"memory as `T`." +"The niche optimization means that `Option` often has the same size in memory " +"as `T`." msgstr "所謂區位最佳化,代表 `Option` 的記憶體大小通常與 `T` 相同。" #: src/std-types/result.md @@ -6330,13 +6195,13 @@ msgstr "結果" #: src/std-types/result.md msgid "" "`Result` is similar to `Option`, but indicates the success or failure of an " -"operation, each with a different type. This is similar to the `Res` defined " -"in the expression exercise, but generic: `Result` where `T` is used in " -"the `Ok` variant and `E` appears in the `Err` variant." +"operation, each with a different type. This is similar to the `Res` defined in " +"the expression exercise, but generic: `Result` where `T` is used in the " +"`Ok` variant and `E` appears in the `Err` variant." msgstr "" -"`Result` 和 `Option` 類似,但會指出作業成功或失敗,且各自都有不同的型別。雖然" -"和運算式練習中定義的 `Res` 很像,但這屬於泛型,也就是 `Result`,其中 " -"`T` 用於 `Ok` 變體,而 `E` 則會出現在 `Err` 變數中。" +"`Result` 和 `Option` 類似,但會指出作業成功或失敗,且各自都有不同的型別。雖然和" +"運算式練習中定義的 `Res` 很像,但這屬於泛型,也就是 `Result`,其中 `T` 用" +"於 `Ok` 變體,而 `E` 則會出現在 `Err` 變數中。" #: src/std-types/result.md msgid "\"diary.txt\"" @@ -6357,28 +6222,28 @@ msgstr "\"The diary could not be opened: {err}\"" #: src/std-types/result.md msgid "" "As with `Option`, the successful value sits inside of `Result`, forcing the " -"developer to explicitly extract it. This encourages error checking. In the " -"case where an error should never happen, `unwrap()` or `expect()` can be " -"called, and this is a signal of the developer intent too." +"developer to explicitly extract it. This encourages error checking. In the case " +"where an error should never happen, `unwrap()` or `expect()` can be called, and " +"this is a signal of the developer intent too." msgstr "" -"就跟使用 `Option` 一樣,成功的值會在 Result 內部,這會強制開發人員明確擷取該" -"值,進而有利於檢查錯誤。在應該絕對不會發生錯誤的情況下,可以呼叫 `unwrap()` " -"或 `expect()`,這也是開發人員意圖的訊號。" +"就跟使用 `Option` 一樣,成功的值會在 Result 內部,這會強制開發人員明確擷取該值," +"進而有利於檢查錯誤。在應該絕對不會發生錯誤的情況下,可以呼叫 `unwrap()` 或 " +"`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 " -"that help functional-style programming." +"`Result` documentation is a recommended read. Not during the course, but it is " +"worth mentioning. It contains a lot of convenience methods and functions that " +"help functional-style programming." msgstr "" -"建議您參閱 `Result` 說明文件。這不涵蓋在課程內,但值得一提。這份文件收錄許多" -"方便的方法和函式,有助於您進行函式程式設計。" +"建議您參閱 `Result` 說明文件。這不涵蓋在課程內,但值得一提。這份文件收錄許多方便" +"的方法和函式,有助於您進行函式程式設計。" #: src/std-types/result.md msgid "" -"`Result` is the standard type to implement error handling as we will see on " -"Day 3." +"`Result` is the standard type to implement error handling as we will see on Day " +"3." msgstr "`Result` 是實作錯誤處理的標準型別,我們將在第 3 天的課程中介紹。" #: src/std-types/string.md @@ -6390,8 +6255,8 @@ msgid "" "[`String`](https://doc.rust-lang.org/std/string/struct.String.html) is the " "standard heap-allocated growable UTF-8 string buffer:" msgstr "" -"[`String`](https://doc.rust-lang.org/std/string/struct.String.html) 是標準堆" -"積配置的可成長 UTF-8 字串緩衝區:" +"[`String`](https://doc.rust-lang.org/std/string/struct.String.html) 是標準堆積配" +"置的可成長 UTF-8 字串緩衝區:" #: src/std-types/string.md src/std-traits/read-and-write.md #: src/memory-management/review.md src/testing/unit-tests.md @@ -6422,39 +6287,39 @@ msgstr "\"s3: len = {}, number of chars = {}\"" #: src/std-types/string.md msgid "" "`String` implements [`Deref`](https://doc.rust-lang.org/std/" -"string/struct.String.html#deref-methods-str), which means that you can call " -"all `str` methods on a `String`." +"string/struct.String.html#deref-methods-str), which means that you can call all " +"`str` methods on a `String`." msgstr "" "`String` 會實作 [`Deref`](https://doc.rust-lang.org/std/string/" -"struct.String.html#deref-methods-str)。也就是說,您可以在 `String` 上呼叫所" -"有 `str` 方法。" +"struct.String.html#deref-methods-str)。也就是說,您可以在 `String` 上呼叫所有 " +"`str` 方法。" #: src/std-types/string.md 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." +"`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`。" #: 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)." +"`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 msgid "" "`String::chars` returns an iterator over the actual characters. Note that a " -"`char` can be different from what a human will consider a \"character\" due " -"to [grapheme clusters](https://docs.rs/unicode-segmentation/latest/" +"`char` can be different from what a human will consider a \"character\" due 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 "" @@ -6467,8 +6332,8 @@ 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 msgid "" @@ -6478,11 +6343,11 @@ msgstr "我們尚未討論 `Deref` 特徵,因此目前主要會講解說明文 #: src/std-types/string.md msgid "" -"`String` implements `Deref` which transparently gives it " -"access to `str`'s methods." +"`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 @@ -6495,8 +6360,8 @@ 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`:" @@ -6504,23 +6369,22 @@ 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." +"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` 代表是否出界。" #: src/std-types/string.md msgid "" -"To a substring by using `s3[0..4]`, where that slice is on character " -"boundaries or not." +"To a substring by using `s3[0..4]`, where that slice is on character boundaries " +"or not." msgstr "使用 `s3[0..4]` 變為子字串,其中該切片會位於字元邊界上,也可能不會。" #: src/std-types/string.md msgid "" -"Many types can be converted to a string with the [`to_string`](https://doc." -"rust-lang.org/std/string/trait.ToString.html#tymethod.to_string) method. " -"This trait is automatically implemented for all types that implement " -"`Display`, so anything that can be formatted can also be converted to a " -"string." +"Many types can be converted to a string with the [`to_string`](https://doc.rust-" +"lang.org/std/string/trait.ToString.html#tymethod.to_string) method. This trait " +"is automatically implemented for all types that implement `Display`, so " +"anything that can be formatted can also be converted to a string." msgstr "" #: src/std-types/vec.md @@ -6528,8 +6392,8 @@ msgid "" "[`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html) is the standard " "resizable heap-allocated buffer:" msgstr "" -"[`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html) 是可調整大小的標準" -"堆積配置緩衝區:" +"[`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html) 是可調整大小的標準堆" +"積配置緩衝區:" #: src/std-types/vec.md msgid "\"v1: len = {}, capacity = {}\"" @@ -6561,33 +6425,32 @@ msgid "" "struct.Vec.html#deref-methods-%5BT%5D), which means that you can call slice " "methods on a `Vec`." msgstr "" -"`Vec` 會實作 [`Deref`](https://doc.rust-lang.org/std/vec/" -"struct.Vec.html#deref-methods-%5BT%5D)。也就是說,您可以在 `Vec` 上呼叫切片方" -"法。" +"`Vec` 會實作 [`Deref`](https://doc.rust-lang.org/std/vec/struct." +"Vec.html#deref-methods-%5BT%5D)。也就是說,您可以在 `Vec` 上呼叫切片方法。" #: 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." +"`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` 內含的資料會儲存" -"在堆積上。這表示在編譯期間無需得知資料量,可在執行階段増量或減量。" +"`Vec` 是一種集合型別,與 `String` 和 `HashMap` 都一樣。`Vec` 內含的資料會儲存在" +"堆積上。這表示在編譯期間無需得知資料量,可在執行階段増量或減量。" #: src/std-types/vec.md 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." +"explicitly. As always with Rust type inference, the `T` was established during " +"the first `push` call." msgstr "" -"請留意 `Vec` 也能做為泛型型別,但您不必明確指定 `T`。和往常的 Rust 型別推" -"論一樣,系統會在第一次 `push` 呼叫期間建立 `T`。" +"請留意 `Vec` 也能做為泛型型別,但您不必明確指定 `T`。和往常的 Rust 型別推論一" +"樣,系統會在第一次 `push` 呼叫期間建立 `T`。" #: 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." +"`vec![...]` is a canonical macro to use instead of `Vec::new()` and it supports " +"adding initial elements to the vector." msgstr "" "`vec![...]` 是用於取代 `Vec::new()` 的標準巨集,且支援在向量中加入初始元素。" @@ -6597,16 +6460,16 @@ msgid "" "Alternatively, using `get` will return an `Option`. The `pop` function will " "remove the last element." msgstr "" -"如要為向量建立索引,請使用 `[` `]`,但如果超出範圍會引發恐慌。或者,使用 " -"`get` 則可傳回 `Option`。`pop` 函式會移除最後一個元素。" +"如要為向量建立索引,請使用 `[` `]`,但如果超出範圍會引發恐慌。或者,使用 `get` " +"則可傳回 `Option`。`pop` 函式會移除最後一個元素。" #: src/std-types/vec.md 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." +"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 天談到切片。現階段,學生只需知道 `Vec` 型別的值也能存取所有記錄" -"下來的切片方法。" +"我們會在第 3 天談到切片。現階段,學生只需知道 `Vec` 型別的值也能存取所有記錄下來" +"的切片方法。" #: src/std-types/hashmap.md msgid "Standard hash map with protection against HashDoS attacks:" @@ -6660,11 +6523,11 @@ msgstr "我們一開始並未定義 `HashMap`,因此現在需要將其納入 #: src/std-types/hashmap.md msgid "" "Try the following lines of code. The first line will see if a book is in the " -"hashmap and if not return an alternative value. The second line will insert " -"the alternative value in the hashmap if the book is not found." +"hashmap and if not return an alternative value. The second line will insert the " +"alternative value in the hashmap if the book is not found." msgstr "" -"請嘗試使用以下幾行程式碼。第一行會查看書籍是否在雜湊表中,如果不在,系統會傳" -"回替代值。如果系統找不到書籍,第二行會在雜湊表中插入替代值。" +"請嘗試使用以下幾行程式碼。第一行會查看書籍是否在雜湊表中,如果不在,系統會傳回替" +"代值。如果系統找不到書籍,第二行會在雜湊表中插入替代值。" #: src/std-types/hashmap.md msgid "\"Harry Potter and the Sorcerer's Stone\"" @@ -6680,79 +6543,79 @@ msgstr "可惜的是,並沒有所謂標準的 `hashmap!` 巨集。這點與 `v #: src/std-types/hashmap.md msgid "" -"Although, since Rust 1.56, HashMap implements [`From<[(K, V); N]>`](https://" -"doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#impl-" -"From%3C%5B(K,+V);+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E), which allows " -"us to easily initialize a hash map from a literal array:" +"Although, since Rust 1.56, HashMap implements [`From<[(K, V); N]>`](https://doc." +"rust-lang.org/std/collections/hash_map/struct.HashMap.html#impl-From%3C%5B(K," +"+V);+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E), which allows us to easily " +"initialize a hash map from a literal array:" msgstr "" "不過,自 Rust 1.56 起,HashMap 會實作 [`From<[(K, V); N]>`](https://doc.rust-" "lang.org/std/collections/hash_map/struct.HashMap.html#impl-From%3C%5B(K,+V);" -"+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E),以便讓我們能從常值陣列初始化雜" -"湊映射:" +"+N%5D%3E-for-HashMap%3CK,+V,+RandomState%3E),以便讓我們能從常值陣列初始化雜湊映" +"射:" #: src/std-types/hashmap.md msgid "" -"Alternatively HashMap can be built from any `Iterator` which yields key-" -"value tuples." +"Alternatively HashMap can be built from any `Iterator` which yields key-value " +"tuples." msgstr "或者,您也可以透過任何能產生鍵/值元組的 `Iterator` 建立 HashMap。" #: src/std-types/hashmap.md msgid "" "We are showing `HashMap`, and avoid using `&str` as key to make " -"examples easier. Using references in collections can, of course, be done, " -"but it can lead into complications with the borrow checker." +"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 msgid "" -"Try removing `to_string()` from the example above and see if it still " -"compiles. Where do you think we might run into issues?" +"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 "" "This type has several \"method-specific\" return types, such as `std::" -"collections::hash_map::Keys`. These types often appear in searches of the " -"Rust docs. Show students the docs for this type, and the helpful link back " -"to the `keys` method." +"collections::hash_map::Keys`. These types often appear in searches of the 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 "" "In this exercise you will take a very simple data structure and make it " "generic. It uses a [`std::collections::HashMap`](https://doc.rust-lang.org/" -"stable/std/collections/struct.HashMap.html) to keep track of which values " -"have been seen and how many times each one has appeared." +"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) 追蹤出現過的值和出現次數。" +"collections::HashMap`](https://doc.rust-lang.org/stable/std/collections/struct." +"HashMap.html) 追蹤出現過的值和出現次數。" #: src/std-types/exercise.md msgid "" -"The initial version of `Counter` is hard coded to only work for `u32` " -"values. Make the struct and its methods generic over the type of value being " -"tracked, that way `Counter` can track any type of value." +"The initial version of `Counter` is hard coded to only work for `u32` values. " +"Make the struct and its methods generic over the type of value being tracked, " +"that way `Counter` can track any type of value." msgstr "" -"`Counter` 的初始版本經過硬式編碼,僅適用於 `u32` 值。請設法讓結構體和相應的方" -"法成為泛型,而非所追蹤值的型別,這樣 `Counter` 就可以追蹤任何型別的值。" +"`Counter` 的初始版本經過硬式編碼,僅適用於 `u32` 值。請設法讓結構體和相應的方法" +"成為泛型,而非所追蹤值的型別,這樣 `Counter` 就可以追蹤任何型別的值。" #: src/std-types/exercise.md msgid "" -"If you finish early, try using the [`entry`](https://doc.rust-lang.org/" -"stable/std/collections/struct.HashMap.html#method.entry) method to halve the " -"number of hash lookups required to implement the `count` method." +"If you finish early, try using the [`entry`](https://doc.rust-lang.org/stable/" +"std/collections/struct.HashMap.html#method.entry) method to halve the number of " +"hash lookups required to implement the `count` method." msgstr "" -"如果您提前完成操作,不妨試著使用 [`entry`](https://doc.rust-lang.org/stable/" -"std/collections/struct.HashMap.html#method.entry) 方法將實作 `count` 方法所需" -"的雜湊查詢數量減半。" +"如果您提前完成操作,不妨試著使用 [`entry`](https://doc.rust-lang.org/stable/std/" +"collections/struct.HashMap.html#method.entry) 方法將實作 `count` 方法所需的雜湊" +"查詢數量減半。" #: src/std-types/exercise.md src/std-types/solution.md msgid "" @@ -6826,8 +6689,8 @@ msgstr "講解這個主題大約需要 1 小時 40 分鐘" #: src/std-traits.md msgid "" -"As with the standard-library types, spend time reviewing the documentation " -"for each trait." +"As with the standard-library types, spend time reviewing the documentation for " +"each trait." msgstr "和標準程式庫型別一樣,請花時間詳閱每種特徵的說明文件。" #: src/std-traits.md @@ -6836,11 +6699,11 @@ msgstr "這節課時間很長,在中間休息片刻吧。" #: src/std-traits/comparisons.md msgid "" -"These traits support comparisons between values. All traits can be derived " -"for types containing fields that implement these traits." +"These traits support comparisons between values. All traits can be derived for " +"types containing fields that implement these traits." msgstr "" -"以下特徵可用於比較不同的值。如果欄位會實作這些特徵,您可以針對含有這類欄位的" -"型別衍生所有特徵。" +"以下特徵可用於比較不同的值。如果欄位會實作這些特徵,您可以針對含有這類欄位的型別" +"衍生所有特徵。" #: src/std-traits/comparisons.md msgid "`PartialEq` and `Eq`" @@ -6851,17 +6714,17 @@ msgid "" "`PartialEq` is a partial equivalence relation, with required method `eq` and " "provided method `ne`. The `==` and `!=` operators will call these methods." msgstr "" -"`PartialEq` 代表部分對等關係,具有必要方法 `eq` 和提供的方法 `ne`。`==` 和 `!" -"=` 運算子會呼叫這些方法。" +"`PartialEq` 代表部分對等關係,具有必要方法 `eq` 和提供的方法 `ne`。`==` 和 `!=` " +"運算子會呼叫這些方法。" #: src/std-traits/comparisons.md msgid "" -"`Eq` is a full equivalence relation (reflexive, symmetric, and transitive) " -"and implies `PartialEq`. Functions that require full equivalence will use " -"`Eq` as a trait bound." +"`Eq` is a full equivalence relation (reflexive, symmetric, and transitive) and " +"implies `PartialEq`. Functions that require full equivalence will use `Eq` as a " +"trait bound." msgstr "" -"`Eq` 代表完整對等關係 (自反、對稱和傳遞性),並且隱含 `PartialEq`。需要完整對" -"等關係的函式會使用 `Eq` 做為特徵界線。" +"`Eq` 代表完整對等關係 (自反、對稱和傳遞性),並且隱含 `PartialEq`。需要完整對等關" +"係的函式會使用 `Eq` 做為特徵界線。" #: src/std-traits/comparisons.md msgid "`PartialOrd` and `Ord`" @@ -6872,8 +6735,8 @@ msgid "" "`PartialOrd` defines a partial ordering, with a `partial_cmp` method. It is " "used to implement the `<`, `<=`, `>=`, and `>` operators." msgstr "" -"`PartialOrd` 會透過 `partial_cmp` 方法定義偏序,可用於實作 `<`、`<=`、`>=` " -"和 `>` 運算子。" +"`PartialOrd` 會透過 `partial_cmp` 方法定義偏序,可用於實作 `<`、`<=`、`>=` 和 " +"`>` 運算子。" #: src/std-traits/comparisons.md msgid "`Ord` is a total ordering, with `cmp` returning `Ordering`." @@ -6887,17 +6750,16 @@ msgstr "`PartialEq` 可以在不同的型別之間實作,但具有自反性的 #: src/std-traits/comparisons.md msgid "" -"In practice, it's common to derive these traits, but uncommon to implement " -"them." +"In practice, it's common to derive these traits, but uncommon to implement them." msgstr "實務上一般會衍生這些特徵,但鮮少會實作這些特徵。" #: src/std-traits/operators.md msgid "" -"Operator overloading is implemented via traits in [`std::ops`](https://doc." -"rust-lang.org/std/ops/index.html):" +"Operator overloading is implemented via traits in [`std::ops`](https://doc.rust-" +"lang.org/std/ops/index.html):" msgstr "" -"運算子超載會透過 [`std::ops`](https://doc.rust-lang.org/std/ops/index.html): " -"內的特徵實作:" +"運算子超載會透過 [`std::ops`](https://doc.rust-lang.org/std/ops/index.html): 內" +"的特徵實作:" #: src/std-traits/operators.md msgid "\"{:?} + {:?} = {:?}\"" @@ -6920,8 +6782,8 @@ msgid "" "`&T` as well. This avoids unnecessary cloning on the call site." msgstr "" "回答:`Add:add` 會耗用 `self`。如果您要超載運算子的型別 `T` 不是 " -"`Copy`,建議您一併為 `&T` 超載運算子。這可避免呼叫點中出現不必要 的複" -"製作業。" +"`Copy`,建議您一併為 `&T` 超載運算子。這可避免呼叫點中出現不必要 的複製作" +"業。" #: src/std-traits/operators.md msgid "" @@ -6933,29 +6795,28 @@ msgstr "為什麼 `Output` 是關聯型別?可將其用做方法的型別參 #, 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." +"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`." +"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` 會將元組新增至 `Point`。" +"您可以針對兩種不同型別實作 `Add`,舉例來說, `impl Add<(i32, i32)> for Point` " +"會將元組新增至 `Point`。" #: src/std-traits/from-and-into.md msgid "" -"Types implement [`From`](https://doc.rust-lang.org/std/convert/trait.From." -"html) and [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) to " +"Types implement [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) " +"and [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) to " "facilitate type conversions:" msgstr "" -"型別會實作 [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) " -"和 [`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) 以利型別轉" -"換作業執行:" +"型別會實作 [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) 和 " +"[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) 以利型別轉換作業" +"執行:" #: src/std-traits/from-and-into.md msgid "\"{s}, {addr}, {one}, {bigger}\"" @@ -6964,37 +6825,36 @@ msgstr "\"{s}, {addr}, {one}, {bigger}\"" #: src/std-traits/from-and-into.md msgid "" "[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) is " -"automatically implemented when [`From`](https://doc.rust-lang.org/std/" -"convert/trait.From.html) is implemented:" +"automatically implemented when [`From`](https://doc.rust-lang.org/std/convert/" +"trait.From.html) is implemented:" msgstr "" "實作 [`From`](https://doc.rust-lang.org/std/convert/trait.From.html) 時," -"[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) 也會自動實" -"作:" +"[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) 也會自動實作:" #: src/std-traits/from-and-into.md msgid "" -"That's why it is common to only implement `From`, as your type will get " -"`Into` implementation too." +"That's why it is common to only implement `From`, as your type will get `Into` " +"implementation too." msgstr "這就是為什麼通常只需實作 `From`,因為型別也會實作 `Into`。" #: src/std-traits/from-and-into.md msgid "" "When declaring a function argument input type like \"anything that can be " -"converted into a `String`\", the rule is opposite, you should use `Into`. " -"Your function will accept types that implement `From` and those that _only_ " +"converted into a `String`\", the rule is opposite, you should use `Into`. Your " +"function will accept types that implement `From` and those that _only_ " "implement `Into`." msgstr "" -"如要宣告函式引數輸入型別 (例如「任何可轉換成 `String` 的型別」),規則便會相" -"反,此時請使用 `Into`。 您的函式會接受實作 `From` 的型別,以及「僅」實作 " -"`Into` 的型別。" +"如要宣告函式引數輸入型別 (例如「任何可轉換成 `String` 的型別」),規則便會相反," +"此時請使用 `Into`。 您的函式會接受實作 `From` 的型別,以及「僅」實作 `Into` 的型" +"別。" #: src/std-traits/casting.md msgid "" -"Rust has no _implicit_ type conversions, but does support explicit casts " -"with `as`. These generally follow C semantics where those are defined." +"Rust has no _implicit_ type conversions, but does support explicit casts with " +"`as`. These generally follow C semantics where those are defined." msgstr "" -"Rust 沒有「隱含」型別的轉換,但支援使用 `as` 明確轉換。後者通常會遵循定義前者" -"時所用的 C 語意。" +"Rust 沒有「隱含」型別的轉換,但支援使用 `as` 明確轉換。後者通常會遵循定義前者時" +"所用的 C 語意。" #: src/std-traits/casting.md msgid "\"as u16: {}\"" @@ -7011,36 +6871,35 @@ msgstr "\"as u8: {}\"" #: src/std-traits/casting.md msgid "" "The results of `as` are _always_ defined in Rust and consistent across " -"platforms. This might not match your intuition for changing sign or casting " -"to a smaller type -- check the docs, and comment for clarity." +"platforms. This might not match your intuition for changing sign or casting to " +"a smaller type -- check the docs, and comment for clarity." msgstr "" -"在 Rust 中,`as` 的結果「一律」會經過定義,且在不同平台間保持一致。這可能不符" -"合您變更符號或轉換到較小型別時的直觀做法,請檢查文件並加註說明內容。" +"在 Rust 中,`as` 的結果「一律」會經過定義,且在不同平台間保持一致。這可能不符合" +"您變更符號或轉換到較小型別時的直觀做法,請檢查文件並加註說明內容。" #: src/std-traits/casting.md msgid "" -"Casting with `as` is a relatively sharp tool that is easy to use " -"incorrectly, and can be a source of subtle bugs as future maintenance work " -"changes the types that are used or the ranges of values in types. Casts are " -"best used only when the intent is to indicate unconditional truncation (e.g. " -"selecting the bottom 32 bits of a `u64` with `as u32`, regardless of what " -"was in the high bits)." +"Casting with `as` is a relatively sharp tool that is easy to use incorrectly, " +"and can be a source of subtle bugs as future maintenance work changes the types " +"that are used or the ranges of values in types. Casts are best used only when " +"the intent is to indicate unconditional truncation (e.g. selecting the bottom " +"32 bits of a `u64` with `as u32`, regardless of what was in the high bits)." msgstr "" -"雖然使用 `as` 進行型別相當簡單,但是非常容易出錯;舉例來說,如果往後的維護作" -"業改變了所用型別或型別中值的範圍,這常常就是某些細微錯誤的來源。只有在意圖用" -"於指明無條件截斷時,我們才建議使用型別轉換。舉例來說,如果無論高位元中的內容" -"為何,您都只需要 `u64` 的底部 32 位元,就可以使用 `as u32`。" +"雖然使用 `as` 進行型別相當簡單,但是非常容易出錯;舉例來說,如果往後的維護作業改" +"變了所用型別或型別中值的範圍,這常常就是某些細微錯誤的來源。只有在意圖用於指明無" +"條件截斷時,我們才建議使用型別轉換。舉例來說,如果無論高位元中的內容為何,您都只" +"需要 `u64` 的底部 32 位元,就可以使用 `as u32`。" #: src/std-traits/casting.md msgid "" -"For infallible casts (e.g. `u32` to `u64`), prefer using `From` or `Into` " -"over `as` to confirm that the cast is in fact infallible. For fallible " -"casts, `TryFrom` and `TryInto` are available when you want to handle casts " -"that fit differently from those that don't." +"For infallible casts (e.g. `u32` to `u64`), prefer using `From` or `Into` over " +"`as` to confirm that the cast is in fact infallible. For fallible casts, " +"`TryFrom` and `TryInto` are available when you want to handle casts that fit " +"differently from those that don't." msgstr "" -"如果是 `u32` 到 `u64` 這類絕對無誤的型別轉換,適合先使用 `From` 或 `Into` (而" -"非 `as`) 確認轉換確實無誤。對於容易出錯的轉換,如果您想以不同的方式處理,可以" -"使用 `TryFrom` 和 `TryInto`。" +"如果是 `u32` 到 `u64` 這類絕對無誤的型別轉換,適合先使用 `From` 或 `Into` (而非 " +"`as`) 確認轉換確實無誤。對於容易出錯的轉換,如果您想以不同的方式處理,可以使用 " +"`TryFrom` 和 `TryInto`。" #: src/std-traits/casting.md msgid "Consider taking a break after this slide." @@ -7048,9 +6907,8 @@ msgstr "建議在講解完這張投影片後休息片刻。" #: src/std-traits/casting.md msgid "" -"`as` is similar to a C++ static cast. Use of `as` in cases where data might " -"be lost is generally discouraged, or at least deserves an explanatory " -"comment." +"`as` is similar to a C++ static cast. Use of `as` in cases where data might be " +"lost is generally discouraged, or at least deserves an explanatory comment." msgstr "" "`as` 類似於 C++ 的靜態轉換。一般不建議在資料可能遺失的情況下使用 `as`,如果要" "用,也至少要提供說明註解。" @@ -7061,13 +6919,13 @@ msgstr "這在將整數轉換為 `usize` 以用做索引時很常見。" #: src/std-traits/read-and-write.md msgid "" -"Using [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) and " -"[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), you can " -"abstract over `u8` sources:" +"Using [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) and [`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) 和 " -"[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html) 即可對 `u8` " -"來源進行抽象化處理:" +"使用 [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) 和 [`BufRead`]" +"(https://doc.rust-lang.org/std/io/trait.BufRead.html) 即可對 `u8` 來源進行抽象化" +"處理:" #: src/std-traits/read-and-write.md msgid "b\"foo\\nbar\\nbaz\\n\"" @@ -7086,8 +6944,8 @@ 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) 則可讓您" -"將 `u8` 接收器抽象化:" +"同樣地,[`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) 則可讓您將 " +"`u8` 接收器抽象化:" #: src/std-traits/read-and-write.md msgid "\"\\n\"" @@ -7110,8 +6968,8 @@ msgid "" "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait " "produces a default value for a type." msgstr "" -"[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) 特徵會" -"產生型別的預設值。" +"[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) 特徵會產生" +"型別的預設值。" #: src/std-traits/default.md msgid "\"John Smith\"" @@ -7142,8 +7000,8 @@ 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." +"A derived implementation will produce a value where all fields are set to their " +"default values." msgstr "衍生的實作項目會產生一個執行個體,其中欄位全都設為預設值。" #: src/std-traits/default.md @@ -7152,10 +7010,9 @@ msgstr "也就是說,該結構體中的所有型別也都必須實作 `Default #: src/std-traits/default.md msgid "" -"Standard Rust types often implement `Default` with reasonable values (e.g. " -"`0`, `\"\"`, etc)." -msgstr "" -"標準的 Rust 型別通常會以合理的值 (例如 `0`、`\"\"` 等等) 實作 `Default`。" +"Standard Rust types often implement `Default` with reasonable values (e.g. `0`, " +"`\"\"`, etc)." +msgstr "標準的 Rust 型別通常會以合理的值 (例如 `0`、`\"\"` 等等) 實作 `Default`。" #: src/std-traits/default.md #, fuzzy @@ -7167,31 +7024,30 @@ msgstr "部分結構體副本可與預設值完美搭配運作。" 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)." +"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 "" -"Closures or lambda expressions have types which cannot be named. However, " -"they implement special [`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn." -"html), [`FnMut`](https://doc.rust-lang.org/std/ops/trait.FnMut.html), and " -"[`FnOnce`](https://doc.rust-lang.org/std/ops/trait.FnOnce.html) traits:" +"Closures or lambda expressions have types which cannot be named. However, they " +"implement special [`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn.html), " +"[`FnMut`](https://doc.rust-lang.org/std/ops/trait.FnMut.html), and [`FnOnce`]" +"(https://doc.rust-lang.org/std/ops/trait.FnOnce.html) traits:" msgstr "" -"無論是閉包還是 lambda 運算式,都含有無法命名的型別。不過,這兩者 都會實作特殊" -"的 [`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn.html)、 [`FnMut`]" -"(https://doc.rust-lang.org/std/ops/trait.FnMut.html) 和 [`FnOnce`](https://" -"doc.rust-lang.org/std/ops/trait.FnOnce.html) 特徵:" +"無論是閉包還是 lambda 運算式,都含有無法命名的型別。不過,這兩者 都會實作特殊的 " +"[`Fn`](https://doc.rust-lang.org/std/ops/trait.Fn.html)、 [`FnMut`](https://doc." +"rust-lang.org/std/ops/trait.FnMut.html) 和 [`FnOnce`](https://doc.rust-lang.org/" +"std/ops/trait.FnOnce.html) 特徵:" #: src/std-traits/closures.md #, fuzzy @@ -7212,38 +7068,37 @@ msgstr "\"multiply_sum: {}\"" #: src/std-traits/closures.md msgid "" -"An `Fn` (e.g. `add_3`) neither consumes nor mutates captured values, or " -"perhaps captures nothing at all. It can be called multiple times " -"concurrently." +"An `Fn` (e.g. `add_3`) neither consumes nor mutates captured values, or perhaps " +"captures nothing at all. It can be called multiple times concurrently." msgstr "" -"`Fn` (例如 `add_3`) 既不會耗用也不會修改擷取的值,或許 也可說是不會擷取任何" -"值,因此可以多次並行呼叫。" +"`Fn` (例如 `add_3`) 既不會耗用也不會修改擷取的值,或許 也可說是不會擷取任何值," +"因此可以多次並行呼叫。" #: src/std-traits/closures.md 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 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 msgid "" -"`FnMut` is a subtype of `FnOnce`. `Fn` is a subtype of `FnMut` and `FnOnce`. " -"I.e. you can use an `FnMut` wherever an `FnOnce` is called for, and you can " -"use an `Fn` wherever an `FnMut` or `FnOnce` is called for." +"`FnMut` is a subtype of `FnOnce`. `Fn` is a subtype of `FnMut` and `FnOnce`. I." +"e. you can use an `FnMut` wherever an `FnOnce` is called for, and you can use " +"an `Fn` wherever an `FnMut` or `FnOnce` is called for." msgstr "" "`FnMut` 是 `FnOnce` 的子型別,而 `Fn` 是 `FnMut` 和 `FnOnce` 的子型別。換句話" -"說,您可以在任何需要呼叫 `FnOnce` 的地方使用 `FnMut`,而在任何需要呼叫 " -"`FnMut` 或 `FnOnce` 的地方 使用 `Fn`。" +"說,您可以在任何需要呼叫 `FnOnce` 的地方使用 `FnMut`,而在任何需要呼叫 `FnMut` " +"或 `FnOnce` 的地方 使用 `Fn`。" #: src/std-traits/closures.md msgid "" @@ -7259,24 +7114,24 @@ 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`。" +"相反地,當有閉包時,最有彈性的就是 `Fn` (可以在任何地方傳遞)、其次是 `FnMut`,最" +"後是 `FnOnce`。" #: src/std-traits/closures.md msgid "" "The compiler also infers `Copy` (e.g. for `add_3`) and `Clone` (e.g. " "`multiply_sum`), depending on what the closure captures." msgstr "" -"編譯器也會根據閉包擷取到的內容來推論 `Copy` (例如針對 `add_3`) 和 `Clone` (例" -"如 `multiply_sum`)." +"編譯器也會根據閉包擷取到的內容來推論 `Copy` (例如針對 `add_3`) 和 `Clone` (例如 " +"`multiply_sum`)." #: src/std-traits/closures.md msgid "" -"By default, closures will capture by reference if they can. The `move` " -"keyword makes them capture by value." +"By default, closures will capture by reference if they can. The `move` keyword " +"makes them capture by value." msgstr "" -"根據預設,閉包會依據參照來擷取內容 (如果可行的話)。`move` 關鍵字則可讓閉包根" -"據值 來擷取內容。" +"根據預設,閉包會依據參照來擷取內容 (如果可行的話)。`move` 關鍵字則可讓閉包根據" +"值 來擷取內容。" #: src/std-traits/closures.md src/smart-pointers/trait-objects.md msgid "\"{} {}\"" @@ -7292,14 +7147,14 @@ msgstr "" #: src/std-traits/exercise.md msgid "" -"In this example, you will implement the classic [\"ROT13\" cipher](https://" -"en.wikipedia.org/wiki/ROT13). Copy this code to the playground, and " -"implement the missing bits. Only rotate ASCII alphabetic characters, to " -"ensure the result is still valid UTF-8." +"In this example, you will implement the classic [\"ROT13\" cipher](https://en." +"wikipedia.org/wiki/ROT13). Copy this code to the playground, and implement the " +"missing bits. Only rotate ASCII alphabetic characters, to ensure the result is " +"still valid UTF-8." msgstr "" -"在這個範例中,您將實作傳統的[「ROT13」加密方式](https://zh.wikipedia.org/" -"wiki/ROT13)。請將此程式碼複製到 Playground,並實作缺少的位元。記得僅能旋轉 " -"ASCII 字母字元,確保結果仍為有效的 UTF-8。" +"在這個範例中,您將實作傳統的[「ROT13」加密方式](https://zh.wikipedia.org/wiki/" +"ROT13)。請將此程式碼複製到 Playground,並實作缺少的位元。記得僅能旋轉 ASCII 字母" +"字元,確保結果仍為有效的 UTF-8。" #: src/std-traits/exercise.md msgid "// Implement the `Read` trait for `RotDecoder`.\n" @@ -7315,8 +7170,8 @@ msgstr "\"To get to the other side!\"" #: src/std-traits/exercise.md msgid "" -"What happens if you chain two `RotDecoder` instances together, each rotating " -"by 13 characters?" +"What happens if you chain two `RotDecoder` instances together, each rotating by " +"13 characters?" msgstr "" "如果將兩個 `RotDecoder` 例項鏈結在一起,每個都以 13 個字元旋轉,會怎麼樣?" @@ -7334,8 +7189,8 @@ msgstr "今天我們將講解以下內容:" #: src/welcome-day-3.md msgid "" -"Memory management, lifetimes, and the borrow checker: how Rust ensures " -"memory safety." +"Memory management, lifetimes, and the borrow checker: how Rust ensures memory " +"safety." msgstr "記憶體管理、生命週期和借用檢查器:Rust 如何確保記憶體安全。" #: src/welcome-day-3.md @@ -7440,16 +7295,16 @@ msgid "" "Creating a `String` puts fixed-sized metadata on the stack and dynamically " "sized data, the actual string, on the heap:" msgstr "" -"建立 `String` 時,系統會在堆疊上放置固定大小的資料,並在堆積上放置動態調整大" -"小的資料:" +"建立 `String` 時,系統會在堆疊上放置固定大小的資料,並在堆積上放置動態調整大小的" +"資料:" #: src/memory-management/review.md msgid "" -"Mention that a `String` is backed by a `Vec`, so it has a capacity and " -"length and can grow if mutable via reallocation on the heap." +"Mention that a `String` is backed by a `Vec`, so it has a capacity and length " +"and can grow if mutable via reallocation on the heap." msgstr "" -"請說明 `String` 是由 `Vec` 支援,因此具有容量和長度,而且還能成長 (前提是可透" -"過堆積上的重新配置作業進行變動)。" +"請說明 `String` 是由 `Vec` 支援,因此具有容量和長度,而且還能成長 (前提是可透過" +"堆積上的重新配置作業進行變動)。" #: src/memory-management/review.md msgid "" @@ -7458,14 +7313,14 @@ msgid "" "struct.System.html) and custom allocators can be implemented using the " "[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" msgstr "" -"如有學員問起,您可以說明基礎記憶體是使用\\[系統配置器\\]配置的堆積,而自訂配" -"置器可以使用\\[配置器 API\\] 實作。" +"如有學員問起,您可以說明基礎記憶體是使用\\[系統配置器\\]配置的堆積,而自訂配置器" +"可以使用\\[配置器 API\\] 實作。" #: 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!" +"We can inspect the memory layout with `unsafe` Rust. However, you should point " +"out that this is rightfully unsafe!" msgstr "" "我們可以使用 `unsafe` 程式碼檢查記憶體配置。不過,您應指出這麼做非常不安全!" @@ -7480,13 +7335,11 @@ msgstr "\"world\"" #: src/memory-management/review.md msgid "" "// DON'T DO THIS AT HOME! For educational purposes only.\n" -" // String provides no guarantees about its layout, so this could lead " -"to\n" +" // String provides no guarantees about its layout, so this could lead to\n" " // undefined behavior.\n" 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" +" // String provides no guarantees about its layout, so this could lead to\n" " // undefined behavior.\n" #: src/memory-management/review.md @@ -7506,8 +7359,7 @@ msgid "Programmer decides when to allocate or free heap memory." msgstr "程式設計師會決定何時分配或釋出堆積記憶體。" #: src/memory-management/approaches.md -msgid "" -"Programmer must determine whether a pointer still points to valid memory." +msgid "Programmer must determine whether a pointer still points to valid memory." msgstr "程式設計師必須判斷指標是否仍指向有效記憶體。" #: src/memory-management/approaches.md @@ -7549,67 +7401,66 @@ msgstr "Rust 運用明確所有權的概念實現這一點。" #: src/memory-management/approaches.md msgid "" -"This slide is intended to help students coming from other languages to put " -"Rust in context." +"This slide is intended to help students coming from other languages to put Rust " +"in context." msgstr "這張投影片的目的,在於協助其他語言的學員瞭解 Rust。" #: src/memory-management/approaches.md msgid "" "C must manage heap manually with `malloc` and `free`. Common errors include " -"forgetting to call `free`, calling it multiple times for the same pointer, " -"or dereferencing a pointer after the memory it points to has been freed." +"forgetting to call `free`, calling it multiple times for the same pointer, or " +"dereferencing a pointer after the memory it points to has been freed." msgstr "" -"如果是 C 語言,必須透過 `malloc` 和 `free` 手動管理堆積。常見的錯誤包括忘記呼" -"叫 `free`、針對同一指標多次呼叫 `free`,或在其指向的記憶體釋出後取消參照指" -"標。" +"如果是 C 語言,必須透過 `malloc` 和 `free` 手動管理堆積。常見的錯誤包括忘記呼叫 " +"`free`、針對同一指標多次呼叫 `free`,或在其指向的記憶體釋出後取消參照指標。" #: src/memory-management/approaches.md msgid "" "C++ has tools like smart pointers (`unique_ptr`, `shared_ptr`) that take " -"advantage of language guarantees about calling destructors to ensure memory " -"is freed when a function returns. It is still quite easy to mis-use these " -"tools and create similar bugs to C." +"advantage of language guarantees about calling destructors to ensure memory is " +"freed when a function returns. It is still quite easy to mis-use these tools " +"and create similar bugs to C." msgstr "" -"C++ 提供智慧指標 (`unique_ptr`、`shared_ptr`) 等工具,可利用有關呼叫解構函式" -"的語言保證,確保在函式傳回時釋出記憶體。但這些工具仍很容易遭到濫用,並且會產" -"生類似 C 語言中的那些錯誤。" +"C++ 提供智慧指標 (`unique_ptr`、`shared_ptr`) 等工具,可利用有關呼叫解構函式的語" +"言保證,確保在函式傳回時釋出記憶體。但這些工具仍很容易遭到濫用,並且會產生類似 " +"C 語言中的那些錯誤。" #: src/memory-management/approaches.md msgid "" -"Java, Go, and Python rely on the garbage collector to identify memory that " -"is no longer reachable and discard it. This guarantees that any pointer can " -"be dereferenced, eliminating use-after-free and other classes of bugs. But, " -"GC has a runtime cost and is difficult to tune properly." +"Java, Go, and Python rely on the garbage collector to identify memory that is " +"no longer reachable and discard it. This guarantees that any pointer can be " +"dereferenced, eliminating use-after-free and other classes of bugs. But, GC has " +"a runtime cost and is difficult to tune properly." msgstr "" -"Java、Go 和 Python 會利用垃圾收集器來識別並捨棄無法再存取的記憶體。這能確保任" -"何指標都可以取消參照,進而消除 UAF (使用已釋放記憶體)和其他類別的錯誤。不過," -"GC 會耗費執行階段成本,且很難正確調整。" +"Java、Go 和 Python 會利用垃圾收集器來識別並捨棄無法再存取的記憶體。這能確保任何" +"指標都可以取消參照,進而消除 UAF (使用已釋放記憶體)和其他類別的錯誤。不過,GC 會" +"耗費執行階段成本,且很難正確調整。" #: src/memory-management/approaches.md msgid "" -"Rust's ownership and borrowing model can, in many cases, get the performance " -"of C, with alloc and free operations precisely where they are required -- " -"zero cost. It also provides tools similar to C++'s smart pointers. When " -"required, other options such as reference counting are available, and there " -"are even third-party crates available to support runtime garbage collection " -"(not covered in this class)." +"Rust's ownership and borrowing model can, in many cases, get the performance of " +"C, with alloc and free operations precisely where they are required -- zero " +"cost. It also provides tools similar to C++'s smart pointers. When required, " +"other options such as reference counting are available, and there are even " +"third-party crates available to support runtime garbage collection (not covered " +"in this class)." msgstr "" -"在許多情況下,Rust 的擁有權和借用模型效能都能媲美 C 語言,並在必要處精準分配" -"及釋放,達成零成本作業。Rust 也提供類似 C++ 智慧指標的工具。如有需要,您還可" -"以使用參照計數等其他選項,而且甚至還有第三方 Crate,可支援執行階段的垃圾收集" -"作業 (本課程不會討論這部分)。" +"在許多情況下,Rust 的擁有權和借用模型效能都能媲美 C 語言,並在必要處精準分配及釋" +"放,達成零成本作業。Rust 也提供類似 C++ 智慧指標的工具。如有需要,您還可以使用參" +"照計數等其他選項,而且甚至還有第三方 Crate,可支援執行階段的垃圾收集作業 (本課程" +"不會討論這部分)。" #: src/memory-management/ownership.md msgid "" -"All variable bindings have a _scope_ where they are valid and it is an error " -"to use a variable outside its scope:" +"All variable bindings have a _scope_ where they are valid and it is an error to " +"use a variable outside its scope:" 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." +"We say that the variable _owns_ the value. Every Rust value has precisely one " +"owner at all times." msgstr "我們會說變數「擁有」值。" #: src/memory-management/ownership.md @@ -7622,11 +7473,11 @@ msgstr "範圍結束時,變數會遭到「捨棄」,資料也會釋放。" #: src/memory-management/ownership.md msgid "" "Students familiar with garbage-collection implementations will know that a " -"garbage collector starts with a set of \"roots\" to find all reachable " -"memory. Rust's \"single owner\" principle is a similar idea." +"garbage collector starts with a set of \"roots\" to find all reachable memory. " +"Rust's \"single owner\" principle is a similar idea." msgstr "" -"熟悉垃圾回收實作的學員會知道,垃圾回收器是從一組「根」開始尋找所有可存取的記" -"憶體。Rust 的「單一擁有者」原則也是類似的概念。" +"熟悉垃圾回收實作的學員會知道,垃圾回收器是從一組「根」開始尋找所有可存取的記憶" +"體。Rust 的「單一擁有者」原則也是類似的概念。" #: src/memory-management/move.md #, fuzzy @@ -7731,24 +7582,23 @@ msgstr "// say_hello(name);\n" #: src/memory-management/move.md msgid "" -"Mention that this is the opposite of the defaults in C++, which copies by " -"value unless you use `std::move` (and the move constructor is defined!)." +"Mention that this is the opposite of the defaults in C++, which copies by value " +"unless you use `std::move` (and the move constructor is defined!)." msgstr "" -"請說明這與 C++ 中的預設情形相反:您必須使用 `std::move`,且已定義移動建構函" -"式,系統才會根據值進行複製。" +"請說明這與 C++ 中的預設情形相反:您必須使用 `std::move`,且已定義移動建構函式," +"系統才會根據值進行複製。" #: src/memory-management/move.md msgid "" -"It is only the ownership that moves. Whether any machine code is generated " -"to manipulate the data itself is a matter of optimization, and such copies " -"are aggressively optimized away." +"It is only the ownership that moves. Whether any machine code is generated to " +"manipulate the data itself is a matter of optimization, and such copies are " +"aggressively optimized away." msgstr "" -"只有擁有權才會轉移。是否產生任何機器碼來操控資料本身是一個最優化問題,而系統" -"會主動將這些副本最優化。" +"只有擁有權才會轉移。是否產生任何機器碼來操控資料本身是一個最優化問題,而系統會主" +"動將這些副本最優化。" #: src/memory-management/move.md -msgid "" -"Simple values (such as integers) can be marked `Copy` (see later slides)." +msgid "Simple values (such as integers) can be marked `Copy` (see later slides)." msgstr "簡單的值 (例如整數) 可標示為 `Copy` (請參閱後續投影片)。" #: src/memory-management/move.md @@ -7764,8 +7614,8 @@ msgid "" "With the first call to `say_hello`, `main` gives up ownership of `name`. " "Afterwards, `name` cannot be used anymore within `main`." msgstr "" -"首次呼叫 `say_hello` 時,`main` 會放棄 `name` 的所有權。之後,`name` 就無法" -"在 `main` 內使用。" +"首次呼叫 `say_hello` 時,`main` 會放棄 `name` 的所有權。之後,`name` 就無法在 " +"`main` 內使用。" #: src/memory-management/move.md msgid "" @@ -7775,11 +7625,11 @@ msgstr "為 `name` 配置的堆積記憶體會在 `say_hello` 函式結束時釋 #: src/memory-management/move.md msgid "" -"`main` can retain ownership if it passes `name` as a reference (`&name`) and " -"if `say_hello` accepts a reference as a parameter." +"`main` can retain ownership if it passes `name` as a reference (`&name`) and if " +"`say_hello` accepts a reference as a parameter." msgstr "" -"如果 `main` 以參照的形式傳送 `name` (`&name`),且 `say_hello` 能以參數的形式" -"接受參照,`main` 就可以保留所有權。" +"如果 `main` 以參照的形式傳送 `name` (`&name`),且 `say_hello` 能以參數的形式接受" +"參照,`main` 就可以保留所有權。" #: src/memory-management/move.md msgid "" @@ -7792,8 +7642,8 @@ msgid "" "Rust makes it harder than C++ to inadvertently create copies by making move " "semantics the default, and by forcing programmers to make clones explicit." msgstr "" -"在 Rust 中,移動語意為預設做法,且強制規定程式設計師必須明確設定克隆,因此不" -"小心建立副本的可能性就會低於在 C++ 中。" +"在 Rust 中,移動語意為預設做法,且強制規定程式設計師必須明確設定克隆,因此不小心" +"建立副本的可能性就會低於在 C++ 中。" #: src/memory-management/move.md #, fuzzy @@ -7842,19 +7692,19 @@ msgstr "" msgid "" "C++ also has [`std::move`](https://en.cppreference.com/w/cpp/utility/move), " "which is used to indicate when a value may be moved from. If the example had " -"been `s2 = std::move(s1)`, no heap allocation would take place. After the " -"move, `s1` would be in a valid but unspecified state. Unlike Rust, the " -"programmer is allowed to keep using `s1`." +"been `s2 = std::move(s1)`, no heap allocation would take place. After the 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." +"Unlike Rust, `=` in C++ can run arbitrary code as determined by the type which " +"is being copied or moved." msgstr "" "C++ 中的 `=` 可以依照要複製或轉移的型別來執行任何程式碼,這點與 Rust 不同。" @@ -7864,30 +7714,28 @@ msgstr "`Clone` 複製" #: src/memory-management/clone.md msgid "" -"Sometimes you _want_ to make a copy of a value. The `Clone` trait " -"accomplishes this." +"Sometimes you _want_ to make a copy of a value. The `Clone` trait accomplishes " +"this." msgstr "有時候,您可能會「想要」複製一個值。`Clone` 特徵可完成這項作業。" #: src/memory-management/clone.md msgid "" "The idea of `Clone` is to make it easy to spot where heap allocations are " -"occurring. Look for `.clone()` and a few others like `Vec::new` or `Box::" -"new`." +"occurring. Look for `.clone()` and a few others like `Vec::new` or `Box::new`." msgstr "" -"`Clone` 的概念是要輕鬆找出堆積分配量的發生位置。請尋找 `.clone()` 和 `Vec::" -"new` 或 `Box::new` 等其他字詞。" +"`Clone` 的概念是要輕鬆找出堆積分配量的發生位置。請尋找 `.clone()` 和 `Vec::new` " +"或 `Box::new` 等其他字詞。" #: src/memory-management/clone.md msgid "" -"It's common to \"clone your way out\" of problems with the borrow checker, " -"and return later to try to optimize those clones away." +"It's common to \"clone your way out\" of problems with the borrow checker, and " +"return later to try to optimize those clones away." msgstr "" -"我們往往會使用借用檢查器「複製解決問題的方法」,稍後再回來試著將這些複製內容" -"最佳化。" +"我們往往會使用借用檢查器「複製解決問題的方法」,稍後再回來試著將這些複製內容最佳" +"化。" #: src/memory-management/copy-types.md -msgid "" -"While move semantics are the default, certain types are copied by default:" +msgid "While move semantics are the default, certain types are copied by default:" msgstr "雖然移動語意是預設做法,但某些型別的預設做法為複製:" #: src/memory-management/copy-types.md @@ -7917,8 +7765,7 @@ msgid "" msgstr "複製是指記憶體區域的按位元複製作業,不適用於任意物件。" #: src/memory-management/copy-types.md -msgid "" -"Copying does not allow for custom logic (unlike copy constructors in C++)." +msgid "Copying does not allow for custom logic (unlike copy constructors in C++)." msgstr "複製不允許用於自訂邏輯,這與 C++ 中的複製建構函式不同。" #: src/memory-management/copy-types.md @@ -7937,19 +7784,18 @@ msgstr "在上述範例中,請嘗試下列操作:" #: src/memory-management/copy-types.md msgid "" -"Add a `String` field to `struct Point`. It will not compile because `String` " -"is not a `Copy` type." +"Add a `String` field to `struct Point`. It will not compile because `String` is " +"not a `Copy` type." msgstr "" -"將 `String` 欄位新增至 `struct Point`。由於 `String` 不屬於 `Copy` 型別,因此" -"不會編譯。" +"將 `String` 欄位新增至 `struct Point`。由於 `String` 不屬於 `Copy` 型別,因此不" +"會編譯。" #: 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!` 中。" +msgstr "從 `derive` 屬性中移除 `Copy`。編譯器錯誤現在位於 `p1` 的 `println!` 中。" #: src/memory-management/copy-types.md msgid "Show that it works if you clone `p1` instead." @@ -7964,8 +7810,8 @@ msgid "" "Values which implement [`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop." "html) can specify code to run when they go out of scope:" msgstr "" -"如果值實作了 [`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html),即" -"可在超出範圍時指定要執行哪個程式碼:" +"如果值實作了 [`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html),即可在" +"超出範圍時指定要執行哪個程式碼:" #: src/memory-management/drop.md msgid "\"Dropping {}\"" @@ -8024,19 +7870,18 @@ msgstr "如此一來,無論值是否實作 `Drop`,系統都會一併捨棄 msgid "" "`std::mem::drop` is just an empty function that takes any value. The " "significance is that it takes ownership of the value, so at the end of its " -"scope it gets dropped. This makes it a convenient way to explicitly drop " -"values earlier than they would otherwise go out of scope." +"scope it gets dropped. This makes it a convenient way to explicitly drop values " +"earlier than they would otherwise go out of scope." msgstr "" -"`std::mem::drop` 只是一個可接受任何值的空白函式。此函式之所以重要,是能夠取得" -"值的擁有權,因此在其範圍結束時會遭到捨棄。這有利於在值超出範圍之前,明確捨棄" -"這些值。" +"`std::mem::drop` 只是一個可接受任何值的空白函式。此函式之所以重要,是能夠取得值" +"的擁有權,因此在其範圍結束時會遭到捨棄。這有利於在值超出範圍之前,明確捨棄這些" +"值。" #: src/memory-management/drop.md msgid "" "This can be useful for objects that do some work on `drop`: releasing locks, " "closing files, etc." -msgstr "" -"如果物件會對 `drop` 執行某些工作 (例如釋放鎖、關閉檔案等),這就相當實用。" +msgstr "如果物件會對 `drop` 執行某些工作 (例如釋放鎖、關閉檔案等),這就相當實用。" #: src/memory-management/drop.md msgid "Why doesn't `Drop::drop` take `self`?" @@ -8057,11 +7902,11 @@ msgstr "請嘗試將 `drop(a)` 替換為 `a.drop()`。" #: src/memory-management/exercise.md msgid "" "In this example, we will implement a complex data type that owns all of its " -"data. We will use the \"builder pattern\" to support building a new value " -"piece-by-piece, using convenience functions." +"data. We will use the \"builder pattern\" to support building a new value piece-" +"by-piece, using convenience functions." msgstr "" -"在本範例中,我們將實作一個包含自身所有資料的複雜資料型別。透過「建構工具模" -"式」,我們會以便利函式逐段建構新值。" +"在本範例中,我們將實作一個包含自身所有資料的複雜資料型別。透過「建構工具模式」," +"我們會以便利函式逐段建構新值。" #: src/memory-management/exercise.md msgid "Fill in the missing pieces." @@ -8194,8 +8039,8 @@ msgid "" "[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) is an owned " "pointer to data on the heap:" msgstr "" -"[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) 是具有所有權的指" -"向堆積上的資料的指標:" +"[`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) 是具有所有權的指向" +"堆積上的資料的指標:" #: src/smart-pointers/box.md msgid "\"five: {}\"" @@ -8203,17 +8048,16 @@ msgstr "\"five: {}\"" #: src/smart-pointers/box.md msgid "" -"`Box` implements `Deref`, which means that you can [call " -"methods from `T` directly on a `Box`](https://doc.rust-lang.org/std/ops/" -"trait.Deref.html#more-on-deref-coercion)." +"`Box` implements `Deref`, which means that you can [call 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` 上透過 " -"`T` 呼叫方法](https://doc.rust-lang.org/std/ops/trait.Deref.html#more-on-" -"deref-coercion)。" +"`T` 呼叫方法](https://doc.rust-lang.org/std/ops/trait.Deref.html#more-on-deref-" +"coercion)。" #: src/smart-pointers/box.md -msgid "" -"Recursive data types or data types with dynamic sizes need to use a `Box`:" +msgid "Recursive data types or data types with dynamic sizes need to use a `Box`:" msgstr "遞迴資料型別或含有動態大小的資料型別必須使用 `Box`:" #: src/smart-pointers/box.md @@ -8233,8 +8077,8 @@ msgstr "\"{list:?}\"" msgid "" "```bob\n" " Stack Heap\n" -".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - " -"- - - - -.\n" +".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - - - " +"- - -.\n" ": : : :\n" ": " "list : : :\n" @@ -8246,8 +8090,8 @@ msgid "" "+----+ :\n" ": : : :\n" ": : : :\n" -"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - " -"- - - - -'\n" +"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - - - " +"- - -'\n" "```" msgstr "" "```bob\n" @@ -8267,8 +8111,8 @@ msgstr "" #: src/smart-pointers/box.md #, fuzzy msgid "" -"`Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be " -"not null." +"`Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be not " +"null." msgstr "" "`Box` 就像是 C++ 中的 `std::unique_ptr`,兩者的差別在於 `Box` 不會是空值。" @@ -8285,41 +8129,40 @@ msgstr "編譯時遇到不知道大小為何的型別,但 Rust 編譯器需要 #: src/smart-pointers/box.md msgid "" "want to transfer ownership of a large amount of data. To avoid copying large " -"amounts of data on the stack, instead store the data on the heap in a `Box` " -"so only the pointer is moved." +"amounts of data on the stack, instead store the data on the heap in a `Box` so " +"only the pointer is moved." msgstr "" -"想要轉移大量資料的所有權。為避免在堆疊上複製大量資料,請改將資料儲存在 `Box` " -"的堆積上,這樣系統就只會移動指標。" +"想要轉移大量資料的所有權。為避免在堆疊上複製大量資料,請改將資料儲存在 `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)." +"`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`,編譯器就不會計算出固定" +"的結構體記憶體大小,結構體看起來會像是無限大。" #: src/smart-pointers/box.md msgid "" -"`Box` solves this problem as it has the same size as a regular pointer and " -"just points at the next element of the `List` in the heap." +"`Box` solves this problem as it has the same size as a regular pointer and just " +"points at the next element of the `List` in the heap." msgstr "" -"`Box` 大小與一般指標相同,並且只會指向堆積中的下一個 `List` 元素,因此可以解" -"決這個問題。" +"`Box` 大小與一般指標相同,並且只會指向堆積中的下一個 `List` 元素,因此可以解決這" +"個問題。" #: 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." +"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 或其他種類的參考,而不是直接儲存" -"值。" +"with indirection」錯誤訊息,建議您使用 Box 或其他種類的參考,而不是直接儲存值。" #: src/smart-pointers/box.md msgid "Niche Optimization" @@ -8330,8 +8173,8 @@ msgid "" "A `Box` cannot be empty, so the pointer is always valid and non-`null`. This " "allows the compiler to optimize the memory layout:" msgstr "" -"`Box` 不能空白,因此指標會一律有效,而且不會是 `null`。這樣一來,編譯器可以將" -"記憶體配置最佳化:" +"`Box` 不能空白,因此指標會一律有效,而且不會是 `null`。這樣一來,編譯器可以將記" +"憶體配置最佳化:" #: src/smart-pointers/box.md #, fuzzy @@ -8365,12 +8208,12 @@ msgstr "" #: src/smart-pointers/rc.md msgid "" -"[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) is a reference-" -"counted shared pointer. Use this when you need to refer to the same data " -"from multiple places:" +"[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) is a reference-counted " +"shared pointer. Use this when you need to refer to the same data from multiple " +"places:" msgstr "" -"[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) 是參考計數的共用指" -"標。如要在多個位置參考相同的資料,可以使用這個指標:" +"[`Rc`](https://doc.rust-lang.org/std/rc/struct.Rc.html) 是參考計數的共用指標。如" +"要在多個位置參考相同的資料,可以使用這個指標:" #: src/smart-pointers/rc.md msgid "\"a: {a}\"" @@ -8382,25 +8225,24 @@ msgstr "\"b: {b}\"" #: src/smart-pointers/rc.md 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." +"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`](../concurrency/shared_state/arc.md) " -"和 [`Mutex`](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." +"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) 指標,以便建立之後會捨棄的循環。" #: src/smart-pointers/rc.md msgid "" -"`Rc`'s count ensures that its contained value is valid for as long as there " -"are references." +"`Rc`'s count ensures that its contained value is valid for as long as there are " +"references." msgstr "`Rc` 的計數可確保只要有參考,內含的值就會保持有效。" #: src/smart-pointers/rc.md @@ -8409,20 +8251,19 @@ msgstr "Rust 中的 `Rc` 就像 C++ 中的 `std::shared_ptr` 一樣。" #: src/smart-pointers/rc.md msgid "" -"`Rc::clone` is cheap: it creates a pointer to the same allocation and " -"increases the reference count. Does not make a deep clone and can generally " -"be ignored when looking for performance issues in code." +"`Rc::clone` is cheap: it creates a pointer to the same allocation and increases " +"the reference count. Does not make a deep clone and can generally be ignored " +"when looking for performance issues in code." msgstr "" -"`Rc::clone` 的成本很低:這個做法會建立指向相同配置的指標,並增加參考計數,而" -"不會產生深克隆,尋找程式碼效能問題時通常可以忽略。" +"`Rc::clone` 的成本很低:這個做法會建立指向相同配置的指標,並增加參考計數,而不會" +"產生深克隆,尋找程式碼效能問題時通常可以忽略。" #: src/smart-pointers/rc.md msgid "" "`make_mut` actually clones the inner value if necessary (\"clone-on-write\") " "and returns a mutable reference." msgstr "" -"`make_mut` 實際上會在必要時克隆內部值 (「clone-on-write」),並回傳可變動的參" -"考。" +"`make_mut` 實際上會在必要時克隆內部值 (「clone-on-write」),並回傳可變動的參考。" #: src/smart-pointers/rc.md msgid "Use `Rc::strong_count` to check the reference count." @@ -8430,16 +8271,15 @@ msgstr "使用 `Rc::strong_count` 可查看參考計數。" #: src/smart-pointers/rc.md msgid "" -"`Rc::downgrade` gives you a _weakly reference-counted_ object to create " -"cycles that will be dropped properly (likely in combination with `RefCell`)." +"`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 "" -"Trait objects allow for values of different types, for instance in a " -"collection:" +"Trait objects allow for values of different types, for instance in a collection:" msgstr "特徵物件可接受不同型別的值,舉例來說,在集合中會是這樣:" #: src/smart-pointers/trait-objects.md @@ -8459,15 +8299,15 @@ msgstr "以下是配置 `pets` 後的記憶體配置:" msgid "" "```bob\n" " Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- -.\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - " +"-.\n" ": : : :\n" ": \"pets: Vec\" : : \"data: Cat\" +----+----+----" "+----+ :\n" -": +-----------+-------+ : : +-------+-------+ | F | i | d | " -"o | :\n" -": | ptr | o---+---+--. : | lives | 9 | +----+----+----" -"+----+ :\n" +": +-----------+-------+ : : +-------+-------+ | F | i | d | o " +"| :\n" +": | ptr | o---+---+--. : | lives | 9 | +----+----+----+----" +"+ :\n" ": | len | 2 | : | : +-------+-------+ " "^ :\n" ": | capacity | 2 | : | : ^ " @@ -8486,38 +8326,38 @@ msgid "" "+ :\n" " : | " "| :\n" -" `- - -| - - |- - - - - - - - - - - - - - - " -"- -'\n" +" `- - -| - - |- - - - - - - - - - - - - - - - " +"-'\n" " | |\n" -" | | " -"\"Program text\"\n" -" .- - -| - - |- - - - - - - - - - - - - - - " -"- -.\n" +" | | \"Program " +"text\"\n" +" .- - -| - - |- - - - - - - - - - - - - - - - " +"-.\n" " : | | " "vtable :\n" " : | | +----------------------" "+ :\n" -" : | `----->| \"::" -"talk\" | :\n" +" : | `----->| \"::talk\" " +"| :\n" " : | +----------------------" "+ :\n" " : | " "vtable :\n" " : | +----------------------" "+ :\n" -" : '----------->| \"::" -"talk\" | :\n" +" : '----------->| \"::talk\" " +"| :\n" " : +----------------------" "+ :\n" " : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- -'\n" +" '- - - - - - - - - - - - - - - - - - - - - - " +"-'\n" "```" msgstr "" "```bob\n" " 堆疊 堆積\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- -.\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - " +"-.\n" ": : : :\n" ": pets : : +----+----+----+----" "+ :\n" @@ -8568,8 +8408,8 @@ msgstr "" " : +----------------------" "+ :\n" " : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- -'\n" +" '- - - - - - - - - - - - - - - - - - - - - - " +"-'\n" "```" #: src/smart-pointers/trait-objects.md @@ -8578,8 +8418,8 @@ msgid "" "Types that implement a given trait may be of different sizes. This makes it " "impossible to have things like `Vec` in the example above." msgstr "" -"如果型別會實作特定特徵,大小可能會不同。因此在上例中就不可能出現 `Vec` " -"這類項目。" +"如果型別會實作特定特徵,大小可能會不同。因此在上例中就不可能出現 `Vec` 這類" +"項目。" #: src/smart-pointers/trait-objects.md msgid "" @@ -8589,8 +8429,8 @@ msgstr "可透過 `dyn Pet` 這個方法向編譯器告知實作 `Pet` 的動態 #: src/smart-pointers/trait-objects.md msgid "" -"In the example, `pets` is allocated on the stack and the vector data is on " -"the heap. The two vector elements are _fat pointers_:" +"In the example, `pets` is allocated on the stack and the vector data is on the " +"heap. The two vector elements are _fat pointers_:" msgstr "" "在本例中,`pets` 和向量資料分別在堆疊和堆積上分配。這兩個向量元素都是「虛指" "標」:" @@ -8600,19 +8440,17 @@ msgstr "" msgid "" "A fat pointer is a double-width pointer. It has two components: a pointer to " "the actual object and a pointer to the [virtual method table](https://en." -"wikipedia.org/wiki/Virtual_method_table) (vtable) for the `Pet` " -"implementation of that particular object." +"wikipedia.org/wiki/Virtual_method_table) (vtable) for the `Pet` implementation " +"of that particular object." msgstr "" -"在本例中,`pets` 會保留指向物件的「虛指標」__,而物件會實作 `Pet`。虛指標包含" -"兩個元件,指向實際物件的指標,以及指向該特定物件中 `Pet` 實作項目的虛擬方法表" -"格。" +"在本例中,`pets` 會保留指向物件的「虛指標」__,而物件會實作 `Pet`。虛指標包含兩" +"個元件,指向實際物件的指標,以及指向該特定物件中 `Pet` 實作項目的虛擬方法表格。" #: src/smart-pointers/trait-objects.md msgid "" -"The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` " -"has a `lives` field." -msgstr "" -"名為 Fido 的 `Dog` 資料是 `name` 和 `age` 欄位。`Cat` 則有 `lives` 欄位。" +"The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` has " +"a `lives` field." +msgstr "名為 Fido 的 `Dog` 資料是 `name` 和 `age` 欄位。`Cat` 則有 `lives` 欄位。" #: src/smart-pointers/trait-objects.md msgid "Compare these outputs in the above example:" @@ -8620,14 +8458,14 @@ msgstr "比較上述範例的輸出內容:" #: src/smart-pointers/exercise.md msgid "" -"A binary tree is a tree-type data structure where every node has two " -"children (left and right). We will create a tree where each node stores a " -"value. For a given node N, all nodes in a N's left subtree contain smaller " -"values, and all nodes in N's right subtree will contain larger values." +"A binary tree is a tree-type data structure where every node has two children " +"(left and right). We will create a tree where each node stores a value. For a " +"given node N, all nodes in a N's left subtree contain smaller values, and all " +"nodes in N's right subtree will contain larger values." msgstr "" -"二元樹是一種樹狀資料結構,其中每個節點都有左右兩個子節點。我們會建立每個節點" -"都儲存一個值的樹狀結構。以指定節點 N 來說,N 左側子樹狀結構中的所有節點都包含" -"較小的值,而 N 右側子樹狀結構中的所有節點都含有較大的值。" +"二元樹是一種樹狀資料結構,其中每個節點都有左右兩個子節點。我們會建立每個節點都儲" +"存一個值的樹狀結構。以指定節點 N 來說,N 左側子樹狀結構中的所有節點都包含較小的" +"值,而 N 右側子樹狀結構中的所有節點都含有較大的值。" #: src/smart-pointers/exercise.md msgid "Implement the following types, so that the given tests pass." @@ -8635,8 +8473,8 @@ msgstr "請實作以下型別,讓指定的測試通過。" #: src/smart-pointers/exercise.md msgid "" -"Extra Credit: implement an iterator over a binary tree that returns the " -"values in order." +"Extra Credit: implement an iterator over a binary tree that returns the values " +"in order." msgstr "加分題:在二元數上實作疊代器,依序傳回值。" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md @@ -8674,8 +8512,7 @@ msgid "[Borrowing](./borrowing.md) (50 minutes)" msgstr "[借用](./borrowing.md) (50 分鐘)" #: src/welcome-day-3-afternoon.md -msgid "" -"[Slices and Lifetimes](./slices-and-lifetimes.md) (1 hour and 10 minutes)" +msgid "[Slices and Lifetimes](./slices-and-lifetimes.md) (1 hour and 10 minutes)" msgstr "[切片和生命週期](./slices-and-lifetimes.md) (1 小時 10 分鐘)" #: src/borrowing.md @@ -8713,8 +8550,7 @@ msgstr "呼叫端會保留輸入內容的所有權。" msgid "" "This slide is a review of the material on references from day 1, expanding " "slightly to include function arguments and return values." -msgstr "" -"這張投影片會複習第 1 天講解過的參照,並略微延伸討論何謂函式引數和回傳值。" +msgstr "這張投影片會複習第 1 天講解過的參照,並略微延伸討論何謂函式引數和回傳值。" #: src/borrowing/shared.md msgid "Notes on stack returns:" @@ -8728,12 +8564,12 @@ msgid "" "and run it on the [Playground](https://play.rust-lang.org/?" "version=stable&mode=release&edition=2021&gist=0cb13be1c05d7e3446686ad9947c4671) " "or look at the assembly in [Godbolt](https://rust.godbolt.org/). In the " -"\"DEBUG\" optimization level, the addresses should change, while they stay " -"the same when changing to the \"RELEASE\" setting:" +"\"DEBUG\" optimization level, the addresses should change, while they stay the " +"same when changing to the \"RELEASE\" setting:" msgstr "" -"示範因為編譯器可刪除複製操作,所以 `add` 回傳的成本較低。變更上述程式碼來顯示" -"堆疊位址,並在 [Playground](https://play.rust-lang.org/) 上執行。在「DEBUG」" -"最佳化等級中,位址應變更,但在變更為「RELEASE」設定時,位址應維持不變:" +"示範因為編譯器可刪除複製操作,所以 `add` 回傳的成本較低。變更上述程式碼來顯示堆" +"疊位址,並在 [Playground](https://play.rust-lang.org/) 上執行。在「DEBUG」最佳化" +"等級中,位址應變更,但在變更為「RELEASE」設定時,位址應維持不變:" #: src/borrowing/shared.md msgid "The Rust compiler can do return value optimization (RVO)." @@ -8748,14 +8584,13 @@ msgid "" "copy." msgstr "" "在 C++ 中,複製省略必須定義在語言規格內,因為建構函式可能有連帶效果。在 Rust " -"中,這完全不是問題。如未發生 RVO,Rust 一律會執行簡單有效的 `memcpy` 複製作" -"業。" +"中,這完全不是問題。如未發生 RVO,Rust 一律會執行簡單有效的 `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:" +"Rust's _borrow checker_ puts constraints on the ways you can borrow values. For " +"a given value, at any time:" msgstr "Rust 會限制借用值的方式:" #: src/borrowing/borrowck.md @@ -8780,20 +8615,20 @@ msgid "" "The above code does not compile because `a` is borrowed as mutable (through " "`c`) and as immutable (through `b`) at the same time." msgstr "" -"上述程式碼不會編譯,因為系統會同時透過 `c` 和 `b`,以可變動項和不可變動項的格" -"式借用 `a`。" +"上述程式碼不會編譯,因為系統會同時透過 `c` 和 `b`,以可變動項和不可變動項的格式" +"借用 `a`。" #: src/borrowing/borrowck.md msgid "" -"Move the `println!` statement for `b` before the scope that introduces `c` " -"to make the code compile." +"Move the `println!` statement for `b` before the scope that introduces `c` to " +"make the code compile." msgstr "請將 `b` 的 `println!` 陳述式移到導入 `c` 的範圍前,即可編譯程式碼。" #: src/borrowing/borrowck.md msgid "" -"After that change, the compiler realizes that `b` is only ever used before " -"the new mutable borrow of `a` through `c`. This is a feature of the borrow " -"checker called \"non-lexical lifetimes\"." +"After that change, the compiler realizes that `b` is only ever used before the " +"new mutable borrow of `a` through `c`. This is a feature of the borrow checker " +"called \"non-lexical lifetimes\"." msgstr "" "經過該變更後,編譯器會發現系統使用 `b` 的時間,只會在新可變動項透過 `c` 借用 " "`a` 之前。這是借用檢查器中的功能,稱為「非詞彙生命週期」(non-lexical " @@ -8801,43 +8636,42 @@ msgstr "" #: src/borrowing/borrowck.md 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 " -"optimize code. For example, a value behind a shared reference can be safely " -"cached in a register for the lifetime of that reference." +"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 optimize " +"code. For example, a value behind a shared reference can be safely cached in a " +"register for the lifetime of that reference." msgstr "" -"專屬參照的約束力很強。Rust 會利用這類參照,確保資料競爭的情形不會發生;此外," -"也會「透過」這項約束,將程式碼最佳化。舉例來說,共用參照背後的值可以在該參照" -"的生命週期內,安全地快取到暫存器中。" +"專屬參照的約束力很強。Rust 會利用這類參照,確保資料競爭的情形不會發生;此外,也" +"會「透過」這項約束,將程式碼最佳化。舉例來說,共用參照背後的值可以在該參照的生命" +"週期內,安全地快取到暫存器中。" #: src/borrowing/borrowck.md msgid "" "The borrow checker is designed to accommodate many common patterns, such as " -"taking exclusive references to different fields in a struct at the same " -"time. But, there are some situations where it doesn't quite \"get it\" and " -"this often results in \"fighting with the borrow checker.\"" +"taking exclusive references to different fields in a struct at the same time. " +"But, there are some situations where it doesn't quite \"get it\" and this often " +"results in \"fighting with the borrow checker.\"" msgstr "" -"借用檢查器在設計上考量了許多常見模式,例如同時對結構體中的不同欄位進行專屬參" -"照。但檢查器也可能無法完全「理解」某些的情況,這通常會導致「與借用檢查器衝" -"突」。" +"借用檢查器在設計上考量了許多常見模式,例如同時對結構體中的不同欄位進行專屬參照。" +"但檢查器也可能無法完全「理解」某些的情況,這通常會導致「與借用檢查器衝突」。" #: src/borrowing/interior-mutability.md msgid "" -"In some situations, it's necessary to modify data behind a shared (read-" -"only) reference. For example, a shared data structure might have an internal " -"cache, and wish to update that cache from read-only methods." +"In some situations, it's necessary to modify data behind a shared (read-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 "" -"The \"interior mutability\" pattern allows exclusive (mutable) access behind " -"a shared reference. The standard library provides several ways to do this, " -"all while still ensuring safety, typically by performing a runtime check." +"The \"interior mutability\" pattern allows exclusive (mutable) access behind 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 @@ -8867,31 +8701,30 @@ msgstr "" #: src/borrowing/interior-mutability.md msgid "" -"The main thing to take away from this slide is that Rust provides _safe_ " -"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." +"The main thing to take away from this slide is that Rust provides _safe_ 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` 是其中兩種方法。" +"這張投影片的重點是 Rust 提供「安全的」方法,可讓您修改共用參照背後的資料。要確保" +"安全性有許多方式,而 `RefCell` 和 `Cell` 是其中兩種方法。" #: src/borrowing/interior-mutability.md msgid "" "`RefCell` enforces Rust's usual borrowing rules (either multiple shared " -"references or a single exclusive reference) with a runtime check. In this " -"case, all borrows are very short and never overlap, so the checks always " -"succeed." +"references or a single exclusive reference) with a runtime check. In this case, " +"all borrows are very short and never overlap, so the checks always succeed." msgstr "" -"`RefCell` 會透過執行階段檢查,強制使用 Rust 的一般借用規則 (多個共用參照或單" -"一專屬參照)。在本例中,所有借用都非常短暫且永遠不會重疊,因此檢查一律會成功。" +"`RefCell` 會透過執行階段檢查,強制使用 Rust 的一般借用規則 (多個共用參照或單一專" +"屬參照)。在本例中,所有借用都非常短暫且永遠不會重疊,因此檢查一律會成功。" #: src/borrowing/interior-mutability.md msgid "" -"`Rc` only allows shared (read-only) access to its contents, since its " -"purpose is to allow (and count) many references. But we want to modify the " -"value, so we need interior mutability." +"`Rc` only allows shared (read-only) access to its contents, since its purpose " +"is to allow (and count) many references. But we want to modify the value, so we " +"need interior mutability." msgstr "" -"`Rc` 只允許對自身內容的共用 (唯讀) 存取行為,因為允許 (並計算) 多個參照才是它" -"的用途。但是,由於我們要修改這個值,因此內部可變動性不可或缺。" +"`Rc` 只允許對自身內容的共用 (唯讀) 存取行為,因為允許 (並計算) 多個參照才是它的" +"用途。但是,由於我們要修改這個值,因此內部可變動性不可或缺。" #: src/borrowing/interior-mutability.md msgid "" @@ -8899,8 +8732,8 @@ msgid "" "`&self`. This needs no runtime check, but requires moving values, which can " "have its own cost." msgstr "" -"如要確保安全,`Cell` 是較簡單的做法,因為其中的 `set` 方法可接受 `&self`。這" -"無需動用執行階段檢查,但需要移動值,因此可能有其相應成本。" +"如要確保安全,`Cell` 是較簡單的做法,因為其中的 `set` 方法可接受 `&self`。這無需" +"動用執行階段檢查,但需要移動值,因此可能有其相應成本。" #: src/borrowing/interior-mutability.md #, fuzzy @@ -8912,19 +8745,19 @@ msgstr "" #: src/borrowing/interior-mutability.md msgid "" -"To demonstrate a runtime panic, add a `fn inc(&mut self)` that increments " -"`self.value` and calls the same method on its children. This will panic in " -"the presence of the reference loop, with `thread 'main' panicked at 'already " +"To demonstrate a runtime panic, add a `fn inc(&mut self)` that increments `self." +"value` and calls the same method on its children. This will panic in the " +"presence of the reference loop, with `thread 'main' panicked at 'already " "borrowed: BorrowMutError'`." msgstr "" -"如要演示執行階段發生的恐慌情形,請新增 `fn inc(&mut self)`,這可讓 `self." -"value` 遞增,並在其子項呼叫相同的方法。在有參照迴圈的情況下,這會引發恐慌,其" -"中的 `thread 'main' 會因 'already borrowed: BorrowMutError'` 而恐慌。" +"如要演示執行階段發生的恐慌情形,請新增 `fn inc(&mut self)`,這可讓 `self.value` " +"遞增,並在其子項呼叫相同的方法。在有參照迴圈的情況下,這會引發恐慌,其中的 " +"`thread 'main' 會因 'already borrowed: BorrowMutError'` 而恐慌。" #: src/borrowing/exercise.md msgid "" -"You're working on implementing a health-monitoring system. As part of that, " -"you need to keep track of users' health statistics." +"You're working on implementing a health-monitoring system. As part of that, you " +"need to keep track of users' health statistics." msgstr "您正在實作健康監控系統,因此須追蹤使用者的健康統計資料。" #: src/borrowing/exercise.md @@ -8934,8 +8767,8 @@ msgid "" "struct definition. Your goal is to implement the stubbed out method on the " "`User` `struct` defined in the `impl` block." msgstr "" -"您將從 `impl` 區塊中的部分虛設函式,以及 `User` 結構體定義著手,目標是在 " -"`impl` 區塊中定義的 `User` `struct` 上導入虛設常式方法。" +"您將從 `impl` 區塊中的部分虛設函式,以及 `User` 結構體定義著手,目標是在 `impl` " +"區塊中定義的 `User` `struct` 上導入虛設常式方法。" #: src/borrowing/exercise.md #, fuzzy @@ -8946,15 +8779,12 @@ msgstr "請將以下程式碼複製到 ,並填入 #: src/borrowing/exercise.md msgid "" -"\"Update a user's statistics based on measurements from a visit to the " -"doctor\"" +"\"Update a user's statistics based on measurements from a visit to the doctor\"" msgstr "" -"\"Update a user's statistics based on measurements from a visit to the " -"doctor\"" +"\"Update a user's statistics based on measurements from a visit to the doctor\"" #: src/borrowing/exercise.md src/borrowing/solution.md -#: src/android/build-rules/library.md -#: src/android/aidl/example-service/client.md +#: src/android/build-rules/library.md src/android/aidl/example-service/client.md msgid "\"Bob\"" msgstr "\"Bob\"" @@ -8974,17 +8804,14 @@ msgstr "[字串參照](./slices-and-lifetimes/str.md) (10 分鐘)" msgid "" "[Lifetime Annotations](./slices-and-lifetimes/lifetime-annotations.md) (10 " "minutes)" -msgstr "" -"[生命週期註解](./slices-and-lifetimes/lifetime-annotations.md) (10 分鐘)" +msgstr "[生命週期註解](./slices-and-lifetimes/lifetime-annotations.md) (10 分鐘)" #: src/slices-and-lifetimes.md -msgid "" -"[Lifetime Elision](./slices-and-lifetimes/lifetime-elision.md) (5 minutes)" +msgid "[Lifetime Elision](./slices-and-lifetimes/lifetime-elision.md) (5 minutes)" msgstr "[生命週期省略](./slices-and-lifetimes/lifetime-elision.md) (5 分鐘)" #: src/slices-and-lifetimes.md -msgid "" -"[Struct Lifetimes](./slices-and-lifetimes/struct-lifetimes.md) (5 minutes)" +msgid "[Struct Lifetimes](./slices-and-lifetimes/struct-lifetimes.md) (5 minutes)" msgstr "[結構體生命週期](./slices-and-lifetimes/struct-lifetimes.md) (5 分鐘)" #: src/slices-and-lifetimes.md @@ -9021,32 +8848,29 @@ msgstr "我們會建立一個切片,方法是先借用 `a`,然後在括號 #: src/slices-and-lifetimes/slices.md 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." +"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/slices-and-lifetimes/slices.md 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/slices-and-lifetimes/slices.md -msgid "" -"To easily create a slice of the full array, we can therefore use `&a[..]`." +msgid "To easily create a slice of the full array, we can therefore use `&a[..]`." msgstr "因此,為了輕鬆建立完整陣列的切片,我們可以使用 `&a[..]`。" #: src/slices-and-lifetimes/slices.md 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." +"`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 "" -"`s` 是對 `i32`s 切片的參照。請注意,`s` (`&[i32]`) 的型別不再提及陣列長度,這" -"有利於我們對不同大小的切片執行運算。" +"`s` 是對 `i32`s 切片的參照。請注意,`s` (`&[i32]`) 的型別不再提及陣列長度,這有" +"利於我們對不同大小的切片執行運算。" #: src/slices-and-lifetimes/slices.md #, fuzzy @@ -9054,8 +8878,8 @@ 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` 必須持續「運作」(在範圍內),時間至少" -"要和切片一樣長。" +"切片一律會從其他物件借用。在本例中,`a` 必須持續「運作」(在範圍內),時間至少要和" +"切片一樣長。" #: src/slices-and-lifetimes/slices.md #, fuzzy @@ -9063,21 +8887,21 @@ 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 " "this point in the execution, but you can read the data from both `a` and `s` " -"safely. It works before you created the slice, and again after the " -"`println`, when the slice is no longer used." +"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[3]`,但可以放心從 `a` 和 `s` 讀取" -"資料。此項目會在您建立切片前運作,並在 `println` 之後,也就是切片不再使用時再" -"次運作。更多細節會在借用檢查器的章節說明。" +"有關修改 `a[3]` 的問題可能引發有趣的討論,但正解是,基於記憶體安全因素,您無法在" +"執行作業的這個時間點,透過 `a` 修改 `a[3]`,但可以放心從 `a` 和 `s` 讀取資料。此" +"項目會在您建立切片前運作,並在 `println` 之後,也就是切片不再使用時再次運作。更" +"多細節會在借用檢查器的章節說明。" #: src/slices-and-lifetimes/str.md msgid "" "We can now understand the two string types in Rust: `&str` is almost like " "`&[char]`, but with its data stored in a variable-length encoding (UTF-8)." msgstr "" -"我們現在可以瞭解 Rust 中有兩種字串型別,`&str` 幾近於 `&[char]`,但其資料是以" -"可變長度編碼 (UTF-8) 儲存。" +"我們現在可以瞭解 Rust 中有兩種字串型別,`&str` 幾近於 `&[char]`,但其資料是以可" +"變長度編碼 (UTF-8) 儲存。" #: src/slices-and-lifetimes/str.md msgid "\"s1: {s1}\"" @@ -9107,30 +8931,30 @@ msgstr "`String` 是可變動的字串緩衝區。" #, 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." +"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/slices-and-lifetimes/str.md msgid "" -"Rust’s `String` type is a wrapper around a vector of bytes. As with a " -"`Vec`, it is owned." +"Rust’s `String` type is a wrapper around a vector of bytes. As with a `Vec`, " +"it is owned." msgstr "" -"Rust 的 `String` 型別是位元組向量的包裝函式。就像使用 `Vec` 一樣,該型別有" -"專屬的擁有者。" +"Rust 的 `String` 型別是位元組向量的包裝函式。就像使用 `Vec` 一樣,該型別有專" +"屬的擁有者。" #: src/slices-and-lifetimes/str.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." +"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()` 方法將字串資料" -"加到該字串。" +"new()` 則建立新的空白字串,您可以使用 `push()` 和 `push_str()` 方法將字串資料加" +"到該字串。" #: src/slices-and-lifetimes/str.md #, fuzzy @@ -9148,9 +8972,9 @@ msgid "" "boundaries, the expression will panic. The `chars` iterator iterates over " "characters and is preferred over trying to get character boundaries right." msgstr "" -"您可以透過 `&str` 和可選的範圍選項,從 `String` 借用 `&str` 切片。如果所選位" -"元組範圍未與字元邊界對齊,運算式會發生恐慌。比起嘗試設定正確的字元邊界,建議" -"優先使用會對字元進行疊代的 `chars` 疊代器。" +"您可以透過 `&str` 和可選的範圍選項,從 `String` 借用 `&str` 切片。如果所選位元組" +"範圍未與字元邊界對齊,運算式會發生恐慌。比起嘗試設定正確的字元邊界,建議優先使用" +"會對字元進行疊代的 `chars` 疊代器。" #: src/slices-and-lifetimes/str.md #, fuzzy @@ -9160,10 +8984,9 @@ msgid "" "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*`,但這個 " -"`&str` 將一律指向記憶體中的有效字串。Rust 的 `String` 大致等同於 C++ 的 " -"`std::string`,主要差別是前者只能包含 UTF-8 編碼的位元組,且絕不會進行小字串" -"最佳化。" +"C++ 程式設計師請注意:您可以將 `&str` 想成 C++ 的 `const char*`,但這個 `&str` " +"將一律指向記憶體中的有效字串。Rust 的 `String` 大致等同於 C++ 的 `std::string`," +"主要差別是前者只能包含 UTF-8 編碼的位元組,且絕不會進行小字串最佳化。" #: src/slices-and-lifetimes/str.md #, fuzzy @@ -9178,14 +9001,14 @@ msgstr "參照的「生命週期」不得「超過」其所參照的值。此由 #: src/slices-and-lifetimes/lifetime-annotations.md 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 " -"`'` and `'a` is a typical default name. Read `&'a Point` as \"a borrowed " -"`Point` which is valid for at least the lifetime `a`\"." +"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 `'` and " +"`'a` is a typical default name. Read `&'a Point` as \"a borrowed `Point` which " +"is valid for at least the lifetime `a`\"." msgstr "" -"按照我們目前所見,生命週期可以隱晦表示。不過,`&'a Point`、`&'document str` " -"也可以明確表示生命週期。生命週期的開頭為 `'`,一般預設名稱為 `'a``。請將 " -"`&'a Point` 讀做「至少對生命週期 `a` 有效的借用 `Point`」。" +"按照我們目前所見,生命週期可以隱晦表示。不過,`&'a Point`、`&'document str` 也可" +"以明確表示生命週期。生命週期的開頭為 `'`,一般預設名稱為 `'a``。請將 `&'a " +"Point` 讀做「至少對生命週期 `a` 有效的借用 `Point`」。" #: src/slices-and-lifetimes/lifetime-annotations.md #, fuzzy @@ -9217,9 +9040,9 @@ msgid "" "requires explicit annotations of lifetimes on function arguments and return " "values." msgstr "" -"在本例中,編譯器無法堆論出 `p3` 到底有多長的生命週期。查看函式主體內部後顯" -"示,編譯器只有把握假設 `p3` 的生命週期是 `p1` 和 `p2` 中的較短那個。但就像型" -"別一樣,Rust 規定要對函式引數和回傳值的生命週期加上明確註解。" +"在本例中,編譯器無法堆論出 `p3` 到底有多長的生命週期。查看函式主體內部後顯示,編" +"譯器只有把握假設 `p3` 的生命週期是 `p1` 和 `p2` 中的較短那個。但就像型別一樣," +"Rust 規定要對函式引數和回傳值的生命週期加上明確註解。" #: src/slices-and-lifetimes/lifetime-annotations.md msgid "Add `'a` appropriately to `left_most`:" @@ -9229,12 +9052,10 @@ msgstr "請將 `'a` 妥善新增至 `left_most`:" msgid "" "This says, \"given p1 and p2 which both outlive `'a`, the return value lives " "for at least `'a`." -msgstr "" -"這表示,「假設 p1 和 p2 都比 `'a` 長」,回傳值的生命週期至少會為 `'a`。" +msgstr "這表示,「假設 p1 和 p2 都比 `'a` 長」,回傳值的生命週期至少會為 `'a`。" #: src/slices-and-lifetimes/lifetime-annotations.md -msgid "" -"In common cases, lifetimes can be elided, as described on the next slide." +msgid "In common cases, lifetimes can be elided, as described on the next slide." msgstr "一般情況下可以省略生命週期,詳情請見下一張投影片。" #: src/slices-and-lifetimes/lifetime-elision.md @@ -9244,14 +9065,14 @@ msgstr "函式呼叫中的生命週期" #: src/slices-and-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 " +"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/slices-and-lifetimes/lifetime-elision.md msgid "Each argument which does not have a lifetime annotation is given one." @@ -9259,17 +9080,17 @@ msgstr "凡是沒有生命週期註解的引數都會獲得一個註解。" #: src/slices-and-lifetimes/lifetime-elision.md msgid "" -"If there is only one argument lifetime, it is given to all un-annotated " -"return values." +"If there is only one argument lifetime, it is given to all un-annotated return " +"values." msgstr "如果只有一個引數生命週期,則會提供給所有未加註的回傳值。" #: src/slices-and-lifetimes/lifetime-elision.md msgid "" -"If there are multiple argument lifetimes, but the first one is for `self`, " -"that lifetime is given to all un-annotated return values." +"If there are multiple argument lifetimes, but the first one is for `self`, that " +"lifetime is given to all un-annotated return values." msgstr "" -"如果有多個引數生命週期,但第一個是要給 `self`,這個生命週期會提供給所有未加註" -"的回傳值。" +"如果有多個引數生命週期,但第一個是要給 `self`,這個生命週期會提供給所有未加註的" +"回傳值。" #: src/slices-and-lifetimes/lifetime-elision.md msgid "In this example, `cab_distance` is trivially elided." @@ -9287,33 +9108,32 @@ msgstr "請試著調整簽章,「謊報」傳回的生命週期:" #: src/slices-and-lifetimes/lifetime-elision.md 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." +"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 的常見錯誤來源。" +"由於這不會執行編譯,表示編譯器已檢查註解是否有效。請注意,原始指標 (不安全) 的情" +"況並非如此,這是不安全 Rust 的常見錯誤來源。" #: src/slices-and-lifetimes/lifetime-elision.md msgid "" -"Students may ask when to use lifetimes. Rust borrows _always_ have " -"lifetimes. Most of the time, elision and type inference mean these don't " -"need to be written out. In more complicated cases, lifetime annotations can " -"help resolve ambiguity. Often, especially when prototyping, it's easier to " -"just work with owned data by cloning values where necessary." +"Students may ask when to use lifetimes. Rust borrows _always_ have lifetimes. " +"Most of the time, elision and type inference mean these don't need to be " +"written out. In more complicated cases, lifetime annotations can help resolve " +"ambiguity. Often, especially when prototyping, it's easier to just work with " +"owned data by cloning values where necessary." msgstr "" -"學生可能會詢問何時該使用生命週期。Rust 的借用「一律」具有生命週期。在大多數情" -"況下,如果採取省略和型別推論的方式,表示您不必編寫這些內容。但在較複雜的情況" -"下,生命週期註解可以協助解決模稜兩可的情況。一般而言,只要在有必要時複製值," -"即可輕鬆處理所擁有的資料,特別是在原型設計階段更是如此。" +"學生可能會詢問何時該使用生命週期。Rust 的借用「一律」具有生命週期。在大多數情況" +"下,如果採取省略和型別推論的方式,表示您不必編寫這些內容。但在較複雜的情況下,生" +"命週期註解可以協助解決模稜兩可的情況。一般而言,只要在有必要時複製值,即可輕鬆處" +"理所擁有的資料,特別是在原型設計階段更是如此。" #: src/slices-and-lifetimes/struct-lifetimes.md msgid "Lifetimes in Data Structures" msgstr "資料結構中的生命週期" #: src/slices-and-lifetimes/struct-lifetimes.md -msgid "" -"If a data type stores borrowed data, it must be annotated with a lifetime:" +msgid "If a data type stores borrowed data, it must be annotated with a lifetime:" msgstr "如果資料型別會儲存借用的資料,則必須使用生命週期註解:" #: src/slices-and-lifetimes/struct-lifetimes.md @@ -9342,24 +9162,24 @@ msgid "" "underlying the contained `&str` lives at least as long as any instance of " "`Highlight` that uses that data." msgstr "" -"在上述範例中,`Highlight` 的註解會強制執行以下規定:若是包含在內的 `&str` 的" -"基礎資料,留存時間應至少和使用該資料的所有 `Highlight` 例項一樣長。" +"在上述範例中,`Highlight` 的註解會強制執行以下規定:若是包含在內的 `&str` 的基礎" +"資料,留存時間應至少和使用該資料的所有 `Highlight` 例項一樣長。" #: src/slices-and-lifetimes/struct-lifetimes.md msgid "" -"If `text` is consumed before the end of the lifetime of `fox` (or `dog`), " -"the borrow checker throws an error." +"If `text` is consumed before the end of the lifetime of `fox` (or `dog`), the " +"borrow checker throws an error." msgstr "" "如果在 `fox` (或 `dog`) 的生命週期結束前消耗 `text`,借用檢查器會擲回錯誤。" #: src/slices-and-lifetimes/struct-lifetimes.md msgid "" -"Types with borrowed data force users to hold on to the original data. This " -"can be useful for creating lightweight views, but it generally makes them " -"somewhat harder to use." +"Types with borrowed data force users to hold on to the original data. This can " +"be useful for creating lightweight views, but it generally makes them somewhat " +"harder to use." msgstr "" -"含有借用資料的型別會強制要求使用者保留原始資料。這在建立輕量檢視畫面可能很實" -"用,但通常也會增加使用難度。" +"含有借用資料的型別會強制要求使用者保留原始資料。這在建立輕量檢視畫面可能很實用," +"但通常也會增加使用難度。" #: src/slices-and-lifetimes/struct-lifetimes.md msgid "When possible, make data structures own their data directly." @@ -9369,34 +9189,34 @@ msgstr "請盡可能讓資料結構直接擁有資料。" msgid "" "Some structs with multiple references inside can have more than one lifetime " "annotation. This can be necessary if there is a need to describe lifetime " -"relationships between the references themselves, in addition to the lifetime " -"of the struct itself. Those are very advanced use cases." +"relationships between the references themselves, in addition to the lifetime of " +"the struct itself. Those are very advanced use cases." msgstr "" -"某些內含多個參照的結構體可擁有多個生命週期註解。如果除了結構體的生命週期之" -"外,還需要描述參照之間的生命週期關係,就可能有必要擁有多個生命週期註解。那些" -"是相當進階的用途。" +"某些內含多個參照的結構體可擁有多個生命週期註解。如果除了結構體的生命週期之外,還" +"需要描述參照之間的生命週期關係,就可能有必要擁有多個生命週期註解。那些是相當進階" +"的用途。" #: src/slices-and-lifetimes/exercise.md msgid "" "In this exercise, you will build a parser for the [protobuf binary encoding]" -"(https://protobuf.dev/programming-guides/encoding/). Don't worry, it's " -"simpler than it seems! This illustrates a common parsing pattern, passing " -"slices of data. The underlying data itself is never copied." +"(https://protobuf.dev/programming-guides/encoding/). Don't worry, it's 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-" -"guides/encoding/)的剖析器。請放心,這比看起來容易!這個練習也會舉例說明常見的" -"剖析模式,也就是傳遞資料切片。基礎資料本身一律不會複製。" +"guides/encoding/)的剖析器。請放心,這比看起來容易!這個練習也會舉例說明常見的剖" +"析模式,也就是傳遞資料切片。基礎資料本身一律不會複製。" #: src/slices-and-lifetimes/exercise.md msgid "" "Fully parsing a protobuf message requires knowing the types of the fields, " -"indexed by their field numbers. That is typically provided in a `proto` " -"file. In this exercise, we'll encode that information into `match` " -"statements in functions that get called for each field." +"indexed by their field numbers. That is typically provided in a `proto` file. " +"In this exercise, we'll encode that information into `match` statements in " +"functions that get called for each field." msgstr "" -"如要完整剖析 protobuf 訊息,您必須瞭解欄位型別,這會依欄位編號建立索引,通常" -"位於 `proto` 檔案內。在本練習中,我們會在針對各欄位呼叫的函式中,將該資訊編碼" -"為 `match` 陳述式。" +"如要完整剖析 protobuf 訊息,您必須瞭解欄位型別,這會依欄位編號建立索引,通常位" +"於 `proto` 檔案內。在本練習中,我們會在針對各欄位呼叫的函式中,將該資訊編碼為 " +"`match` 陳述式。" #: src/slices-and-lifetimes/exercise.md msgid "We'll use the following proto:" @@ -9404,25 +9224,25 @@ msgstr "我們將使用以下 proto:" #: src/slices-and-lifetimes/exercise.md msgid "" -"A proto message is encoded as a series of fields, one after the next. Each " -"is implemented as a \"tag\" followed by the value. The tag contains a field " -"number (e.g., `2` for the `id` field of a `Person` message) and a wire type " -"defining how the payload should be determined from the byte stream." +"A proto message is encoded as a series of fields, one after the next. Each is " +"implemented as a \"tag\" followed by the value. The tag contains a field number " +"(e.g., `2` for the `id` field of a `Person` message) and a wire type defining " +"how the payload should be determined from the byte stream." msgstr "" -"proto 訊息會編碼為一系列的欄位,一個接著一個。每個欄位都以後方加上值的「標" -"記」形式實作。此標記含有欄位編號 (例如 `Person` 訊息的 `id` 欄位編號是 `2`) " -"以及有線型別,後者負責定義應如何從位元組資料流中決定酬載。" +"proto 訊息會編碼為一系列的欄位,一個接著一個。每個欄位都以後方加上值的「標記」形" +"式實作。此標記含有欄位編號 (例如 `Person` 訊息的 `id` 欄位編號是 `2`) 以及有線型" +"別,後者負責定義應如何從位元組資料流中決定酬載。" #: src/slices-and-lifetimes/exercise.md msgid "" "Integers, including the tag, are represented with a variable-length encoding " -"called VARINT. Luckily, `parse_varint` is defined for you below. The given " -"code also defines callbacks to handle `Person` and `PhoneNumber` fields, and " -"to parse a message into a series of calls to those callbacks." +"called VARINT. Luckily, `parse_varint` is defined for you below. The given 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 的可變長度編碼表示。好消息是,以下程式碼已為" -"您定義 `parse_varint`。該程式碼也定義了回呼,藉此處理 `Person` 和 " -"`PhoneNumber` 欄位,並將訊息剖析為對這些回呼的一系列呼叫。" +"整數 (包含標記) 會以稱為 VARINT 的可變長度編碼表示。好消息是,以下程式碼已為您定" +"義 `parse_varint`。該程式碼也定義了回呼,藉此處理 `Person` 和 `PhoneNumber` 欄" +"位,並將訊息剖析為對這些回呼的一系列呼叫。" #: src/slices-and-lifetimes/exercise.md msgid "" @@ -9467,13 +9287,11 @@ msgstr "/// The Varint WireType indicates the value is a single VARINT.\n" #: src/slices-and-lifetimes/exercise.md src/slices-and-lifetimes/solution.md msgid "" "//I64, -- not needed for this exercise\n" -" /// The Len WireType indicates that the value is a length represented as " -"a\n" +" /// The Len WireType indicates that the value is a length represented as a\n" " /// 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\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/slices-and-lifetimes/exercise.md src/slices-and-lifetimes/solution.md @@ -9501,10 +9319,8 @@ msgid "//1 => WireType::I64, -- not needed for this exercise\n" msgstr "//1 => WireType::I64, -- not needed for this exercise\n" #: src/slices-and-lifetimes/exercise.md src/slices-and-lifetimes/solution.md -msgid "" -"/// Parse a VARINT, returning the parsed value and the remaining bytes.\n" -msgstr "" -"/// Parse a VARINT, returning the parsed value and the remaining bytes.\n" +msgid "/// Parse a VARINT, returning the parsed value and the remaining bytes.\n" +msgstr "/// Parse a VARINT, returning the parsed value and the remaining bytes.\n" #: src/slices-and-lifetimes/exercise.md src/slices-and-lifetimes/solution.md msgid "" @@ -9528,11 +9344,9 @@ msgstr "/// Parse a field, returning the remaining bytes\n" #: src/slices-and-lifetimes/exercise.md msgid "" -"\"Based on the wire type, build a Field, consuming as many bytes as " -"necessary.\"" +"\"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.\"" +"\"Based on the wire type, build a Field, consuming as many bytes as necessary.\"" #: src/slices-and-lifetimes/exercise.md msgid "\"Return the field, and any un-consumed bytes.\"" @@ -9634,20 +9448,19 @@ msgid "[FromIterator](./iterators/fromiterator.md) (5 minutes)" msgstr "[FromIterator](./iterators/fromiterator.md) (5 分鐘)" #: src/iterators.md -msgid "" -"[Exercise: Iterator Method Chaining](./iterators/exercise.md) (30 minutes)" +msgid "[Exercise: Iterator Method Chaining](./iterators/exercise.md) (30 minutes)" msgstr "[練習:疊代器方法鏈結](./iterators/exercise.md) (30 分鐘)" #: src/iterators/iterator.md msgid "" -"The [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) " -"trait supports iterating over values in a collection. It requires a `next` " -"method and provides lots of methods. Many standard library types implement " -"`Iterator`, and you can implement it yourself, too:" +"The [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) trait " +"supports iterating over values in a collection. It requires a `next` method and " +"provides lots of methods. Many standard library types implement `Iterator`, and " +"you can implement it yourself, too:" msgstr "" -"[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) 特徵可讓" -"您對集合中的值進行疊代作業。這需要用到 `next` 方法,且會提供大量方法。許多標" -"準程式庫型別都能實作 `Iterator`,而您也可以自行實作:" +"[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) 特徵可讓您" +"對集合中的值進行疊代作業。這需要用到 `next` 方法,且會提供大量方法。許多標準程式" +"庫型別都能實作 `Iterator`,而您也可以自行實作:" #: src/iterators/iterator.md msgid "\"fib({i}): {n}\"" @@ -9656,38 +9469,37 @@ 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 " -"the trait where you can find all the documentation about them. In Rust these " -"functions should produce the code as efficient as equivalent imperative " -"implementations." +"The `Iterator` trait implements many common functional programming operations " +"over collections (e.g. `map`, `filter`, `reduce`, etc). This is the trait where " +"you can find all the documentation about them. In Rust these functions should " +"produce the code as efficient as equivalent imperative implementations." msgstr "" "`Iterator` 特徵會對集合實作許多常見的函式程式操作,例如 `map`、`filter`、 " -"`reduce` 等等。您可以藉由此特徵找出所有相關的說明文件。在 Rust 中,這些 函式" -"會產生程式碼,且應與對應的命令式實作項目一樣有效率。" +"`reduce` 等等。您可以藉由此特徵找出所有相關的說明文件。在 Rust 中,這些 函式會" +"產生程式碼,且應與對應的命令式實作項目一樣有效率。" #: src/iterators/iterator.md msgid "" "`IntoIterator` is the trait that makes for loops work. It is implemented by " -"collection types such as `Vec` and references to them such as `&Vec` " -"and `&[T]`. Ranges also implement it. This is why you can iterate over a " -"vector with `for i in some_vec { .. }` but `some_vec.next()` doesn't exist." +"collection types such as `Vec` and references to them such as `&Vec` and " +"`&[T]`. Ranges also implement it. This is why you can iterate over a vector " +"with `for i in some_vec { .. }` but `some_vec.next()` doesn't exist." msgstr "" -"`IntoIterator` 是迫使 for 迴圈運作的特徵。此特徵由集合型別(例如 `Vec`) " -"和相關參照 (`&Vec` 與 `&[T]`) 實作而成。此外,範圍也會實作這項特徵。 這就" -"說明了您為何可以透過 `for i in some_vec { .. }` 對向量進行疊代,即使沒有 " -"`some_vec.next()` 也無妨。" +"`IntoIterator` 是迫使 for 迴圈運作的特徵。此特徵由集合型別(例如 `Vec`) 和相" +"關參照 (`&Vec` 與 `&[T]`) 實作而成。此外,範圍也會實作這項特徵。 這就說明了" +"您為何可以透過 `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." +"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` 特徵會告訴您如何在建立疊代器後進行「疊代」。相關特徵 " -"`IntoIterator` 則會說明如何建立疊代器:" +"`Iterator` 特徵會告訴您如何在建立疊代器後進行「疊代」。相關特徵 `IntoIterator` " +"則會說明如何建立疊代器:" #: src/iterators/intoiterator.md msgid "\"point = {x}, {y}\"" @@ -9714,8 +9526,8 @@ 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`。" +"請注意,`IntoIter` 和 `Item` 已建立連結:疊代器必須具有相同的 `Item` 型別,表示" +"會傳回 `Option`。" #: src/iterators/intoiterator.md msgid "The example iterates over all combinations of x and y coordinates." @@ -9726,8 +9538,8 @@ msgid "" "Try iterating over the grid twice in `main`. Why does this fail? Note that " "`IntoIterator::into_iter` takes ownership of `self`." msgstr "" -"請嘗試在 `main` 中對格線疊代兩次。想想為什麼這樣會失敗?請注意," -"`IntoIterator::into_iter` 會取得 `self` 的擁有權。" +"請嘗試在 `main` 中對格線疊代兩次。想想為什麼這樣會失敗?請注意,`IntoIterator::" +"into_iter` 會取得 `self` 的擁有權。" #: src/iterators/intoiterator.md msgid "" @@ -9739,14 +9551,14 @@ msgstr "" #: src/iterators/intoiterator.md msgid "" -"The same problem can occur for standard library types: `for e in " -"some_vector` will take ownership of `some_vector` and iterate over owned " -"elements from that vector. Use `for e in &some_vector` instead, to iterate " -"over references to elements of `some_vector`." +"The same problem can occur for standard library types: `for e in some_vector` " +"will take ownership of `some_vector` and iterate over owned elements from that " +"vector. Use `for e in &some_vector` instead, to iterate over references to " +"elements of `some_vector`." msgstr "" "標準程式庫型別可能會發生同樣的問題,也就是 `for e in some_vector` 會取得 " -"`some_vector` 的擁有權,並對該向量內擁有的元素進行疊代。因此,請改用 `for e " -"in &some_vector` 疊代處理對 `some_vector` 元素的參照。" +"`some_vector` 的擁有權,並對該向量內擁有的元素進行疊代。因此,請改用 `for e in " +"&some_vector` 疊代處理對 `some_vector` 元素的參照。" #: src/iterators/fromiterator.md msgid "FromIterator" @@ -9755,12 +9567,12 @@ msgstr "FromIterator" #: src/iterators/fromiterator.md msgid "" "[`FromIterator`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html) " -"lets you build a collection from an [`Iterator`](https://doc.rust-lang.org/" -"std/iter/trait.Iterator.html)." +"lets you build a collection from an [`Iterator`](https://doc.rust-lang.org/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." -"html) 建構集合。" +"[`FromIterator`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html) 可" +"讓您透過 [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) 建" +"構集合。" #: src/iterators/fromiterator.md msgid "\"prime_squares: {prime_squares:?}\"" @@ -9777,20 +9589,19 @@ msgstr "您可以透過兩種方式為這個方法指定 `B`:" #: src/iterators/fromiterator.md msgid "" -"With the \"turbofish\": `some_iterator.collect::()`, as " -"shown. The `_` shorthand used here lets Rust infer the type of the `Vec` " -"elements." +"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 "" "With type inference: `let prime_squares: Vec<_> = some_iterator.collect()`. " "Rewrite the example to use this form." msgstr "" -"使用型別推論:`let prime_squares: Vec<_> = some_iterator.collect()`。請重新編" -"寫這個例子,採用這個形式。" +"使用型別推論:`let prime_squares: Vec<_> = some_iterator.collect()`。請重新編寫" +"這個例子,採用這個形式。" #: src/iterators/fromiterator.md #, fuzzy @@ -9805,9 +9616,9 @@ msgstr "" #: 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." +"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) 特徵:" @@ -9819,19 +9630,17 @@ msgid "" "pass. Use an iterator expression and `collect` the result to construct the " "return value." msgstr "" -"將下列程式碼複製到 ,然後設法通過測試。請盡量避" -"免為中繼結果分配 `Vec`:" +"將下列程式碼複製到 ,然後設法通過測試。請盡量避免為" +"中繼結果分配 `Vec`:" #: src/iterators/exercise.md src/iterators/solution.md msgid "" -"/// Calculate the differences between elements of `values` offset by " -"`offset`,\n" +"/// Calculate the differences between elements of `values` offset by `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" msgstr "" -"/// Calculate the differences between elements of `values` offset by " -"`offset`,\n" +"/// Calculate the differences between elements of `values` offset by `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" @@ -9853,8 +9662,7 @@ msgid "[use, super, self](./modules/paths.md) (10 minutes)" msgstr "[use、super、self](./modules/paths.md) (10 分鐘)" #: src/modules.md -msgid "" -"[Exercise: Modules for a GUI Library](./modules/exercise.md) (15 minutes)" +msgid "[Exercise: Modules for a GUI Library](./modules/exercise.md) (15 minutes)" msgstr "[練習:GUI 程式庫的模組](./modules/exercise.md) (15 分鐘)" #: src/modules/modules.md @@ -9875,34 +9683,33 @@ msgstr "\"In the bar module\"" #: src/modules/modules.md msgid "" -"Packages provide functionality and include a `Cargo.toml` file that " -"describes how to build a bundle of 1+ crates." +"Packages provide functionality and include a `Cargo.toml` file that describes " +"how to build a bundle of 1+ crates." msgstr "" -"套件會提供功能,並收錄 `Cargo.toml` 檔案,用於說明如何建構含有超過 1 個 " -"Crate 的組合。" +"套件會提供功能,並收錄 `Cargo.toml` 檔案,用於說明如何建構含有超過 1 個 Crate 的" +"組合。" #: src/modules/modules.md msgid "" -"Crates are a tree of modules, where a binary crate creates an executable and " -"a library crate compiles to a library." +"Crates are a tree of modules, where a binary crate creates an executable and a " +"library crate compiles to a library." msgstr "" -"Crate 是模組的樹狀結構,其中二進位檔 Crate 會建立執行檔,而程式庫 Crate 則會" -"編譯至程式庫。" +"Crate 是模組的樹狀結構,其中二進位檔 Crate 會建立執行檔,而程式庫 Crate 則會編譯" +"至程式庫。" #: src/modules/modules.md msgid "Modules define organization, scope, and are the focus of this section." msgstr "模組不僅會定義組織、範圍,同時也是本節重點。" #: src/modules/filesystem.md -msgid "" -"Omitting the module content will tell Rust to look for it in another file:" +msgid "Omitting the module content will tell Rust to look for it in another file:" msgstr "如果您省略模組內容,系統會指示 Rust 在其他檔案中尋找該內容:" #: src/modules/filesystem.md msgid "" -"This tells rust that the `garden` module content is found at `src/garden." -"rs`. Similarly, a `garden::vegetables` module can be found at `src/garden/" -"vegetables.rs`." +"This tells rust that the `garden` module content is found at `src/garden.rs`. " +"Similarly, a `garden::vegetables` module can be found at `src/garden/vegetables." +"rs`." msgstr "" "這會讓 Rust 知道 `garden` 模組內容是在 `src/garden.rs` 中找到的。同樣地," "`garden::vegetables` 模組可在 `src/garden/vegetables.rs` 中找到。" @@ -9921,12 +9728,11 @@ msgstr "`src/main.rs` (適用於二進位檔 Crate)" #: src/modules/filesystem.md msgid "" -"Modules defined in files can be documented, too, using \"inner doc " -"comments\". These document the item that contains them -- in this case, a " -"module." +"Modules defined in files can be documented, too, using \"inner doc comments\". " +"These document the item that contains them -- in this case, a module." msgstr "" -"您也可以使用 \"inner doc comments\" 記錄檔案中定義的模組。這些會記錄包含它們" -"的項目,在本例中就是模組。" +"您也可以使用 \"inner doc comments\" 記錄檔案中定義的模組。這些會記錄包含它們的項" +"目,在本例中就是模組。" #: src/modules/filesystem.md msgid "" @@ -9960,11 +9766,11 @@ msgstr "" #: src/modules/filesystem.md 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." +"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` 的檔案在 IDE 中很難區分。" +"導入 `filename.rs` 做為 `filename/mod.rs` 的替代方案,主要是因為許多名為 `mod." +"rs` 的檔案在 IDE 中很難區分。" #: src/modules/filesystem.md msgid "Deeper nesting can use folders, even if the main module is a file:" @@ -9972,8 +9778,7 @@ msgstr "更深層的巢狀結構可以使用資料夾,即使主要模組為檔 #: src/modules/filesystem.md msgid "" -"The place rust will look for modules can be changed with a compiler " -"directive:" +"The place rust will look for modules can be changed with a compiler directive:" msgstr "Rust 尋找模組的位置可透過編譯器指令變更:" #: src/modules/filesystem.md @@ -9982,11 +9787,11 @@ msgstr "\"some/path.rs\"" #: src/modules/filesystem.md 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." +"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` 的檔案中 (類似 " -"Go 中的慣例),這就會很實用。" +"舉例來說,如果您想將模組的測試放在名為 `some_module_test.rs` 的檔案中 (類似 Go " +"中的慣例),這就會很實用。" #: src/modules/visibility.md msgid "Modules are a privacy boundary:" @@ -10002,8 +9807,8 @@ msgstr "父項和同層項目一律會顯示。" #: src/modules/visibility.md msgid "" -"In other words, if an item is visible in module `foo`, it's visible in all " -"the descendants of `foo`." +"In other words, if an item is visible in module `foo`, it's visible in all the " +"descendants of `foo`." msgstr "換句話說,如果項目顯示在 `foo` 模組中,則會出現在 `foo` 的所有子系中。" #: src/modules/visibility.md @@ -10028,8 +9833,8 @@ msgstr "使用 `pub` 關鍵字將模組設為公開。" #: src/modules/visibility.md msgid "" -"Additionally, there are advanced `pub(...)` specifiers to restrict the scope " -"of public visibility." +"Additionally, there are advanced `pub(...)` specifiers to restrict the scope of " +"public visibility." msgstr "此外,您也可以使用進階的 `pub(...)` 指定碼來限制公開的瀏覽權限範圍。" #: src/modules/visibility.md @@ -10050,8 +9855,8 @@ msgstr "您也可以授予特定路徑的瀏覽權限,但這較不常見。" #: src/modules/visibility.md msgid "" -"In any case, visibility must be granted to an ancestor module (and all of " -"its descendants)." +"In any case, visibility must be granted to an ancestor module (and all of its " +"descendants)." msgstr "無論如何,都請務必將瀏覽權限授予祖系模組 (及其所有子系)。" #: src/modules/paths.md @@ -10060,11 +9865,11 @@ msgstr "use、super、self" #: src/modules/paths.md 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:" +"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" @@ -10100,11 +9905,11 @@ msgstr "`bar::foo` 是指 `bar` Crate 中的 `foo`。" #: src/modules/paths.md msgid "" -"It is common to \"re-export\" symbols at a shorter path. For example, the " -"top-level `lib.rs` in a crate might have" +"It is common to \"re-export\" symbols at a shorter path. For example, the top-" +"level `lib.rs` in a crate might have" msgstr "" -"常見的方式是在較短的路徑上「重新導出」符號。舉例來說,Crate 中的頂層 `lib." -"rs` 可能有" +"常見的方式是在較短的路徑上「重新導出」符號。舉例來說,Crate 中的頂層 `lib.rs` 可" +"能有" #: src/modules/paths.md msgid "" @@ -10115,41 +9920,40 @@ msgstr "透過便捷的短路徑,向其他 Crate 提供 `DiskStorage` 和`Netw #: src/modules/paths.md msgid "" "For the most part, only items that appear in a module need to be `use`'d. " -"However, a trait must be in scope to call any methods on that trait, even if " -"a type implementing that trait is already in scope. For example, to use the " +"However, a trait must be in scope to call any methods on that trait, even if a " +"type implementing that trait is already in scope. For example, to use the " "`read_to_string` method on a type implementing the `Read` trait, you need to " "`use std::io::Read`." msgstr "" -"在大部分情況下,只有顯示在模組中的項目需要 `use`。但是,如要呼叫特徵的任何方" -"法,該特徵必須處於範圍之內,即使實作該特徵的型別已在範圍內也一樣。舉例來說," -"如要在實作 `Read` 特徵的型別上使用 `read_to_string` 方法,您需要 `use std::" -"io::Read`。" +"在大部分情況下,只有顯示在模組中的項目需要 `use`。但是,如要呼叫特徵的任何方法," +"該特徵必須處於範圍之內,即使實作該特徵的型別已在範圍內也一樣。舉例來說,如要在實" +"作 `Read` 特徵的型別上使用 `read_to_string` 方法,您需要 `use std::io::Read`。" #: src/modules/paths.md msgid "" -"The `use` statement can have a wildcard: `use std::io::*`. This is " -"discouraged because it is not clear which items are imported, and those " -"might change over time." +"The `use` statement can have a wildcard: `use std::io::*`. This is discouraged " +"because it is not clear which items are imported, and those might change over " +"time." msgstr "" -"`use` 陳述式可能包含萬用字元,例如 `use std::io::*`。不過,這不是建議的做法," -"因為我們無法確定匯入了哪些項目,而且這些項目可能隨著時間改變。" +"`use` 陳述式可能包含萬用字元,例如 `use std::io::*`。不過,這不是建議的做法,因" +"為我們無法確定匯入了哪些項目,而且這些項目可能隨著時間改變。" #: src/modules/exercise.md msgid "" -"In this exercise, you will reorganize a small GUI Library implementation. " -"This library defines a `Widget` trait and a few implementations of that " -"trait, as well as a `main` function." +"In this exercise, you will reorganize a small GUI Library implementation. This " +"library defines a `Widget` trait and a few implementations of that trait, as " +"well as a `main` function." msgstr "" -"在本練習中,您將重新編排小型的 GUI 程式庫實作項目。這個程式庫定義了 `Widget` " -"特徵、該特徵的幾個實作項目,以及 `main` 函式。" +"在本練習中,您將重新編排小型的 GUI 程式庫實作項目。這個程式庫定義了 `Widget` 特" +"徵、該特徵的幾個實作項目,以及 `main` 函式。" #: src/modules/exercise.md 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 "" -"通常,每種型別 (或一組密切相關的型別) 會放入各自的模組中,因此每個小工具型別" -"應該都有自己的模組。" +"通常,每種型別 (或一組密切相關的型別) 會放入各自的模組中,因此每個小工具型別應該" +"都有自己的模組。" #: src/modules/exercise.md #, fuzzy @@ -10200,12 +10004,10 @@ msgstr "// Add 4 paddings for borders\n" #: src/modules/exercise.md msgid "" -"// TODO: Change draw_into to return Result<(), std::fmt::Error>. Then use " -"the\n" +"// TODO: Change draw_into to return Result<(), std::fmt::Error>. Then use the\n" " // ?-operator here instead of .unwrap().\n" msgstr "" -"// TODO: Change draw_into to return Result<(), std::fmt::Error>. Then use " -"the\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 @@ -10255,12 +10057,12 @@ msgstr "\"Click me!\"" #: src/modules/exercise.md msgid "" -"Encourage students to divide the code in a way that feels natural for them, " -"and get accustomed to the required `mod`, `use`, and `pub` declarations. " -"Afterward, discuss what organizations are most idiomatic." +"Encourage students to divide the code in a way that feels natural for them, and " +"get accustomed to the required `mod`, `use`, and `pub` declarations. Afterward, " +"discuss what organizations are most idiomatic." msgstr "" -"請鼓勵學生以自在的方式分割程式碼,習慣必要的 `mod`、`use` 和 `pub` 宣告。之" -"後,討論哪些組織結構最為慣用。" +"請鼓勵學生以自在的方式分割程式碼,習慣必要的 `mod`、`use` 和 `pub` 宣告。之後," +"討論哪些組織結構最為慣用。" #: src/modules/solution.md msgid "// ---- src/widgets.rs ----\n" @@ -10366,9 +10168,9 @@ msgstr "整合測試 (integration test) 則可放置在 `tests/` 資料夾下。 #: src/testing/unit-tests.md 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." +"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)]` 可有條件地編譯測試 (僅限在建構測試時)。" @@ -10446,8 +10248,8 @@ msgstr "系統會編譯程式碼,執行 `cargo test` 時會一併執行這些 #: src/testing/other.md msgid "" -"Adding `#` in the code will hide it from the docs, but will still compile/" -"run it." +"Adding `#` in the code will hide it from the docs, but will still compile/run " +"it." msgstr "程式碼中新增 `#` 後,即可從文件中隱藏,但仍會編譯/執行。" #: src/testing/other.md @@ -10456,14 +10258,14 @@ msgid "" "version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." msgstr "" "請在 [Rust Playground](https://play.rust-lang.org/?" -"version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0) " -"上測試上述程式碼。" +"version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0) 上" +"測試上述程式碼。" #: src/testing/lints.md msgid "" -"The Rust compiler produces fantastic error messages, as well as helpful " -"built-in lints. [Clippy](https://doc.rust-lang.org/clippy/) provides even " -"more lints, organized into groups that can be enabled per-project." +"The Rust compiler produces fantastic error messages, as well as helpful built-" +"in lints. [Clippy](https://doc.rust-lang.org/clippy/) provides even more lints, " +"organized into groups that can be enabled per-project." msgstr "" "Rust 編譯器會產生高品質的錯誤訊息,以及實用的內建 Lint。[Clippy](https://doc." "rust-lang.org/clippy/) 則提供更多 Lint,且會整理成可供每個專案啟用的群組。" @@ -10474,26 +10276,26 @@ msgstr "\"X probably fits in a u16, right? {}\"" #: src/testing/lints.md msgid "" -"Run the code sample and examine the error message. There are also lints " -"visible here, but those will not be shown once the code compiles. Switch to " -"the Playground site to show those lints." +"Run the code sample and examine the error message. There are also lints visible " +"here, but those will not be shown once the code compiles. Switch to the " +"Playground site to show those lints." msgstr "" -"請執行程式碼範例並查看錯誤訊息。雖然這裡也能看到 Lint,但程式碼開始編譯後," -"Lint 就不會再顯示。因此若要查看這些 Lint,請改用 Playground 網站。" +"請執行程式碼範例並查看錯誤訊息。雖然這裡也能看到 Lint,但程式碼開始編譯後,Lint " +"就不會再顯示。因此若要查看這些 Lint,請改用 Playground 網站。" #: src/testing/lints.md msgid "" -"After resolving the lints, run `clippy` on the playground site to show " -"clippy warnings. Clippy has extensive documentation of its lints, and adds " -"new lints (including default-deny lints) all the time." +"After resolving the lints, run `clippy` on the playground site to show clippy " +"warnings. Clippy has extensive documentation of its lints, and adds new lints " +"(including default-deny lints) all the time." msgstr "" -"解析 Lint 後,請在 Playground 網站上執行 `clippy`,顯示 clippy 警告。Clippy " -"提供大量 Lint 說明文件,且會一直添加新的 Lint (包括預設拒絕的 Lint)。" +"解析 Lint 後,請在 Playground 網站上執行 `clippy`,顯示 clippy 警告。Clippy 提供" +"大量 Lint 說明文件,且會一直添加新的 Lint (包括預設拒絕的 Lint)。" #: src/testing/lints.md msgid "" -"Note that errors or warnings with `help: ...` can be fixed with `cargo fix` " -"or via your editor." +"Note that errors or warnings with `help: ...` can be fixed with `cargo fix` or " +"via your editor." msgstr "" "請注意,您可以使用 `cargo fix` 或編輯器,修正含有 `help: ...` 的錯誤或警告。" @@ -10503,12 +10305,12 @@ msgstr "盧恩演算法" #: src/testing/exercise.md msgid "" -"The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used " -"to validate credit card numbers. The algorithm takes a string as input and " -"does the following to validate the credit card number:" +"The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used to " +"validate credit card numbers. The algorithm takes a string as input and does " +"the following to validate the credit card number:" msgstr "" -"[盧恩演算法](https://en.wikipedia.org/wiki/Luhn_algorithm)可用於驗證信用卡號" -"碼。這個演算法會將字串做為輸入內容,並執行下列操作來驗證信用卡號碼:" +"[盧恩演算法](https://en.wikipedia.org/wiki/Luhn_algorithm)可用於驗證信用卡號碼。" +"這個演算法會將字串做為輸入內容,並執行下列操作來驗證信用卡號碼:" #: src/testing/exercise.md #, fuzzy @@ -10520,16 +10322,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." @@ -10541,19 +10343,18 @@ msgstr "如果加總所得數字的末位是 `0`,代表信用卡卡號有效 #: src/testing/exercise.md msgid "" -"The provided code provides a buggy implementation of the luhn algorithm, " -"along with two basic unit tests that confirm that most the algorithm is " -"implemented correctly." +"The provided code provides a buggy implementation of the luhn algorithm, along " +"with two basic unit tests that confirm that most the algorithm is implemented " +"correctly." 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." +"Copy the code below to and write additional tests " +"to uncover bugs in the provided implementation, fixing any bugs you find." msgstr "" "請將以下程式碼複製到 ,並填入缺少的函式和方法:" @@ -10656,8 +10457,7 @@ msgstr "[錯誤特徵](./error-handling/error.md) (5 分鐘)" #: src/error-handling.md msgid "" "[thiserror and anyhow](./error-handling/thiserror-and-anyhow.md) (5 minutes)" -msgstr "" -"[thiserror 和 anyhow](./error-handling/thiserror-and-anyhow.md) (5 分鐘)" +msgstr "[thiserror 和 anyhow](./error-handling/thiserror-and-anyhow.md) (5 分鐘)" #: src/error-handling.md msgid "" @@ -10698,19 +10498,17 @@ msgstr "針對特定用途的恐慌可以使用 `panic!` 巨集。" #: src/error-handling/panics.md msgid "" -"A panic will \"unwind\" the stack, dropping values just as if the functions " -"had returned." +"A panic will \"unwind\" the stack, dropping values just as if the functions had " +"returned." msgstr "恐慌會「解開」堆疊,此行為捨棄值的方式就像函式已傳回一樣。" #: src/error-handling/panics.md -msgid "" -"Use non-panicking APIs (such as `Vec::get`) if crashing is not acceptable." +msgid "Use non-panicking APIs (such as `Vec::get`) if crashing is not acceptable." msgstr "如果無法接受程式崩潰,請使用不會觸發恐慌的 API,例如 `Vec::get`。" #: src/error-handling/panics.md msgid "" -"By default, a panic will cause the stack to unwind. The unwinding can be " -"caught:" +"By default, a panic will cause the stack to unwind. The unwinding can be caught:" msgstr "根據預設,恐慌會造成解開堆疊。您可以擷取這類動作:" #: src/error-handling/panics.md @@ -10727,8 +10525,7 @@ msgstr "\"oh no!\"" #: src/error-handling/panics.md msgid "" -"Catching is unusual; do not attempt to implement exceptions with " -"`catch_unwind`!" +"Catching is unusual; do not attempt to implement exceptions with `catch_unwind`!" msgstr "捕獲是異常行為;請勿嘗試以 `catch_unwind` 實作例外狀況!" #: src/error-handling/panics.md @@ -10744,14 +10541,13 @@ msgstr "如果您在 `Cargo.toml` 中設定 `panic = 'abort'`,就無法採取 #: src/error-handling/try.md 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. " -"The try-operator `?` is used to return errors to the caller. It lets you " -"turn the common" +"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. The try-" +"operator `?` is used to return errors to the caller. It lets you turn the common" msgstr "" -"連線遭拒或找不到檔案等執行階段錯誤,都是透過 `Result` 型別來處理,但每次呼叫" -"時都比對此類型可能相當麻煩。try 運算子 `?` 的用途是將錯誤傳回呼叫端,可讓您將" -"下列常見的程式碼" +"連線遭拒或找不到檔案等執行階段錯誤,都是透過 `Result` 型別來處理,但每次呼叫時都" +"比對此類型可能相當麻煩。try 運算子 `?` 的用途是將錯誤傳回呼叫端,可讓您將下列常" +"見的程式碼" #: src/error-handling/try.md msgid "into the much simpler" @@ -10788,19 +10584,19 @@ msgid "" "Use the `fs::write` call to test out the different scenarios: no file, empty " "file, file with username." msgstr "" -"請使用 `fs::write` 呼叫來測試以下不同情況:沒有檔案、空白檔案、含使用者名稱的" -"檔案。" +"請使用 `fs::write` 呼叫來測試以下不同情況:沒有檔案、空白檔案、含使用者名稱的檔" +"案。" #: src/error-handling/try.md 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." +"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:Termination`,便可傳回 `Result<(), " -"E>`。實務上,這表示 `E` 會實作 `Debug`。執行檔將顯示 `Err` 變體,並在發生錯誤" -"時傳回非零的結束狀態。" +"請注意,只要 `main` 實作 `std::process:Termination`,便可傳回 `Result<(), E>`。" +"實務上,這表示 `E` 會實作 `Debug`。執行檔將顯示 `Err` 變體,並在發生錯誤時傳回非" +"零的結束狀態。" #: src/error-handling/try-conversions.md msgid "" @@ -10818,8 +10614,7 @@ 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` 呼叫意味著,我們嘗試將錯誤型別轉換成函式回傳的型別:" +msgstr "這裡的 `From::from` 呼叫意味著,我們嘗試將錯誤型別轉換成函式回傳的型別:" #: src/error-handling/try-conversions.md msgid "\"IO error: {e}\"" @@ -10837,32 +10632,32 @@ msgstr "//fs::write(\"config.dat\", \"\").unwrap();\n" #: src/error-handling/try-conversions.md msgid "" "The `?` operator must return a value compatible with the return type of the " -"function. For `Result`, it means that the error types have to be compatible. " -"A function that returns `Result` can only use `?` on a value " -"of type `Result` if `ErrorOuter` and `ErrorInner` are the " -"same type or if `ErrorOuter` implements `From`." +"function. For `Result`, it means that the error types have to be compatible. A " +"function that returns `Result` can only use `?` on a value of " +"type `Result` if `ErrorOuter` and `ErrorInner` are the same type " +"or if `ErrorOuter` implements `From`." msgstr "" "`?` 運算子必須傳回與函式傳回類型相容的值。如果是 `Result`,表示錯誤類型必須相" -"容。如果是傳回 `Result` 的函式,當 `ErrorOuter` 和 " -"`ErrorInner` 的型別相同、或者 `ErrorOuter` 實作 `From` 時,就只能" -"在 `Result` 型別的值上使用 `?`。" +"容。如果是傳回 `Result` 的函式,當 `ErrorOuter` 和 `ErrorInner` " +"的型別相同、或者 `ErrorOuter` 實作 `From` 時,就只能在 `Result` 型別的值上使用 `?`。" #: src/error-handling/try-conversions.md msgid "" "A common alternative to a `From` implementation is `Result::map_err`, " "especially when the conversion only happens in one place." msgstr "" -"`From` 實作的常見的替代方案是 `Result::map_err`,特別是當轉換只在單一位置發生" -"時更是如此。" +"`From` 實作的常見的替代方案是 `Result::map_err`,特別是當轉換只在單一位置發生時" +"更是如此。" #: src/error-handling/try-conversions.md msgid "" "There is no compatibility requirement for `Option`. A function returning " -"`Option` can use the `?` operator on `Option` for arbitrary `T` and " -"`U` types." +"`Option` can use the `?` operator on `Option` for arbitrary `T` and `U` " +"types." msgstr "" -"`Option` 並沒有相容性規定。如果函式會傳回 `Option`,可以在 `Option` 上" -"將 `?` 運算子用於任意的 `T` 和 `U` 型別。" +"`Option` 並沒有相容性規定。如果函式會傳回 `Option`,可以在 `Option` 上將 " +"`?` 運算子用於任意的 `T` 和 `U` 型別。" #: src/error-handling/try-conversions.md msgid "" @@ -10870,9 +10665,8 @@ 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`。" +"傳回 `Result` 的函式無法在 `Option` 上使用 `?`,反之亦然。不過,`Option::ok_or` " +"會將 `Option` 轉換為 `Result`,而 `Result::ok` 則將 `Result` 轉換為 `Option`。" #: src/error-handling/error.md msgid "Dynamic Error Types" @@ -10881,10 +10675,9 @@ 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." +"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` 可讓這項工作更輕鬆。" @@ -10907,8 +10700,8 @@ msgstr "\"Error: {err}\"" #: src/error-handling/error.md msgid "" -"The `read_count` function can return `std::io::Error` (from file operations) " -"or `std::num::ParseIntError` (from `String::parse`)." +"The `read_count` function can return `std::io::Error` (from file operations) or " +"`std::num::ParseIntError` (from `String::parse`)." msgstr "" "`read_count` 函式可以傳回 `std::io::Error` (透過檔案作業) 或 `std::num::" "ParseIntError` (透過 `String::parse`)。" @@ -10917,14 +10710,14 @@ msgstr "" #, 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 " -"a good idea to use `Box` in the public API of a library, but it " -"can be a good option in a program where you just want to display the error " -"message somewhere." +"different error cases differently in the program. As such it's generally not a " +"good idea to use `Box` in the public API of a library, but it 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 "" @@ -10934,8 +10727,8 @@ 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` 特徵目前僅與[每夜版]" +"定義自訂錯誤型別時,請務必實作 `std::error::Error` 特徵,這樣才能裝箱。不過,如" +"果您需要支援 `no_std` 屬性,請留意 `std::error::Error` 特徵目前僅與[每夜版]" "(https://github.com/rust-lang/rust/issues/103765)中的 `no_std` 相容。" #: src/error-handling/thiserror-and-anyhow.md @@ -10944,8 +10737,8 @@ 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/) crate 很常用來建立錯誤列舉,我們在上" -"一頁就曾這麼做:" +"[thiserror](https://docs.rs/thiserror/) crate 很常用來建立錯誤列舉,我們在上一頁" +"就曾這麼做:" #: src/error-handling/thiserror-and-anyhow.md msgid "" @@ -10959,8 +10752,8 @@ msgid "" "`anyhow` is often used by applications to help with error handling in " "functions, including adding contextual information to your errors." msgstr "" -"`anyhow` 經常由應用程式使用,目的是協助函式中的錯誤處理機制,包括為錯誤加上背" -"景資訊。" +"`anyhow` 經常由應用程式使用,目的是協助函式中的錯誤處理機制,包括為錯誤加上背景" +"資訊。" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Found no username in {0}\"" @@ -10991,8 +10784,8 @@ 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` 衍生巨集是由 `thiserror` 提供,附有許多實用的屬性,有助於以精簡方式定義" +"錯誤型別。" #: src/error-handling/thiserror-and-anyhow.md msgid "The `std::error::Error` trait is derived automatically." @@ -11008,12 +10801,12 @@ msgstr "`anyhow`" #: src/error-handling/thiserror-and-anyhow.md 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." +"`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 "" -"`anyhow::Error` 基本上是 `Box` 周遭的包裝函式。因此,通常也是不建" -"議程式庫的公用 API 使用,但可在應用程式中廣泛使用。" +"`anyhow::Error` 基本上是 `Box` 周遭的包裝函式。因此,通常也是不建議程" +"式庫的公用 API 使用,但可在應用程式中廣泛使用。" #: src/error-handling/thiserror-and-anyhow.md msgid "`anyhow::Result` is a type alias for `Result`." @@ -11026,21 +10819,20 @@ msgstr "必要時,可以擷取其中的實際錯誤類型進行檢查。" #: src/error-handling/thiserror-and-anyhow.md 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." +"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 "" -"Go 開發人員可能會覺得 `anyhow::Result` 提供的功能似曾相識,因為該功能提供" -"了與 Go 中的 `(T, error)` 類似的使用模式和人體工學。" +"Go 開發人員可能會覺得 `anyhow::Result` 提供的功能似曾相識,因為該功能提供了" +"與 Go 中的 `(T, error)` 類似的使用模式和人體工學。" #: src/error-handling/thiserror-and-anyhow.md msgid "" -"`anyhow::Context` is a trait implemented for the standard `Result` and " -"`Option` types. `use anyhow::Context` is necessary to enable `.context()` " -"and `.with_context()` on those types." +"`anyhow::Context` is a trait implemented for the standard `Result` and `Option` " +"types. `use anyhow::Context` is necessary to enable `.context()` and `." +"with_context()` on those types." msgstr "" -"`anyhow::Context` 是針對標準 `Result` 和 `Option` 型別實作的特徵。如要啟用這" -"些型別的 `.context()` 和 `.with_context()`,就必須使用 anyhow::Context。" +"`anyhow::Context` 是針對標準 `Result` 和 `Option` 型別實作的特徵。如要啟用這些型" +"別的 `.context()` 和 `.with_context()`,就必須使用 anyhow::Context。" #: src/error-handling/exercise.md msgid "Exercise: Rewriting with Result" @@ -11050,22 +10842,22 @@ msgstr "練習:根據結果重新編寫" msgid "" "The following implements a very simple parser for an expression language. " "However, it handles errors by panicking. Rewrite it to instead use idiomatic " -"error handling and propagate errors to a return from `main`. Feel free to " -"use `thiserror` and `anyhow`." +"error handling and propagate errors to a return from `main`. Feel free to use " +"`thiserror` and `anyhow`." msgstr "" -"以下程式碼實作一個非常簡單的運算式語言剖析器,但會藉由恐慌來處理錯誤。請重新" -"編寫,改用慣用的錯誤處理機制,並將錯誤傳播至 `main` 的回傳陳述式。您可以自由" -"使用 `thiserror` 和 `anyhow`。" +"以下程式碼實作一個非常簡單的運算式語言剖析器,但會藉由恐慌來處理錯誤。請重新編" +"寫,改用慣用的錯誤處理機制,並將錯誤傳播至 `main` 的回傳陳述式。您可以自由使用 " +"`thiserror` 和 `anyhow`。" #: src/error-handling/exercise.md msgid "" "HINT: start by fixing error handling in the `parse` function. Once that is " -"working correctly, update `Tokenizer` to implement " -"`Iterator>` and handle that in the parser." +"working correctly, update `Tokenizer` to implement `Iterator>` and handle that in the parser." msgstr "" "提示:首先請修正 `parse` 函式中的錯誤處理機制。確認一切正常運作後,更新 " -"`Tokenizer` 即可實作 `Iterator>`,並在剖析" -"器中處理。" +"`Tokenizer` 即可實作 `Iterator>`,並在剖析器" +"中處理。" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// An arithmetic operator.\n" @@ -11156,8 +10948,7 @@ msgid "[Unsafe](./unsafe-rust/unsafe.md) (5 minutes)" msgstr "[不安全](./unsafe-rust/unsafe.md) (5 分鐘)" #: src/unsafe-rust.md -msgid "" -"[Dereferencing Raw Pointers](./unsafe-rust/dereferencing.md) (10 minutes)" +msgid "[Dereferencing Raw Pointers](./unsafe-rust/dereferencing.md) (10 minutes)" msgstr "[將原始指標解除參照](./unsafe-rust/dereferencing.md) (10 分鐘)" #: src/unsafe-rust.md @@ -11194,15 +10985,14 @@ msgstr "\\*\\*安全的 Rust:\\*\\*可確保記憶體安全,無法觸發未 #: src/unsafe-rust/unsafe.md msgid "" -"**Unsafe Rust:** can trigger undefined behavior if preconditions are " -"violated." +"**Unsafe Rust:** can trigger undefined behavior if preconditions are violated." 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." +"We saw mostly safe Rust in this course, but it's important to know what Unsafe " +"Rust is." msgstr "雖然本課程中出現的大多都是安全的 Rust,但瞭解不安全的 Rust 也很重要。" #: src/unsafe-rust/unsafe.md @@ -11210,8 +11000,8 @@ msgid "" "Unsafe code is usually small and isolated, and its correctness should be " "carefully documented. It is usually wrapped in a safe abstraction layer." msgstr "" -"不安全的程式碼通常都很簡短、受到隔離,而且封裝在安全的抽象層中。您應該仔細記" -"錄這類程式碼的正確性。" +"不安全的程式碼通常都很簡短、受到隔離,而且封裝在安全的抽象層中。您應該仔細記錄這" +"類程式碼的正確性。" #: src/unsafe-rust/unsafe.md msgid "Unsafe Rust gives you access to five new capabilities:" @@ -11240,8 +11030,8 @@ msgstr "實作 `unsafe` 特徵。" #: src/unsafe-rust/unsafe.md msgid "" "We will briefly cover unsafe capabilities next. For full details, please see " -"[Chapter 19.1 in the Rust Book](https://doc.rust-lang.org/book/ch19-01-" -"unsafe-rust.html) and the [Rustonomicon](https://doc.rust-lang.org/nomicon/)." +"[Chapter 19.1 in the Rust Book](https://doc.rust-lang.org/book/ch19-01-unsafe-" +"rust.html) and the [Rustonomicon](https://doc.rust-lang.org/nomicon/)." msgstr "" "接下來將簡單介紹不安全的功能。如需瞭解詳情,請參閱 [Rust Book 的第 19.1 章]" "(https://rust-lang.tw/book-tw/ch19-01-unsafe-rust.html),以及 [Rustonomicon]" @@ -11250,15 +11040,13 @@ msgstr "" #: 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." +"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 "" -"Unsafe Rust does not mean the code is incorrect. It means that developers " -"have turned off the compiler safety features and have to write correct code " -"by themselves. It means the compiler no longer enforces Rust's memory-safety " -"rules." +"Unsafe Rust does not mean the code is incorrect. It means that developers have " +"turned off the compiler safety features and have to write correct code by " +"themselves. It means the compiler no longer enforces Rust's memory-safety rules." #: src/unsafe-rust/dereferencing.md msgid "Creating pointers is safe, but dereferencing them requires `unsafe`:" @@ -11271,15 +11059,13 @@ msgstr "\"careful!\"" #: src/unsafe-rust/dereferencing.md msgid "" "// Safe because r1 and r2 were obtained from references and so are\n" -" // guaranteed to be non-null and properly aligned, the objects " -"underlying\n" +" // guaranteed to be non-null and properly aligned, the objects underlying\n" " // the references from which they were obtained are live throughout the\n" " // whole unsafe block, and they are not accessed either through the\n" " // references or concurrently through any other pointers.\n" msgstr "" "// Safe because r1 and r2 were obtained from references and so are\n" -" // guaranteed to be non-null and properly aligned, the objects " -"underlying\n" +" // guaranteed to be non-null and properly aligned, the objects underlying\n" " // the references from which they were obtained are live throughout the\n" " // whole unsafe block, and they are not accessed either through the\n" " // references or concurrently through any other pointers.\n" @@ -11314,13 +11100,13 @@ msgstr "" #: src/unsafe-rust/dereferencing.md msgid "" -"It is good practice (and required by the Android Rust style guide) to write " -"a comment for each `unsafe` block explaining how the code inside it " -"satisfies the safety requirements of the unsafe operations it is doing." +"It is good practice (and required by the Android Rust style guide) to write a " +"comment for each `unsafe` block explaining how the code inside it satisfies the " +"safety requirements of the unsafe operations it is doing." msgstr "" -"It is good practice (and required by the Android Rust style guide) to write " -"a comment for each `unsafe` block explaining how the code inside it " -"satisfies the safety requirements of the unsafe operations it is doing." +"It is good practice (and required by the Android Rust style guide) to write a " +"comment for each `unsafe` block explaining how the code inside it satisfies the " +"safety requirements of the unsafe operations it is doing." #: src/unsafe-rust/dereferencing.md msgid "" @@ -11336,11 +11122,11 @@ msgstr "The pointer must be non-null." #: src/unsafe-rust/dereferencing.md msgid "" -"The pointer must be _dereferenceable_ (within the bounds of a single " -"allocated object)." +"The pointer must be _dereferenceable_ (within the bounds of a single allocated " +"object)." msgstr "" -"The pointer must be _dereferenceable_ (within the bounds of a single " -"allocated object)." +"The pointer must be _dereferenceable_ (within the bounds of a single allocated " +"object)." #: src/unsafe-rust/dereferencing.md msgid "The object must not have been deallocated." @@ -11352,11 +11138,11 @@ msgstr "There must not be concurrent accesses to the same location." #: src/unsafe-rust/dereferencing.md msgid "" -"If the pointer was obtained by casting a reference, the underlying object " -"must be live and no reference may be used to access the memory." +"If the pointer was obtained by casting a reference, the underlying object must " +"be live and no reference may be used to access the memory." msgstr "" -"If the pointer was obtained by casting a reference, the underlying object " -"must be live and no reference may be used to access the memory." +"If the pointer was obtained by casting a reference, the underlying object must " +"be live and no reference may be used to access the memory." #: src/unsafe-rust/dereferencing.md msgid "In most cases the pointer must also be properly aligned." @@ -11364,13 +11150,13 @@ msgstr "In most cases the pointer must also be properly aligned." #: src/unsafe-rust/dereferencing.md 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_." +"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 "" -"「NOT SAFE」部分提供了常見的 UB 錯誤示例:`*r1` 具有 `'static` 生命週期,因" -"此 `r3` 具有 `&'static String` 這個型別,從而會超過 `s`。從指標建立參照需要" -"「格外謹慎」__。" +"「NOT SAFE」部分提供了常見的 UB 錯誤示例:`*r1` 具有 `'static` 生命週期,因此 " +"`r3` 具有 `&'static String` 這個型別,從而會超過 `s`。從指標建立參照需要「格外謹" +"慎」__。" #: src/unsafe-rust/mutable-static.md msgid "It is safe to read an immutable static variable:" @@ -11398,23 +11184,23 @@ msgstr "\"COUNTER: {COUNTER}\"" #: src/unsafe-rust/mutable-static.md msgid "" "The program here is safe because it is single-threaded. However, the Rust " -"compiler is conservative and will assume the worst. Try removing the " -"`unsafe` and see how the compiler explains that it is undefined behavior to " -"mutate a static from multiple threads." +"compiler is conservative and will assume the worst. Try removing the `unsafe` " +"and see how the compiler explains that it is undefined behavior to mutate a " +"static from multiple threads." msgstr "" -"這裡的程式採用單一執行緒,因此安全無虞。不過,Rust 編譯器較為保守,會設想最糟" -"的情況。請嘗試移除 `unsafe`,看看編譯器如何解釋為什麼從多個執行緒變更 " -"static,屬於未定義的行為。" +"這裡的程式採用單一執行緒,因此安全無虞。不過,Rust 編譯器較為保守,會設想最糟的" +"情況。請嘗試移除 `unsafe`,看看編譯器如何解釋為什麼從多個執行緒變更 static,屬於" +"未定義的行為。" #: src/unsafe-rust/mutable-static.md msgid "" -"Using a mutable static is generally a bad idea, but there are some cases " -"where it might make sense in low-level `no_std` code, such as implementing a " -"heap allocator or working with some C APIs." +"Using a mutable static is generally a bad idea, but there are some cases where " +"it might make sense in low-level `no_std` code, such as implementing a heap " +"allocator or working with some C APIs." msgstr "" -"Using a mutable static is generally a bad idea, but there are some cases " -"where it might make sense in low-level `no_std` code, such as implementing a " -"heap allocator or working with some C APIs." +"Using a mutable static is generally a bad idea, but there are some cases where " +"it might make sense in low-level `no_std` code, such as implementing a heap " +"allocator or working with some C APIs." #: src/unsafe-rust/unions.md msgid "Unions are like enums, but you need to track the active field yourself:" @@ -11435,23 +11221,23 @@ msgstr "在執行階段不會產生未定義的行為,好處如下:" #: 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." +"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 "" -"Unions are very rarely needed in Rust as you can usually use an enum. They " -"are occasionally needed for interacting with C library APIs." +"Unions are very rarely needed in Rust as you can usually use an enum. They are " +"occasionally needed for interacting with C library APIs." #: src/unsafe-rust/unions.md msgid "" "If you just want to reinterpret bytes as a different type, you probably want " -"[`std::mem::transmute`](https://doc.rust-lang.org/stable/std/mem/fn." -"transmute.html) or a safe wrapper such as the [`zerocopy`](https://crates.io/" -"crates/zerocopy) crate." +"[`std::mem::transmute`](https://doc.rust-lang.org/stable/std/mem/fn.transmute." +"html) or a safe wrapper such as the [`zerocopy`](https://crates.io/crates/" +"zerocopy) crate." msgstr "" "If you just want to reinterpret bytes as a different type, you probably want " -"[`std::mem::transmute`](https://doc.rust-lang.org/stable/std/mem/fn." -"transmute.html) or a safe wrapper such as the [`zerocopy`](https://crates.io/" -"crates/zerocopy) crate." +"[`std::mem::transmute`](https://doc.rust-lang.org/stable/std/mem/fn.transmute." +"html) or a safe wrapper such as the [`zerocopy`](https://crates.io/crates/" +"zerocopy) crate." #: src/unsafe-rust/unsafe-functions.md msgid "Calling Unsafe Functions" @@ -11459,11 +11245,11 @@ msgstr "呼叫不安全的函式" #: src/unsafe-rust/unsafe-functions.md msgid "" -"A function or method can be marked `unsafe` if it has extra preconditions " -"you must uphold to avoid undefined behaviour:" +"A function or method can be marked `unsafe` if it has extra preconditions you " +"must uphold to avoid undefined behaviour:" msgstr "" -"如果函式或方法具有額外先決條件,而您必須遵循這些條件才能避免未定義的行為,那" -"麼就可以將該函式或方法標示為 `unsafe`:" +"如果函式或方法具有額外先決條件,而您必須遵循這些條件才能避免未定義的行為,那麼就" +"可以將該函式或方法標示為 `unsafe`:" #: src/unsafe-rust/unsafe-functions.md src/unsafe-rust/exercise.md #: src/unsafe-rust/solution.md src/android/interoperability/with-c.md @@ -11553,20 +11339,20 @@ msgstr "\"a = {}, b = {}\"" #, 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 " -"reason: it is an external function (FFI). Calling external functions is " -"usually only a problem when those functions do things with pointers which " -"might violate Rust's memory model, but in general any C function might have " -"undefined behaviour under any arbitrary circumstances." +"create UB if the range is incorrect. `abs` is incorrect for a different reason: " +"it is an external function (FFI). Calling external functions is usually only a " +"problem when those functions do things with pointers which might violate Rust's " +"memory model, but in general any C function might have undefined behaviour " +"under any arbitrary circumstances." msgstr "" "This is usually only a problem for extern functions which do things with " -"pointers which might violate Rust's memory model, but in general any C " -"function might have undefined behaviour under any arbitrary circumstances." +"pointers which might violate Rust's memory model, but in general any C function " +"might have undefined behaviour under any arbitrary circumstances." #: src/unsafe-rust/unsafe-functions.md msgid "" -"The `\"C\"` in this example is the ABI; [other ABIs are available too]" -"(https://doc.rust-lang.org/reference/items/external-blocks.html)." +"The `\"C\"` in this example is the ABI; [other ABIs are available too](https://" +"doc.rust-lang.org/reference/items/external-blocks.html)." msgstr "" "此例中的 `\"C\"` 為 ABI;[您也可以使用其他 ABI](https://doc.rust-lang.org/" "reference/items/external-blocks.html)。" @@ -11574,23 +11360,22 @@ msgstr "" #: 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 "" -"We wouldn't actually use pointers for this because it can be done safely " +"We wouldn't actually use pointers for a `swap` function - it can be done safely " "with references." +msgstr "" +"We wouldn't actually use pointers for this because it can be done safely with " +"references." #: 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." +"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 "" -"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." +"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." #: src/unsafe-rust/unsafe-traits.md msgid "Implementing Unsafe Traits" @@ -11601,8 +11386,8 @@ msgid "" "Like with functions, you can mark a trait as `unsafe` if the implementation " "must guarantee particular conditions to avoid undefined behaviour." msgstr "" -"與函式類似,如果實作程序必須保證符合特定條件才能避免未定義的行為,您可以將特" -"徵標示為 `unsafe`。" +"與函式類似,如果實作程序必須保證符合特定條件才能避免未定義的行為,您可以將特徵標" +"示為 `unsafe`。" #: src/unsafe-rust/unsafe-traits.md msgid "" @@ -11636,11 +11421,9 @@ msgstr "" #: src/unsafe-rust/unsafe-traits.md msgid "" -"The actual safety section for `AsBytes` is rather longer and more " -"complicated." +"The actual safety section for `AsBytes` is rather longer and more complicated." msgstr "" -"The actual safety section for `AsBytes` is rather longer and more " -"complicated." +"The actual safety section for `AsBytes` is rather longer and more complicated." #: src/unsafe-rust/unsafe-traits.md msgid "The built-in `Send` and `Sync` traits are unsafe." @@ -11657,9 +11440,8 @@ msgid "" "interface_ (FFI). We will use this to build a safe wrapper for the `libc` " "functions you would use from C to read the names of files in a directory." msgstr "" -"Rust 對透過「外部函式介面」__(FFI) 呼叫函式的做法提供強大支援。我們會利用這點" -"來為 `libc` 函式建立安全的包裝函式,這是您在 C 語言中用來讀取目錄檔案名稱的函" -"式。" +"Rust 對透過「外部函式介面」__(FFI) 呼叫函式的做法提供強大支援。我們會利用這點來" +"為 `libc` 函式建立安全的包裝函式,這是您在 C 語言中用來讀取目錄檔案名稱的函式。" #: src/unsafe-rust/exercise.md msgid "You will want to consult the manual pages:" @@ -11683,8 +11465,8 @@ 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 msgid "Encoding" @@ -11699,8 +11481,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" @@ -11728,11 +11510,11 @@ msgstr "與 C 函式通訊" #: src/unsafe-rust/exercise.md msgid "" -"[`OsStr`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html) and " -"[`OsString`](https://doc.rust-lang.org/std/ffi/struct.OsString.html)" +"[`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" @@ -11748,8 +11530,7 @@ msgstr "您將在以下所有型別之間轉換:" #: src/unsafe-rust/exercise.md msgid "" -"`&str` to `CString`: you need to allocate space for a trailing `\\0` " -"character," +"`&str` to `CString`: you need to allocate space for a trailing `\\0` character," msgstr "`&str` 到 `CString`:您需要為結尾的 `\\0` 字元分配空間。" #: src/unsafe-rust/exercise.md @@ -11790,8 +11571,8 @@ msgid "" "The [Nomicon](https://doc.rust-lang.org/nomicon/ffi.html) also has a very " "useful chapter about FFI." msgstr "" -"[Nomicon](https://doc.rust-lang.org/nomicon/ffi.html) 也有關於 FFI 的實用章節" -"可供參閱。" +"[Nomicon](https://doc.rust-lang.org/nomicon/ffi.html) 也有關於 FFI 的實用章節可" +"供參閱。" #: src/unsafe-rust/exercise.md msgid "" @@ -11833,16 +11614,14 @@ msgid "" " //\n" " // \"Platforms that existed before these updates were available\" " "refers\n" -" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and " -"PowerPC.\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and PowerPC.\n" msgstr "" "// See https://github.com/rust-lang/libc/issues/414 and the section on\n" " // _DARWIN_FEATURE_64_BIT_INODE in the macOS man page for stat(2).\n" " //\n" " // \"Platforms that existed before these updates were available\" " "refers\n" -" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and " -"PowerPC.\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and PowerPC.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "\"readdir$INODE64\"" @@ -11955,28 +11734,28 @@ msgstr "歡迎在 Android 中使用 Rust" #: src/android.md msgid "" -"Rust is supported for system software on Android. This means that you can " -"write new services, libraries, drivers or even firmware in Rust (or improve " -"existing code as needed)." +"Rust is supported for system software on Android. This means that you can write " +"new services, libraries, drivers or even firmware in Rust (or improve existing " +"code as needed)." msgstr "" -"Android 的系統軟體支援 Rust。也就是說,您可以在 Rust 中編寫新的服務、程式庫、" -"驅動程式,甚至是韌體,也可以視需要強化現有程式碼。" +"Android 的系統軟體支援 Rust。也就是說,您可以在 Rust 中編寫新的服務、程式庫、驅" +"動程式,甚至是韌體,也可以視需要強化現有程式碼。" #: src/android.md msgid "" "We will attempt to call Rust from one of your own projects today. So try to " -"find a little corner of your code base where we can move some lines of code " -"to Rust. The fewer dependencies and \"exotic\" types the better. Something " -"that parses some raw bytes would be ideal." +"find a little corner of your code base where we can move some lines of code to " +"Rust. The fewer dependencies and \"exotic\" types the better. Something that " +"parses some raw bytes would be ideal." msgstr "" -"今天我們會嘗試在您擁有的其中一項專案中呼叫 Rust。因此,請盡量在程式碼集中找出" -"一小段來改寫成 Rust。請注意,依附元件和「獨特」型別越少越好。理想情況是確保程" -"式碼能剖析部分原始位元組。" +"今天我們會嘗試在您擁有的其中一項專案中呼叫 Rust。因此,請盡量在程式碼集中找出一" +"小段來改寫成 Rust。請注意,依附元件和「獨特」型別越少越好。理想情況是確保程式碼" +"能剖析部分原始位元組。" #: src/android.md msgid "" -"The speaker may mention any of the following given the increased use of Rust " -"in Android:" +"The speaker may mention any of the following given the increased use of Rust in " +"Android:" msgstr "由於 Rust 在 Android 中越來越廣為使用,講者可能可以提到以下議題:" #: src/android.md @@ -11992,13 +11771,13 @@ msgid "" "Libraries: [Rutabaga Virtual Graphics Interface](https://crosvm.dev/book/" "appendix/rutabaga_gfx.html)" msgstr "" -"程式庫:[Rutabaga 虛擬繪圖介面](https://crosvm.dev/book/appendix/" -"rutabaga_gfx.html)" +"程式庫:[Rutabaga 虛擬繪圖介面](https://crosvm.dev/book/appendix/rutabaga_gfx." +"html)" #: src/android.md msgid "" -"Kernel Drivers: [Binder](https://lore.kernel.org/rust-for-linux/20231101-" -"rust-binder-v1-0-08ba9197f637@google.com/)" +"Kernel Drivers: [Binder](https://lore.kernel.org/rust-for-linux/20231101-rust-" +"binder-v1-0-08ba9197f637@google.com/)" msgstr "" "核心驅動程式:[Binder](https://lore.kernel.org/rust-for-linux/20231101-rust-" "binder-v1-0-08ba9197f637@google.com/)" @@ -12016,32 +11795,32 @@ msgid "" "We will be using a Cuttlefish Android Virtual Device to test our code. Make " "sure you have access to one or create a new one with:" msgstr "" -"我們會使用 Cuttlefish Android 虛擬裝置來測試程式碼。請確認您可以存取這項裝" -"置,或是使用下方程式碼建立新裝置:" +"我們會使用 Cuttlefish Android 虛擬裝置來測試程式碼。請確認您可以存取這項裝置,或" +"是使用下方程式碼建立新裝置:" #: src/android/setup.md msgid "" "Please see the [Android Developer Codelab](https://source.android.com/docs/" "setup/start) for details." msgstr "" -"詳情請參閱 [Android 開發人員程式碼研究室](https://source.android.com/docs/" -"setup/start)。" +"詳情請參閱 [Android 開發人員程式碼研究室](https://source.android.com/docs/setup/" +"start)。" #: src/android/setup.md msgid "" "Cuttlefish is a reference Android device designed to work on generic Linux " "desktops. MacOS support is also planned." msgstr "" -"Cuttlefish 是參考用的 Android 裝置,可在一般 Linux 電腦上運作。日後也計劃支" -"援 MacOS。" +"Cuttlefish 是參考用的 Android 裝置,可在一般 Linux 電腦上運作。日後也計劃支援 " +"MacOS。" #: src/android/setup.md msgid "" -"The Cuttlefish system image maintains high fidelity to real devices, and is " -"the ideal emulator to run many Rust use cases." +"The Cuttlefish system image maintains high fidelity to real devices, and is the " +"ideal emulator to run many Rust use cases." msgstr "" -"Cuttlefish 系統映像檔能維持媲美實體裝置的高保真度,是可用於許多 Rust 用途的理" -"想模擬器。" +"Cuttlefish 系統映像檔能維持媲美實體裝置的高保真度,是可用於許多 Rust 用途的理想" +"模擬器。" #: src/android/build-rules.md msgid "The Android build system (Soong) supports Rust via a number of modules:" @@ -12077,8 +11856,8 @@ msgstr "`rust_ffi`" #: src/android/build-rules.md msgid "" -"Produces a Rust C library usable by `cc` modules, and provides both static " -"and shared variants." +"Produces a Rust C library usable by `cc` modules, and provides both static and " +"shared variants." msgstr "生成一個可被 `cc` 模組使用的 Rust C 函式庫,及其對應的靜態和共享變體。" #: src/android/build-rules.md @@ -12087,8 +11866,7 @@ msgstr "`rust_proc_macro`" #: src/android/build-rules.md msgid "" -"Produces a `proc-macro` Rust library. These are analogous to compiler " -"plugins." +"Produces a `proc-macro` Rust library. These are analogous to compiler plugins." msgstr "生成一個 `proc-macro` Rust 函式庫,類似於編譯器 擴充。" #: src/android/build-rules.md @@ -12113,8 +11891,8 @@ msgstr "`rust_protobuf`" #: src/android/build-rules.md msgid "" -"Generates source and produces a Rust library that provides an interface for " -"a particular protobuf." +"Generates source and produces a Rust library that provides an interface for a " +"particular protobuf." msgstr "生成對應 protobuf 介面的 Rust 原始碼及函式庫。" #: src/android/build-rules.md @@ -12144,31 +11922,31 @@ msgstr "" #: src/android/build-rules.md msgid "" -"For compliance and performance, Android must have crates in-tree. It must " -"also interop with C/C++/Java code. Soong fills that gap." +"For compliance and performance, Android must have crates in-tree. It must also " +"interop with C/C++/Java code. Soong fills that gap." msgstr "" -"為了遵循常規並確保效能,Android 必須在自身專案內提供 Crate。此外,也必須保有" -"與 C/C++/Java 程式碼的互通性。Soong 可以彌補這中間的落差。" +"為了遵循常規並確保效能,Android 必須在自身專案內提供 Crate。此外,也必須保有與 " +"C/C++/Java 程式碼的互通性。Soong 可以彌補這中間的落差。" #: src/android/build-rules.md msgid "" -"Soong has many similarities to Bazel, which is the open-source variant of " -"Blaze (used in google3)." +"Soong has many similarities to Bazel, which is the open-source variant of Blaze " +"(used in google3)." msgstr "" "Soong 與 Bazel 有許多相似之處,後者是 Blaze 的開放原始碼變化版本 (用於 " "google3)。" #: src/android/build-rules.md msgid "" -"There is a plan to transition [Android](https://source.android.com/docs/" -"setup/build/bazel/introduction), [ChromeOS](https://chromium.googlesource." -"com/chromiumos/bazel/), and [Fuchsia](https://source.android.com/docs/setup/" -"build/bazel/introduction) to Bazel." +"There is a plan to transition [Android](https://source.android.com/docs/setup/" +"build/bazel/introduction), [ChromeOS](https://chromium.googlesource.com/" +"chromiumos/bazel/), and [Fuchsia](https://source.android.com/docs/setup/build/" +"bazel/introduction) to Bazel." msgstr "" "Google 有將 [Android](https://source.android.com/docs/setup/build/bazel/" -"introduction)、[ChromeOS](https://chromium.googlesource.com/chromiumos/" -"bazel/) 和 [Fuchsia](https://source.android.com/docs/setup/build/bazel/" -"introduction) 轉移到 Bazel 的規畫。" +"introduction)、[ChromeOS](https://chromium.googlesource.com/chromiumos/bazel/) " +"和 [Fuchsia](https://source.android.com/docs/setup/build/bazel/introduction) 轉" +"移到 Bazel 的規畫。" #: src/android/build-rules.md msgid "Learning Bazel-like build rules is useful for all Rust OS developers." @@ -12177,8 +11955,7 @@ msgstr "對所有 Rust OS 開發人員來說,學習類似 Bazel 的建構規 #: src/android/build-rules.md msgid "Fun fact: Data from Star Trek is a Soong-type Android." msgstr "" -"趣味小知識:《星艦迷航記》中的「百科 (Data)」是 Soong 型的仿生機器人 " -"(android)。" +"趣味小知識:《星艦迷航記》中的「百科 (Data)」是 Soong 型的仿生機器人 (android)。" #: src/android/build-rules/binary.md msgid "Rust Binaries" @@ -12186,11 +11963,11 @@ msgstr "Rust 二進位檔" #: src/android/build-rules/binary.md msgid "" -"Let us start with a simple application. At the root of an AOSP checkout, " -"create the following files:" +"Let us start with a simple application. At the root of an AOSP checkout, create " +"the following files:" msgstr "" -"我們從一個簡單的應用程式開始著手。請在 Android 開放原始碼計畫程式庫的根層級," -"建立下列檔案:" +"我們從一個簡單的應用程式開始著手。請在 Android 開放原始碼計畫程式庫的根層級,建" +"立下列檔案:" #: src/android/build-rules/binary.md src/android/build-rules/library.md msgid "_hello_rust/Android.bp_:" @@ -12261,8 +12038,8 @@ msgid "" "(https://cs.android.com/android/platform/superproject/+/master:external/rust/" "crates/)." msgstr "" -"`libtextwrap` (隨附於 [`external/rust/crates/`](https://cs.android.com/" -"android/platform/superproject/+/master:external/rust/crates/) 的 Crate 中)" +"`libtextwrap` (隨附於 [`external/rust/crates/`](https://cs.android.com/android/" +"platform/superproject/+/master:external/rust/crates/) 的 Crate 中)" #: src/android/build-rules/library.md msgid "\"hello_rust_with_dep\"" @@ -12284,9 +12061,8 @@ msgstr "// Need this to avoid dynamic link error.\n" msgid "\"greetings\"" msgstr "\"greetings\"" -#: src/android/build-rules/library.md -#: src/android/aidl/example-service/service.md src/android/testing.md -#: src/android/interoperability/java.md +#: src/android/build-rules/library.md src/android/aidl/example-service/service.md +#: src/android/testing.md src/android/interoperability/java.md msgid "\"src/lib.rs\"" msgstr "\"src/lib.rs\"" @@ -12345,8 +12121,8 @@ msgstr "您可以在 Rust 中建立新的 AIDL 服務。" #: src/android/aidl/birthday-service.md msgid "" "To illustrate how to use Rust with Binder, we're going to walk through the " -"process of creating a Binder interface. We're then going to both implement " -"the described service and write client code that talks to that service." +"process of creating a Binder interface. We're then going to both implement the " +"described service and write client code that talks to that service." msgstr "" #: src/android/aidl/example-service/interface.md @@ -12359,8 +12135,7 @@ msgstr "您可以使用 AIDL 介面宣告服務的 API:" #: src/android/aidl/example-service/interface.md #: src/android/aidl/example-service/service-bindings.md -msgid "" -"_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" +msgid "_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" msgstr "" "_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" @@ -12416,8 +12191,8 @@ msgstr "生成的特徵:" #: src/android/aidl/example-service/service-bindings.md msgid "" -"Your service will need to implement this trait, and your client will use " -"this trait to talk to the service." +"Your service will need to implement this trait, and your client will use this " +"trait to talk to the service." msgstr "" #: src/android/aidl/example-service/service-bindings.md @@ -12428,8 +12203,8 @@ msgstr "" #: src/android/aidl/example-service/service-bindings.md msgid "" -"Point out how the generated function signature, specifically the argument " -"and return types, correspond the interface definition." +"Point out how the generated function signature, specifically the argument and " +"return types, correspond the interface definition." msgstr "" #: src/android/aidl/example-service/service-bindings.md @@ -12492,8 +12267,8 @@ msgstr "\"libbinder_rs\"" #: src/android/aidl/example-service/service.md msgid "" -"Point out the path to the generated `IBirthdayService` trait, and explain " -"why each of the segments is necessary." +"Point out the path to the generated `IBirthdayService` trait, and explain why " +"each of the segments is necessary." msgstr "" #: src/android/aidl/example-service/service.md @@ -12541,11 +12316,11 @@ msgstr "// To avoid dynamic link error.\n" #: src/android/aidl/example-service/server.md msgid "" -"The process for taking a user-defined service implementation (in this case " -"the `BirthdayService` type, which implements the `IBirthdayService`) and " -"starting it as a Binder service has multiple steps, and may appear more " -"complicated than students are used to if they've used Binder from C++ or " -"another language. Explain to students why each step is necessary." +"The process for taking a user-defined service implementation (in this case the " +"`BirthdayService` type, which implements the `IBirthdayService`) and starting " +"it as a Binder service has multiple steps, and may appear more complicated than " +"students are used to if they've used Binder from C++ or another language. " +"Explain to students why each step is necessary." msgstr "" #: src/android/aidl/example-service/server.md @@ -12563,14 +12338,14 @@ msgstr "" #: src/android/aidl/example-service/server.md msgid "" -"Call `add_service`, giving it a service identifier and your service object " -"(the `BnBirthdayService` object in the example)." +"Call `add_service`, giving it a service identifier and your service object (the " +"`BnBirthdayService` object in the example)." msgstr "" #: src/android/aidl/example-service/server.md msgid "" -"Call `join_thread_pool` to add the current thread to Binder's thread pool " -"and start listening for connections." +"Call `join_thread_pool` to add the current thread to Binder's thread pool and " +"start listening for connections." msgstr "" #: src/android/aidl/example-service/deploy.md @@ -12581,16 +12356,14 @@ msgstr "現在我們可以建構、推送及啟動服務:" msgid "" "```shell\n" "m birthday_server\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server\" /data/local/tmp\n" "adb root\n" "adb shell /data/local/tmp/birthday_server\n" "```" msgstr "" "```shell\n" "m birthday_server\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_server\" /data/local/tmp\n" "adb root\n" "adb shell /data/local/tmp/birthday_server\n" "```" @@ -12621,8 +12394,7 @@ msgid "/// Call the birthday service.\n" msgstr "/// Call the birthday service.\n" #: src/android/aidl/example-service/client.md src/android/aidl/types/objects.md -#: src/android/aidl/types/parcelables.md -#: src/android/aidl/types/file-descriptor.md +#: src/android/aidl/types/parcelables.md src/android/aidl/types/file-descriptor.md msgid "\"Failed to connect to BirthdayService\"" msgstr "\"Failed to connect to BirthdayService\"" @@ -12655,15 +12427,13 @@ msgstr "建構、推送及在裝置裡執行用戶端程式:" msgid "" "```shell\n" "m birthday_client\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client\" /data/local/tmp\n" "adb shell /data/local/tmp/birthday_client Charlie 60\n" "```" msgstr "" "```shell\n" "m birthday_client\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/birthday_client\" /data/local/tmp\n" "adb shell /data/local/tmp/birthday_client Charlie 60\n" "```" @@ -12676,29 +12446,28 @@ msgstr "" #: src/android/aidl/example-service/client.md msgid "" "`Strong` is a custom smart pointer type for Binder. It handles both an in-" -"process ref count for the service trait object, and the global Binder ref " -"count that tracks how many processes have a reference to the object." +"process ref count for the service trait object, and the global Binder ref count " +"that tracks how many processes have a reference to the object." msgstr "" #: src/android/aidl/example-service/client.md msgid "" -"Note that the trait object that the client uses to talk to the service uses " -"the exact same trait that the server implements. For a given Binder " -"interface, there is a single Rust trait generated that both client and " -"server use." +"Note that the trait object that the client uses to talk to the service uses the " +"exact same trait that the server implements. For a given Binder interface, " +"there is a single Rust trait generated that both client and server use." msgstr "" #: src/android/aidl/example-service/client.md msgid "" -"Use the same service identifier used when registering the service. This " -"should ideally be defined in a common crate that both the client and server " -"can depend on." +"Use the same service identifier used when registering the service. This should " +"ideally be defined in a common crate that both the client and server can depend " +"on." msgstr "" #: src/android/aidl/example-service/changing-definition.md msgid "" -"Let us extend the API with more functionality: we want to let clients " -"specify a list of lines for the birthday card:" +"Let us extend the API with more functionality: we want to let clients specify a " +"list of lines for the birthday card:" msgstr "讓我們為這個 API 擴充更多功能:我們想要讓用戶能在生日卡上指定幾行字:" #: src/android/aidl/example-service/changing-definition.md @@ -12707,9 +12476,9 @@ msgstr "" #: src/android/aidl/example-service/changing-definition.md msgid "" -"Note how the `String[]` in the AIDL definition is translated as a " -"`&[String]` in Rust, i.e. that idiomatic Rust types are used in the " -"generated bindings wherever possible:" +"Note how the `String[]` in the AIDL definition is translated as a `&[String]` " +"in Rust, i.e. that idiomatic Rust types are used in the generated bindings " +"wherever possible:" msgstr "" #: src/android/aidl/example-service/changing-definition.md @@ -12887,10 +12656,10 @@ msgstr "`Vec`" #: src/android/aidl/types/arrays.md msgid "" -"In Android 13 or higher, fixed-size arrays are supported, i.e. `T[N]` " -"becomes `[T; N]`. Fixed-size arrays can have multiple dimensions (e.g. " -"int\\[3\\]\\[4\\]). In the Java backend, fixed-size arrays are represented " -"as array types." +"In Android 13 or higher, fixed-size arrays are supported, i.e. `T[N]` becomes " +"`[T; N]`. Fixed-size arrays can have multiple dimensions (e.g. " +"int\\[3\\]\\[4\\]). In the Java backend, fixed-size arrays are represented as " +"array types." msgstr "" #: src/android/aidl/types/arrays.md @@ -12899,8 +12668,8 @@ msgstr "" #: src/android/aidl/types/objects.md msgid "" -"AIDL objects can be sent either as a concrete AIDL type or as the type-" -"erased `IBinder` interface:" +"AIDL objects can be sent either as a concrete AIDL type or as the type-erased " +"`IBinder` interface:" msgstr "" #: src/android/aidl/types/objects.md @@ -12960,10 +12729,8 @@ msgid "Binder for Rust supports sending parcelables directly:" msgstr "" #: src/android/aidl/types/parcelables.md -msgid "" -"**birthday_service/aidl/com/example/birthdayservice/BirthdayInfo.aidl**:" -msgstr "" -"**birthday_service/aidl/com/example/birthdayservice/BirthdayInfo.aidl**:" +msgid "**birthday_service/aidl/com/example/birthdayservice/BirthdayInfo.aidl**:" +msgstr "**birthday_service/aidl/com/example/birthdayservice/BirthdayInfo.aidl**:" #: src/android/aidl/types/parcelables.md msgid "/** The same thing, but with a parcelable. */" @@ -13006,13 +12773,11 @@ msgstr "**birthday_service/src/lib.rs**:" #: src/android/aidl/types/file-descriptor.md msgid "" "// Convert the file descriptor to a `File`. `ParcelFileDescriptor` wraps\n" -" // an `OwnedFd`, which can be cloned and then used to create a " -"`File`\n" +" // an `OwnedFd`, which can be cloned and then used to create a `File`\n" " // object.\n" msgstr "" "// Convert the file descriptor to a `File`. `ParcelFileDescriptor` wraps\n" -" // an `OwnedFd`, which can be cloned and then used to create a " -"`File`\n" +" // an `OwnedFd`, which can be cloned and then used to create a `File`\n" " // object.\n" #: src/android/aidl/types/file-descriptor.md @@ -13021,9 +12786,9 @@ msgstr "" #: src/android/aidl/types/file-descriptor.md msgid "" -"`ParcelFileDescriptor` wraps an `OwnedFd`, and so can be created from a " -"`File` (or any other type that wraps an `OwnedFd`), and can be used to " -"create a new `File` handle on the other side." +"`ParcelFileDescriptor` wraps an `OwnedFd`, and so can be created from a `File` " +"(or any other type that wraps an `OwnedFd`), and can be used to create a new " +"`File` handle on the other side." msgstr "" #: src/android/aidl/types/file-descriptor.md @@ -13039,8 +12804,8 @@ msgstr "在 Android 中的測試" #: src/android/testing.md msgid "" -"Building on [Testing](../testing.md), we will now look at how unit tests " -"work in AOSP. Use the `rust_test` module for your unit tests:" +"Building on [Testing](../testing.md), we will now look at how unit tests work " +"in AOSP. Use the `rust_test` module for your unit tests:" msgstr "" #: src/android/testing.md @@ -13107,8 +12872,8 @@ msgid "" "INFO: Elapsed time: 2.666s, Critical Path: 2.40s\n" "INFO: 3 processes: 2 internal, 1 linux-sandbox.\n" "INFO: Build completed successfully, 3 total actions\n" -"//comprehensive-rust-android/testing:libleftpad_test_host PASSED " -"in 2.3s\n" +"//comprehensive-rust-android/testing:libleftpad_test_host PASSED in " +"2.3s\n" " PASSED libleftpad_test.tests::long_string (0.0s)\n" " PASSED libleftpad_test.tests::short_string (0.0s)\n" "Test cases: finished with 2 passing and 0 failing out of 2 test cases\n" @@ -13118,8 +12883,8 @@ msgstr "" "INFO: Elapsed time: 2.666s, Critical Path: 2.40s\n" "INFO: 3 processes: 2 internal, 1 linux-sandbox.\n" "INFO: Build completed successfully, 3 total actions\n" -"//comprehensive-rust-android/testing:libleftpad_test_host PASSED " -"in 2.3s\n" +"//comprehensive-rust-android/testing:libleftpad_test_host PASSED in " +"2.3s\n" " PASSED libleftpad_test.tests::long_string (0.0s)\n" " PASSED libleftpad_test.tests::short_string (0.0s)\n" "Test cases: finished with 2 passing and 0 failing out of 2 test cases\n" @@ -13156,9 +12921,9 @@ msgstr "" #: src/android/testing/googletest.md msgid "" -"GoogleTest is not part of the Rust Playground, so you need to run this " -"example in a local environment. Use `cargo add googletest` to quickly add it " -"to an existing Cargo project." +"GoogleTest is not part of the Rust Playground, so you need to run this example " +"in a local environment. Use `cargo add googletest` to quickly add it to an " +"existing Cargo project." msgstr "" #: src/android/testing/googletest.md @@ -13174,8 +12939,8 @@ msgstr "" #: src/android/testing/googletest.md msgid "" -"A particularly nice feature is that mismatches in multi-line strings are " -"shown as a diff:" +"A particularly nice feature is that mismatches in multi-line strings are shown " +"as a diff:" msgstr "" #: src/android/testing/googletest.md @@ -13204,71 +12969,69 @@ msgstr "" #: src/android/testing/mocking.md msgid "" -"For mocking, [Mockall](https://docs.rs/mockall/) is a widely used library. " -"You need to refactor your code to use traits, which you can then quickly " -"mock:" +"For mocking, [Mockall](https://docs.rs/mockall/) is a widely used library. You " +"need to refactor your code to use traits, which you can then quickly mock:" msgstr "" #: src/android/testing/mocking.md msgid "" -"Mockall is the recommended mocking library in Android (AOSP). There are " -"other [mocking libraries available on crates.io](https://crates.io/keywords/" -"mock), in particular in the area of mocking HTTP services. The other mocking " -"libraries work in a similar fashion as Mockall, meaning that they make it " -"easy to get a mock implementation of a given trait." +"Mockall is the recommended mocking library in Android (AOSP). There are other " +"[mocking libraries available on crates.io](https://crates.io/keywords/mock), in " +"particular in the area of mocking HTTP services. The other mocking libraries " +"work in a similar fashion as Mockall, meaning that they make it easy to get a " +"mock implementation of a given trait." msgstr "" #: src/android/testing/mocking.md msgid "" "Note that mocking is somewhat _controversial_: mocks allow you to completely " -"isolate a test from its dependencies. The immediate result is faster and " -"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." +"isolate a test from its dependencies. The immediate result is faster and 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 "" #: src/android/testing/mocking.md msgid "" -"If at all possible, it is recommended that you use the real dependencies. As " -"an example, many databases allow you to configure an in-memory backend. This " -"means that you get the correct behavior in your tests, plus they are fast " -"and will automatically clean up after themselves." +"If at all possible, it is recommended that you use the real dependencies. As an " +"example, many databases allow you to configure an in-memory backend. This 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 "" "Similarly, many web frameworks allow you to start an in-process server which " -"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." +"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 "" #: src/android/testing/mocking.md msgid "" -"Mockall is not part of the Rust Playground, so you need to run this example " -"in a local environment. Use `cargo add mockall` to quickly add Mockall to an " +"Mockall is not part of the Rust Playground, so you need to run this example in " +"a local environment. Use `cargo add mockall` to quickly add Mockall to an " "existing Cargo project." msgstr "" #: src/android/testing/mocking.md msgid "" "Mockall has a lot more functionality. In particular, you can set up " -"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:" +"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 "" #: src/android/testing/mocking.md msgid "" "You can use `.times(n)` to limit the number of times a mock method can be " -"called to `n` --- the mock will automatically panic when dropped if this " -"isn't satisfied." +"called to `n` --- the mock will automatically panic when dropped if this isn't " +"satisfied." msgstr "" #: src/android/logging.md msgid "" -"You should use the `log` crate to automatically log to `logcat` (on-device) " -"or `stdout` (on-host):" +"You should use the `log` crate to automatically log to `logcat` (on-device) or " +"`stdout` (on-host):" msgstr "" -"您應使用 `log` Crate,自動將記錄印出到 `logcat` (裝置端) 或 `stdout` (主機" -"端):" +"您應使用 `log` Crate,自動將記錄印出到 `logcat` (裝置端) 或 `stdout` (主機端):" #: src/android/logging.md msgid "_hello_rust_logs/Android.bp_:" @@ -13323,15 +13086,13 @@ msgstr "建構、推送及在裝置上執行二進位檔:" msgid "" "```shell\n" "m hello_rust_logs\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs\" /data/local/tmp\n" "adb shell /data/local/tmp/hello_rust_logs\n" "```" msgstr "" "```shell\n" "m hello_rust_logs\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs\" /data/local/tmp\n" "adb shell /data/local/tmp/hello_rust_logs\n" "```" @@ -13358,8 +13119,8 @@ msgid "" "When you call functions in a foreign language we say that you're using a " "_foreign function interface_, also known as FFI." msgstr "" -"當您以其他語言呼叫函式時,我們稱之為使用「_外部函式介面_」,亦稱 FFI " -"(Foreign Function Interface)。" +"當您以其他語言呼叫函式時,我們稱之為使用「_外部函式介面_」,亦稱 FFI (Foreign " +"Function Interface)。" #: src/android/interoperability/with-c.md msgid "Interoperability with C" @@ -13370,8 +13131,8 @@ msgid "" "Rust has full support for linking object files with a C calling convention. " "Similarly, you can export Rust functions and call them from C." msgstr "" -"Rust 能完整支援以 C 語言的呼叫慣例來連結物件檔案。同樣地,您可以匯出 Rust 函" -"式,然後透過 C 語言呼叫這些函式。" +"Rust 能完整支援以 C 語言的呼叫慣例來連結物件檔案。同樣地,您可以匯出 Rust 函式," +"然後透過 C 語言呼叫這些函式。" #: src/android/interoperability/with-c.md msgid "You can do it by hand if you want:" @@ -13386,8 +13147,8 @@ msgid "" "We already saw this in the [Safe FFI Wrapper exercise](../../exercises/day-3/" "safe-ffi-wrapper.md)." msgstr "" -"我們已在[「安全的 FFI 包裝函式」練習](../../exercises/day-3/safe-ffi-wrapper." -"md)中看過此例。" +"我們已在[「安全的 FFI 包裝函式」練習](../../exercises/day-3/safe-ffi-wrapper.md)" +"中看過此例。" #: src/android/interoperability/with-c.md msgid "" @@ -13405,11 +13166,11 @@ msgstr "使用 Bindgen" #: src/android/interoperability/with-c/bindgen.md msgid "" -"The [bindgen](https://rust-lang.github.io/rust-bindgen/introduction.html) " -"tool can auto-generate bindings from a C header file." +"The [bindgen](https://rust-lang.github.io/rust-bindgen/introduction.html) tool " +"can auto-generate bindings from a C header file." msgstr "" -"[bindgen](https://rust-lang.github.io/rust-bindgen/introduction.html) 工具可" -"從 C 標頭檔案自動產生繫結。" +"[bindgen](https://rust-lang.github.io/rust-bindgen/introduction.html) 工具可從 " +"C 標頭檔案自動產生繫結。" #: src/android/interoperability/with-c/bindgen.md msgid "First create a small C library:" @@ -13626,34 +13387,31 @@ msgstr "\"main.c\"" msgid "" "```shell\n" "m analyze_numbers\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers\" /data/local/tmp\n" "adb shell /data/local/tmp/analyze_numbers\n" "```" msgstr "" "```shell\n" "m analyze_numbers\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers\" /data/local/tmp\n" "adb shell /data/local/tmp/analyze_numbers\n" "```" #: src/android/interoperability/with-c/rust.md msgid "" -"`#[no_mangle]` disables Rust's usual name mangling, so the exported symbol " -"will just be the name of the function. You can also use `#[export_name = " +"`#[no_mangle]` disables Rust's usual name mangling, so the exported symbol will " +"just be the name of the function. You can also use `#[export_name = " "\"some_name\"]` to specify whatever name you want." msgstr "" -"`#[no_mangle]` 會停用 Rust 的一般名稱改編功能,因此匯出的符號將只是函式名稱。" -"您也可以使用 `#[export_name = \"some_name\"]` 指定任何名稱。" +"`#[no_mangle]` 會停用 Rust 的一般名稱改編功能,因此匯出的符號將只是函式名稱。您" +"也可以使用 `#[export_name = \"some_name\"]` 指定任何名稱。" #: src/android/interoperability/cpp.md msgid "" -"The [CXX crate](https://cxx.rs/) makes it possible to do safe " -"interoperability between Rust and C++." +"The [CXX crate](https://cxx.rs/) makes it possible to do safe interoperability " +"between Rust and C++." msgstr "" -"透過 [CXX Crate](https://cxx.rs/),您可以在 Rust 和 C++ 之間實現安全的互通" -"性。" +"透過 [CXX Crate](https://cxx.rs/),您可以在 Rust 和 C++ 之間實現安全的互通性。" #: src/android/interoperability/cpp.md msgid "The overall approach looks like this:" @@ -13665,9 +13423,9 @@ 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::bridge]` 屬性巨集註解的 Rust 模組中,使用外部區塊提" -"供這項說明。" +"CXX 的運作需要依照函式的型別敘述。這些敘述定義了從一種語言公開至另一種語言的介" +"面。您會在具有 `#[cxx::bridge]` 屬性巨集註解的 Rust 模組中,使用外部區塊提供這項" +"說明。" #: src/android/interoperability/cpp/bridge.md msgid "\"org::blobstore\"" @@ -13716,22 +13474,22 @@ msgstr "橋接器通常是在 Crate 中的 `ffi` 模組中宣告。" #: src/android/interoperability/cpp/bridge.md msgid "" "From the declarations made in the bridge module, CXX will generate matching " -"Rust and C++ type/function definitions in order to expose those items to " -"both languages." +"Rust and C++ type/function definitions in order to expose those items to both " +"languages." msgstr "" -"透過在橋接模組中建立宣告,CXX 會產生相符的 Rust 和 C++ 型別/函式定義,以便向" -"這兩種語言公開這些項目。" +"透過在橋接模組中建立宣告,CXX 會產生相符的 Rust 和 C++ 型別/函式定義,以便向這兩" +"種語言公開這些項目。" #: src/android/interoperability/cpp/bridge.md msgid "" -"To view the generated Rust code, use [cargo-expand](https://github.com/" -"dtolnay/cargo-expand) to view the expanded proc macro. For most of the " -"examples you would use `cargo expand ::ffi` to expand just the `ffi` module " -"(though this doesn't apply for Android projects)." +"To view the generated Rust code, use [cargo-expand](https://github.com/dtolnay/" +"cargo-expand) to view the expanded proc macro. For most of the examples you " +"would use `cargo expand ::ffi` to expand just the `ffi` module (though this " +"doesn't apply for Android projects)." msgstr "" "如要查看產生的 Rust 程式碼,請使用 [cargo-expand](https://github.com/dtolnay/" -"cargo-expand) 檢視已展開的程序巨集。在大多數範例中,您都會使用 `cargo " -"expand ::ffi`,這樣就能只展開 `ffi` 模組 (但這不適用於 Android 專案)。" +"cargo-expand) 檢視已展開的程序巨集。在大多數範例中,您都會使用 `cargo expand ::" +"ffi`,這樣就能只展開 `ffi` 模組 (但這不適用於 Android 專案)。" #: src/android/interoperability/cpp/bridge.md msgid "To view the generated C++ code, look in `target/cxxbridge`." @@ -13761,14 +13519,14 @@ msgstr "在 `extern \"Rust\"` 參照項目中宣告的項目皆位於上層模 #: src/android/interoperability/cpp/rust-bridge.md msgid "" -"The CXX code generator uses your `extern \"Rust\"` section(s) to produce a C+" -"+ header file containing the corresponding C++ declarations. The generated " -"header has the same path as the Rust source file containing the bridge, " -"except with a .rs.h file extension." +"The CXX code generator uses your `extern \"Rust\"` section(s) to produce a C++ " +"header file containing the corresponding C++ declarations. The generated header " +"has the same path as the Rust source file containing the bridge, except with a ." +"rs.h file extension." msgstr "" -"CXX 程式碼產生器會使用您的 `extern \"Rust\"` 區段,產生含有相對應 C++ 宣告的 " -"C++ 標頭檔案。產生的標頭與包含橋接器的 Rust 來源檔案具有相同路徑,但副檔名" -"為 .rs.h。" +"CXX 程式碼產生器會使用您的 `extern \"Rust\"` 區段,產生含有相對應 C++ 宣告的 C+" +"+ 標頭檔案。產生的標頭與包含橋接器的 Rust 來源檔案具有相同路徑,但副檔名為 .rs." +"h。" #: src/android/interoperability/cpp/generated-cpp.md msgid "Results in (roughly) the following C++:" @@ -13792,17 +13550,17 @@ msgstr "\"org$blobstore$cxxbridge1$BlobstoreClient$put\"" #: src/android/interoperability/cpp/cpp-bridge.md msgid "" -"The programmer does not need to promise that the signatures they have typed " -"in are accurate. CXX performs static assertions that the signatures exactly " +"The programmer does not need to promise that the signatures they have typed in " +"are accurate. CXX performs static assertions that the signatures exactly " "correspond with what is declared in C++." msgstr "" -"程式設計師不需要保證已輸入的簽章正確無誤。CXX 會執行靜態斷言,保證簽章與 C++ " -"中宣告的內容完全相符。" +"程式設計師不需要保證已輸入的簽章正確無誤。CXX 會執行靜態斷言,保證簽章與 C++ 中" +"宣告的內容完全相符。" #: src/android/interoperability/cpp/cpp-bridge.md msgid "" -"`unsafe extern` blocks allow you to declare C++ functions that are safe to " -"call from Rust." +"`unsafe extern` blocks allow you to declare C++ functions that are safe to call " +"from Rust." msgstr "`unsafe extern` 區塊可用來宣告能從 Rust 安全呼叫的 C++ 函式。" #: src/android/interoperability/cpp/shared-types.md @@ -13820,9 +13578,9 @@ msgid "" "derive `Hash` also generates an implementation of `std::hash` for the " "corresponding C++ type." msgstr "" -"共用型別上的 `#[derive()]` 只支援部分特徵。系統也會為 C++ 程式碼產生相對應的" -"功能。舉例來說,如果衍生出 `Hash`,也會為相應的 C++ 型別產生 `std::hash` 的實" -"作項目。" +"共用型別上的 `#[derive()]` 只支援部分特徵。系統也會為 C++ 程式碼產生相對應的功" +"能。舉例來說,如果衍生出 `Hash`,也會為相應的 C++ 型別產生 `std::hash` 的實作項" +"目。" #: src/android/interoperability/cpp/shared-enums.md msgid "Generated Rust:" @@ -13835,12 +13593,12 @@ msgstr "產生的 C++:" #: src/android/interoperability/cpp/shared-enums.md msgid "" "On the Rust side, the code generated for shared enums is actually a struct " -"wrapping a numeric value. This is because it is not UB in C++ for an enum " -"class to hold a value different from all of the listed variants, and our " -"Rust representation needs to have the same behavior." +"wrapping a numeric value. This is because it is not UB in C++ for an enum class " +"to hold a value different from all of the listed variants, and our Rust " +"representation needs to have the same behavior." msgstr "" -"在 Rust 端,為共用列舉產生的程式碼其實是包裝數值的結構體。這是因為在 C++ 中," -"列舉類別保留與所有所列變數不同的值並不屬於 UB,而 Rust 表示法需具有相同行為。" +"在 Rust 端,為共用列舉產生的程式碼其實是包裝數值的結構體。這是因為在 C++ 中,列" +"舉類別保留與所有所列變數不同的值並不屬於 UB,而 Rust 表示法需具有相同行為。" #: src/android/interoperability/cpp/rust-result.md msgid "\"fallible1 requires depth > 0\"" @@ -13859,16 +13617,16 @@ msgstr "傳回 `Result` 的 Rust 函式會轉譯為 C++ 端的例外狀況。" #: src/android/interoperability/cpp/rust-result.md msgid "" "The exception thrown will always be of type `rust::Error`, which primarily " -"exposes a way to get the error message string. The error message will come " -"from the error type's `Display` impl." +"exposes a way to get the error message string. The error message will come from " +"the error type's `Display` impl." msgstr "" "擲回的例外狀況一律屬於 `rust::Error` 類型,這主要用來公開取得錯誤訊息字串的方" "法。錯誤訊息會來自錯誤類型的 `Display` 實作項目。" #: src/android/interoperability/cpp/rust-result.md msgid "" -"A panic unwinding from Rust to C++ will always cause the process to " -"immediately terminate." +"A panic unwinding from Rust to C++ will always cause the process to immediately " +"terminate." msgstr "從 Rust 恐慌解開至 C++ 一律會導致程序立即終止。" #: src/android/interoperability/cpp/cpp-exception.md @@ -13881,22 +13639,22 @@ msgstr "\"Error: {}\"" #: src/android/interoperability/cpp/cpp-exception.md msgid "" -"C++ functions declared to return a `Result` will catch any thrown exception " -"on the C++ side and return it as an `Err` value to the calling Rust function." +"C++ functions declared to return a `Result` will catch any thrown exception on " +"the C++ side and return it as an `Err` value to the calling Rust function." msgstr "" -"所宣告用來傳回 `Result` 的 C++ 函式會擷取 C++ 端的任何擲回例外狀況,並將其當" -"做 `Err` 值傳回至發出呼叫的 Rust 函式。" +"所宣告用來傳回 `Result` 的 C++ 函式會擷取 C++ 端的任何擲回例外狀況,並將其當做 " +"`Err` 值傳回至發出呼叫的 Rust 函式。" #: src/android/interoperability/cpp/cpp-exception.md msgid "" -"If an exception is thrown from an extern \"C++\" function that is not " -"declared by the CXX bridge to return `Result`, the program calls C++'s `std::" -"terminate`. The behavior is equivalent to the same exception being thrown " -"through a `noexcept` C++ function." +"If an exception is thrown from an extern \"C++\" function that is not declared " +"by the CXX bridge to return `Result`, the program calls C++'s `std::terminate`. " +"The behavior is equivalent to the same exception being thrown through a " +"`noexcept` C++ function." msgstr "" -"假使例外狀況是從 CXX 橋接器未宣告的外部「C++」函式擲回,藉此傳回 `Result`,則" -"程式會呼叫 C++ 的 `std::terminate`。此行為等同於透過 `noexcept` C++ 函式擲回" -"的相同例外狀況。" +"假使例外狀況是從 CXX 橋接器未宣告的外部「C++」函式擲回,藉此傳回 `Result`,則程" +"式會呼叫 C++ 的 `std::terminate`。此行為等同於透過 `noexcept` C++ 函式擲回的相同" +"例外狀況。" #: src/android/interoperability/cpp/type-mapping.md #, fuzzy @@ -13957,26 +13715,24 @@ msgstr "`std::vector`" #: src/android/interoperability/cpp/type-mapping.md msgid "" -"These types can be used in the fields of shared structs and the arguments " -"and returns of extern functions." +"These types can be used in the fields of shared structs and the arguments and " +"returns of extern functions." msgstr "這些型別可用於共用結構體的欄位,以及外部函式的引數和回傳內容。" #: src/android/interoperability/cpp/type-mapping.md msgid "" -"Note that Rust's `String` does not map directly to `std::string`. There are " -"a few reasons for this:" -msgstr "" -"請注意,Rust 的 `String` 不會直接對應至 `std::string`。以下列舉幾個原因:" +"Note that Rust's `String` does not map directly to `std::string`. There are a " +"few reasons for this:" +msgstr "請注意,Rust 的 `String` 不會直接對應至 `std::string`。以下列舉幾個原因:" #: src/android/interoperability/cpp/type-mapping.md -msgid "" -"`std::string` does not uphold the UTF-8 invariant that `String` requires." +msgid "`std::string` does not uphold the UTF-8 invariant that `String` requires." msgstr "`std::string` 不會維護 `String` 所需的 UTF-8 不變體。" #: src/android/interoperability/cpp/type-mapping.md msgid "" -"The two types have different layouts in memory and so can't be passed " -"directly between languages." +"The two types have different layouts in memory and so can't be passed directly " +"between languages." msgstr "這兩種型別的內部記憶體結構不同,因此無法在語言之間直接傳遞。" #: src/android/interoperability/cpp/type-mapping.md @@ -13984,8 +13740,8 @@ msgid "" "`std::string` requires move constructors that don't match Rust's move " "semantics, so a `std::string` can't be passed by value to Rust." msgstr "" -"`std::string` 需要的移動建構函式與 Rust 的移動語意不相符,因此 `std::string` " -"無法透過值傳遞至 Rust。" +"`std::string` 需要的移動建構函式與 Rust 的移動語意不相符,因此 `std::string` 無" +"法透過值傳遞至 Rust。" #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-cpp-genrules.md @@ -13998,8 +13754,7 @@ msgid "" "Create a `cc_library_static` to build the C++ library, including the CXX " "generated header and source file." msgstr "" -"建立 `cc_library_static` 來建構 C++ 程式庫,包括 CXX 產生的標頭檔案和來源檔" -"案。" +"建立 `cc_library_static` 來建構 C++ 程式庫,包括 CXX 產生的標頭檔案和來源檔案。" #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-build-rust.md @@ -14027,31 +13782,31 @@ msgstr "\"libcxx_test_bridge_code\"" #: src/android/interoperability/cpp/android-build-cpp.md msgid "" "Point out that `libcxx_test_bridge_header` and `libcxx_test_bridge_code` are " -"the dependencies for the CXX-generated C++ bindings. We'll show how these " -"are setup on the next slide." +"the dependencies for the CXX-generated C++ bindings. We'll show how these are " +"setup on the next slide." msgstr "" -"指出 `libcxx_test_bridge_header 和 `libcxx_test_bridge_code` 是 CXX 產生的 C+" -"+ 繫結依附元件。下一張投影片將說明相關設定方法。" +"指出 `libcxx_test_bridge_header 和 `libcxx_test_bridge_code` 是 CXX 產生的 C++ " +"繫結依附元件。下一張投影片將說明相關設定方法。" #: src/android/interoperability/cpp/android-build-cpp.md msgid "" -"Note that you also need to depend on the `cxx-bridge-header` library in " -"order to pull in common CXX definitions." +"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 定義。" #: src/android/interoperability/cpp/android-build-cpp.md msgid "" -"Full docs for using CXX in Android can be found in [the Android docs]" -"(https://source.android.com/docs/setup/build/rust/building-rust-modules/" -"android-rust-patterns#rust-cpp-interop-using-cxx). You may want to share " -"that link with the class so that students know where they can find these " -"instructions again in the future." +"Full docs for using CXX in Android can be found in [the Android docs](https://" +"source.android.com/docs/setup/build/rust/building-rust-modules/android-rust-" +"patterns#rust-cpp-interop-using-cxx). You may want to share that link with the " +"class so that students know where they can find these instructions again in the " +"future." msgstr "" -"如需介紹如何在 Android 中使用 CXX 的完整文件,請參閱 [Android 說明文件]" -"(https://source.android.com/docs/setup/build/rust/building-rust-modules/" -"android-rust-patterns#rust-cpp-interop-using-cxx)。您可以與全班分享該連結,這" -"樣學生就知道以後能在哪裡找到這些說明。" +"如需介紹如何在 Android 中使用 CXX 的完整文件,請參閱 [Android 說明文件](https://" +"source.android.com/docs/setup/build/rust/building-rust-modules/android-rust-" +"patterns#rust-cpp-interop-using-cxx)。您可以與全班分享該連結,這樣學生就知道以後" +"能在哪裡找到這些說明。" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "" @@ -14112,8 +13867,8 @@ 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`,來源檔" -"案的名稱則是 `lib.rs.cc`。不過,系統不會強制執行這項命名慣例。" +"按照慣例,如果 Rust 來源檔案是 `lib.rs`,標頭檔案會命名為 `lib.rs.h`,來源檔案的" +"名稱則是 `lib.rs.cc`。不過,系統不會強制執行這項命名慣例。" #: src/android/interoperability/cpp/android-build-rust.md msgid "" @@ -14139,8 +13894,8 @@ msgid "" "jni/) allows you to create a compatible library." msgstr "" "Java 可透過 [Java 原生介面 (JNI)](https://en.wikipedia.org/wiki/" -"Java_Native_Interface) 載入共用物件。[`jni` Crate](https://docs.rs/jni/) 可用" -"來建立相容的程式庫。" +"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:" @@ -14208,11 +13963,11 @@ msgstr "最後,您可以建構、同步處理及執行二進位檔:" #: src/exercises/android/morning.md msgid "" -"This is a group exercise: We will look at one of the projects you work with " -"and try to integrate some Rust into it. Some suggestions:" +"This is a group exercise: We will look at one of the projects you work with and " +"try to integrate some Rust into it. Some suggestions:" msgstr "" -"這是小組練習:我們會查看您的其中一項專案,嘗試將一些 Rust 整合至該專案。建議" -"事項:" +"這是小組練習:我們會查看您的其中一項專案,嘗試將一些 Rust 整合至該專案。建議事" +"項:" #: src/exercises/android/morning.md msgid "Call your AIDL service with a client written in Rust." @@ -14224,8 +13979,8 @@ msgstr "將函式從專案移至 Rust,並呼叫該函式。" #: src/exercises/android/morning.md 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." +"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。" @@ -14236,47 +13991,45 @@ msgstr "歡迎瞭解 Chromium 中的 Rust" #: src/chromium.md msgid "" -"Rust is supported for third-party libraries in Chromium, with first-party " -"glue code to connect between Rust and existing Chromium C++ code." +"Rust is supported for third-party libraries in Chromium, with first-party glue " +"code to connect between Rust and existing Chromium C++ code." msgstr "" "Chromium 中的第三方程式庫支援 Rust,且有第一方黏合程式碼可連結 Rust 和現有的 " "Chromium C++ 程式碼。" #: src/chromium.md msgid "" -"Today, we'll call into Rust to do something silly with strings. If you've " -"got a corner of the code where you're displaying a UTF8 string to the user, " -"feel free to follow this recipe in your part of the codebase instead of the " -"exact part we talk about." +"Today, we'll call into Rust to do something silly with strings. If you've got a " +"corner of the code where you're displaying a UTF8 string to the user, feel free " +"to follow this recipe in your part of the codebase instead of the exact part we " +"talk about." msgstr "" -"今天我們會在 Rust 中用字串做些小事。如果您有一小部份的程式碼要向使用者顯示 " -"UTF8 字串,您可以在自己的程式碼集內採用這個方案,不必採用我們所介紹的該部分程" -"式碼集。" +"今天我們會在 Rust 中用字串做些小事。如果您有一小部份的程式碼要向使用者顯示 UTF8 " +"字串,您可以在自己的程式碼集內採用這個方案,不必採用我們所介紹的該部分程式碼集。" #: src/chromium/setup.md msgid "" -"Make sure you can build and run Chromium. Any platform and set of build " -"flags is OK, so long as your code is relatively recent (commit position " -"1223636 onwards, corresponding to November 2023):" +"Make sure you can build and run Chromium. Any platform and set of build flags " +"is OK, so long as your code is relatively recent (commit position 1223636 " +"onwards, corresponding to November 2023):" msgstr "" -"請確認您可以建構並執行 Chromium。任何平台和建構標記組合都可以,只要程式碼相對" -"較新即可 (提交位置在 1223636 之後,日期對應到 2023 年 11 月):" +"請確認您可以建構並執行 Chromium。任何平台和建構標記組合都可以,只要程式碼相對較" +"新即可 (提交位置在 1223636 之後,日期對應到 2023 年 11 月):" #: src/chromium/setup.md msgid "" -"(A component, debug build is recommended for quickest iteration time. This " -"is the default!)" +"(A component, debug build is recommended for quickest iteration time. This is " +"the default!)" msgstr "(如要達到最快的疊代速度,建議使用元件式及偵錯版本。這是預設情形!)" #: src/chromium/setup.md msgid "" -"See [How to build Chromium](https://www.chromium.org/developers/how-tos/get-" -"the-code/) if you aren't already at that point. Be warned: setting up to " -"build Chromium takes time." +"See [How to build Chromium](https://www.chromium.org/developers/how-tos/get-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/" -"developers/how-tos/get-the-code/)。提醒您,設定 Chromium 建構作業需要一段時" -"間。" +"developers/how-tos/get-the-code/)。提醒您,設定 Chromium 建構作業需要一段時間。" #: src/chromium/setup.md msgid "It's also recommended that you have Visual Studio code installed." @@ -14289,12 +14042,12 @@ msgstr "關於練習" #: src/chromium/setup.md msgid "" "This part of the course has a series of exercises which build on each other. " -"We'll be doing them spread throughout the course instead of just at the end. " -"If you don't have time to complete a certain part, don't worry: you can " -"catch up in the next slot." +"We'll be doing them spread throughout the course instead of just at the end. If " +"you don't have time to complete a certain part, don't worry: you can catch up " +"in the next slot." msgstr "" -"這部分的課程包含一系列連貫的練習。我們會在課程中穿插練習,而不是放到最後。如" -"果沒時間完成某個部分也不必擔心,下次補上即可。" +"這部分的課程包含一系列連貫的練習。我們會在課程中穿插練習,而不是放到最後。如果沒" +"時間完成某個部分也不必擔心,下次補上即可。" #: src/chromium/cargo.md msgid "" @@ -14302,8 +14055,8 @@ msgid "" "(https://crates.io/). Chromium is built using `gn` and `ninja` and a curated " "set of dependencies." msgstr "" -"Rust 社群一般使用 `cargo` 和 [crates.io](https://crates.io/) 的程式庫。" -"Chromium 是以 `gn` 和 `ninja` 技術和一組精選的依附元件建構而成。" +"Rust 社群一般使用 `cargo` 和 [crates.io](https://crates.io/) 的程式庫。Chromium " +"是以 `gn` 和 `ninja` 技術和一組精選的依附元件建構而成。" #: src/chromium/cargo.md msgid "When writing code in Rust, your choices are:" @@ -14311,22 +14064,21 @@ msgstr "在 Rust 中編寫程式碼時,您有以下選擇:" #: src/chromium/cargo.md msgid "" -"Use `gn` and `ninja` with the help of the templates from `//build/rust/*." -"gni` (e.g. `rust_static_library` that we'll meet later). This uses " -"Chromium's audited toolchain and crates." +"Use `gn` and `ninja` with the help of the templates from `//build/rust/*.gni` " +"(e.g. `rust_static_library` that we'll meet later). This uses Chromium's " +"audited toolchain and crates." msgstr "" -"藉助 `//build/rust/*.gni` 中的範本 (例如 `rust_static_library`,稍後會介紹)," -"使用 `gn` 和 `ninja`。這麼做會使用 Chromium 經稽核的工具鏈和 Crate。" +"藉助 `//build/rust/*.gni` 中的範本 (例如 `rust_static_library`,稍後會介紹),使" +"用 `gn` 和 `ninja`。這麼做會使用 Chromium 經稽核的工具鏈和 Crate。" #: src/chromium/cargo.md msgid "" -"Use `cargo`, but [restrict yourself to Chromium's audited toolchain and " -"crates](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/" -"docs/rust.md#Using-cargo)" +"Use `cargo`, but [restrict yourself to Chromium's audited toolchain and crates]" +"(https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust." +"md#Using-cargo)" msgstr "" -"使用 `cargo`,但[限制自己使用 Chromium 經稽核的工具鏈和 Crate](https://" -"chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust.md#Using-" -"cargo)" +"使用 `cargo`,但[限制自己使用 Chromium 經稽核的工具鏈和 Crate](https://chromium." +"googlesource.com/chromium/src/+/refs/heads/main/docs/rust.md#Using-cargo)" #: src/chromium/cargo.md msgid "" @@ -14342,9 +14094,9 @@ msgid "" "code can be built into the Chromium browser. At the same time, Cargo is an " "important part of the Rust ecosystem and you should keep it in your toolbox." msgstr "" -"接下來的重點將放在 `gn` 和 `ninja`,因為這就是將 Rust 程式碼建構至 Chromium " -"瀏覽器中的方式。同時,Cargo 是 Rust 生態系統中重要的一環,因此您應該學會使用" -"這項工具。" +"接下來的重點將放在 `gn` 和 `ninja`,因為這就是將 Rust 程式碼建構至 Chromium 瀏覽" +"器中的方式。同時,Cargo 是 Rust 生態系統中重要的一環,因此您應該學會使用這項工" +"具。" #: src/chromium/cargo.md #, fuzzy @@ -14357,8 +14109,8 @@ msgstr "請分成小組,按照下列指示開始練習:" #: src/chromium/cargo.md msgid "" -"Brainstorm scenarios where `cargo` may offer an advantage and assess the " -"risk profile of these scenarios." +"Brainstorm scenarios where `cargo` may offer an advantage and assess the risk " +"profile of these scenarios." msgstr "發想各種 `cargo` 可帶來優勢的情境,然後評估這些情境的風險狀況。" #: src/chromium/cargo.md @@ -14372,38 +14124,38 @@ msgstr "" #: src/chromium/cargo.md msgid "" "Ask students to avoid peeking at the speaker notes before completing the " -"exercise. Assuming folks taking the course are physically together, ask them " -"to discuss in small groups of 3-4 people." +"exercise. Assuming folks taking the course are physically together, ask them to " +"discuss in small groups of 3-4 people." msgstr "" -"請要求學生不要在完成練習前偷看演講者備忘稿。如果學生在彼此身邊,請要求他們分" -"為 3 到 4 人一組一起討論。" +"請要求學生不要在完成練習前偷看演講者備忘稿。如果學生在彼此身邊,請要求他們分為 " +"3 到 4 人一組一起討論。" #: src/chromium/cargo.md msgid "" -"Notes/hints related to the first part of the exercise (\"scenarios where " -"Cargo may offer an advantage\"):" +"Notes/hints related to the first part of the exercise (\"scenarios where Cargo " +"may offer an advantage\"):" msgstr "與第一部分練習 (「Cargo 可帶來優勢的情境」) 相關的附註/提示:" #: src/chromium/cargo.md msgid "" -"It's fantastic that when writing a tool, or prototyping a part of Chromium, " -"one has access to the rich ecosystem of crates.io libraries. There is a " -"crate for almost anything and they are usually quite pleasant to use. " -"(`clap` for command-line parsing, `serde` for serializing/deserializing to/" -"from various formats, `itertools` for working with iterators, etc.)." +"It's fantastic that when writing a tool, or prototyping a part of Chromium, one " +"has access to the rich ecosystem of crates.io libraries. There is a crate for " +"almost anything and they are usually quite pleasant to use. (`clap` for command-" +"line parsing, `serde` for serializing/deserializing to/from various formats, " +"`itertools` for working with iterators, etc.)." msgstr "" -"很棒的是,在編寫工具或設計 Chromium 中某部分的原型時,開發人員可以存取 " -"crates.io 程式庫豐富的生態系統。幾乎所有東西都有 Crate,而且使用方法通常很簡" -"便 (用於指令列剖析的 `clap`、用於將各種格式序列化/反序列化的 `serde`,以及與" -"疊代器搭配使用的 `itertools` 等)。" +"很棒的是,在編寫工具或設計 Chromium 中某部分的原型時,開發人員可以存取 crates." +"io 程式庫豐富的生態系統。幾乎所有東西都有 Crate,而且使用方法通常很簡便 (用於指" +"令列剖析的 `clap`、用於將各種格式序列化/反序列化的 `serde`,以及與疊代器搭配使用" +"的 `itertools` 等)。" #: src/chromium/cargo.md msgid "" -"`cargo` makes it easy to try a library (just add a single line to `Cargo." -"toml` and start writing code)" +"`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 msgid "" @@ -14416,15 +14168,15 @@ msgstr "" msgid "" "Development experience is made really nice not only by core Rust tools (e.g. " "using `rustup` to switch to a different `rustc` version when testing a crate " -"that needs to work on nightly, current stable, and older stable) but also by " -"an ecosystem of third-party tools (e.g. Mozilla provides `cargo vet` for " -"streamlining and sharing security audits; `criterion` crate gives a " -"streamlined way to run benchmarks)." +"that needs to work on nightly, current stable, and older stable) but also by an " +"ecosystem of third-party tools (e.g. Mozilla provides `cargo vet` for " +"streamlining and sharing security audits; `criterion` crate gives a streamlined " +"way to run benchmarks)." msgstr "" -"之所以能實現優異的開發體驗,一來是因為有核心 Rust 工具,例如想測試的 Crate 需" -"在每夜版、目前穩定版和較舊穩定版執行時,可使用 `rustup` 切換至其他 `rustc` 版" -"本。二來是因為有第三方工具的生態系統,例如 Mozilla 提供的 `cargo vet` 可簡化" -"及分享安全性稽核作業,`criterion` Crate 則能簡化執行基準測試的方式。" +"之所以能實現優異的開發體驗,一來是因為有核心 Rust 工具,例如想測試的 Crate 需在" +"每夜版、目前穩定版和較舊穩定版執行時,可使用 `rustup` 切換至其他 `rustc` 版本。" +"二來是因為有第三方工具的生態系統,例如 Mozilla 提供的 `cargo vet` 可簡化及分享安" +"全性稽核作業,`criterion` Crate 則能簡化執行基準測試的方式。" #: src/chromium/cargo.md msgid "" @@ -14437,32 +14189,30 @@ msgid "It may be worth comparing with Chrome Extensions or VScode extensions." msgstr "可考慮與 Chrome 擴充功能或 VScode 擴充功能比較。" #: src/chromium/cargo.md -msgid "" -"Broad, generic examples of projects where `cargo` may be the right choice:" +msgid "Broad, generic examples of projects where `cargo` may be the right choice:" msgstr "以下列出廣泛通用的專案範例,皆可能適合使用 `cargo`:" #: src/chromium/cargo.md msgid "" -"Perhaps surprisingly, Rust is becoming increasingly popular in the industry " -"for writing command line tools. The breadth and ergonomics of libraries is " -"comparable to Python, while being more robust (thanks to the rich " -"typesystem) and running faster (as a compiled, rather than interpreted " -"language)." +"Perhaps surprisingly, Rust is becoming increasingly popular in the industry for " +"writing command line tools. The breadth and ergonomics of libraries is " +"comparable to Python, while being more robust (thanks to the rich typesystem) " +"and running faster (as a compiled, rather than interpreted language)." msgstr "" -"或許令人意外的是,業界越來越廣泛使用 Rust 編寫指令列工具。Rust 程式庫在廣度和" -"人因工程學方面與 Python 不相上下,又因為豐富的型別系統而更強健,就以編譯語言 " -"(而非解譯語言) 來說,執行速度也更快。" +"或許令人意外的是,業界越來越廣泛使用 Rust 編寫指令列工具。Rust 程式庫在廣度和人" +"因工程學方面與 Python 不相上下,又因為豐富的型別系統而更強健,就以編譯語言 (而非" +"解譯語言) 來說,執行速度也更快。" #: src/chromium/cargo.md msgid "" "Participating in the Rust ecosystem requires using standard Rust tools like " -"Cargo. Libraries that want to get external contributions, and want to be " -"used outside of Chromium (e.g. in Bazel or Android/Soong build environments) " -"should probably use Cargo." +"Cargo. Libraries that want to get external contributions, and want to be used " +"outside of Chromium (e.g. in Bazel or Android/Soong build environments) should " +"probably use Cargo." msgstr "" -"如要參與 Rust 生態系統,必須使用 Cargo 等標準 Rust 工具。如果程式庫要取得外部" -"貢獻,並用於 Chromium 以外的地方 (例如 Bazel 或 Android/Soong 建構環境),則大" -"概應使用 Cargo。" +"如要參與 Rust 生態系統,必須使用 Cargo 等標準 Rust 工具。如果程式庫要取得外部貢" +"獻,並用於 Chromium 以外的地方 (例如 Bazel 或 Android/Soong 建構環境),則大概應" +"使用 Cargo。" #: src/chromium/cargo.md msgid "Examples of Chromium-related projects that are `cargo`\\-based:" @@ -14470,11 +14220,11 @@ msgstr "`cargo`\\ 式的 Chromium 相關專案範例:" #: src/chromium/cargo.md msgid "" -"`serde_json_lenient` (experimented with in other parts of Google which " -"resulted in PRs with performance improvements)" +"`serde_json_lenient` (experimented with in other parts of Google which resulted " +"in PRs with performance improvements)" msgstr "" -"`serde_json_lenient` (在 Google 的其他部分中經過實驗,產生了一些可提升效能的 " -"PR (Pull Request))" +"`serde_json_lenient` (在 Google 的其他部分中經過實驗,產生了一些可提升效能的 PR " +"(Pull Request))" #: src/chromium/cargo.md msgid "Fontations libraries like `font-types`" @@ -14482,20 +14232,19 @@ msgstr "`font-types` 等字型程式庫" #: src/chromium/cargo.md msgid "" -"`gnrt` tool (we will meet it later in the course) which depends on `clap` " -"for command-line parsing and on `toml` for configuration files." +"`gnrt` tool (we will meet it later in the course) which depends on `clap` for " +"command-line parsing and on `toml` for configuration files." msgstr "" "`gnrt` 工具 (課程稍後會介紹),這個工具需使用 `clap` 執行指令列剖析,並需使用 " "`toml` 處理設定檔。" #: src/chromium/cargo.md msgid "" -"Disclaimer: a unique reason for using `cargo` was unavailability of `gn` " -"when building and bootstrapping Rust standard library when building Rust " -"toolchain." +"Disclaimer: a unique reason for using `cargo` was unavailability of `gn` when " +"building and bootstrapping Rust standard library when building Rust toolchain." msgstr "" -"免責事項:使用 `cargo` 的特別理由之一,是因為建構 Rust 工具鏈時,系統無法在建" -"構和啟動 Rust 標準程式庫期間使用 `gn`。" +"免責事項:使用 `cargo` 的特別理由之一,是因為建構 Rust 工具鏈時,系統無法在建構" +"和啟動 Rust 標準程式庫期間使用 `gn`。" #: src/chromium/cargo.md msgid "" @@ -14503,9 +14252,9 @@ msgid "" "third-party libraries downloaded from the internet, but `run_gnrt.py` asks " "`cargo` that only `--locked` content is allowed via `Cargo.lock`.)" msgstr "" -"`run_gnrt.py` 使用 Chromium 的 `cargo` 和 `rustc` 副本。`gnrt` 依附於從網際網" -"路下載的第三方程式庫,但 `run_gnrt.py` 透過 `Cargo.lock` 要求 `cargo` 只允許 " -"`--locked` 內容。" +"`run_gnrt.py` 使用 Chromium 的 `cargo` 和 `rustc` 副本。`gnrt` 依附於從網際網路" +"下載的第三方程式庫,但 `run_gnrt.py` 透過 `Cargo.lock` 要求 `cargo` 只允許 `--" +"locked` 內容。" #: src/chromium/cargo.md msgid "" @@ -14519,16 +14268,16 @@ 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` 原始碼 " -"(從 GitHub 擷取,由 Rust 編譯器團隊審查)、為自舉而下載的二進位檔 Rust 編譯器" +"`rustc` (Rust 編譯器) 依序依附於 LLVM 程式庫、Clang 編譯器、`rustc` 原始碼 (從 " +"GitHub 擷取,由 Rust 編譯器團隊審查)、為自舉而下載的二進位檔 Rust 編譯器" #: src/chromium/cargo.md msgid "" "`rustup` (it may be worth pointing out that `rustup` is developed under the " "umbrella of the https://github.com/rust-lang/ organization - same as `rustc`)" msgstr "" -"`rustup` (可考慮告知學生 `rustup` 是 https://github.com/rust-lang/ 組織所開發" -"的一系列項目之一,與 `rustc` 相同)" +"`rustup` (可考慮告知學生 `rustup` 是 https://github.com/rust-lang/ 組織所開發的" +"一系列項目之一,與 `rustc` 相同)" #: src/chromium/cargo.md msgid "`cargo`, `rustfmt`, etc." @@ -14539,8 +14288,8 @@ msgid "" "Various internal infrastructure (bots that build `rustc`, system for " "distributing the prebuilt toolchain to Chromium engineers, etc.)" msgstr "" -"各種內部基礎架構 (建構 `rustc` 的機器人、將預建工具鏈發布給 Chromium 工程師的" -"系統等)" +"各種內部基礎架構 (建構 `rustc` 的機器人、將預建工具鏈發布給 Chromium 工程師的系" +"統等)" #: src/chromium/cargo.md msgid "Cargo tools like `cargo audit`, `cargo vet`, etc." @@ -14548,8 +14297,8 @@ msgstr "Cargo 工具,例如 `cargo audit`、`cargo vet` 等" #: src/chromium/cargo.md msgid "" -"Rust libraries vendored into `//third_party/rust` (audited by " -"security@chromium.org)" +"Rust libraries vendored into `//third_party/rust` (audited by security@chromium." +"org)" msgstr "" "供應至 `//third_party/rust` 的 Rust 程式庫 (由 security@chromium.org 稽核)" @@ -14563,33 +14312,31 @@ msgstr "Chromium Rust 政策" #: src/chromium/policy.md msgid "" -"Chromium does not yet allow first-party Rust except in rare cases as " -"approved by Chromium's [Area Tech Leads](https://source.chromium.org/" -"chromium/chromium/src/+/main:ATL_OWNERS)." +"Chromium does not yet allow first-party Rust except in rare cases as approved " +"by Chromium's [Area Tech Leads](https://source.chromium.org/chromium/chromium/" +"src/+/main:ATL_OWNERS)." msgstr "" -"Chromium 目前不支援第一方 Rust,除非是 Chromium [領域技術主管](https://" -"source.chromium.org/chromium/chromium/src/+/main:ATL_OWNERS)核准的少數情況。" +"Chromium 目前不支援第一方 Rust,除非是 Chromium [領域技術主管](https://source." +"chromium.org/chromium/chromium/src/+/main:ATL_OWNERS)核准的少數情況。" #: src/chromium/policy.md msgid "" -"Chromium's policy on third party libraries is outlined [here](https://" -"chromium.googlesource.com/chromium/src/+/main/docs/adding_to_third_party." -"md#rust) - Rust is allowed for third party libraries under various " -"circumstances, including if they're the best option for performance or for " -"security." +"Chromium's policy on third party libraries is outlined [here](https://chromium." +"googlesource.com/chromium/src/+/main/docs/adding_to_third_party.md#rust) - Rust " +"is allowed for third party libraries under various circumstances, including if " +"they're the best option for performance or for security." msgstr "" -"Chromium 的第三方程式庫政策列載於[這個頁面](https://chromium.googlesource." -"com/chromium/src/+/main/docs/adding_to_third_party.md#rust) - 第三方程式庫可" -"在各種情況下使用 Rust,包括這些程式庫是效能或安全方面的最佳選擇時。" +"Chromium 的第三方程式庫政策列載於[這個頁面](https://chromium.googlesource.com/" +"chromium/src/+/main/docs/adding_to_third_party.md#rust) - 第三方程式庫可在各種情" +"況下使用 Rust,包括這些程式庫是效能或安全方面的最佳選擇時。" #: src/chromium/policy.md msgid "" -"Very few Rust libraries directly expose a C/C++ API, so that means that " -"nearly all such libraries will require a small amount of first-party glue " -"code." +"Very few Rust libraries directly expose a C/C++ API, so that means that nearly " +"all such libraries will require a small amount of first-party glue code." msgstr "" -"只有極少數的 Rust 程式庫會直接公開 C/C++ API,這表示幾乎所有這類程式庫都需要" -"少量的第一方黏合程式碼。" +"只有極少數的 Rust 程式庫會直接公開 C/C++ API,這表示幾乎所有這類程式庫都需要少量" +"的第一方黏合程式碼。" #: src/chromium/policy.md #, fuzzy @@ -14634,11 +14381,11 @@ msgstr "" #: src/chromium/policy.md msgid "" -"First-party Rust glue code for a particular third-party crate should " -"normally be kept in `third_party/rust///wrapper`." +"First-party Rust glue code for a particular third-party crate should normally " +"be kept in `third_party/rust///wrapper`." msgstr "" -"特定第三方 Crate 的第一方 Rust 黏合程式碼通常應儲存在 `third_party/rust/" -"//wrapper`。" +"特定第三方 Crate 的第一方 Rust 黏合程式碼通常應儲存在 `third_party/rust//" +"/wrapper`。" #: src/chromium/policy.md msgid "Because of this, today's course will be heavily focused on:" @@ -14663,9 +14410,9 @@ msgstr "建構規則" #: src/chromium/build-rules.md msgid "" -"Rust code is usually built using `cargo`. Chromium builds with `gn` and " -"`ninja` for efficiency --- its static rules allow maximum parallelism. Rust " -"is no exception." +"Rust code is usually built using `cargo`. Chromium builds with `gn` and `ninja` " +"for efficiency --- its static rules allow maximum parallelism. Rust is no " +"exception." msgstr "" "Rust 程式碼通常是以 `cargo` 建構。為提升建構效率,Chromium 會使用 `gn` 和 " "`ninja`,因為 Chromium 的靜態規則允許最大程度的平行處理。Rust 也不例外。" @@ -14701,44 +14448,43 @@ msgstr "" #: src/chromium/build-rules.md msgid "" -"You can also add `deps` on other Rust targets. Later we'll use this to " -"depend upon third party code." +"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 "" "You must specify _both_ the crate root, _and_ a full list of sources. The " -"`crate_root` is the file given to the Rust compiler representing the root " -"file of the compilation unit --- typically `lib.rs`. `sources` is a complete " -"list of all source files which `ninja` needs in order to determine when " -"rebuilds are necessary." +"`crate_root` is the file given to the Rust compiler representing the root file " +"of the compilation unit --- typically `lib.rs`. `sources` is a complete list of " +"all source files which `ninja` needs in order to determine when rebuilds are " +"necessary." msgstr "" "您必須「同時」指定 Crate 根層級「以及」完整的來源清單。`crate_root` 是提供給 " -"Rust 編譯器的檔案,代表編譯單元的根檔案 (通常是 `lib.rs`)。`sources` 是列出所" -"有來源檔案的完整清單,`ninja` 判斷何時必須重建時,就需要使用此清單。" +"Rust 編譯器的檔案,代表編譯單元的根檔案 (通常是 `lib.rs`)。`sources` 是列出所有" +"來源檔案的完整清單,`ninja` 判斷何時必須重建時,就需要使用此清單。" #: src/chromium/build-rules.md msgid "" -"(There's no such thing as a Rust `source_set`, because in Rust, an entire " -"crate is a compilation unit. A `static_library` is the smallest unit.)" +"(There's no such thing as a Rust `source_set`, because in Rust, an entire crate " +"is a compilation unit. A `static_library` is the smallest unit.)" msgstr "" -"(並不存在 Rust 的 `source_set` 這種東西,因為在 Rust 中,整個 Crate 就是編譯" -"單元。`static_library` 是最小單元。)" +"(並不存在 Rust 的 `source_set` 這種東西,因為在 Rust 中,整個 Crate 就是編譯單" +"元。`static_library` 是最小單元。)" #: src/chromium/build-rules.md msgid "" -"Students might be wondering why we need a gn template, rather than using " -"[gn's built-in support for Rust static libraries](https://gn.googlesource." -"com/gn/+/main/docs/reference.md#func_static_library). The answer is that " -"this template provides support for CXX interop, Rust features, and unit " -"tests, some of which we'll use later." +"Students might be wondering why we need a gn template, rather than using [gn's " +"built-in support for Rust static libraries](https://gn.googlesource.com/gn/+/" +"main/docs/reference.md#func_static_library). The answer is that this template " +"provides support for CXX interop, Rust features, and unit tests, some of which " +"we'll use later." msgstr "" -"學生可能會想知道為何需要 gn 範本,而不是使用 [gn 內建的 Rust 靜態程式庫支援功" -"能](https://gn.googlesource.com/gn/+/main/docs/reference." -"md#func_static_library)。答案是這個範本可支援 CXX 互通性、Rust 功能和單元測" -"試,其中一些項目稍後會用到。" +"學生可能會想知道為何需要 gn 範本,而不是使用 [gn 內建的 Rust 靜態程式庫支援功能]" +"(https://gn.googlesource.com/gn/+/main/docs/reference.md#func_static_library)。" +"答案是這個範本可支援 CXX 互通性、Rust 功能和單元測試,其中一些項目稍後會用到。" #: src/chromium/build-rules/unsafe.md msgid "Including `unsafe` Rust Code" @@ -14746,14 +14492,13 @@ msgstr "包含 `unsafe` Rust 程式碼" #: src/chromium/build-rules/unsafe.md msgid "" -"Unsafe Rust code is forbidden in `rust_static_library` by default --- it " -"won't compile. If you need unsafe Rust code, add `allow_unsafe = true` to " -"the gn target. (Later in the course we'll see circumstances where this is " -"necessary.)" +"Unsafe Rust code is forbidden in `rust_static_library` by default --- it won't " +"compile. If you need unsafe Rust code, add `allow_unsafe = true` to the gn " +"target. (Later in the course we'll see circumstances where this is necessary.)" msgstr "" -"根據預設,`rust_static_library` 中禁止使用不安全的 Rust 程式碼,系統也不會編" -"譯這類程式碼。如果需要不安全的 Rust 程式碼,請在 gn 目標中加入 `allow_unsafe " -"= true` (本課程稍後會說明必須這麼做的情況)。" +"根據預設,`rust_static_library` 中禁止使用不安全的 Rust 程式碼,系統也不會編譯這" +"類程式碼。如果需要不安全的 Rust 程式碼,請在 gn 目標中加入 `allow_unsafe = " +"true` (本課程稍後會說明必須這麼做的情況)。" #: src/chromium/build-rules/unsafe.md msgid "" @@ -14819,16 +14564,16 @@ msgstr "" #: src/chromium/build-rules/vscode.md msgid "" -"Types are elided in Rust code, which makes a good IDE even more useful than " -"for C++. Visual Studio code works well for Rust in Chromium. To use it," +"Types are elided in Rust code, which makes a good IDE even more useful than for " +"C++. Visual Studio code works well for Rust in Chromium. To use it," msgstr "" -"Rust 程式碼中省略了型別,因此相較於 C++ 而言,使用優質的 IDE 會更加有效。" -"Visual Studio Code 很適合 Chromium 中的 Rust。使用方法:" +"Rust 程式碼中省略了型別,因此相較於 C++ 而言,使用優質的 IDE 會更加有效。Visual " +"Studio Code 很適合 Chromium 中的 Rust。使用方法:" #: src/chromium/build-rules/vscode.md msgid "" -"Ensure your VSCode has the `rust-analyzer` extension, not earlier forms of " -"Rust support" +"Ensure your VSCode has the `rust-analyzer` extension, not earlier forms of Rust " +"support" msgstr "確認 VSCode 具有 `rust-analyzer` 擴充功能,而非舊版 Rust 支援功能" #: src/chromium/build-rules/vscode.md @@ -14843,19 +14588,18 @@ msgstr "`ln -s out/Debug/rust-project.json rust-project.json`" #: src/chromium/build-rules/vscode.md msgid "" -"A demo of some of the code annotation and exploration features of rust-" -"analyzer might be beneficial if the audience are naturally skeptical of IDEs." +"A demo of some of the code annotation and exploration features of rust-analyzer " +"might be beneficial if the audience are naturally skeptical of IDEs." msgstr "" -"如果大家對 IDE 自然產生懷疑,示範 rust-analyzer 的一些程式碼註解和探索功能或" -"許會有幫助。" +"如果大家對 IDE 自然產生懷疑,示範 rust-analyzer 的一些程式碼註解和探索功能或許會" +"有幫助。" #: src/chromium/build-rules/vscode.md 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 相關 Rust 程式" -"碼):" +"下列步驟或許有助於示範 (不過您可以改用自己最熟悉的 Chromium 相關 Rust 程式碼):" #: src/chromium/build-rules/vscode.md msgid "Open `components/qr_code_generator/qr_code_generator_ffi_glue.rs`" @@ -14866,13 +14610,12 @@ msgid "" "Place the cursor over the `QrCode::new` call (around line 26) in " "\\`qr_code_generator_ffi_glue.rs" msgstr "" -"將游標移到 \\`qr_code_generator_ffi_glue.rs 中的 `QrCode::new` 呼叫 (約在第 " -"26 行)。" +"將游標移到 \\`qr_code_generator_ffi_glue.rs 中的 `QrCode::new` 呼叫 (約在第 26 " +"行)。" #: src/chromium/build-rules/vscode.md msgid "" -"Demo **show documentation** (typical bindings: vscode = ctrl k i; vim/CoC = " -"K)." +"Demo **show documentation** (typical bindings: vscode = ctrl k i; vim/CoC = K)." msgstr "示範「顯示說明文件」(一般繫結:vscode = ctrl k i; vim/CoC = K)。" #: src/chromium/build-rules/vscode.md @@ -14889,20 +14632,20 @@ msgid "" "164; the outline is in the file explorer pane in vscode; typical vim/CoC " "bindings = space o)" msgstr "" -"示範「大綱」,並前往 `QrCode::with_bits` 方法 (約在 164 行;大綱位於 vscode " -"的檔案總管窗格;一般 vim/CoC 繫結 = 空格 o)" +"示範「大綱」,並前往 `QrCode::with_bits` 方法 (約在 164 行;大綱位於 vscode 的檔" +"案總管窗格;一般 vim/CoC 繫結 = 空格 o)" #: src/chromium/build-rules/vscode.md msgid "" -"Demo **type annotations** (there are quote a few nice examples in the " -"`QrCode::with_bits` method)" +"Demo **type annotations** (there are quote a few nice examples in the `QrCode::" +"with_bits` method)" msgstr "示範「型別註解」(`QrCode::with_bits` 方法中引用了幾個不錯的範例)" #: src/chromium/build-rules/vscode.md msgid "" -"It may be worth pointing out that `gn gen ... --export-rust-project` will " -"need to be rerun after editing `BUILD.gn` files (which we will do a few " -"times throughout the exercises in this session)." +"It may be worth pointing out that `gn gen ... --export-rust-project` will need " +"to be rerun after editing `BUILD.gn` files (which we will do a few times " +"throughout the exercises in this session)." msgstr "" "可考慮指出在編輯 `BUILD.gn` 檔案之後,需要重新執行 `gn gen ... --export-rust-" "project` (我們會在本課程的練習中多次執行此操作)。" @@ -14917,48 +14660,46 @@ msgid "" "In your Chromium build, add a new Rust target to `//ui/base/BUILD.gn` " "containing:" msgstr "" -"在您的 Chromium 版本中,將新的 Rust 目標加至 `//ui/base/BUILD.gn`,其中包含以" -"下內容:" +"在您的 Chromium 版本中,將新的 Rust 目標加至 `//ui/base/BUILD.gn`,其中包含以下" +"內容:" #: src/exercises/chromium/build-rules.md #, fuzzy msgid "" -"**Important**: note that `no_mangle` here is considered a type of unsafety " -"by the Rust compiler, so you'll need to allow unsafe code in your `gn` " -"target." +"**Important**: note that `no_mangle` here is considered a type of unsafety by " +"the Rust compiler, so you'll need to allow unsafe code in your `gn` target." msgstr "" -"**重要事項**:請注意,Rust 編譯器會將此處的 `no_mangle` 視為不安全型別,因此" -"您需要在 `gn` 目標中允許不安全的程式碼。" +"**重要事項**:請注意,Rust 編譯器會將此處的 `no_mangle` 視為不安全型別,因此您需" +"要在 `gn` 目標中允許不安全的程式碼。" #: src/exercises/chromium/build-rules.md msgid "" "Add this new Rust target as a dependency of `//ui/base:base`. Declare this " -"function at the top of `ui/base/resource/resource_bundle.cc` (later, we'll " -"see how this can be automated by bindings generation tools):" +"function at the top of `ui/base/resource/resource_bundle.cc` (later, we'll see " +"how this can be automated by bindings generation tools):" msgstr "" "將這個新的 Rust 目標新增為 `//ui/base:base` 的依附元件。在 `ui/base/resource/" -"resource_bundle.cc` 頂端宣告此函式 (稍後會說明如何使用繫結產生工具自動執行此" -"操作):" +"resource_bundle.cc` 頂端宣告此函式 (稍後會說明如何使用繫結產生工具自動執行此操" +"作):" #: src/exercises/chromium/build-rules.md msgid "" -"Call this function from somewhere in `ui/base/resource/resource_bundle.cc` - " -"we suggest the top of `ResourceBundle::MaybeMangleLocalizedString`. Build " -"and run Chromium, and ensure that \"Hello from Rust!\" is printed lots of " -"times." +"Call this function from somewhere in `ui/base/resource/resource_bundle.cc` - we " +"suggest the top of `ResourceBundle::MaybeMangleLocalizedString`. Build and run " +"Chromium, and ensure that \"Hello from Rust!\" is printed lots of times." msgstr "" "從 `ui/base/resource/resource_bundle.cc` 的某處呼叫此函式,建議位置是 " -"`ResourceBundle::MaybeMangleLocalizedString` 的頂端。建構及執行 Chromium,確" -"認系統多次顯示「Hello from Rust!」。" +"`ResourceBundle::MaybeMangleLocalizedString` 的頂端。建構及執行 Chromium,確認系" +"統多次顯示「Hello from Rust!」。" #: src/exercises/chromium/build-rules.md msgid "" -"If you use VSCode, now set up Rust to work well in VSCode. It will be useful " -"in subsequent exercises. If you've succeeded, you will be able to use right-" -"click \"Go to definition\" on `println!`." +"If you use VSCode, now set up Rust to work well in VSCode. It will be useful in " +"subsequent exercises. If you've succeeded, you will be able to use right-click " +"\"Go to definition\" on `println!`." msgstr "" -"如果使用 VSCode,現在請設定 Rust,讓 Rust 在 VSCode 中順利運作。這在後續練習" -"中會很實用。如果您成功完成,就能在 `println!` 中以滑鼠右鍵按一下「Go to " +"如果使用 VSCode,現在請設定 Rust,讓 Rust 在 VSCode 中順利運作。這在後續練習中會" +"很實用。如果您成功完成,就能在 `println!` 中以滑鼠右鍵按一下「Go to " "definition」。" #: src/exercises/chromium/build-rules.md @@ -14968,32 +14709,32 @@ msgstr "如何找到說明" #: src/exercises/chromium/build-rules.md msgid "" -"The options available to the [`rust_static_library` gn template](https://" -"source.chromium.org/chromium/chromium/src/+/main:build/rust/" -"rust_static_library.gni;l=16)" +"The options available to the [`rust_static_library` gn template](https://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)" +"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) 相關資訊" #: src/exercises/chromium/build-rules.md msgid "" -"Information about [`extern \"C\"`](https://doc.rust-lang.org/std/keyword." -"extern.html)" +"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) 相關資訊" #: 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" +"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) switch 相關資訊" @@ -15008,22 +14749,21 @@ msgstr "" #: src/exercises/chromium/build-rules.md msgid "" -"This example is unusual because it boils down to the lowest-common-" -"denominator interop language, C. Both C++ and Rust can natively declare and " -"call C ABI functions. Later in the course, we'll connect C++ directly to " -"Rust." +"This example is unusual because it boils down to the lowest-common-denominator " +"interop language, C. Both C++ and Rust can natively declare and call C ABI " +"functions. Later in the course, we'll connect C++ directly to Rust." msgstr "" -"此範例會探究做為最小公因數的互通語言 C,因此很特別。C++ 和 Rust 都能以原生方" -"式宣告及呼叫 C ABI 函式。本課程稍後會將 C++ 直接連結至 Rust。" +"此範例會探究做為最小公因數的互通語言 C,因此很特別。C++ 和 Rust 都能以原生方式宣" +"告及呼叫 C ABI 函式。本課程稍後會將 C++ 直接連結至 Rust。" #: src/exercises/chromium/build-rules.md msgid "" -"`allow_unsafe = true` is required here because `#[no_mangle]` might allow " -"Rust to generate two functions with the same name, and Rust can no longer " -"guarantee that the right one is called." +"`allow_unsafe = true` is required here because `#[no_mangle]` might allow Rust " +"to generate two functions with the same name, and Rust can no longer guarantee " +"that the right one is called." msgstr "" -"這裡需要 `allow_unsafe = true`,因為 `#[no_mangle]` 可能會允許 Rust 產生兩個" -"名稱相同的函式,Rust 就不再能保證系統會呼叫正確的函式。" +"這裡需要 `allow_unsafe = true`,因為 `#[no_mangle]` 可能會允許 Rust 產生兩個名稱" +"相同的函式,Rust 就不再能保證系統會呼叫正確的函式。" #: src/exercises/chromium/build-rules.md msgid "" @@ -15035,11 +14775,11 @@ msgstr "" #: src/chromium/testing.md msgid "" "Rust community typically authors unit tests in a module placed in the same " -"source file as the code being tested. This was covered [earlier](../testing." -"md) in the course and looks like this:" +"source file as the code being tested. This was covered [earlier](../testing.md) " +"in the course and looks like this:" msgstr "" -"Rust 社群撰寫單元測試的模組,通常會位在與所測試程式碼相同的來源檔案中。這種做" -"法已在[先前課程](../testing.md)中介紹,如下所示:" +"Rust 社群撰寫單元測試的模組,通常會位在與所測試程式碼相同的來源檔案中。這種做法" +"已在[先前課程](../testing.md)中介紹,如下所示:" #: src/chromium/testing.md msgid "" @@ -15048,21 +14788,18 @@ msgid "" "and helps to avoid rebuilding `.rs` files a second time (in the `test` " "configuration)." msgstr "" -"在 Chromium 中,我們將單元測試放在獨立的來源檔案中,而對 Rust 也繼續採取這項" -"做法,這樣不僅能較一致地找到測試,也有助於避免在 `test` 設定中再次重新建構 `." -"rs` 檔案。" +"在 Chromium 中,我們將單元測試放在獨立的來源檔案中,而對 Rust 也繼續採取這項做" +"法,這樣不僅能較一致地找到測試,也有助於避免在 `test` 設定中再次重新建構 `.rs` " +"檔案。" #: src/chromium/testing.md -msgid "" -"This results in the following options for testing Rust code in Chromium:" +msgid "This results in the following options for testing Rust code in Chromium:" msgstr "因此 Chromium 中有以下 Rust 程式碼測試選項:" #: src/chromium/testing.md msgid "" -"Native Rust tests (i.e. `#[test]`). Discouraged outside of `//third_party/" -"rust`." -msgstr "" -"原生 Rust 測試 (即 `#[test]`)。不建議在 `//third_party/rust` 之外使用。" +"Native Rust tests (i.e. `#[test]`). Discouraged outside of `//third_party/rust`." +msgstr "原生 Rust 測試 (即 `#[test]`)。不建議在 `//third_party/rust` 之外使用。" #: src/chromium/testing.md msgid "" @@ -15070,15 +14807,14 @@ msgid "" "when Rust code is just a thin FFI layer and the existing unit tests provide " "sufficient coverage for the feature." msgstr "" -"在 C++ 中編寫的 `gtest` 測試,並透過 FFI 呼叫並執行 Rust。如果 Rust 程式碼只" -"是精簡的 FFI 層,這麼做就夠充分,而現有的單元測試可為這項功能提供足夠的涵蓋" -"率。" +"在 C++ 中編寫的 `gtest` 測試,並透過 FFI 呼叫並執行 Rust。如果 Rust 程式碼只是精" +"簡的 FFI 層,這麼做就夠充分,而現有的單元測試可為這項功能提供足夠的涵蓋率。" #: src/chromium/testing.md msgid "" "`gtest` tests authored in Rust and using the crate under test through its " -"public API (using `pub mod for_testing { ... }` if needed). This is the " -"subject of the next few slides." +"public API (using `pub mod for_testing { ... }` if needed). This is the subject " +"of the next few slides." msgstr "" "在 Rust 中編寫的 `gtest` 測試,並透過公用 API 使用受測試的 Crate (視需要使用 " "`pub mod for_testing { ... }`)。這是接下來幾張投影片的主題。" @@ -15089,8 +14825,8 @@ msgid "" "exercised by Chromium bots. (Such testing is needed rarely --- only after " "adding or updating third-party crates.)" msgstr "" -"請提及第三方 Crate 的原生 Rust 測試最終應由 Chromium 機器人執行 (這類測試極少" -"需要執行,只有在新增或更新第三方 Crate 後才需要)。" +"請提及第三方 Crate 的原生 Rust 測試最終應由 Chromium 機器人執行 (這類測試極少需" +"要執行,只有在新增或更新第三方 Crate 後才需要)。" #: src/chromium/testing.md msgid "" @@ -15101,13 +14837,13 @@ msgstr "以下範例或許有助說明 C++ `gtest` 和 Rust `gtest` 各自的使 #: src/chromium/testing.md msgid "" "QR has very little functionality in the first-party Rust layer (it's just a " -"thin FFI glue) and therefore uses the existing C++ unit tests for testing " -"both the C++ and the Rust implementation (parameterizing the tests so they " -"enable or disable Rust using a `ScopedFeatureList`)." +"thin FFI glue) and therefore uses the existing C++ unit tests for testing both " +"the C++ and the Rust implementation (parameterizing the tests so they enable or " +"disable Rust using a `ScopedFeatureList`)." msgstr "" -"QR 在第一方 Rust 層中的功用很少 (只是精簡的 FFI 黏合工具),因此會使用現有的 " -"C++ 單元測試,測試 C++ 和 Rust 的實作項目 (將測試參數化,方便以 " -"`ScopedFeatureList` 啟用或停用 Rust)。" +"QR 在第一方 Rust 層中的功用很少 (只是精簡的 FFI 黏合工具),因此會使用現有的 C++ " +"單元測試,測試 C++ 和 Rust 的實作項目 (將測試參數化,方便以 `ScopedFeatureList` " +"啟用或停用 Rust)。" #: src/chromium/testing.md msgid "" @@ -15116,9 +14852,9 @@ msgid "" "missing in the `png` crate - e.g. RGBA => BGRA, or gamma correction. Such " "functionality may benefit from separate tests authored in Rust." msgstr "" -"假設性/WIP PNG 整合可能需實作記憶體安全地像素轉換,這類像素轉換是由 `libpng` " -"提供,但 `png` Crate 中缺少 (例如 RGBA => BGRA 或伽馬校正)。這類功能可能受益" -"於在 Rust 中編寫的獨立測試。" +"假設性/WIP PNG 整合可能需實作記憶體安全地像素轉換,這類像素轉換是由 `libpng` 提" +"供,但 `png` Crate 中缺少 (例如 RGBA => BGRA 或伽馬校正)。這類功能可能受益於在 " +"Rust 中編寫的獨立測試。" #: src/chromium/testing/rust-gtest-interop.md msgid "" @@ -15130,17 +14866,16 @@ msgstr "" #: src/chromium/testing/rust-gtest-interop.md msgid "" -"Use a Rust function as a `gtest` testcase (using the `#[gtest(...)]` " -"attribute)" +"Use a Rust function as a `gtest` testcase (using the `#[gtest(...)]` attribute)" msgstr "使用 Rust 函式做為 `gtest` 測試案例 (使用 `#[gtest(...)]` 屬性)" #: src/chromium/testing/rust-gtest-interop.md msgid "" -"Use `expect_eq!` and similar macros (similar to `assert_eq!` but not " -"panicking and not terminating the test when the assertion fails)." +"Use `expect_eq!` and similar macros (similar to `assert_eq!` but not panicking " +"and not terminating the test when the assertion fails)." msgstr "" -"使用 `expect_eq!` 和類似的巨集 (類似於 `assert_eq!`,但不會導致恐慌,斷言失敗" -"時也不會終止測試)。" +"使用 `expect_eq!` 和類似的巨集 (類似於 `assert_eq!`,但不會導致恐慌,斷言失敗時" +"也不會終止測試)。" #: src/chromium/testing/rust-gtest-interop.md #, fuzzy @@ -15149,11 +14884,11 @@ msgstr "範例" #: src/chromium/testing/build-gn.md msgid "" -"The simplest way to build Rust `gtest` tests is to add them to an existing " -"test binary that already contains tests authored in C++. For example:" +"The simplest way to build Rust `gtest` tests is to add them to an existing test " +"binary that already contains tests authored in C++. For example:" msgstr "" -"如要建構 Rust `gtest` 測試,最簡單的方法就是將這些測試新增至已包含 C++ 測試的" -"現有測試二進位檔,例如:" +"如要建構 Rust `gtest` 測試,最簡單的方法就是將這些測試新增至已包含 C++ 測試的現" +"有測試二進位檔,例如:" #: src/chromium/testing/build-gn.md msgid "" @@ -15178,8 +14913,8 @@ msgid "" "Authoring Rust tests in a separate `static_library` also works, but requires " "manually declaring the dependency on the support libraries:" msgstr "" -"也可以在單獨的 `static_library` 中編寫 Rust 測試,但必須手動宣告支援程式庫的" -"依附元件:" +"也可以在單獨的 `static_library` 中編寫 Rust 測試,但必須手動宣告支援程式庫的依附" +"元件:" #: src/chromium/testing/build-gn.md msgid "" @@ -15221,18 +14956,18 @@ msgstr "" #: src/chromium/testing/chromium-import-macro.md msgid "" -"After adding `:my_rust_lib` to GN `deps`, we still need to learn how to " -"import and use `my_rust_lib` from `my_rust_lib_unittest.rs`. We haven't " -"provided an explicit `crate_name` for `my_rust_lib` so its crate name is " -"computed based on the full target path and name. Fortunately we can avoid " -"working with such an unwieldy name by using the `chromium::import!` macro " -"from the automatically-imported `chromium` crate:" +"After adding `:my_rust_lib` to GN `deps`, we still need to learn how to import " +"and use `my_rust_lib` from `my_rust_lib_unittest.rs`. We haven't provided an " +"explicit `crate_name` for `my_rust_lib` so its crate name is computed based on " +"the full target path and name. Fortunately we can avoid working with such an " +"unwieldy name by using the `chromium::import!` macro from the automatically-" +"imported `chromium` crate:" msgstr "" "將 `:my_rust_lib` 新增至 GN `deps` 之後,我們仍需瞭解如何從 " -"`my_rust_lib_unittest.rs` 匯入及使用 `my_rust_lib`。我們尚未為 `my_rust_lib` " -"提供明確的 `crate_name`,因此系統會依據完整目標路徑和名稱來運算出 Crate 名" -"稱。幸好,我們可從自動匯入的 `chromium` Crate 中使用 `chromium::import!` 巨" -"集,避免採用這類不方便的名稱:" +"`my_rust_lib_unittest.rs` 匯入及使用 `my_rust_lib`。我們尚未為 `my_rust_lib` 提" +"供明確的 `crate_name`,因此系統會依據完整目標路徑和名稱來運算出 Crate 名稱。幸" +"好,我們可從自動匯入的 `chromium` Crate 中使用 `chromium::import!` 巨集,避免採" +"用這類不方便的名稱:" #: src/chromium/testing/chromium-import-macro.md msgid "\"//ui/base:my_rust_lib\"" @@ -15244,9 +14979,9 @@ msgstr "在掩蓋之下,巨集會展開為類似如下的內容:" #: src/chromium/testing/chromium-import-macro.md msgid "" -"More information can be found in [the doc comment](https://source.chromium." -"org/chromium/chromium/src/+/main:build/rust/chromium_prelude/" -"chromium_prelude.rs?q=f:chromium_prelude.rs%20pub.use.*%5Cbimport%5Cb;%20-f:" +"More information can be found in [the doc comment](https://source.chromium.org/" +"chromium/chromium/src/+/main:build/rust/chromium_prelude/chromium_prelude.rs?" +"q=f:chromium_prelude.rs%20pub.use.*%5Cbimport%5Cb;%20-f:" "third_party&ss=chromium%2Fchromium%2Fsrc) of the `chromium::import` macro." msgstr "" "詳情請參閱 `chromium::import` 巨集的[文件註解](https://source.chromium.org/" @@ -15259,13 +14994,13 @@ msgid "" "`rust_static_library` supports specifying an explicit name via `crate_name` " "property, but doing this is discouraged. And it is discouraged because the " "crate name has to be globally unique. crates.io guarantees uniqueness of its " -"crate names so `cargo_crate` GN targets (generated by the `gnrt` tool " -"covered in a later section) use short crate names." +"crate names so `cargo_crate` GN targets (generated by the `gnrt` tool covered " +"in a later section) use short crate names." msgstr "" -"`rust_static_library` 支援透過 `crate_name` 屬性指定明確名稱,但不建議這麼" -"做。不建議的原因是 Crate 名稱在全域範圍內不得重複。crates.io 可保證其 Crate " -"名稱不重複,因此 `cargo_crate` GN 目標會使用簡短的 Crate 名稱。此目標是由後續" -"章節介紹的 `gnrt` 工具所產生。" +"`rust_static_library` 支援透過 `crate_name` 屬性指定明確名稱,但不建議這麼做。不" +"建議的原因是 Crate 名稱在全域範圍內不得重複。crates.io 可保證其 Crate 名稱不重" +"複,因此 `cargo_crate` GN 目標會使用簡短的 Crate 名稱。此目標是由後續章節介紹的 " +"`gnrt` 工具所產生。" #: src/exercises/chromium/testing.md msgid "Testing exercise" @@ -15281,12 +15016,12 @@ msgstr "在您的 Chromium 版本中:" #: src/exercises/chromium/testing.md msgid "" -"Add a testable function next to `hello_from_rust`. Some suggestions: adding " -"two integers received as arguments, computing the nth Fibonacci number, " -"summing integers in a slice, etc." +"Add a testable function next to `hello_from_rust`. Some suggestions: adding two " +"integers received as arguments, computing the nth Fibonacci number, summing " +"integers in a slice, etc." msgstr "" -"在 `hello_from_rust` 旁邊新增可測試的函式。建議措施:新增兩個以引數形式接收的" -"整數、計算第 n 個費波那契數、加總切片中的整數等。" +"在 `hello_from_rust` 旁邊新增可測試的函式。建議措施:新增兩個以引數形式接收的整" +"數、計算第 n 個費波那契數、加總切片中的整數等。" #: src/exercises/chromium/testing.md msgid "Add a separate `..._unittest.rs` file with a test for the new function." @@ -15302,59 +15037,55 @@ msgstr "建構並執行測試,確認新測試能正常運作。" #: src/chromium/interoperability-with-cpp.md msgid "" -"The Rust community offers multiple options for C++/Rust interop, with new " -"tools being developed all the time. At the moment, Chromium uses a tool " -"called CXX." +"The Rust community offers multiple options for C++/Rust interop, with new tools " +"being developed all the time. At the moment, Chromium uses a tool called CXX." msgstr "" -"Rust 社群提供多個 C++/Rust 互通性選項,並且會持續開發新工具。目前 Chromium 使" -"用的工具稱為 CXX。" +"Rust 社群提供多個 C++/Rust 互通性選項,並且會持續開發新工具。目前 Chromium 使用" +"的工具稱為 CXX。" #: src/chromium/interoperability-with-cpp.md msgid "" -"You describe your whole language boundary in an interface definition " -"language (which looks a lot like Rust) and then CXX tools generate " -"declarations for functions and types in both Rust and C++." +"You describe your whole language boundary in an interface definition 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 和 C++ 中的函式和型別產生宣告。" +"您可以透過介面定義語言 (很類似 Rust) 描述整個語言邊界,然後 CXX 工具會為 Rust " +"和 C++ 中的函式和型別產生宣告。" #: src/chromium/interoperability-with-cpp.md msgid "" "See the [CXX tutorial](https://cxx.rs/tutorial.html) for a full example of " "using this." -msgstr "" -"如需完整的使用範例,請參閱 [CXX 教學課程](https://cxx.rs/tutorial.html)。" +msgstr "如需完整的使用範例,請參閱 [CXX 教學課程](https://cxx.rs/tutorial.html)。" #: src/chromium/interoperability-with-cpp.md msgid "" "Talk through the diagram. Explain that behind the scenes, this is doing just " -"the same as you previously did. Point out that automating the process has " -"the following benefits:" +"the same as you previously did. Point out that automating the process has the " +"following benefits:" msgstr "" -"請完整講解圖表,說明背後的原理和先前的操作相同。請指出將程序自動化有以下優" -"點:" +"請完整講解圖表,說明背後的原理和先前的操作相同。請指出將程序自動化有以下優點:" #: src/chromium/interoperability-with-cpp.md msgid "" "The tool guarantees that the C++ and Rust sides match (e.g. you get compile " "errors if the `#[cxx::bridge]` doesn't match the actual C++ or Rust " -"definitions, but with out-of-sync manual bindings you'd get Undefined " -"Behavior)" +"definitions, but with out-of-sync manual bindings you'd get Undefined Behavior)" msgstr "" -"這項工具會保證 C++ 和 Rust 端相符。舉例來說,當 `#[cxx::bridge]` 與實際的 C+" -"+ 或 Rust 定義不相符,就會發生「編譯錯誤」,但如有未同步的手動繫結,則會發生" -"「未定義的行為」" +"這項工具會保證 C++ 和 Rust 端相符。舉例來說,當 `#[cxx::bridge]` 與實際的 C++ " +"或 Rust 定義不相符,就會發生「編譯錯誤」,但如有未同步的手動繫結,則會發生「未定" +"義的行為」" #: src/chromium/interoperability-with-cpp.md msgid "" "The tool automates generation of FFI thunks (small, C-ABI-compatible, free " "functions) for non-C features (e.g. enabling FFI calls into Rust or C++ " -"methods; manual bindings would require authoring such top-level, free " -"functions manually)" +"methods; manual bindings would require authoring such top-level, free functions " +"manually)" msgstr "" -"這項工具會自動為非 C 功能產生 FFI 替換程式 (與 C-ABI 相容的小型、可自由使用的" -"函式),例如讓 FFI 呼叫 Rust 或 C++ 方法;手動繫結會需要手動編寫這類頂層的、可" -"自由使用的函式" +"這項工具會自動為非 C 功能產生 FFI 替換程式 (與 C-ABI 相容的小型、可自由使用的函" +"式),例如讓 FFI 呼叫 Rust 或 C++ 方法;手動繫結會需要手動編寫這類頂層的、可自由" +"使用的函式" #: src/chromium/interoperability-with-cpp.md msgid "The tool and the library can handle a set of core types - for example:" @@ -15362,26 +15093,25 @@ msgstr "這項工具和程式庫可處理一組核心型別,例如:" #: src/chromium/interoperability-with-cpp.md msgid "" -"`&[T]` can be passed across the FFI boundary, even though it doesn't " -"guarantee any particular ABI or memory layout. With manual bindings `std::" -"span` / `&[T]` have to be manually destructured and rebuilt out of a " -"pointer and length - this is error-prone given that each language represents " -"empty slices slightly differently)" +"`&[T]` can be passed across the FFI boundary, even though it doesn't guarantee " +"any particular ABI or memory layout. With manual bindings `std::span` / " +"`&[T]` have to be manually destructured and rebuilt out of a pointer and length " +"- this is error-prone given that each language represents empty slices slightly " +"differently)" msgstr "" -"`&[T]` 傳遞時可以跨越 FFI 邊界,但無法保證任何特定 ABI 或記憶體布局。使用手動" -"繫結時,`std::span`/`&[T]` 必須從一個指標和長度去手動解構並重新建構。這麼" -"做很容易出錯,因為每種語言各以略微不同的方式表示空切片" +"`&[T]` 傳遞時可以跨越 FFI 邊界,但無法保證任何特定 ABI 或記憶體布局。使用手動繫" +"結時,`std::span`/`&[T]` 必須從一個指標和長度去手動解構並重新建構。這麼做很容" +"易出錯,因為每種語言各以略微不同的方式表示空切片" #: src/chromium/interoperability-with-cpp.md msgid "" "Smart pointers like `std::unique_ptr`, `std::shared_ptr`, and/or `Box` " "are natively supported. With manual bindings, one would have to pass C-ABI-" -"compatible raw pointers, which would increase lifetime and memory-safety " -"risks." +"compatible raw pointers, which would increase lifetime and memory-safety risks." msgstr "" -"`std::unique_ptr`、`std::shared_ptr` 和/或 `Box` 等智慧指標均可原生支" -"援。使用手動繫結時,必須傳遞與 C-ABI 相容的原始指標,這可能會增加生命週期和記" -"憶體安全風險。" +"`std::unique_ptr`、`std::shared_ptr` 和/或 `Box` 等智慧指標均可原生支援。" +"使用手動繫結時,必須傳遞與 C-ABI 相容的原始指標,這可能會增加生命週期和記憶體安" +"全風險。" #: src/chromium/interoperability-with-cpp.md msgid "" @@ -15391,8 +15121,8 @@ msgid "" "terminate a string)." msgstr "" "`rust::String` 和 `CxxString` 型別可理解並維持各語言字串表示法的差異,例如 " -"`rust::String::lossy` 可透過非 UTF8 輸入內容建構 Rust 字串,而 `rust::" -"String::c_str` 可以空終止字串。" +"`rust::String::lossy` 可透過非 UTF8 輸入內容建構 Rust 字串,而 `rust::String::" +"c_str` 可以空終止字串。" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" @@ -15414,10 +15144,10 @@ msgstr "請說明以下事項:" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" -"Although this looks like a regular Rust `mod`, the `#[cxx::bridge]` " -"procedural macro does complex things to it. The generated code is quite a " -"bit more sophisticated - though this does still result in a `mod` called " -"`ffi` in your code." +"Although this looks like a regular Rust `mod`, the `#[cxx::bridge]` procedural " +"macro does complex things to it. The generated code is quite a bit more " +"sophisticated - though this does still result in a `mod` called `ffi` in your " +"code." msgstr "" "雖然這看起來像一般的 Rust `mod`,但 `#[cxx::bridge]` 程序巨集會對其執行複雜作" "業。產生的程式碼較為複雜,但仍會導致程式碼中出現名為 `ffi` 的 `mod`。" @@ -15440,19 +15170,18 @@ msgstr "從 Rust 到 C++ 的呼叫,以及 C++ 型別 (底部)" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" -"**Common misconception**: It _looks_ like a C++ header is being parsed by " -"Rust, but this is misleading. This header is never interpreted by Rust, but " -"simply `#include`d in the generated C++ code for the benefit of C++ " -"compilers." +"**Common misconception**: It _looks_ like a C++ header is being parsed by Rust, " +"but this is misleading. This header is never interpreted by Rust, but simply " +"`#include`d in the generated C++ code for the benefit of C++ compilers." msgstr "" -"**常見誤解**:它「看似」是由 Rust 剖析的 C++ 標頭,但這會造成誤導。這種標頭一" -"律不會由 Rust 解譯,只是為了 C++ 編譯器的好處,而在產生的 C++ 程式碼中設為 " +"**常見誤解**:它「看似」是由 Rust 剖析的 C++ 標頭,但這會造成誤導。這種標頭一律" +"不會由 Rust 解譯,只是為了 C++ 編譯器的好處,而在產生的 C++ 程式碼中設為 " "`#include`。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" -"By far the most useful page when using CXX is the [type reference](https://" -"cxx.rs/bindings.html)." +"By far the most useful page when using CXX is the [type reference](https://cxx." +"rs/bindings.html)." msgstr "使用 CXX 時,最實用的頁面是[型別參照](https://cxx.rs/bindings.html)。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md @@ -15461,8 +15190,7 @@ msgstr "CXX 基本上適用下列情況:" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" -"Your Rust-C++ interface is sufficiently simple that you can declare all of " -"it." +"Your Rust-C++ interface is sufficiently simple that you can declare all of it." msgstr "您的 Rust-C++ 介面非常簡單,您可以宣告其中所有項目。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md @@ -15470,8 +15198,8 @@ 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::string`、" -"`&[u8]` 等。" +"您只使用 CXX 已原生支援的型別,例如 `std::unique_ptr`、`std::string`、`&[u8]` " +"等。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" @@ -15481,20 +15209,18 @@ msgstr "它有許多限制,例如不支援 Rust 的 `Option` 型別。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" -"These limitations constrain us to using Rust in Chromium only for well " -"isolated \"leaf nodes\" rather than for arbitrary Rust-C++ interop. When " -"considering a use-case for Rust in Chromium, a good starting point is to " -"draft the CXX bindings for the language boundary to see if it appears simple " -"enough." +"These limitations constrain us to using Rust in Chromium only for well isolated " +"\"leaf nodes\" rather than for arbitrary Rust-C++ interop. When considering a " +"use-case for Rust in Chromium, a good starting point is to draft the CXX " +"bindings for the language boundary to see if it appears simple enough." msgstr "" -"這些限制會導致我們只能在 Chromium 中將 Rust 用於妥善隔離的「葉節點」,而非用" -"於任意 Rust-C++ 互通情形。考慮 Chromium 中 Rust 的用途時,建議先草擬語言邊界" -"的 CXX 繫結,瞭解是否足夠簡單。" +"這些限制會導致我們只能在 Chromium 中將 Rust 用於妥善隔離的「葉節點」,而非用於任" +"意 Rust-C++ 互通情形。考慮 Chromium 中 Rust 的用途時,建議先草擬語言邊界的 CXX " +"繫結,瞭解是否足夠簡單。" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" -"You should also discuss some of the other sticky points with CXX, for " -"example:" +"You should also discuss some of the other sticky points with CXX, for example:" msgstr "您也應討論一些 CXX 的其他棘手問題,例如:" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md @@ -15508,11 +15234,11 @@ msgstr "函式指標不容易使用。" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" -"CXX's [support for `Result`](https://cxx.rs/binding/result.html) relies " -"on C++ exceptions, so we can't use that in Chromium. Alternatives:" +"CXX's [support for `Result`](https://cxx.rs/binding/result.html) relies on " +"C++ exceptions, so we can't use that in Chromium. Alternatives:" msgstr "" -"CXX 的 [`Result` 支援](https://cxx.rs/binding/result.html)功能依賴 C++ " -"例外狀況,因此無法用於 Chromium。替代方案:" +"CXX 的 [`Result` 支援](https://cxx.rs/binding/result.html)功能依賴 C++ 例外" +"狀況,因此無法用於 Chromium。替代方案:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "The `T` part of `Result` can be:" @@ -15520,11 +15246,11 @@ msgstr "`Result` 的 `T` 部分可以是以下情形之一:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" -"Returned via out parameters (e.g. via `&mut T`). This requires that `T` can " -"be passed across the FFI boundary - for example `T` has to be:" +"Returned via out parameters (e.g. via `&mut T`). This requires that `T` can be " +"passed across the FFI boundary - for example `T` has to be:" msgstr "" -"可透過傳出參數傳回,例如透過 `&mut T`。也就是說,`T` 必須能跨越 FFI 界線傳" -"遞,例如 `T` 必須符合下列條件:" +"可透過傳出參數傳回,例如透過 `&mut T`。也就是說,`T` 必須能跨越 FFI 界線傳遞,例" +"如 `T` 必須符合下列條件:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "A primitive type (like `u32` or `usize`)" @@ -15535,17 +15261,17 @@ msgid "" "A type natively supported by `cxx` (like `UniquePtr`) that has a suitable " "default value to use in a failure case (_unlike_ `Box`)." msgstr "" -"是 `cxx` 原生支援的型別 (就像 `UniquePtr`),具有可在失敗情況下使用的適當預" -"設值 (「不像」`Box`)。" +"是 `cxx` 原生支援的型別 (就像 `UniquePtr`),具有可在失敗情況下使用的適當預設" +"值 (「不像」`Box`)。" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" -"Retained on the Rust side, and exposed via reference. This may be needed " -"when `T` is a Rust type, which cannot be passed across the FFI boundary, and " -"cannot be stored in `UniquePtr`." +"Retained on the Rust side, and exposed via reference. This may be needed when " +"`T` is a Rust type, which cannot be passed across the FFI boundary, and cannot " +"be stored in `UniquePtr`." msgstr "" -"在 Rust 端保留,並透過參照公開。當 `T` 是 Rust 型別,無法跨越 FFI 邊界傳遞," -"且無法儲存在 `UniquePtr` 時,這就可能有必要。" +"在 Rust 端保留,並透過參照公開。當 `T` 是 Rust 型別,無法跨越 FFI 邊界傳遞,且無" +"法儲存在 `UniquePtr` 時,這就可能有必要。" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "The `E` part of `Result` can be:" @@ -15559,8 +15285,8 @@ msgstr "傳回為布林值 (例如 `true` 代表成功,`false` 代表失敗)" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" -"Preserving error details is in theory possible, but so far hasn't been " -"needed in practice." +"Preserving error details is in theory possible, but so far hasn't been needed " +"in practice." msgstr "理論上可保留錯誤詳細資料,但目前在實際情況中並不需要。" #: src/chromium/interoperability-with-cpp/error-handling-qr.md @@ -15570,15 +15296,15 @@ msgstr "CXX 錯誤處理:QR Code 範例" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" "The QR code generator is [an example](https://source.chromium.org/chromium/" -"chromium/src/+/main:components/qr_code_generator/qr_code_generator_ffi_glue." -"rs;l=13-18;drc=7bf1b75b910ca430501b9c6a74c1d18a0223ecca) where a boolean is " -"used to communicate success vs failure, and where the successful result can " -"be passed across the FFI boundary:" +"chromium/src/+/main:components/qr_code_generator/qr_code_generator_ffi_glue.rs;" +"l=13-18;drc=7bf1b75b910ca430501b9c6a74c1d18a0223ecca) where a boolean is used " +"to communicate success vs failure, and where the successful result can be " +"passed across the FFI boundary:" msgstr "" -"在 QR code 產生器這個[範例](https://source.chromium.org/chromium/chromium/" -"src/+/main:components/qr_code_generator/qr_code_generator_ffi_glue.rs;" -"l=13-18;drc=7bf1b75b910ca430501b9c6a74c1d18a0223ecca)中,布林值是用來表示成功" -"與失敗,且成功結果可跨越 FFI 邊界傳遞:" +"在 QR code 產生器這個[範例](https://source.chromium.org/chromium/chromium/src/+/" +"main:components/qr_code_generator/qr_code_generator_ffi_glue.rs;l=13-18;" +"drc=7bf1b75b910ca430501b9c6a74c1d18a0223ecca)中,布林值是用來表示成功與失敗,且" +"成功結果可跨越 FFI 邊界傳遞:" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "\"qr_code_generator\"" @@ -15586,33 +15312,32 @@ msgstr "\"qr_code_generator\"" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" -"Students may be curious about the semantics of the `out_qr_size` output. " -"This is not the size of the vector, but the size of the QR code (and " -"admittedly it is a bit redundant - this is the square root of the size of " -"the vector)." +"Students may be curious about the semantics of the `out_qr_size` output. This " +"is not the size of the vector, but the size of the QR code (and admittedly it " +"is a bit redundant - this is the square root of the size of the vector)." msgstr "" -"學生可能會想瞭解 `out_qr_size` 輸出內容的語意。這不是向量大小,而是 QR code " -"的大小 (誠然有點多餘,因為這是向量大小的平方根)。" +"學生可能會想瞭解 `out_qr_size` 輸出內容的語意。這不是向量大小,而是 QR code 的大" +"小 (誠然有點多餘,因為這是向量大小的平方根)。" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" "It may be worth pointing out the importance of initializing `out_qr_size` " -"before calling into the Rust function. Creation of a Rust reference that " -"points to uninitialized memory results in Undefined Behavior (unlike in C++, " -"when only the act of dereferencing such memory results in UB)." +"before calling into the Rust function. Creation of a Rust reference that points " +"to uninitialized memory results in Undefined Behavior (unlike in C++, when only " +"the act of dereferencing such memory results in UB)." msgstr "" -"可考慮說明先初始化 `out_qr_size` 再呼叫 Rust 函式的重要性。建立指向未初始化記" -"憶體的 Rust 參照時,會導致「未定義的行為」(不同的是,在 C++ 中只有解除參照這" -"類記憶體時才會導致「未定義的行為」)。" +"可考慮說明先初始化 `out_qr_size` 再呼叫 Rust 函式的重要性。建立指向未初始化記憶" +"體的 Rust 參照時,會導致「未定義的行為」(不同的是,在 C++ 中只有解除參照這類記憶" +"體時才會導致「未定義的行為」)。" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" "If students ask about `Pin`, then explain why CXX needs it for mutable " -"references to C++ data: the answer is that C++ data can’t be moved around " -"like Rust data, because it may contain self-referential pointers." +"references to C++ data: the answer is that C++ data can’t be moved around like " +"Rust data, because it may contain self-referential pointers." msgstr "" -"如有學生詢問 `Pin`,請說明為何 CXX 需要這個項目來處理 C++ 資料的可變動參照:" -"答案是因為 C++ 資料可能包含自我參照指標,無法像 Rust 資料一樣移動。" +"如有學生詢問 `Pin`,請說明為何 CXX 需要這個項目來處理 C++ 資料的可變動參照:答案" +"是因為 C++ 資料可能包含自我參照指標,無法像 Rust 資料一樣移動。" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "CXX Error Handling: PNG Example" @@ -15620,10 +15345,9 @@ msgstr "CXX 錯誤處理:PNG 範例" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "" -"A prototype of a PNG decoder illustrates what can be done when the " -"successful result cannot be passed across the FFI boundary:" -msgstr "" -"PNG 解碼器的原型可說明當成功的結果無法跨越 FFI 邊界時,可以執行哪些操作:" +"A prototype of a PNG decoder illustrates what can be done when the successful " +"result cannot be passed across the FFI boundary:" +msgstr "PNG 解碼器的原型可說明當成功的結果無法跨越 FFI 邊界時,可以執行哪些操作:" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "\"gfx::rust_bindings\"" @@ -15645,10 +15369,10 @@ msgstr "/// `crate::png::PngReader` 型別的 C++ 繫結:\n" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "" -"`PngReader` and `ResultOfPngReader` are Rust types --- objects of these " -"types cannot cross the FFI boundary without indirection of a `Box`. We " -"can't have an `out_parameter: &mut PngReader`, because CXX doesn't allow C++ " -"to store Rust objects by value." +"`PngReader` and `ResultOfPngReader` are Rust types --- objects of these types " +"cannot cross the FFI boundary without indirection of a `Box`. We can't have " +"an `out_parameter: &mut PngReader`, because CXX doesn't allow C++ to store Rust " +"objects by value." msgstr "" "`PngReader` 和 `ResultOfPngReader` 是 Rust 型別,這些型別的物件必須採用 " "`Box` 的間接機制,才能跨越 FFI 邊界。我們無法使用 `out_parameter: &mut " @@ -15663,10 +15387,9 @@ msgid "" "appropriate methods of `Result` (e.g. into `is_err`, `unwrap`, and/or " "`as_mut`)." msgstr "" -"本範例說明即使 CXX 不支援任意泛型和範本,我們還是可以手動將這些範本特化/單型" -"化為非泛型型別,傳遞到 FFI 邊界。在範例中,`ResultOfPngReader` 屬於非泛型型" -"別,會轉送至適當的 `Result` 方法,例如 `is_err`、`unwrap` 和/或 " -"`as_mut`。" +"本範例說明即使 CXX 不支援任意泛型和範本,我們還是可以手動將這些範本特化/單型化為" +"非泛型型別,傳遞到 FFI 邊界。在範例中,`ResultOfPngReader` 屬於非泛型型別,會轉" +"送至適當的 `Result` 方法,例如 `is_err`、`unwrap` 和/或 `as_mut`。" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "Using cxx in Chromium" @@ -15674,8 +15397,8 @@ msgstr "在 Chromium 中使用 CXX" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" -"In Chromium, we define an independent `#[cxx::bridge] mod` for each leaf-" -"node where we want to use Rust. You'd typically have one for each " +"In Chromium, we define an independent `#[cxx::bridge] mod` for each leaf-node " +"where we want to use Rust. You'd typically have one for each " "`rust_static_library`. Just add" msgstr "" "在 Chromium 中,我們會為每個要使用 Rust 的葉節點定義獨立的 `#[cxx::bridge] " @@ -15712,14 +15435,13 @@ msgstr "\"ui/base/my_rust_file.rs.h\"" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" -"You will find some utility functions in `//base` to convert to/from Chromium " -"C++ types to CXX Rust types --- for example [`SpanToRustSlice`](https://" -"source.chromium.org/chromium/chromium/src/+/main:base/containers/span_rust.h;" -"l=21)." +"You will find some utility functions in `//base` to convert to/from Chromium C+" +"+ types to CXX Rust types --- for example [`SpanToRustSlice`](https://source." +"chromium.org/chromium/chromium/src/+/main:base/containers/span_rust.h;l=21)." msgstr "" -"您會在 `//base` 中發現一些公用函式,可將 Chromium C++ 型別轉換成 CXX Rust 型" -"別,逆向轉換也可以,例如 [`SpanToRustSlice`](https://source.chromium.org/" -"chromium/chromium/src/+/main:base/containers/span_rust.h;l=21)。" +"您會在 `//base` 中發現一些公用函式,可將 Chromium C++ 型別轉換成 CXX Rust 型別," +"逆向轉換也可以,例如 [`SpanToRustSlice`](https://source.chromium.org/chromium/" +"chromium/src/+/main:base/containers/span_rust.h;l=21)。" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "Students may ask --- why do we still need `allow_unsafe = true`?" @@ -15728,28 +15450,28 @@ msgstr "學生可能會問:為何仍需要 `allow_unsafe = true`?" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" "The broad answer is that no C/C++ code is \"safe\" by the normal Rust " -"standards. Calling back and forth to C/C++ from Rust may do arbitrary things " -"to memory, and compromise the safety of Rust's own data layouts. Presence of " -"_too many_ `unsafe` keywords in C/C++ interop can harm the signal-to-noise " -"ratio of such a keyword, and is [controversial](https://steveklabnik.com/" -"writing/the-cxx-debate), but strictly, bringing any foreign code into a Rust " -"binary can cause unexpected behavior from Rust's perspective." -msgstr "" -"籠統的答案是根據一般 Rust 標準,任何 C/C++ 程式碼都不「安全」。從 Rust 來回呼" -"叫 C/C++ 可能會對記憶體執行任何作業,進而破壞 Rust 本身資料布局的安全性。在 " -"C/C++ 互通性中如果出現「過多」`unsafe` 關鍵字,可能會傷害這類關鍵字的訊噪比," -"且[具有爭議性](https://steveklabnik.com/writing/the-cxx-debate),但嚴格來說," -"在 Rust 二進位檔中導入任何外來程式碼,都可能對 Rust 造成非預期行為。" +"standards. Calling back and forth to C/C++ from Rust may do arbitrary things to " +"memory, and compromise the safety of Rust's own data layouts. Presence of _too " +"many_ `unsafe` keywords in C/C++ interop can harm the signal-to-noise ratio of " +"such a keyword, and is [controversial](https://steveklabnik.com/writing/the-cxx-" +"debate), but strictly, bringing any foreign code into a Rust binary can cause " +"unexpected behavior from Rust's perspective." +msgstr "" +"籠統的答案是根據一般 Rust 標準,任何 C/C++ 程式碼都不「安全」。從 Rust 來回呼叫 " +"C/C++ 可能會對記憶體執行任何作業,進而破壞 Rust 本身資料布局的安全性。在 C/C++ " +"互通性中如果出現「過多」`unsafe` 關鍵字,可能會傷害這類關鍵字的訊噪比,且[具有爭" +"議性](https://steveklabnik.com/writing/the-cxx-debate),但嚴格來說,在 Rust 二進" +"位檔中導入任何外來程式碼,都可能對 Rust 造成非預期行為。" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" "The narrow answer lies in the diagram at the top of [this page](../" "interoperability-with-cpp.md) --- behind the scenes, CXX generates Rust " -"`unsafe` and `extern \"C\"` functions just like we did manually in the " -"previous section." +"`unsafe` and `extern \"C\"` functions just like we did manually in the previous " +"section." msgstr "" -"詳細答案位於[這個頁面](../interoperability-with-cpp.md)頂端的圖表中:CXX 會在" -"幕後產生 Rust `unsafe` 和 `extern \"C\"` 函式,如同前一節中的手動操作。" +"詳細答案位於[這個頁面](../interoperability-with-cpp.md)頂端的圖表中:CXX 會在幕" +"後產生 Rust `unsafe` 和 `extern \"C\"` 函式,如同前一節中的手動操作。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Exercise: Interoperability with C++" @@ -15761,20 +15483,20 @@ msgstr "第一部分" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"In the Rust file you previously created, add a `#[cxx::bridge]` which " -"specifies a single function, to be called from C++, called " -"`hello_from_rust`, taking no parameters and returning no value." +"In the Rust file you previously created, add a `#[cxx::bridge]` which 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++ 呼叫的單一函式 " -"(名為 `hello_from_rust`),但不採用任何參數,也不會傳回值。" +"在您先前建立的 Rust 檔案中新增 `#[cxx::bridge]`,指定要從 C++ 呼叫的單一函式 (名" +"為 `hello_from_rust`),但不採用任何參數,也不會傳回值。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" "Modify your previous `hello_from_rust` function to remove `extern \"C\"` and " "`#[no_mangle]`. This is now just a standard Rust function." msgstr "" -"修改先前的 `hello_from_rust` 函式,移除 `extern \"C\"` 和 `#[no_mangle]`。現" -"在這樣就只是標準的 Rust 函式。" +"修改先前的 `hello_from_rust` 函式,移除 `extern \"C\"` 和 `#[no_mangle]`。現在這" +"樣就只是標準的 Rust 函式。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Modify your `gn` target to build these bindings." @@ -15782,8 +15504,8 @@ msgstr "修改 `gn` 目標,建構這些繫結。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"In your C++ code, remove the forward-declaration of `hello_from_rust`. " -"Instead, include the generated header file." +"In your C++ code, remove the forward-declaration of `hello_from_rust`. Instead, " +"include the generated header file." msgstr "" "在 C++ 程式碼中,移除 `hello_from_rust` 的前向宣告,改為納入產生的標頭檔案。" @@ -15814,8 +15536,8 @@ 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!`。您會需要在新標頭檔案中宣告 " -"C++ 函式。" +"額外的標頭檔案,可從 `cxx::bridge` 中 `include!`。您會需要在新標頭檔案中宣告 C+" +"+ 函式。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -15823,16 +15545,14 @@ msgid "" "`unsafe` keyword in your `#[cxx::bridge]` [as described here](https://cxx.rs/" "extern-c++.html#functions-and-member-functions)." msgstr "" -"用於呼叫這類函式的 `unsafe` 區塊,或者可在 `#[cxx::bridge]` 中指定 `unsafe` " -"關鍵字,[如這個頁面所述](https://cxx.rs/extern-c++.html#functions-and-member-" +"用於呼叫這類函式的 `unsafe` 區塊,或者可在 `#[cxx::bridge]` 中指定 `unsafe` 關鍵" +"字,[如這個頁面所述](https://cxx.rs/extern-c++.html#functions-and-member-" "functions)。" #: src/exercises/chromium/interoperability-with-cpp.md 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\"`" +"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\"`" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Pass a C++ string from C++ into Rust." @@ -15853,23 +15573,21 @@ msgstr "" msgid "" "Intentionally get the C++ function signatures mismatched from the `#[cxx::" "bridge]`, and get used to the errors you see." -msgstr "" -"刻意從 `#[cxx::bridge]` 中取得不相符的 C++ 函式簽章,並熟悉看到的錯誤。" +msgstr "刻意從 `#[cxx::bridge]` 中取得不相符的 C++ 函式簽章,並熟悉看到的錯誤。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"Pass a `std::unique_ptr` of some type from C++ into Rust, so that Rust can " -"own some C++ object." +"Pass a `std::unique_ptr` of some type from C++ into Rust, so that Rust can own " +"some C++ object." msgstr "" -"將某些型別的 `std::unique_ptr` 從 C++ 傳遞至 Rust,這樣 Rust 就能擁有某些 C+" -"+ 物件。" +"將某些型別的 `std::unique_ptr` 從 C++ 傳遞至 Rust,這樣 Rust 就能擁有某些 C++ 物" +"件。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"Create a Rust object and pass it into C++, so that C++ owns it. (Hint: you " -"need a `Box`)." -msgstr "" -"建立 Rust 物件並傳遞至 C++ 中,讓 C++ 擁有該物件 (提示:您需要 `Box`)。" +"Create a Rust object and pass it into C++, so that C++ owns it. (Hint: you need " +"a `Box`)." +msgstr "建立 Rust 物件並傳遞至 C++ 中,讓 C++ 擁有該物件 (提示:您需要 `Box`)。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Declare some methods on a C++ type. Call them from Rust." @@ -15901,8 +15619,8 @@ msgid "" "The [`rust_static_library` gn template](https://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/interoperability-with-cpp.md msgid "Some of the questions you may encounter:" @@ -15910,23 +15628,23 @@ msgstr "您可能會遇到以下問題:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"I'm seeing a problem initializing a variable of type X with type Y, where X " -"and Y are both function types. This is because your C++ function doesn't " -"quite match the declaration in your `cxx::bridge`." +"I'm seeing a problem initializing a variable of type X with type Y, where X and " +"Y are both function types. This is because your C++ function doesn't quite " +"match the declaration in your `cxx::bridge`." msgstr "" -"當 X 和 Y 都是函式型別,初始化型別 X 的變數和型別 Y 時會發生問題。這是因為 C+" -"+ 函式與 `cxx::bridge` 中的宣告不太相符。" +"當 X 和 Y 都是函式型別,初始化型別 X 的變數和型別 Y 時會發生問題。這是因為 C++ " +"函式與 `cxx::bridge` 中的宣告不太相符。" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" "I seem to be able to freely convert C++ references into Rust references. " "Doesn't that risk UB? For CXX's _opaque_ types, no, because they are zero-" -"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." +"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 的" -"「opaque」型別就不會,因為這種型別的大小為零。CXX 中的 trivial 型別則「有可" -"能」造成 UB,雖然 CXX 的設計讓撰寫這類範例相當困難。" +"「opaque」型別就不會,因為這種型別的大小為零。CXX 中的 trivial 型別則「有可能」" +"造成 UB,雖然 CXX 的設計讓撰寫這類範例相當困難。" #: src/chromium/adding-third-party-crates.md msgid "" @@ -15934,8 +15652,8 @@ msgid "" "crates.io). It's _very easy_ for Rust crates to depend upon one another. So " "they do!" msgstr "" -"Rust 程式庫稱為「Crate」,位於 [crates.io](https://crates.io)。Rust Crate「非" -"常容易」互相依附,所以它們也確實常常這麼做!" +"Rust 程式庫稱為「Crate」,位於 [crates.io](https://crates.io)。Rust Crate「非常" +"容易」互相依附,所以它們也確實常常這麼做!" #: src/chromium/adding-third-party-crates.md msgid "C++ library" @@ -15989,8 +15707,8 @@ msgstr "所有 Crate 都使用通用的建構系統,因此我們可以自動 #: src/chromium/adding-third-party-crates.md msgid "" -"... but, crates typically have transitive dependencies, so you will likely " -"have to bring in multiple libraries." +"... but, crates typically have transitive dependencies, so you will likely have " +"to bring in multiple libraries." msgstr "...但 Crate 通常具有遞移依附元件,因此可能需要導入多個程式庫。" #: src/chromium/adding-third-party-crates.md @@ -16015,14 +15733,13 @@ msgstr "設定 `Cargo.toml` 檔案以新增 Crate" #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "" -"Chromium has a single set of centrally-managed direct crate dependencies. " -"These are managed through a single [`Cargo.toml`](https://source.chromium." -"org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/Cargo." -"toml):" +"Chromium has a single set of centrally-managed direct crate dependencies. These " +"are managed through a single [`Cargo.toml`](https://source.chromium.org/" +"chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/Cargo.toml):" msgstr "" -"Chromium 有一組集中管理的直接 Crate 依附元件。這些元件可透過單一 [`Cargo." -"toml`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/" -"rust/chromium_crates_io/Cargo.toml) 管理:" +"Chromium 有一組集中管理的直接 Crate 依附元件。這些元件可透過單一 [`Cargo.toml`]" +"(https://source.chromium.org/chromium/chromium/src/+/main:third_party/rust/" +"chromium_crates_io/Cargo.toml) 管理:" #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "" @@ -16045,9 +15762,9 @@ msgstr "" #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "" "As with any other `Cargo.toml`, you can specify [more details about the " -"dependencies](https://doc.rust-lang.org/cargo/reference/specifying-" -"dependencies.html) --- most commonly, you'll want to specify the `features` " -"that you wish to enable in the crate." +"dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies." +"html) --- most commonly, you'll want to specify the `features` that you wish to " +"enable in the crate." msgstr "" "與任何其他 `Cargo.toml` 一樣,您可以指定[依附元件的更多詳細資料](https://doc." "rust-lang.org/cargo/reference/specifying-dependencies.html)。以最常見的情況來" @@ -16058,8 +15775,8 @@ msgid "" "When adding a crate to Chromium, you'll often need to provide some extra " "information in an additional file, `gnrt_config.toml`, which we'll meet next." msgstr "" -"將 Crate 新增至 Chromium 時,您通常需要在 `gnrt_config.toml` 這個額外檔案中提" -"供額外資訊,這接下來會介紹。" +"將 Crate 新增至 Chromium 時,您通常需要在 `gnrt_config.toml` 這個額外檔案中提供" +"額外資訊,這接下來會介紹。" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md msgid "" @@ -16073,8 +15790,7 @@ msgstr "" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md msgid "" -"If you add a new crate, you should specify at least the `group`. This is one " -"of:" +"If you add a new crate, you should specify at least the `group`. This is one of:" msgstr "新增 Crate 時,應至少指定 `group`,可以是以下其中一個:" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md @@ -16084,15 +15800,15 @@ msgstr "舉例來說:" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md 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." +"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 檔案的位置。" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md msgid "" -"Later, we'll see some other things you will need to configure in this file " -"to resolve problems." +"Later, we'll see some other things you will need to configure in this file to " +"resolve problems." msgstr "稍後我們會看到一些其他您需在這個檔案中設定的項目,才能解決問題。" #: src/chromium/adding-third-party-crates/downloading-crates.md @@ -16107,14 +15823,13 @@ msgstr "首先,請按照以下方式下載任何你想要的 Crate:" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "" -"Although the `gnrt` tool is part of the Chromium source code, by running " -"this command you will be downloading and running its dependencies from " -"`crates.io`. See [the earlier section](../cargo.md) discussing this security " -"decision." +"Although the `gnrt` tool is part of the Chromium source code, by running this " +"command you will be downloading and running its dependencies from `crates.io`. " +"See [the earlier section](../cargo.md) discussing this security decision." msgstr "" "雖然 `gnrt` 工具屬於 Chromium 原始碼的一部分,但透過執行這項指令,您可以從 " -"`crates.io` 下載並執行其依附元件。請參閱[前面的章節](../cargo.md)中有關這項安" -"全性決策的討論。" +"`crates.io` 下載並執行其依附元件。請參閱[前面的章節](../cargo.md)中有關這項安全" +"性決策的討論。" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "This `vendor` command may download:" @@ -16133,8 +15848,8 @@ msgid "" "New versions of other crates, as required by `cargo` to resolve the complete " "set of crates required by Chromium." msgstr "" -"其他 Crate 的新版本。這是 `cargo` 的要求,以便解析 Chromium 所需的完整 Crate " -"組合。" +"其他 Crate 的新版本。這是 `cargo` 的要求,以便解析 Chromium 所需的完整 Crate 組" +"合。" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "" @@ -16143,12 +15858,11 @@ msgid "" "patching fails you may need to take manual action." msgstr "" "Chromium 會維護部分 Crate 的修補程式,保留在 `//third_party/rust/" -"chromium_crates_io/patches` 中。系統會自動重新套用這些設定,但如果修補失敗," -"就可能需要手動操作。" +"chromium_crates_io/patches` 中。系統會自動重新套用這些設定,但如果修補失敗,就可" +"能需要手動操作。" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md -msgid "" -"Once you've downloaded the crate, generate the `BUILD.gn` files like this:" +msgid "Once you've downloaded the crate, generate the `BUILD.gn` files like this:" msgstr "下載 Crate 後,請如下產生 `BUILD.gn` 檔案:" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md @@ -16160,16 +15874,15 @@ msgid "" "At least one new crate source code in `third_party/rust/chromium_crates_io/" "vendor`" msgstr "" -"在 `third_party/rust/chromium_crates_io/vendor` 中,至少有一個新的 Crate 原始" -"碼" +"在 `third_party/rust/chromium_crates_io/vendor` 中,至少有一個新的 Crate 原始碼" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" "At least one new `BUILD.gn` in `third_party/rust//v`" msgstr "" -"在 `third_party/rust//v` 中,至少有一個新" -"的 `BUILD.gn`" +"在 `third_party/rust//v` 中,至少有一個新的 " +"`BUILD.gn`" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "An appropriate `README.chromium`" @@ -16177,11 +15890,11 @@ msgstr "適當的 `README.chromium`" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" -"The \"major semver version\" is a [Rust \"semver\" version number](https://" -"doc.rust-lang.org/cargo/reference/semver.html)." +"The \"major semver version\" is a [Rust \"semver\" version number](https://doc." +"rust-lang.org/cargo/reference/semver.html)." msgstr "" -"「major semver version」是 [Rust「Semver」版本號碼](https://doc.rust-lang." -"org/cargo/reference/semver.html)." +"「major semver version」是 [Rust「Semver」版本號碼](https://doc.rust-lang.org/" +"cargo/reference/semver.html)." #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" @@ -16190,9 +15903,9 @@ msgstr "請仔細查看,尤其是 `third_party/rust` 中產生的內容。" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" -"Talk a little about semver --- and specifically the way that in Chromium " -"it's to allow multiple incompatible versions of a crate, which is " -"discouraged but sometimes necessary in the Cargo ecosystem." +"Talk a little about semver --- and specifically the way that in Chromium it's " +"to allow multiple incompatible versions of a crate, which is discouraged but " +"sometimes necessary in the Cargo ecosystem." msgstr "" "請稍微介紹一下 Semver,並具體說明在 Chromium 中,Semver 可允許多種不相容的 " "Crate 版本。這不是建議做法,但在 Cargo 生態系統中有時是必要的。" @@ -16200,13 +15913,13 @@ msgstr "" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "" "If your build fails, it may be because of a `build.rs`: programs which do " -"arbitrary things at build time. This is fundamentally at odds with the " -"design of `gn` and `ninja` which aim for static, deterministic, build rules " -"to maximize parallelism and repeatability of builds." +"arbitrary things at build time. This is fundamentally at odds with the design " +"of `gn` and `ninja` which aim for static, deterministic, build rules to " +"maximize parallelism and repeatability of builds." msgstr "" "如果建構失敗,可能是因為 `build.rs`,這類程式會在建構期間執行任意操作。根本而" -"言,這不符合 `gn` 和 `ninja` 的設計,後者的目標是達成靜態的確定性建構規則,盡" -"可能提高建構作業的平行處理程度和重複性。" +"言,這不符合 `gn` 和 `ninja` 的設計,後者的目標是達成靜態的確定性建構規則,盡可" +"能提高建構作業的平行處理程度和重複性。" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "" @@ -16273,16 +15986,15 @@ msgstr "如果 `ninja` 抱怨缺少檔案,請查看 `build.rs`,確認是否 #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" -"If so, modify [`gnrt_config.toml`](../configuring-gnrt-config-toml.md) to " -"add `build-script-outputs` to the crate. If this is a transitive dependency, " -"that is, one on which Chromium code should not directly depend, also add " -"`allow-first-party-usage=false`. There are several examples already in that " -"file:" +"If so, modify [`gnrt_config.toml`](../configuring-gnrt-config-toml.md) to add " +"`build-script-outputs` to the crate. If this is a transitive dependency, that " +"is, one on which Chromium code should not directly depend, also add `allow-" +"first-party-usage=false`. There are several examples already in that file:" msgstr "" "如果是,請修改 [`gnrt_config.toml`](../configuring-gnrt-config-toml.md),將 " -"`build-script-outputs` 新增至 Crate。若是遞移依附元件,也就是 Chromium 程式" -"碼 不應直接依附的依附元件,請一併加上 `allow-first-party-usage=false`。該檔案" -"中已有幾個範例:" +"`build-script-outputs` 新增至 Crate。若是遞移依附元件,也就是 Chromium 程式碼 不" +"應直接依附的依附元件,請一併加上 `allow-first-party-usage=false`。該檔案中已有幾" +"個範例:" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" @@ -16301,24 +16013,24 @@ msgstr "" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" "Now rerun [`gnrt.py -- gen`](../generating-gn-build-rules.md) to regenerate " -"`BUILD.gn` files to inform ninja that this particular output file is input " -"to subsequent build steps." +"`BUILD.gn` files to inform ninja that this particular output file is input to " +"subsequent build steps." msgstr "" "現在請重新執行 [`gnrt.py -- gen`](../generating-gn-build-rules.md),重新產生 " "`BUILD.gn` 檔案以通知 ninja 這個輸出檔案會輸入至後續建構步驟。" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "" -"Some crates use the [`cc`](https://crates.io/crates/cc) crate to build and " -"link C/C++ libraries. Other crates parse C/C++ using [`bindgen`](https://" -"crates.io/crates/bindgen) within their build scripts. These actions can't be " -"supported in a Chromium context --- our gn, ninja and LLVM build system is " -"very specific in expressing relationships between build actions." +"Some crates use the [`cc`](https://crates.io/crates/cc) crate to build and link " +"C/C++ libraries. Other crates parse C/C++ using [`bindgen`](https://crates.io/" +"crates/bindgen) within their build scripts. These actions can't be supported in " +"a Chromium context --- our gn, ninja and LLVM build system is very specific in " +"expressing relationships between build actions." msgstr "" -"部分 Crate 使用 [`cc`](https://crates.io/crates/cc) Crate 建構和連結 C/C++ 程" -"式庫。其他 Crate 在建構指令碼中使用 [`bindgen`](https://crates.io/crates/" -"bindgen) 剖析 C/C++。Chromium 環境無法支援這些動作,因為我們的 gn、ninja 和 " -"LLVM 建構系統特別要求明確表達建構動作之間的關係。" +"部分 Crate 使用 [`cc`](https://crates.io/crates/cc) Crate 建構和連結 C/C++ 程式" +"庫。其他 Crate 在建構指令碼中使用 [`bindgen`](https://crates.io/crates/bindgen) " +"剖析 C/C++。Chromium 環境無法支援這些動作,因為我們的 gn、ninja 和 LLVM 建構系統" +"特別要求明確表達建構動作之間的關係。" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "So, your options are:" @@ -16334,22 +16046,22 @@ msgstr "將修補程式套用至 Crate。" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "" -"Patches should be kept in `third_party/rust/chromium_crates_io/patches/" -"` - see for example the [patches against the `cxx` crate](https://" -"source.chromium.org/chromium/chromium/src/+/main:third_party/rust/" -"chromium_crates_io/patches/cxx/) - and will be applied automatically by " -"`gnrt` each time it upgrades the crate." +"Patches should be kept in `third_party/rust/chromium_crates_io/patches/` " +"- see for example the [patches against the `cxx` crate](https://source.chromium." +"org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/patches/" +"cxx/) - and will be applied automatically by `gnrt` each time it upgrades the " +"crate." msgstr "" -"修補程式應保留在 `third_party/rust/chromium_crates_io/patches/` 中,範" -"例請見 [`cxx` Crate 的修補程式](https://source.chromium.org/chromium/" -"chromium/src/+/main:third_party/rust/chromium_crates_io/patches/cxx。此外,在" -"每次升級 Crate 時,修補補程式會由 `gnrt` 自動套用。" +"修補程式應保留在 `third_party/rust/chromium_crates_io/patches/` 中,範例" +"請見 [`cxx` Crate 的修補程式](https://source.chromium.org/chromium/chromium/src/" +"+/main:third_party/rust/chromium_crates_io/patches/cxx。此外,在每次升級 Crate " +"時,修補補程式會由 `gnrt` 自動套用。" #: src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "" -"Once you've added a third-party crate and generated build rules, depending " -"on a crate is simple. Find your `rust_static_library` target, and add a " -"`dep` on the `:lib` target within your crate." +"Once you've added a third-party crate and generated build rules, depending on a " +"crate is simple. Find your `rust_static_library` target, and add a `dep` on the " +"`:lib` target within your crate." msgstr "" "新增第三方 Crate 並產生建構規則後,依附 Crate 就很簡單。請找出 " "`rust_static_library` 目標,然後在 Crate 的 `:lib` 目標中新增 `dep`。" @@ -16363,15 +16075,13 @@ msgstr "特定 OS" msgid "" "```bob\n" " +------------+ +----------------------+\n" -"\"//third_party/rust\" | crate name | \"/v\" | major semver version | \":" -"lib\"\n" +"\"//third_party/rust\" | crate name | \"/v\" | major semver version | \":lib\"\n" " +------------+ +----------------------+\n" "```" msgstr "" "```bob\n" " +------------+ +----------------------+\n" -"\"//third_party/rust\" | crate name | \"/v\" | major semver version | \":" -"lib\"\n" +"\"//third_party/rust\" | crate name | \"/v\" | major semver version | \":lib\"\n" " +------------+ +----------------------+\n" "```" @@ -16401,40 +16111,38 @@ msgstr "稽核第三方 Crate" msgid "" "Adding new libraries is subject to Chromium's standard [policies](https://" "chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust." -"md#Third_party-review), but of course also subject to security review. As " -"you may be bringing in not just a single crate but also transitive " -"dependencies, there may be a lot of code to review. On the other hand, safe " -"Rust code can have limited negative side effects. How should you review it?" +"md#Third_party-review), but of course also subject to security review. As you " +"may be bringing in not just a single crate but also transitive dependencies, " +"there may be a lot of code to review. On the other hand, safe Rust code can " +"have limited negative side effects. How should you review it?" msgstr "" "新增程式庫時必須遵守 Chromium 的標準[政策](https://chromium.googlesource.com/" -"chromium/src/+/refs/heads/main/docs/rust.md#Third_party-review),不過當然也須" -"接受安全性審查。您可能不只引入一個 Crate,還會傳入遞移依附元件,因此可能有許" -"多程式碼需要審查。另一方面,安全的 Rust 程式碼不會產生多少負面副作用。應如何" -"審查呢?" +"chromium/src/+/refs/heads/main/docs/rust.md#Third_party-review),不過當然也須接" +"受安全性審查。您可能不只引入一個 Crate,還會傳入遞移依附元件,因此可能有許多程式" +"碼需要審查。另一方面,安全的 Rust 程式碼不會產生多少負面副作用。應如何審查呢?" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"Over time Chromium aims to move to a process based around [cargo vet]" -"(https://mozilla.github.io/cargo-vet/)." +"Over time Chromium aims to move to a process based around [cargo vet](https://" +"mozilla.github.io/cargo-vet/)." msgstr "" "隨著時間推移,Chromium 的目標是移至以 [cargo vet](https://mozilla.github.io/" "cargo-vet/) 為基礎的程序。" #: src/chromium/adding-third-party-crates/reviews-and-audits.md -msgid "" -"Meanwhile, for each new crate addition, we are checking for the following:" +msgid "Meanwhile, for each new crate addition, we are checking for the following:" msgstr "同時,我們會針對每個新增的 Crate 檢查以下項目:" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"Understand why each crate is used. What's the relationship between crates? " -"If the build system for each crate contains a `build.rs` or procedural " -"macros, work out what they're for. Are they compatible with the way Chromium " -"is normally built?" +"Understand why each crate is used. What's the relationship between crates? If " +"the build system for each crate contains a `build.rs` or procedural macros, " +"work out what they're for. Are they compatible with the way Chromium is " +"normally built?" msgstr "" -"瞭解使用各個 Crate 的原因。Crate 之間的關係為何?如果每個 Crate 的建構系統都" -"包含 `build.rs` 或程序巨集,請思考 Crate 的用途。這些 Crate 是否與 Chromium " -"平常的建構方式相容?" +"瞭解使用各個 Crate 的原因。Crate 之間的關係為何?如果每個 Crate 的建構系統都包" +"含 `build.rs` 或程序巨集,請思考 Crate 的用途。這些 Crate 是否與 Chromium 平常的" +"建構方式相容?" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "Check each crate seems to be reasonably well maintained" @@ -16447,19 +16155,19 @@ msgid "" "ironically involves downloading lots of dependencies from the internet[2](../" "cargo.md))" msgstr "" -"使用 `cd third-party/rust/chromium_crates_io; cargo audit` 檢查是否有已知的安" -"全漏洞 (您首先需要執行 `cargo install cargo-audit`,諷刺的是,這麼做需要從網" -"際網路下載大量依附元件[2](../cargo.md))" +"使用 `cd third-party/rust/chromium_crates_io; cargo audit` 檢查是否有已知的安全" +"漏洞 (您首先需要執行 `cargo install cargo-audit`,諷刺的是,這麼做需要從網際網路" +"下載大量依附元件[2](../cargo.md))" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"Ensure any `unsafe` code is good enough for the [Rule of Two](https://" -"chromium.googlesource.com/chromium/src/+/main/docs/security/rule-of-2." -"md#unsafe-code-in-safe-languages)" +"Ensure any `unsafe` code is good enough for the [Rule of Two](https://chromium." +"googlesource.com/chromium/src/+/main/docs/security/rule-of-2.md#unsafe-code-in-" +"safe-languages)" msgstr "" "確保所有 `unsafe` 程式碼都妥善符合[兩個項目的規則](https://chromium." -"googlesource.com/chromium/src/+/main/docs/security/rule-of-2.md#unsafe-code-" -"in-safe-languages)" +"googlesource.com/chromium/src/+/main/docs/security/rule-of-2.md#unsafe-code-in-" +"safe-languages)" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "Check for any use of `fs` or `net` APIs" @@ -16467,20 +16175,20 @@ msgstr "檢查是否使用 `fs` 或 `net` API" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"Read all the code at a sufficient level to look for anything out of place " -"that might have been maliciously inserted. (You can't realistically aim for " -"100% perfection here: there's often just too much code.)" +"Read all the code at a sufficient level to look for anything out of place that " +"might have been maliciously inserted. (You can't realistically aim for 100% " +"perfection here: there's often just too much code.)" msgstr "" -"請在足夠的層級閱讀所有程式碼,檢查是否出現任何可能是惡意插入的錯誤內容 (實務" -"上很難達到 100% 完美的成果,畢竟通常會有太多程式碼。)" +"請在足夠的層級閱讀所有程式碼,檢查是否出現任何可能是惡意插入的錯誤內容 (實務上很" +"難達到 100% 完美的成果,畢竟通常會有太多程式碼。)" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"These are just guidelines --- work with reviewers from `security@chromium." -"org` to work out the right way to become confident of the crate." +"These are just guidelines --- work with reviewers from `security@chromium.org` " +"to work out the right way to become confident of the crate." msgstr "" -"上述內容只是指南,請與 `security@chromium.org` 的審查人員合作,瞭解如何正確地" -"確保 Crate 是可信的。" +"上述內容只是指南,請與 `security@chromium.org` 的審查人員合作,瞭解如何正確地確" +"保 Crate 是可信的。" #: src/chromium/adding-third-party-crates/checking-in.md msgid "Checking Crates into Chromium Source Code" @@ -16508,67 +16216,66 @@ msgstr "請一併在後者的位置中新增 `OWNERS` 檔案。" #: src/chromium/adding-third-party-crates/checking-in.md msgid "" -"You should land all this, along with your `Cargo.toml` and `gnrt_config." -"toml` changes, into the Chromium repo." +"You should land all this, along with your `Cargo.toml` and `gnrt_config.toml` " +"changes, into the Chromium repo." msgstr "" -"請務必在 Chromium 存放區中放入所有這些項目,以及 `Cargo.toml` 和 " -"`gnrt_config.toml` 變更內容。" +"請務必在 Chromium 存放區中放入所有這些項目,以及 `Cargo.toml` 和 `gnrt_config." +"toml` 變更內容。" #: src/chromium/adding-third-party-crates/checking-in.md 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 msgid "" "As you do so, you might find presubmit checks fail because of non-inclusive " "language. This is because Rust crate data tends to include names of git " -"branches, and many projects still use non-inclusive terminology there. So " -"you may need to run:" +"branches, and many projects still use non-inclusive terminology there. So you " +"may need to run:" msgstr "" -"這時,預先提交的檢查作業可能會因使用非包容性的語言而失敗。這是因為 Rust " -"Crate 資料通常會包含 Git 分支版本的名稱,而許多專案仍使用非包容性的術語。因" -"此,您可能需要執行以下項目:" +"這時,預先提交的檢查作業可能會因使用非包容性的語言而失敗。這是因為 Rust Crate 資" +"料通常會包含 Git 分支版本的名稱,而許多專案仍使用非包容性的術語。因此,您可能需" +"要執行以下項目:" #: src/chromium/adding-third-party-crates/keeping-up-to-date.md msgid "" -"As the OWNER of any third party Chromium dependency, you are [expected to " -"keep it up to date with any security fixes](https://chromium.googlesource." -"com/chromium/src/+/main/docs/adding_to_third_party.md#add-owners). It is " -"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." +"As the OWNER of any third party Chromium dependency, you are [expected to keep " +"it up to date with any security fixes](https://chromium.googlesource.com/" +"chromium/src/+/main/docs/adding_to_third_party.md#add-owners). It is 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 依附元件的擁有者,您應[確保該元件已採用任何最新的安全性修" -"正項目](https://chromium.googlesource.com/chromium/src/+/main/docs/" -"adding_to_third_party.md#add-owners)。我們希望很快就能針對 Rust Crate 將這項" -"作業自動化,但您目前仍須負責處理此事,如同使用其他第三方依附元件時一樣。" +"身為第三方 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 "" "Add [uwuify](https://crates.io/crates/uwuify) to Chromium, turning off the " -"crate's [default features](https://doc.rust-lang.org/cargo/reference/" -"features.html#the-default-feature). Assume that the crate will be used in " -"shipping Chromium, but won't be used to handle untrustworthy input." +"crate's [default features](https://doc.rust-lang.org/cargo/reference/features." +"html#the-default-feature). Assume that the crate will be used in shipping " +"Chromium, but won't be used to handle untrustworthy input." msgstr "" -"在 Chromium 中新增 [uwuify](https://crates.io/crates/uwuify),關閉 Crate 的" -"[預設功能](https://doc.rust-lang.org/cargo/reference/features.html#the-" -"default-feature)。假設提交 Chromium 時會使用這個 Crate,但不會用於處理不可靠" -"的輸入資料。" +"在 Chromium 中新增 [uwuify](https://crates.io/crates/uwuify),關閉 Crate 的[預設" +"功能](https://doc.rust-lang.org/cargo/reference/features.html#the-default-" +"feature)。假設提交 Chromium 時會使用這個 Crate,但不會用於處理不可靠的輸入資料。" #: src/exercises/chromium/third-party.md msgid "" "(In the next exercise we'll use uwuify from Chromium, but feel free to skip " "ahead and do that now if you like. Or, you could create a new " -"[`rust_executable` target](https://source.chromium.org/chromium/chromium/src/" -"+/main:build/rust/rust_executable.gni) which uses `uwuify`)." +"[`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` 目標]" -"(https://source.chromium.org/chromium/chromium/src/+/main:build/rust/" -"rust_executable.gni)。)" +"(在下一項練習中,我們將使用 Chromium 的 uwuify,但您現在就可以跳過這部分,直接開" +"始練習。或者,您可以建立使用 `uwuify` 的新 [`rust_executable` 目標](https://" +"source.chromium.org/chromium/chromium/src/+/main:build/rust/rust_executable." +"gni)。)" #: src/exercises/chromium/third-party.md msgid "Students will need to download lots of transitive dependencies." @@ -16612,15 +16319,14 @@ msgstr "`uwuify`。" #: src/exercises/chromium/third-party.md msgid "" -"If students are downloading even more than that, they probably forgot to " -"turn off the default features." +"If students are downloading even more than that, they probably forgot to turn " +"off the default features." msgstr "如果學生下載的項目不只這些,可能是因為忘了關閉預設功能。" #: src/exercises/chromium/third-party.md msgid "" "Thanks to [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) for this crate!" -msgstr "" -"感謝 [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) 提供這個 Crate!" +msgstr "感謝 [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) 提供這個 Crate!" #: src/exercises/chromium/bringing-it-together.md msgid "Bringing It Together --- Exercise" @@ -16638,23 +16344,20 @@ msgstr "產品管理提要" #: src/exercises/chromium/bringing-it-together.md msgid "" -"A community of pixies has been discovered living in a remote rainforest. " -"It's important that we get Chromium for Pixies delivered to them as soon as " -"possible." -msgstr "" -"我們在偏遠的雨林中發現一群精靈,務必盡快將精靈專用 Chromium 提供給他們。" +"A community of pixies has been discovered living in a remote rainforest. It's " +"important that we get Chromium for Pixies delivered to them as soon as possible." +msgstr "我們在偏遠的雨林中發現一群精靈,務必盡快將精靈專用 Chromium 提供給他們。" #: src/exercises/chromium/bringing-it-together.md msgid "" -"The requirement is to translate all Chromium's UI strings into Pixie " -"language." +"The requirement is to translate all Chromium's UI strings into Pixie language." msgstr "目前要求是將所有 Chromium 的 UI 字串翻譯成精靈語。" #: src/exercises/chromium/bringing-it-together.md msgid "" "There's not time to wait for proper translations, but fortunately pixie " -"language is very close to English, and it turns out there's a Rust crate " -"which does the translation." +"language is very close to English, and it turns out there's a Rust crate which " +"does the translation." msgstr "" "現在沒時間取得適當的翻譯,但幸好精靈語非常接近英文,也找到能負責翻譯的 Rust " "Crate。" @@ -16668,8 +16371,8 @@ msgstr "" #: src/exercises/chromium/bringing-it-together.md msgid "" -"(Obviously, real translations of Chrome require incredible care and " -"diligence. Don't ship this!)" +"(Obviously, real translations of Chrome require incredible care and diligence. " +"Don't ship this!)" msgstr "(想當然耳,實際翻譯 Chrome 時必須非常審慎認真。千萬別發布這些內容!)" #: src/exercises/chromium/bringing-it-together.md @@ -16679,12 +16382,12 @@ msgstr "步驟" #: src/exercises/chromium/bringing-it-together.md msgid "" "Modify `ResourceBundle::MaybeMangleLocalizedString` so that it uwuifies all " -"strings before display. In this special build of Chromium, it should always " -"do this irrespective of the setting of `mangle_localized_strings_`." +"strings before display. In this special build of Chromium, it should always do " +"this irrespective of the setting of `mangle_localized_strings_`." msgstr "" -"修改 `ResourceBundle::MaybeMangleLocalizedString`,讓所有字串在顯示前 uwu " -"化。在這個特殊版本的 Chromium 中,無論 `mangle_localized_strings_` 的設定為" -"何,一律應執行這項轉換。" +"修改 `ResourceBundle::MaybeMangleLocalizedString`,讓所有字串在顯示前 uwu 化。在" +"這個特殊版本的 Chromium 中,無論 `mangle_localized_strings_` 的設定為何,一律應" +"執行這項轉換。" #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -16694,47 +16397,46 @@ msgstr "如果您順利完成所有練習,那麼恭喜您成功為精靈打造 #: src/exercises/chromium/bringing-it-together.md msgid "" -"UTF16 vs UTF8. Students should be aware that Rust strings are always UTF8, " -"and will probably decide that it's better to do the conversion on the C++ " -"side using `base::UTF16ToUTF8` and back again." +"UTF16 vs UTF8. Students should be aware that Rust strings are always UTF8, and " +"will probably decide that it's better to do the conversion on the C++ side " +"using `base::UTF16ToUTF8` and back again." msgstr "" -"UTF16 與 UTF8:學生應瞭解 Rust 字串一律為 UTF8,且可能判斷出較適合在 C++ 端使" -"用 `base::UTF16ToUTF8` 完成轉換再返回。" +"UTF16 與 UTF8:學生應瞭解 Rust 字串一律為 UTF8,且可能判斷出較適合在 C++ 端使用 " +"`base::UTF16ToUTF8` 完成轉換再返回。" #: src/exercises/chromium/bringing-it-together.md msgid "" "If students decide to do the conversion on the Rust side, they'll need to " "consider [`String::from_utf16`](https://doc.rust-lang.org/std/string/struct." "String.html#method.from_utf16), consider error handling, and consider which " -"[CXX supported types can transfer a lot of u16s](https://cxx.rs/binding/" -"slice.html)." +"[CXX supported types can transfer a lot of u16s](https://cxx.rs/binding/slice." +"html)." msgstr "" "如果學生決定在 Rust 端完成轉換,就需考慮 [`String::from_utf16`](https://doc." -"rust-lang.org/std/string/struct.String.html#method.from_utf16)、錯誤處理方" -"式,以及哪些 [CXX 支援的型別可傳輸大量 u16](https://cxx.rs/binding/slice." -"html)。" +"rust-lang.org/std/string/struct.String.html#method.from_utf16)、錯誤處理方式,以" +"及哪些 [CXX 支援的型別可傳輸大量 u16](https://cxx.rs/binding/slice.html)。" #: src/exercises/chromium/bringing-it-together.md msgid "" "Students may design the C++/Rust boundary in several different ways, e.g. " "taking and returning strings by value, or taking a mutable reference to a " -"string. If a mutable reference is used, CXX will likely tell the student " -"that they need to use [`Pin`](https://doc.rust-lang.org/std/pin/). You may " -"need to explain what `Pin` does, and then explain why CXX needs it for " -"mutable references to C++ data: the answer is that C++ data can't be moved " -"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 資料一樣" -"移動,因為該資料可能包含自我參照指標。" +"string. If a mutable reference is used, CXX will likely tell the student that " +"they need to use [`Pin`](https://doc.rust-lang.org/std/pin/). You may need to " +"explain what `Pin` does, and then explain why CXX needs it for mutable " +"references to C++ data: the answer is that C++ data can't be moved 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 資料一樣移動,因為該資料可能" +"包含自我參照指標。" #: src/exercises/chromium/bringing-it-together.md msgid "" "The C++ target containing `ResourceBundle::MaybeMangleLocalizedString` will " -"need to depend on a `rust_static_library` target. The student probably " -"already did this." +"need to depend on a `rust_static_library` target. The student probably already " +"did this." msgstr "" "包含 `ResourceBundle::MaybeMangleLocalizedString` 的 C++ 目標需依附於 " "`rust_static_library` 目標。學生可能已經這麼做。" @@ -16743,8 +16445,7 @@ msgstr "" msgid "" "The `rust_static_library` target will need to depend on `//third_party/rust/" "uwuify/v0_2:lib`." -msgstr "" -"`rust_static_library` 目標需依附於 `//third_party/rust/uwuify/v0_2:lib`。" +msgstr "`rust_static_library` 目標需依附於 `//third_party/rust/uwuify/v0_2:lib`。" #: src/exercises/chromium/solutions.md msgid "" @@ -16760,22 +16461,22 @@ msgstr "歡迎瞭解 Rust 裸機開發" #: src/bare-metal.md msgid "" -"This is a standalone one-day course about bare-metal Rust, aimed at people " -"who are familiar with the basics of Rust (perhaps from completing the " -"Comprehensive Rust course), and ideally also have some experience with bare-" -"metal programming in some other language such as C." +"This is a standalone one-day course about bare-metal Rust, aimed at people who " +"are familiar with the basics of Rust (perhaps from completing the Comprehensive " +"Rust course), and ideally also have some experience with bare-metal programming " +"in some other language such as C." msgstr "" -"這個為期一天的獨立課程會介紹 Rust 裸機開發,適合熟悉 Rust 基本概念的開發人員 " -"(或許是完成 Comprehensive Rust 課程的學生),且最好具備一些 C 等其他語言的裸機" -"程式設計經驗。" +"這個為期一天的獨立課程會介紹 Rust 裸機開發,適合熟悉 Rust 基本概念的開發人員 (或" +"許是完成 Comprehensive Rust 課程的學生),且最好具備一些 C 等其他語言的裸機程式設" +"計經驗。" #: src/bare-metal.md msgid "" "Today we will talk about 'bare-metal' Rust: running Rust code without an OS " "underneath us. This will be divided into several parts:" msgstr "" -"今天我們要介紹 Rust「裸機開發」:在執行 Rust 程式碼時不使用作業系統。這會分為" -"以下幾個部分:" +"今天我們要介紹 Rust「裸機開發」:在執行 Rust 程式碼時不使用作業系統。這會分為以" +"下幾個部分:" #: src/bare-metal.md msgid "What is `no_std` Rust?" @@ -16797,23 +16498,21 @@ msgstr "一些適用於 Rust 裸機開發的實用 Crate。" msgid "" "For the microcontroller part of the course we will use the [BBC micro:bit]" "(https://microbit.org/) v2 as an example. It's a [development board](https://" -"tech.microbit.org/hardware/) based on the Nordic nRF51822 microcontroller " -"with some LEDs and buttons, an I2C-connected accelerometer and compass, and " -"an on-board SWD debugger." +"tech.microbit.org/hardware/) based on the Nordic nRF51822 microcontroller with " +"some LEDs and buttons, an I2C-connected accelerometer and compass, and an on-" +"board SWD debugger." msgstr "" -"在本課程的微控制器部分,我們將使用 [BBC micro:bit](https://microbit.org/) 第 " -"2 版當做範例。這是以 Nordic nRF51822 微控制器為基礎的[開發板](https://tech." -"microbit.org/hardware/),具備一些 LED 和按鈕、連接 I2C 的加速計和羅盤,以及內" -"建的 SWD 偵錯工具。" +"在本課程的微控制器部分,我們將使用 [BBC micro:bit](https://microbit.org/) 第 2 " +"版當做範例。這是以 Nordic nRF51822 微控制器為基礎的[開發板](https://tech." +"microbit.org/hardware/),具備一些 LED 和按鈕、連接 I2C 的加速計和羅盤,以及內建" +"的 SWD 偵錯工具。" #: src/bare-metal.md -msgid "" -"To get started, install some tools we'll need later. On gLinux or Debian:" +msgid "To get started, install some tools we'll need later. On gLinux or Debian:" msgstr "如要開始使用,請先安裝稍後需使用的工具。使用 gLinux 或 Debian:" #: src/bare-metal.md -msgid "" -"And give users in the `plugdev` group access to the micro:bit programmer:" +msgid "And give users in the `plugdev` group access to the micro:bit programmer:" msgstr "為 `plugdev` 群組中的使用者授予 micro:bit 程式工具的存取權:" #: src/bare-metal.md src/bare-metal/microcontrollers/debugging.md @@ -16941,22 +16640,22 @@ msgid "" "Depending on the target, you may need to compile with `panic = \"abort\"` to " "avoid an error about `eh_personality`." msgstr "" -"視目標而定,編譯時可能需要使用 `panic = \"abort\"`,以免發生 " -"`eh_personality` 相關錯誤。" +"視目標而定,編譯時可能需要使用 `panic = \"abort\"`,以免發生 `eh_personality` 相" +"關錯誤。" #: src/bare-metal/minimal.md msgid "" -"Note that there is no `main` or any other entry point; it's up to you to " -"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." +"Note that there is no `main` or any other entry point; it's up to you to 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` 或任何其他進入點。您可以自行定義進入點。這通常涉及連結" -"器指令碼和一些組語程式碼,以便準備好執行 Rust 程式碼。" +"請注意,並沒有 `main` 或任何其他進入點。您可以自行定義進入點。這通常涉及連結器指" +"令碼和一些組語程式碼,以便準備好執行 Rust 程式碼。" #: src/bare-metal/alloc.md msgid "" -"To use `alloc` you must implement a [global (heap) allocator](https://doc." -"rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html)." +"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/" "stable/std/alloc/trait.GlobalAlloc.html)。" @@ -16983,16 +16682,16 @@ msgstr "String" #: src/bare-metal/alloc.md msgid "" "`buddy_system_allocator` is a third-party crate implementing a basic buddy " -"system allocator. Other crates are available, or you can write your own or " -"hook into your existing allocator." +"system allocator. Other crates are available, or you can write your own or hook " +"into your existing allocator." msgstr "" -"`buddy_system_allocator` 是實作基本夥伴系統分配器的第三方 Crate。也可以使用其" -"他 Crate,或是自行撰寫或連結至現有分配器。" +"`buddy_system_allocator` 是實作基本夥伴系統分配器的第三方 Crate。也可以使用其他 " +"Crate,或是自行撰寫或連結至現有分配器。" #: src/bare-metal/alloc.md msgid "" -"The const parameter of `LockedHeap` is the max order of the allocator; i.e. " -"in this case it can allocate regions of up to 2\\*\\*32 bytes." +"The const parameter of `LockedHeap` is the max order of the allocator; i.e. in " +"this case it can allocate regions of up to 2\\*\\*32 bytes." msgstr "" "`LockedHeap` 的 const 參數是分配器最高的階,意即在本例中,它最多可分配 " "2\\*\\*32 個位元組的區域。" @@ -17003,16 +16702,16 @@ msgid "" "exactly one global allocator defined in your binary. Usually this is done in " "the top-level binary crate." msgstr "" -"如果依附元件樹狀結構中有任何 Crate 依附於 `alloc`,您就必須在二進位檔中只定義" -"一個全域分配器。通常是在頂層二進位檔 Crate 中定義。" +"如果依附元件樹狀結構中有任何 Crate 依附於 `alloc`,您就必須在二進位檔中只定義一" +"個全域分配器。通常是在頂層二進位檔 Crate 中定義。" #: src/bare-metal/alloc.md msgid "" "`extern crate panic_halt as _` is necessary to ensure that the `panic_halt` " "crate is linked in so we get its panic handler." msgstr "" -"務必使用 `extern crate panic_halt as _`,確保 `panic_halt` Crate 已連結,讓我" -"們能取得其恐慌處理常式。" +"務必使用 `extern crate panic_halt as _`,確保 `panic_halt` Crate 已連結,讓我們" +"能取得其恐慌處理常式。" #: src/bare-metal/alloc.md msgid "This example will build but not run, as it doesn't have an entry point." @@ -17022,8 +16721,7 @@ msgstr "這個範例將建構但不執行,因為沒有進入點。" msgid "" "The `cortex_m_rt` crate provides (among other things) a reset handler for " "Cortex M microcontrollers." -msgstr "" -"`cortex_m_rt` Crate 提供 Cortex M 微控制器的重設處理常式 (和其他項目)。" +msgstr "`cortex_m_rt` Crate 提供 Cortex M 微控制器的重設處理常式 (和其他項目)。" #: src/bare-metal/microcontrollers.md msgid "" @@ -17033,11 +16731,11 @@ msgstr "接下來,我們要探討如何存取周邊裝置,會有愈來愈多 #: src/bare-metal/microcontrollers.md msgid "" -"The `cortex_m_rt::entry` macro requires that the function have type `fn() -" -"> !`, because returning to the reset handler doesn't make sense." +"The `cortex_m_rt::entry` macro requires that the function have type `fn() -> !" +"`, because returning to the reset handler doesn't make sense." msgstr "" -"`cortex_m_rt::entry` 巨集規定函式必須具有 `fn() -> !` 型別,因為返回重設處理" -"常式並不合理。" +"`cortex_m_rt::entry` 巨集規定函式必須具有 `fn() -> !` 型別,因為返回重設處理常式" +"並不合理。" #: src/bare-metal/microcontrollers.md msgid "Run the example with `cargo embed --bin minimal`" @@ -17048,8 +16746,7 @@ msgid "" "Most microcontrollers access peripherals via memory-mapped IO. Let's try " "turning on an LED on our micro:bit:" msgstr "" -"大多數微控制器會透過記憶體對映 IO 存取周邊裝置。請嘗試在 micro:bit 上開啟 " -"LED:" +"大多數微控制器會透過記憶體對映 IO 存取周邊裝置。請嘗試在 micro:bit 上開啟 LED:" #: src/bare-metal/microcontrollers/mmio.md msgid "/// GPIO port 0 peripheral address\n" @@ -17063,8 +16760,7 @@ msgstr "// GPIO peripheral offsets\n" msgid "// PIN_CNF fields\n" msgstr "// PIN_CNF fields\n" -#: src/bare-metal/microcontrollers/mmio.md -#: src/bare-metal/microcontrollers/pacs.md +#: src/bare-metal/microcontrollers/mmio.md src/bare-metal/microcontrollers/pacs.md #: src/bare-metal/microcontrollers/hals.md msgid "// Configure GPIO 0 pins 21 and 28 as push-pull outputs.\n" msgstr "// Configure GPIO 0 pins 21 and 28 as push-pull outputs.\n" @@ -17077,20 +16773,18 @@ msgstr "" "// Safe because the pointers are to valid peripheral control registers, and\n" " // no aliases exist.\n" -#: src/bare-metal/microcontrollers/mmio.md -#: src/bare-metal/microcontrollers/pacs.md +#: src/bare-metal/microcontrollers/mmio.md src/bare-metal/microcontrollers/pacs.md #: src/bare-metal/microcontrollers/hals.md msgid "// Set pin 28 low and pin 21 high to turn the LED on.\n" msgstr "// Set pin 28 low and pin 21 high to turn the LED on.\n" #: src/bare-metal/microcontrollers/mmio.md msgid "" -"GPIO 0 pin 21 is connected to the first column of the LED matrix, and pin 28 " -"to the first row." +"GPIO 0 pin 21 is connected to the first column of the LED matrix, and pin 28 to " +"the first row." msgstr "GPIO 0 接腳 21 連接至 LED 矩陣的第一欄,接腳 28 則連接至第一列。" -#: src/bare-metal/microcontrollers/mmio.md -#: src/bare-metal/microcontrollers/pacs.md +#: src/bare-metal/microcontrollers/mmio.md src/bare-metal/microcontrollers/pacs.md #: src/bare-metal/microcontrollers/hals.md #: src/bare-metal/microcontrollers/board-support.md msgid "Run the example with:" @@ -17106,17 +16800,16 @@ msgid "" "wrappers for memory-mapped peripherals from [CMSIS-SVD](https://www.keil.com/" "pack/doc/CMSIS/SVD/html/index.html) files." msgstr "" -"[`svd2rust`](https://crates.io/crates/svd2rust) 會針對 [CMSIS-SVD](https://" -"www.keil.com/pack/doc/CMSIS/SVD/html/index.html) 檔案中記憶體對映周邊裝置,產" -"生大多是安全的 Rust 包裝函式。" +"[`svd2rust`](https://crates.io/crates/svd2rust) 會針對 [CMSIS-SVD](https://www." +"keil.com/pack/doc/CMSIS/SVD/html/index.html) 檔案中記憶體對映周邊裝置,產生大多" +"是安全的 Rust 包裝函式。" #: src/bare-metal/microcontrollers/pacs.md msgid "" -"SVD (System View Description) files are XML files typically provided by " -"silicon vendors which describe the memory map of the device." +"SVD (System View Description) files are XML files typically provided by silicon " +"vendors which describe the memory map of the device." msgstr "" -"SVD (系統視圖說明) 檔案通常是晶片供應商提供的 XML 檔案,描述裝置的記憶體對" -"映。" +"SVD (系統視圖說明) 檔案通常是晶片供應商提供的 XML 檔案,描述裝置的記憶體對映。" #: src/bare-metal/microcontrollers/pacs.md msgid "" @@ -17127,12 +16820,11 @@ msgstr "" #: src/bare-metal/microcontrollers/pacs.md msgid "" -"SVD files are often buggy and incomplete, so there are various projects " -"which patch the mistakes, add missing details, and publish the generated " -"crates." +"SVD files are often buggy and incomplete, so there are various projects which " +"patch the mistakes, add missing details, and publish the generated crates." msgstr "" -"SVD 檔案通常有很多錯誤且不完整,因此會使用各種專案修補錯誤、新增缺少的詳細資" -"料,以及發布產生的 Crate。" +"SVD 檔案通常有很多錯誤且不完整,因此會使用各種專案修補錯誤、新增缺少的詳細資料," +"以及發布產生的 Crate。" #: src/bare-metal/microcontrollers/pacs.md msgid "`cortex-m-rt` provides the vector table, among other things." @@ -17140,11 +16832,11 @@ msgstr "`cortex-m-rt` 提供向量表等內容。" #: src/bare-metal/microcontrollers/pacs.md 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." +"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 pac " -"-- -d --no-show-raw-insn`,查看產生的二進位檔。" +"如果使用 `cargo install cargo-binutils`,則可以執行 `cargo objdump --bin pac -- " +"-d --no-show-raw-insn`,查看產生的二進位檔。" #: src/bare-metal/microcontrollers/hals.md msgid "HAL crates" @@ -17158,8 +16850,8 @@ msgid "" "(https://crates.io/crates/embedded-hal)." msgstr "" "許多微控制器的 [HAL Crate](https://github.com/rust-embedded/awesome-embedded-" -"rust#hal-implementation-crates) 能為各種周邊裝置提供包裝函式。這些項目通常會" -"實作 [`embedded-hal`](https://crates.io/crates/embedded-hal) 的特徵。" +"rust#hal-implementation-crates) 能為各種周邊裝置提供包裝函式。這些項目通常會實" +"作 [`embedded-hal`](https://crates.io/crates/embedded-hal) 的特徵。" #: src/bare-metal/microcontrollers/hals.md msgid "// Create HAL wrapper for GPIO port 0.\n" @@ -17172,8 +16864,8 @@ msgstr "`set_low` 和 `set_high` 是 `embedded_hal` `OutputPin` 特徵上的方 #: src/bare-metal/microcontrollers/hals.md msgid "" -"HAL crates exist for many Cortex-M and RISC-V devices, including various " -"STM32, GD32, nRF, NXP, MSP430, AVR and PIC microcontrollers." +"HAL crates exist for many Cortex-M and RISC-V devices, including various STM32, " +"GD32, nRF, NXP, MSP430, AVR and PIC microcontrollers." msgstr "" "許多 Cortex-M 和 RISC-V 裝置都有 HAL Crate,包括各種 STM32、GD32、nRF、NXP、" "MSP430、AVR 和 PIC 微控制器。" @@ -17184,14 +16876,14 @@ msgstr "開發板支援 Crate" #: src/bare-metal/microcontrollers/board-support.md msgid "" -"Board support crates provide a further level of wrapping for a specific " -"board for convenience." +"Board support crates provide a further level of wrapping for a specific board " +"for convenience." msgstr "為方便起見,開發板支援 Crate 可針對特定開發板提供進一步包裝。" #: src/bare-metal/microcontrollers/board-support.md msgid "" -"In this case the board support crate is just providing more useful names, " -"and a bit of initialisation." +"In this case the board support crate is just providing more useful names, and a " +"bit of initialisation." msgstr "在本例中,開發板支援 Crate 只會提供更多實用名稱,以及一些初始化作業。" #: src/bare-metal/microcontrollers/board-support.md @@ -17218,34 +16910,34 @@ msgstr "// pin_input.is_high(); // Error, moved.\n" #: src/bare-metal/microcontrollers/type-state.md msgid "" -"Pins don't implement `Copy` or `Clone`, so only one instance of each can " -"exist. Once a pin is moved out of the port struct nobody else can take it." +"Pins don't implement `Copy` or `Clone`, so only one instance of each can exist. " +"Once a pin is moved out of the port struct nobody else can take it." msgstr "" -"接腳不會實作 `Copy` 或 `Clone`,因此每個項目只能有一個實例。一旦接腳從連接埠" -"結構中移出,就無法再供使用。" +"接腳不會實作 `Copy` 或 `Clone`,因此每個項目只能有一個實例。一旦接腳從連接埠結構" +"中移出,就無法再供使用。" #: src/bare-metal/microcontrollers/type-state.md msgid "" -"Changing the configuration of a pin consumes the old pin instance, so you " -"can’t keep use the old instance afterwards." +"Changing the configuration of a pin consumes the old pin instance, so you can’t " +"keep use the old instance afterwards." msgstr "變更接腳設定時會耗用舊的接腳例項,因此之後無法繼續使用舊的例項。" #: src/bare-metal/microcontrollers/type-state.md msgid "" -"The type of a value indicates the state that it is in: e.g. in this case, " -"the configuration state of a GPIO pin. This encodes the state machine into " -"the type system, and ensures that you don't try to use a pin in a certain " -"way without properly configuring it first. Illegal state transitions are " -"caught at compile time." +"The type of a value indicates the state that it is in: e.g. in this case, the " +"configuration state of a GPIO pin. This encodes the state machine into the type " +"system, and ensures that you don't try to use a pin in a certain way without " +"properly configuring it first. Illegal state transitions are caught at compile " +"time." msgstr "" -"值的型別會指出其所處狀態,例如本例中 GPIO 接腳的設定狀態。這可將狀態機器編碼" -"至型別系統,確保您不會在未事先適當設定時嘗試使用接腳。在編譯期間,系統會偵測" -"非法的狀態轉換作業。" +"值的型別會指出其所處狀態,例如本例中 GPIO 接腳的設定狀態。這可將狀態機器編碼至型" +"別系統,確保您不會在未事先適當設定時嘗試使用接腳。在編譯期間,系統會偵測非法的狀" +"態轉換作業。" #: src/bare-metal/microcontrollers/type-state.md msgid "" -"You can call `is_high` on an input pin and `set_high` on an output pin, but " -"not vice-versa." +"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`,但不得反過來呼叫。" @@ -17258,8 +16950,8 @@ msgid "" "The [`embedded-hal`](https://crates.io/crates/embedded-hal) crate provides a " "number of traits covering common microcontroller peripherals." msgstr "" -"[`embedded-hal`](https://crates.io/crates/embedded-hal) Crate 提供多個特徵," -"涵蓋常見的微控制器周邊裝置。" +"[`embedded-hal`](https://crates.io/crates/embedded-hal) Crate 提供多個特徵,涵蓋" +"常見的微控制器周邊裝置。" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "GPIO" @@ -17287,38 +16979,37 @@ msgstr "看門狗計時器" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"Other crates then implement [drivers](https://github.com/rust-embedded/" -"awesome-embedded-rust#driver-crates) in terms of these traits, e.g. an " -"accelerometer driver might need an I2C or SPI bus implementation." +"Other crates then implement [drivers](https://github.com/rust-embedded/awesome-" +"embedded-rust#driver-crates) in terms of these traits, e.g. an accelerometer " +"driver might need an I2C or SPI bus implementation." msgstr "" "其他 Crate 隨後會根據這些特徵實作[驅動程式](https://github.com/rust-embedded/" -"awesome-embedded-rust#driver-crates),例如加速計驅動程式可能需要實作 I2C 或 " -"SPI 匯流排。" +"awesome-embedded-rust#driver-crates),例如加速計驅動程式可能需要實作 I2C 或 SPI " +"匯流排。" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"There are implementations for many microcontrollers, as well as other " -"platforms such as Linux on Raspberry Pi." +"There are implementations for many microcontrollers, as well as other platforms " +"such as Linux on Raspberry Pi." msgstr "" "許多微控制器和其他平台 (例如 Raspberry Pi 上的 Linux) 都有相應的實作項目。" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"There is work in progress on an `async` version of `embedded-hal`, but it " -"isn't stable yet." +"There is work in progress on an `async` version of `embedded-hal`, but it isn't " +"stable yet." msgstr "`embedded-hal` 的 `async` 版本已在開發中,但尚未推出穩定版。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"[probe-rs](https://probe.rs/) is a handy toolset for embedded debugging, " -"like OpenOCD but better integrated." +"[probe-rs](https://probe.rs/) is a handy toolset for embedded debugging, like " +"OpenOCD but better integrated." msgstr "" -"[probe-rs](https://probe.rs/) 是適用於嵌入式偵錯的實用工具組,就像 OpenOCD," -"但整合效果更好。" +"[probe-rs](https://probe.rs/) 是適用於嵌入式偵錯的實用工具組,就像 OpenOCD,但整" +"合效果更好。" #: src/bare-metal/microcontrollers/probe-rs.md -msgid "" -"SWD (Serial Wire Debug) and JTAG via CMSIS-DAP, ST-Link and J-Link probes" +msgid "SWD (Serial Wire Debug) and JTAG via CMSIS-DAP, ST-Link and J-Link probes" msgstr "透過 CMSIS-DAP、ST-Link 和 J-Link 探測器執行 SWD (序列線偵錯) 和 JTAG" #: src/bare-metal/microcontrollers/probe-rs.md @@ -17331,42 +17022,42 @@ msgstr "Cargo 整合" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"`cargo-embed` is a cargo subcommand to build and flash binaries, log RTT " -"(Real Time Transfers) output and connect GDB. It's configured by an `Embed." -"toml` file in your project directory." +"`cargo-embed` is a cargo subcommand to build and flash binaries, log RTT (Real " +"Time Transfers) output and connect GDB. It's configured by an `Embed.toml` file " +"in your project directory." msgstr "" -"`cargo-embed` 是 Cargo 子指令,用於建構和刷新二進位檔、記錄 RTT (即時傳輸)輸" -"出內容,以及連結 GDB。這個指令是由專案目錄中的 `Embed.toml` 檔案來設定。" +"`cargo-embed` 是 Cargo 子指令,用於建構和刷新二進位檔、記錄 RTT (即時傳輸)輸出內" +"容,以及連結 GDB。這個指令是由專案目錄中的 `Embed.toml` 檔案來設定。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"[CMSIS-DAP](https://arm-software.github.io/CMSIS_5/DAP/html/index.html) is " -"an Arm standard protocol over USB for an in-circuit debugger to access the " -"CoreSight Debug Access Port of various Arm Cortex processors. It's what the " -"on-board debugger on the BBC micro:bit uses." +"[CMSIS-DAP](https://arm-software.github.io/CMSIS_5/DAP/html/index.html) is an " +"Arm standard protocol over USB for an in-circuit debugger to access the " +"CoreSight Debug Access Port of various Arm Cortex processors. It's what the on-" +"board debugger on the BBC micro:bit uses." msgstr "" -"[CMSIS-DAP](https://arm-software.github.io/CMSIS_5/DAP/html/index.html) 是針" -"對 USB 的 Arm 標準通訊協定,供電路內偵錯工具存取各種 Arm Cortex 處理器的 " -"CoreSight 偵錯存取埠。這就是 BBC micro:bit 內建偵錯工具所使用的通訊協定。" +"[CMSIS-DAP](https://arm-software.github.io/CMSIS_5/DAP/html/index.html) 是針對 " +"USB 的 Arm 標準通訊協定,供電路內偵錯工具存取各種 Arm Cortex 處理器的 CoreSight " +"偵錯存取埠。這就是 BBC micro:bit 內建偵錯工具所使用的通訊協定。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"ST-Link is a range of in-circuit debuggers from ST Microelectronics, J-Link " -"is a range from SEGGER." +"ST-Link is a range of in-circuit debuggers from ST Microelectronics, J-Link is " +"a range from SEGGER." msgstr "" "ST-Link 是 ST Microelectronics 推出的一系列電路內偵錯工具,J-Link 系列則來自 " "SEGGER。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"The Debug Access Port is usually either a 5-pin JTAG interface or 2-pin " -"Serial Wire Debug." +"The Debug Access Port is usually either a 5-pin JTAG interface or 2-pin Serial " +"Wire Debug." msgstr "偵錯存取埠通常是 5 接腳的 JTAG 介面或 2 接腳的序列線偵錯介面。" #: src/bare-metal/microcontrollers/probe-rs.md msgid "" -"probe-rs is a library which you can integrate into your own tools if you " -"want to." +"probe-rs is a library which you can integrate into your own tools if you want " +"to." msgstr "您可以視需要將 probe-rs 程式庫整合至自己的工具。" #: src/bare-metal/microcontrollers/probe-rs.md @@ -17423,8 +17114,7 @@ msgid "\"Real-Time Interrupt-driven Concurrency\"" msgstr "「即時中斷驅動並行」" #: src/bare-metal/microcontrollers/other-projects.md -msgid "" -"Shared resource management, message passing, task scheduling, timer queue" +msgid "Shared resource management, message passing, task scheduling, timer queue" msgstr "共用資源管理、訊息傳遞、工作排程、計時器佇列" #: src/bare-metal/microcontrollers/other-projects.md @@ -17454,8 +17144,7 @@ msgid "" "Microkernel RTOS from Oxide Computer Company with memory protection, " "unprivileged drivers, IPC" msgstr "" -"Oxide Computer Company 的微核心 RTOS,提供記憶體防護、未具有特權的驅動程式、" -"IPC" +"Oxide Computer Company 的微核心 RTOS,提供記憶體防護、未具有特權的驅動程式、IPC" #: src/bare-metal/microcontrollers/other-projects.md msgid "[Bindings for FreeRTOS](https://github.com/lobaro/FreeRTOS-rust)" @@ -17463,8 +17152,8 @@ msgstr "[FreeRTOS 繫結](https://github.com/lobaro/FreeRTOS-rust)" #: src/bare-metal/microcontrollers/other-projects.md msgid "" -"Some platforms have `std` implementations, e.g. [esp-idf](https://esp-rs." -"github.io/book/overview/using-the-standard-library.html)." +"Some platforms have `std` implementations, e.g. [esp-idf](https://esp-rs.github." +"io/book/overview/using-the-standard-library.html)." msgstr "" "部分平台提供 `std` 實作項目,例如 [esp-idf](https://esp-rs.github.io/book/" "overview/using-the-standard-library.html)。" @@ -17479,18 +17168,16 @@ msgstr "其中不包含任何 HAL。" #: src/bare-metal/microcontrollers/other-projects.md msgid "" -"It uses the Cortex-M NVIC (Nested Virtual Interrupt Controller) for " -"scheduling rather than a proper kernel." -msgstr "" -"排程時會使用 Cortex-M NVIC (巢狀虛擬中斷控制器),而不是使用適當的核心。" +"It uses the Cortex-M NVIC (Nested Virtual Interrupt Controller) for scheduling " +"rather than a proper kernel." +msgstr "排程時會使用 Cortex-M NVIC (巢狀虛擬中斷控制器),而不是使用適當的核心。" #: src/bare-metal/microcontrollers/other-projects.md msgid "Cortex-M only." msgstr "僅限 Cortex-M。" #: src/bare-metal/microcontrollers/other-projects.md -msgid "" -"Google uses TockOS on the Haven microcontroller for Titan security keys." +msgid "Google uses TockOS on the Haven microcontroller for Titan security keys." msgstr "Google 會針對 Titan 安全金鑰,在 Haven 微控制器上使用 TockOS。" #: src/bare-metal/microcontrollers/other-projects.md @@ -17517,8 +17204,8 @@ msgid "" "serial port. If you have time, try displaying it on the LEDs somehow too, or " "use the buttons somehow." msgstr "" -"我們將讀取 I2C 羅盤上的方向,並將讀數記錄到序列埠。如有時間,可以試著顯示在 " -"LED 上,或以某種方法使用按鈕。" +"我們將讀取 I2C 羅盤上的方向,並將讀數記錄到序列埠。如有時間,可以試著顯示在 LED " +"上,或以某種方法使用按鈕。" #: src/exercises/bare-metal/compass.md msgid "Hints:" @@ -17526,14 +17213,14 @@ msgstr "提示:" #: src/exercises/bare-metal/compass.md msgid "" -"Check the documentation for the [`lsm303agr`](https://docs.rs/lsm303agr/" -"latest/lsm303agr/) and [`microbit-v2`](https://docs.rs/microbit-v2/latest/" -"microbit/) crates, as well as the [micro:bit hardware](https://tech.microbit." -"org/hardware/)." +"Check the documentation for the [`lsm303agr`](https://docs.rs/lsm303agr/latest/" +"lsm303agr/) and [`microbit-v2`](https://docs.rs/microbit-v2/latest/microbit/) " +"crates, as well as the [micro:bit hardware](https://tech.microbit.org/" +"hardware/)." msgstr "" -"參閱 [`lsm303agr`](https://docs.rs/lsm303agr/latest/lsm303agr/) 和 " -"[`microbit-v2`](https://docs.rs/microbit-v2/latest/microbit/) Crate 的說明文" -"件,並瞭解 [micro:bit 硬體](https://tech.microbit.org/hardware/)。" +"參閱 [`lsm303agr`](https://docs.rs/lsm303agr/latest/lsm303agr/) 和 [`microbit-" +"v2`](https://docs.rs/microbit-v2/latest/microbit/) Crate 的說明文件,並瞭解 " +"[micro:bit 硬體](https://tech.microbit.org/hardware/)。" #: src/exercises/bare-metal/compass.md msgid "" @@ -17541,19 +17228,18 @@ msgid "" msgstr "LSM303AGR 慣性測量單元已連接至內部 I2C 匯流排。" #: src/exercises/bare-metal/compass.md -msgid "" -"TWI is another name for I2C, so the I2C master peripheral is called TWIM." +msgid "TWI is another name for I2C, so the I2C master peripheral is called TWIM." msgstr "TWI 是 I2C 的別名,所以 I2C 主周邊裝置的名稱是 TWIM。" #: src/exercises/bare-metal/compass.md msgid "" -"The LSM303AGR driver needs something implementing the `embedded_hal::" -"blocking::i2c::WriteRead` trait. The [`microbit::hal::Twim`](https://docs.rs/" -"microbit-v2/latest/microbit/hal/struct.Twim.html) struct implements this." +"The LSM303AGR driver needs something implementing the `embedded_hal::blocking::" +"i2c::WriteRead` trait. The [`microbit::hal::Twim`](https://docs.rs/microbit-v2/" +"latest/microbit/hal/struct.Twim.html) struct implements this." msgstr "" -"LSM303AGR 驅動程式需要某個實作 `embedded_hal::blocking::i2c::WriteRead` 特徵" -"的項目。[`microbit::hal::Twim`](https://docs.rs/microbit-v2/latest/microbit/" -"hal/struct.Twim.html) 結構體實作此特徵。" +"LSM303AGR 驅動程式需要某個實作 `embedded_hal::blocking::i2c::WriteRead` 特徵的項" +"目。[`microbit::hal::Twim`](https://docs.rs/microbit-v2/latest/microbit/hal/" +"struct.Twim.html) 結構體實作此特徵。" #: src/exercises/bare-metal/compass.md msgid "" @@ -17565,9 +17251,9 @@ msgstr "" #: src/exercises/bare-metal/compass.md msgid "" -"You can also look at the [nRF52833 datasheet](https://infocenter.nordicsemi." -"com/pdf/nRF52833_PS_v1.5.pdf) if you want, but it shouldn't be necessary for " -"this exercise." +"You can also look at the [nRF52833 datasheet](https://infocenter.nordicsemi.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/pdf/" "nRF52833_PS_v1.5.pdf),但在這項練習中並非必要。" @@ -17577,8 +17263,8 @@ msgid "" "Download the [exercise template](../../comprehensive-rust-exercises.zip) and " "look in the `compass` directory for the following files." msgstr "" -"請下載[練習範本](../../comprehensive-rust-exercises.zip),並在 `compass` 目錄" -"中查看下列檔案。" +"請下載[練習範本](../../comprehensive-rust-exercises.zip),並在 `compass` 目錄中" +"查看下列檔案。" #: src/exercises/bare-metal/compass.md src/exercises/bare-metal/rtc.md msgid "_src/main.rs_:" @@ -17601,8 +17287,7 @@ msgid "See the serial output on Linux with:" msgstr "使用下列指令在 Linux 查看序列輸出內容:" #: src/exercises/bare-metal/compass.md -msgid "" -"Or on Mac OS something like (the device name may be slightly different):" +msgid "Or on Mac OS something like (the device name may be slightly different):" msgstr "或在 macOS 上使用類似如下的指令 (裝置名稱可能略有不同):" #: src/exercises/bare-metal/compass.md @@ -17651,12 +17336,10 @@ msgstr "\"{},{},{}\\t{},{},{}\"" #: src/exercises/bare-metal/solutions-morning.md msgid "" -"// If button A is pressed, switch to the next mode and briefly blink all " -"LEDs\n" +"// If button A is pressed, switch to the next mode and briefly blink all LEDs\n" " // on.\n" msgstr "" -"// If button A is pressed, switch to the next mode and briefly blink all " -"LEDs\n" +"// If button A is pressed, switch to the next mode and briefly blink all LEDs\n" " // on.\n" #: src/bare-metal/aps.md @@ -17670,9 +17353,9 @@ msgid "" "with QEMU's aarch64 ['virt'](https://qemu-project.gitlab.io/qemu/system/arm/" "virt.html) board." msgstr "" -"目前我們已介紹過微控制器,例如 Arm Cortex-M 系列產品,現在來試著為 Cortex-A " -"撰寫一些內容。為求簡單,我們會使用 QEMU 的 aarch64 ['virt'](https://qemu-" -"project.gitlab.io/qemu/system/arm/virt.html) 開發板。" +"目前我們已介紹過微控制器,例如 Arm Cortex-M 系列產品,現在來試著為 Cortex-A 撰寫" +"一些內容。為求簡單,我們會使用 QEMU 的 aarch64 ['virt'](https://qemu-project." +"gitlab.io/qemu/system/arm/virt.html) 開發板。" #: src/bare-metal/aps.md msgid "" @@ -17680,8 +17363,8 @@ msgid "" "privilege (exception levels on Arm CPUs, rings on x86), while application " "processors do." msgstr "" -"普遍來說,微控制器並沒有 MMU 或多個權限層級 (Arm CPU 上的例外狀況層級、x86 上" -"的環),但應用程式處理器有。" +"普遍來說,微控制器並沒有 MMU 或多個權限層級 (Arm CPU 上的例外狀況層級、x86 上的" +"環),但應用程式處理器有。" #: src/bare-metal/aps.md msgid "" @@ -17689,12 +17372,11 @@ msgid "" "architecture. The 'virt' board doesn't correspond to any particular real " "hardware, but is designed purely for virtual machines." msgstr "" -"QEMU 可針對每個架構模擬不同的機器或開發板模型。'virt' 開發板並無對應至任何特" -"定的真實硬體,而是專為虛擬機器設計。" +"QEMU 可針對每個架構模擬不同的機器或開發板模型。'virt' 開發板並無對應至任何特定的" +"真實硬體,而是專為虛擬機器設計。" #: src/bare-metal/aps/entry-point.md -msgid "" -"Before we can start running Rust code, we need to do some initialisation." +msgid "Before we can start running Rust code, we need to do some initialisation." msgstr "我們需要先完成一些初始化作業,才能開始執行 Rust 程式碼。" #: src/bare-metal/aps/entry-point.md @@ -17704,8 +17386,8 @@ msgid "" ".global entry\n" "entry:\n" " /*\n" -" * Load and apply the memory management configuration, ready to enable " -"MMU and\n" +" * Load and apply the memory management configuration, ready to enable MMU " +"and\n" " * caches.\n" " */\n" " adrp x30, idmap\n" @@ -17724,8 +17406,7 @@ msgid "" " mov_i x30, .Lsctlrval\n" "\n" " /*\n" -" * Ensure everything before this point has completed, then invalidate " -"any\n" +" * Ensure everything before this point has completed, then invalidate any\n" " * potentially stale local TLB entries before they start being used.\n" " */\n" " isb\n" @@ -17777,8 +17458,8 @@ msgstr "" ".global entry\n" "entry:\n" " /*\n" -" * Load and apply the memory management configuration, ready to enable " -"MMU and\n" +" * Load and apply the memory management configuration, ready to enable MMU " +"and\n" " * caches.\n" " */\n" " adrp x30, idmap\n" @@ -17797,8 +17478,7 @@ msgstr "" " mov_i x30, .Lsctlrval\n" "\n" " /*\n" -" * Ensure everything before this point has completed, then invalidate " -"any\n" +" * Ensure everything before this point has completed, then invalidate any\n" " * potentially stale local TLB entries before they start being used.\n" " */\n" " isb\n" @@ -17849,45 +17529,43 @@ msgstr "" msgid "" "This is the same as it would be for C: initialising the processor state, " "zeroing the BSS, and setting up the stack pointer." -msgstr "" -"這與使用 C 時相同:將處理器狀態初始化、將 BSS 設為零,以及設定堆疊指標。" +msgstr "這與使用 C 時相同:將處理器狀態初始化、將 BSS 設為零,以及設定堆疊指標。" #: src/bare-metal/aps/entry-point.md msgid "" "The BSS (block starting symbol, for historical reasons) is the part of the " "object file which containing statically allocated variables which are " -"initialised to zero. They are omitted from the image, to avoid wasting space " -"on zeroes. The compiler assumes that the loader will take care of zeroing " -"them." +"initialised to zero. They are omitted from the image, to avoid wasting space on " +"zeroes. The compiler assumes that the loader will take care of zeroing them." msgstr "" -"BSS (區塊起始符號,因歷史因素而存在) 是物件檔案的一部分,含有初始化為零的靜態" -"分配變數。映像檔會省略這些變數,以免浪費空間儲存零。編譯器會假設由載入器負責" -"將變數初始化為零。" +"BSS (區塊起始符號,因歷史因素而存在) 是物件檔案的一部分,含有初始化為零的靜態分" +"配變數。映像檔會省略這些變數,以免浪費空間儲存零。編譯器會假設由載入器負責將變數" +"初始化為零。" #: src/bare-metal/aps/entry-point.md msgid "" -"The BSS may already be zeroed, depending on how memory is initialised and " -"the image is loaded, but we zero it to be sure." +"The BSS may already be zeroed, depending on how memory is initialised and the " +"image is loaded, but we zero it to be sure." msgstr "" -"視記憶體初始化及映像檔載入方式而定,BSS 可能已為零,但為了確定,我們會將它設" -"為零。" +"視記憶體初始化及映像檔載入方式而定,BSS 可能已為零,但為了確定,我們會將它設為" +"零。" #: src/bare-metal/aps/entry-point.md msgid "" -"We need to enable the MMU and cache before reading or writing any memory. If " -"we don't:" +"We need to enable the MMU and cache before reading or writing any memory. If we " +"don't:" msgstr "我們需要啟用 MMU 和快取,才能讀取或寫入任何記憶體。如果不這樣做:" #: src/bare-metal/aps/entry-point.md msgid "" -"Unaligned accesses will fault. We build the Rust code for the `aarch64-" -"unknown-none` target which sets `+strict-align` to prevent the compiler " -"generating unaligned accesses, so it should be fine in this case, but this " -"is not necessarily the case in general." +"Unaligned accesses will fault. We build the Rust code for the `aarch64-unknown-" +"none` target which sets `+strict-align` to prevent the compiler generating " +"unaligned accesses, so it should be fine in this case, but this is not " +"necessarily the case in general." msgstr "" -"未對齊的存取會發生錯誤。我們是為 `aarch64-unknown-none` 目標建構 Rust 程式" -"碼,這會設定 `+strict-align`,防止編譯器產生未對齊的存取,因此在本例中應該不" -"會出錯,但這不一定是一般情況。" +"未對齊的存取會發生錯誤。我們是為 `aarch64-unknown-none` 目標建構 Rust 程式碼,這" +"會設定 `+strict-align`,防止編譯器產生未對齊的存取,因此在本例中應該不會出錯,但" +"這不一定是一般情況。" #: src/bare-metal/aps/entry-point.md msgid "" @@ -17895,25 +17573,25 @@ msgid "" "problem is that the VM is accessing memory directly with the cache disabled, " "while the host has cacheable aliases to the same memory. Even if the host " "doesn't explicitly access the memory, speculative accesses can lead to cache " -"fills, and then changes from one or the other will get lost when the cache " -"is cleaned or the VM enables the cache. (Cache is keyed by physical address, " -"not VA or IPA.)" +"fills, and then changes from one or the other will get lost when the cache is " +"cleaned or the VM enables the cache. (Cache is keyed by physical address, not " +"VA or IPA.)" msgstr "" -"如果是在 VM 中執行,可能會導致快取一致性問題。問題在於 VM 會在快取已停用時直" -"接存取記憶體,而主機具有相同記憶體的可快取別名。即使主機未明確存取記憶體,推" -"測存取行為仍可能導致快取填補,而當快取遭到清理或 VM 啟用快取時,存取之間的變" -"更就會遺失 (快取是以實體位址做為索引鍵,並非使用 VA 或 IPA)。" +"如果是在 VM 中執行,可能會導致快取一致性問題。問題在於 VM 會在快取已停用時直接存" +"取記憶體,而主機具有相同記憶體的可快取別名。即使主機未明確存取記憶體,推測存取行" +"為仍可能導致快取填補,而當快取遭到清理或 VM 啟用快取時,存取之間的變更就會遺失 " +"(快取是以實體位址做為索引鍵,並非使用 VA 或 IPA)。" #: src/bare-metal/aps/entry-point.md msgid "" "For simplicity, we just use a hardcoded pagetable (see `idmap.S`) which " -"identity maps the first 1 GiB of address space for devices, the next 1 GiB " -"for DRAM, and another 1 GiB higher up for more devices. This matches the " -"memory layout that QEMU uses." +"identity maps the first 1 GiB of address space for devices, the next 1 GiB for " +"DRAM, and another 1 GiB higher up for more devices. This matches the memory " +"layout that QEMU uses." msgstr "" -"為求簡單,我們只使用寫死的分頁表 (見 `idmap.S`),其中前 1 GiB 的位址空間是對" -"應至裝置、接下來 1 GiB 是對應至 DRAM,另外 1 GiB 以上則適用更多裝置。這符合 " -"QEMU 使用的記憶體布局。" +"為求簡單,我們只使用寫死的分頁表 (見 `idmap.S`),其中前 1 GiB 的位址空間是對應至" +"裝置、接下來 1 GiB 是對應至 DRAM,另外 1 GiB 以上則適用更多裝置。這符合 QEMU 使" +"用的記憶體布局。" #: src/bare-metal/aps/entry-point.md msgid "" @@ -17924,11 +17602,11 @@ msgstr "我們也會設定例外狀況向量 (`vbar_el1`),稍後將進一步 #: src/bare-metal/aps/entry-point.md msgid "" "All examples this afternoon assume we will be running at exception level 1 " -"(EL1). If you need to run at a different exception level you'll need to " -"modify `entry.S` accordingly." +"(EL1). If you need to run at a different exception level you'll need to modify " +"`entry.S` accordingly." msgstr "" -"今天下午的所有例子都假設我們會在例外狀況層級 1 (EL1) 執行。如要在不同的例外狀" -"況層級執行,就需據以修改 `entry.S`。" +"今天下午的所有例子都假設我們會在例外狀況層級 1 (EL1) 執行。如要在不同的例外狀況" +"層級執行,就需據以修改 `entry.S`。" #: src/bare-metal/aps/inline-assembly.md msgid "Inline assembly" @@ -17936,12 +17614,12 @@ msgstr "行內組語" #: src/bare-metal/aps/inline-assembly.md msgid "" -"Sometimes we need to use assembly to do things that aren't possible with " -"Rust code. For example, to make an HVC (hypervisor call) to tell the " -"firmware to power off the system:" +"Sometimes we need to use assembly to do things that aren't possible with Rust " +"code. For example, to make an HVC (hypervisor call) to tell the firmware to " +"power off the system:" msgstr "" -"有時候,我們需要使用組語,才能執行 Rust 程式碼無法執行的作業。舉例來說,如要" -"發出 HVC (管理程序呼叫) 指示韌體關閉系統:" +"有時候,我們需要使用組語,才能執行 Rust 程式碼無法執行的作業。舉例來說,如要發" +"出 HVC (管理程序呼叫) 指示韌體關閉系統:" #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -17997,12 +17675,12 @@ msgstr "" #: src/bare-metal/aps/inline-assembly.md msgid "" -"PSCI is the Arm Power State Coordination Interface, a standard set of " -"functions to manage system and CPU power states, among other things. It is " -"implemented by EL3 firmware and hypervisors on many systems." +"PSCI is the Arm Power State Coordination Interface, a standard set of functions " +"to manage system and CPU power states, among other things. It is implemented by " +"EL3 firmware and hypervisors on many systems." msgstr "" -"PSCI 是 Arm 電源狀態協調介面,這組標準函式可管理系統和 CPU 電源狀態及其他項" -"目,是由 EL3 韌體和管理程序在許多系統上實作。" +"PSCI 是 Arm 電源狀態協調介面,這組標準函式可管理系統和 CPU 電源狀態及其他項目," +"是由 EL3 韌體和管理程序在許多系統上實作。" #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -18016,11 +17694,11 @@ msgstr "" #: src/bare-metal/aps/inline-assembly.md msgid "" -"This `main` function needs to be `#[no_mangle]` and `extern \"C\"` because " -"it is called from our entry point in `entry.S`." +"This `main` function needs to be `#[no_mangle]` and `extern \"C\"` because it " +"is called from our entry point in `entry.S`." msgstr "" -"這個 `main` 函式需為 `#[no_mangle]` 和 `extern \"C\"`,因為此函式是從 `entry." -"S` 的進入點呼叫。" +"這個 `main` 函式需為 `#[no_mangle]` 和 `extern \"C\"`,因為此函式是從 `entry.S` " +"的進入點呼叫。" #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -18031,18 +17709,17 @@ msgid "" "arguments passed to a function, so `entry.S` doesn't need to do anything " "special except make sure it doesn't change these registers." msgstr "" -"`_x0` 到 `_x3` 是暫存器 `x0` 到 `x3` 的值。按照慣例,系統啟動載入程式會使用這" -"些值,將指標等項目傳遞給裝置樹狀結構。根據標準的 aarch64 呼叫慣例 (即 " -"`extern \"C\"` 指定使用的項目),前 8 個傳遞至函式的引數會使用暫存器 `x0` 到 " -"`x7`,因此 `entry.S` 不需執行任何特殊操作,只要確保不會變更這些暫存器。" +"`_x0` 到 `_x3` 是暫存器 `x0` 到 `x3` 的值。按照慣例,系統啟動載入程式會使用這些" +"值,將指標等項目傳遞給裝置樹狀結構。根據標準的 aarch64 呼叫慣例 (即 `extern " +"\"C\"` 指定使用的項目),前 8 個傳遞至函式的引數會使用暫存器 `x0` 到 `x7`,因此 " +"`entry.S` 不需執行任何特殊操作,只要確保不會變更這些暫存器。" #: src/bare-metal/aps/inline-assembly.md msgid "" "Run the example in QEMU with `make qemu_psci` under `src/bare-metal/aps/" "examples`." msgstr "" -"使用 `src/bare-metal/aps/examples` 下的 `make qemu_psci`,在 QEMU 中執行範" -"例。" +"使用 `src/bare-metal/aps/examples` 下的 `make qemu_psci`,在 QEMU 中執行範例。" #: src/bare-metal/aps/mmio.md msgid "Volatile memory access for MMIO" @@ -18064,20 +17741,20 @@ msgstr "`addr_of!` 可用來取得結構體的欄位,而不必建立中繼參 #: src/bare-metal/aps/mmio.md msgid "" -"Volatile access: read or write operations may have side-effects, so prevent " -"the compiler or hardware from reordering, duplicating or eliding them." +"Volatile access: read or write operations may have side-effects, so prevent the " +"compiler or hardware from reordering, duplicating or eliding them." msgstr "" -"揮發性存取:讀取或寫入作業可能會有副作用,因此請避免編譯器或硬體遭到重新排" -"序、複製或省略。" +"揮發性存取:讀取或寫入作業可能會有副作用,因此請避免編譯器或硬體遭到重新排序、複" +"製或省略。" #: src/bare-metal/aps/mmio.md msgid "" -"Usually if you write and then read, e.g. via a mutable reference, the " -"compiler may assume that the value read is the same as the value just " -"written, and not bother actually reading memory." +"Usually if you write and then read, e.g. via a mutable reference, the 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 msgid "" @@ -18085,8 +17762,8 @@ msgid "" "this is unsound. Whenever a reference exist, the compiler may choose to " "dereference it." msgstr "" -"有些用於硬體揮發性存取的現有 Crate 確實會保留參照,但這樣不安全。每當有參照存" -"在時,編譯器可能會選擇解除參照。" +"有些用於硬體揮發性存取的現有 Crate 確實會保留參照,但這樣不安全。每當有參照存在" +"時,編譯器可能會選擇解除參照。" #: src/bare-metal/aps/mmio.md msgid "" @@ -18100,11 +17777,11 @@ msgstr "編寫 UART 驅動程式" #: src/bare-metal/aps/uart.md msgid "" -"The QEMU 'virt' machine has a [PL011](https://developer.arm.com/" -"documentation/ddi0183/g) UART, so let's write a driver for that." +"The QEMU 'virt' machine has a [PL011](https://developer.arm.com/documentation/" +"ddi0183/g) UART, so let's write a driver for that." msgstr "" -"QEMU 'virt' 機器搭載 [PL011](https://developer.arm.com/documentation/ddi0183/" -"g) UART,所以我們要為此編寫驅動程式。" +"QEMU 'virt' 機器搭載 [PL011](https://developer.arm.com/documentation/ddi0183/g) " +"UART,所以我們要為此編寫驅動程式。" #: src/bare-metal/aps/uart.md msgid "/// Minimal driver for a PL011 UART.\n" @@ -18117,8 +17794,7 @@ msgid "" " ///\n" " /// # Safety\n" " ///\n" -" /// The given base address must point to the 8 MMIO control registers of " -"a\n" +" /// The given base address must point to the 8 MMIO control registers of a\n" " /// PL011 device, which must be mapped into the address space of the " "process\n" " /// as device memory and not have any other aliases.\n" @@ -18128,8 +17804,7 @@ msgstr "" " ///\n" " /// # Safety\n" " ///\n" -" /// The given base address must point to the 8 MMIO control registers of " -"a\n" +" /// The given base address must point to the 8 MMIO control registers of a\n" " /// PL011 device, which must be mapped into the address space of the " "process\n" " /// as device memory and not have any other aliases.\n" @@ -18162,33 +17837,33 @@ msgstr "// Wait until the UART is no longer busy.\n" msgid "" "Note that `Uart::new` is unsafe while the other methods are safe. This is " "because as long as the caller of `Uart::new` guarantees that its safety " -"requirements are met (i.e. that there is only ever one instance of the " -"driver for a given UART, and nothing else aliasing its address space), then " -"it is always safe to call `write_byte` later because we can assume the " -"necessary preconditions." +"requirements are met (i.e. that there is only ever one instance of the driver " +"for a given UART, and nothing else aliasing its address space), then it is " +"always safe to call `write_byte` later because we can assume the necessary " +"preconditions." msgstr "" -"請注意,`Uart::new` 並不安全,其他方法則是安全的。這是因為只要 `Uart::new` 的" -"呼叫端保證能滿足安全規定,也就是特定 UART 只有一個驅動程式例項,沒有其他項目" -"定義其位址空間的別名,那麼稍後呼叫 `write_byte` 一律是安全的,因為我們可以假" -"設必要的先決條件。" +"請注意,`Uart::new` 並不安全,其他方法則是安全的。這是因為只要 `Uart::new` 的呼" +"叫端保證能滿足安全規定,也就是特定 UART 只有一個驅動程式例項,沒有其他項目定義其" +"位址空間的別名,那麼稍後呼叫 `write_byte` 一律是安全的,因為我們可以假設必要的先" +"決條件。" #: src/bare-metal/aps/uart.md msgid "" -"We could have done it the other way around (making `new` safe but " -"`write_byte` unsafe), but that would be much less convenient to use as every " -"place that calls `write_byte` would need to reason about the safety" +"We could have done it the other way around (making `new` safe but `write_byte` " +"unsafe), but that would be much less convenient to use as every place that " +"calls `write_byte` would need to reason about the safety" msgstr "" -"我們可以反過來操作,也就是讓 `new` 安全,而 `write_byte` 不安全,但這樣的使用" -"便利度低許多,因為每個呼叫 `write_byte` 的位置都需要分析安全性" +"我們可以反過來操作,也就是讓 `new` 安全,而 `write_byte` 不安全,但這樣的使用便" +"利度低許多,因為每個呼叫 `write_byte` 的位置都需要分析安全性" #: src/bare-metal/aps/uart.md msgid "" -"This is a common pattern for writing safe wrappers of unsafe code: moving " -"the burden of proof for soundness from a large number of places to a smaller " -"number of places." +"This is a common pattern for writing safe wrappers of unsafe code: moving the " +"burden of proof for soundness from a large number of places to a smaller number " +"of places." msgstr "" -"這是為不安全程式碼撰寫安全包裝函式的常見模式:將證明安全性的負擔從大量位置移" -"到少量位置。" +"這是為不安全程式碼撰寫安全包裝函式的常見模式:將證明安全性的負擔從大量位置移到少" +"量位置。" #: src/bare-metal/aps/uart/traits.md msgid "More traits" @@ -18196,8 +17871,8 @@ msgstr "其他特徵" #: src/bare-metal/aps/uart/traits.md msgid "" -"We derived the `Debug` trait. It would be useful to implement a few more " -"traits too." +"We derived the `Debug` trait. It would be useful to implement a few more traits " +"too." msgstr "我們衍生了 `Debug` 特徵。實作多一點特徵也會有幫助。" #: src/bare-metal/aps/uart/traits.md @@ -18231,14 +17906,14 @@ msgstr "經改良的 UART 驅動程式" msgid "" "The PL011 actually has [a bunch more registers](https://developer.arm.com/" "documentation/ddi0183/g/programmers-model/summary-of-registers), and adding " -"offsets to construct pointers to access them is error-prone and hard to " -"read. Plus, some of them are bit fields which would be nice to access in a " -"structured way." +"offsets to construct pointers to access them is error-prone and hard to read. " +"Plus, some of them are bit fields which would be nice to access in a structured " +"way." msgstr "" -"PL011 實際上還有[許多暫存器](https://developer.arm.com/documentation/ddi0183/" -"g/programmers-model/summary-of-registers),若為了存取這些暫存器而將偏移值新增" -"至建構指標,不僅容易發生錯誤,還難以讀取。此外,部分暫存器是位元欄位,適合以" -"結構化方式存取。" +"PL011 實際上還有[許多暫存器](https://developer.arm.com/documentation/ddi0183/g/" +"programmers-model/summary-of-registers),若為了存取這些暫存器而將偏移值新增至建" +"構指標,不僅容易發生錯誤,還難以讀取。此外,部分暫存器是位元欄位,適合以結構化方" +"式存取。" #: src/bare-metal/aps/better-uart.md msgid "Offset" @@ -18386,10 +18061,9 @@ msgstr "為求簡潔,還省略了一些 ID 暫存器。" #: src/bare-metal/aps/better-uart/bitflags.md msgid "" -"The [`bitflags`](https://crates.io/crates/bitflags) crate is useful for " -"working with bitflags." -msgstr "" -"[`bitflags`](https://crates.io/crates/bitflags) Crate 適合用於 Bitflags。" +"The [`bitflags`](https://crates.io/crates/bitflags) crate is useful for working " +"with bitflags." +msgstr "[`bitflags`](https://crates.io/crates/bitflags) Crate 適合用於 Bitflags。" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Flags from the UART flag register.\n" @@ -18433,11 +18107,11 @@ msgstr "/// Ring indicator.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "" -"The `bitflags!` macro creates a newtype something like `Flags(u16)`, along " -"with a bunch of method implementations to get and set flags." +"The `bitflags!` macro creates a newtype something like `Flags(u16)`, along with " +"a bunch of method implementations to get and set flags." msgstr "" -"`bitflags!` 巨集會建立一個新型別 (例如 `Flags(u16)`),以及一系列取得及設定標" -"記的方法實作項目。" +"`bitflags!` 巨集會建立一個新型別 (例如 `Flags(u16)`),以及一系列取得及設定標記的" +"方法實作項目。" #: src/bare-metal/aps/better-uart/registers.md msgid "Multiple registers" @@ -18457,9 +18131,9 @@ msgid "" "(among other things) reorder fields however it sees fit." msgstr "" "[`#[repr(C)]`](https://doc.rust-lang.org/reference/type-layout.html#the-c-" -"representation) 會指示編譯器依序排列結構體欄位,遵循與 C 相同的規則。以確保結" -"構體具有可預測的布局,因為預設的 Rust 表示法允許編譯器依自身判斷重新排序欄位 " -"(和執行其他操作)。" +"representation) 會指示編譯器依序排列結構體欄位,遵循與 C 相同的規則。以確保結構" +"體具有可預測的布局,因為預設的 Rust 表示法允許編譯器依自身判斷重新排序欄位 (和執" +"行其他操作)。" #: src/bare-metal/aps/better-uart/driver.md msgid "Now let's use the new `Registers` struct in our driver." @@ -18547,23 +18221,21 @@ msgid "" "function is called from our entry point code in `entry.S`. See the speaker " "notes there for details." msgstr "" -"就像在[行內組語](../inline-assembly.md)範例中,系統會從 `entry.S` 的進入點程" -"式碼呼叫這個 `main` 函式。詳情請參閱演講者備忘稿。" +"就像在[行內組語](../inline-assembly.md)範例中,系統會從 `entry.S` 的進入點程式碼" +"呼叫這個 `main` 函式。詳情請參閱演講者備忘稿。" #: src/bare-metal/aps/better-uart/using.md msgid "" "Run the example in QEMU with `make qemu` under `src/bare-metal/aps/examples`." -msgstr "" -"使用 `src/bare-metal/aps/examples` 下的 `make qemu`,在 QEMU 中執行範例。" +msgstr "使用 `src/bare-metal/aps/examples` 下的 `make qemu`,在 QEMU 中執行範例。" #: src/bare-metal/aps/logging.md msgid "" -"It would be nice to be able to use the logging macros from the [`log`]" -"(https://crates.io/crates/log) crate. We can do this by implementing the " -"`Log` trait." +"It would be nice to be able to use the logging macros from the [`log`](https://" +"crates.io/crates/log) crate. We can do this by implementing the `Log` trait." msgstr "" -"建議使用 [`log`](https://crates.io/crates/log) Crate 中的記錄巨集。實作 " -"`Log` 特徵即可使用該項目。" +"建議使用 [`log`](https://crates.io/crates/log) Crate 中的記錄巨集。實作 `Log` 特" +"徵即可使用該項目。" #: src/bare-metal/aps/logging.md msgid "\"[{}] {}\"" @@ -18578,8 +18250,8 @@ msgid "" "The unwrap in `log` is safe because we initialise `LOGGER` before calling " "`set_logger`." msgstr "" -"在 `log` 中取消包裝很安全,因為在呼叫 `set_logger` 之前,我們會將 `LOGGER` 初" -"始化。" +"在 `log` 中取消包裝很安全,因為在呼叫 `set_logger` 之前,我們會將 `LOGGER` 初始" +"化。" #: src/bare-metal/aps/logging/using.md msgid "We need to initialise the logger before we use it." @@ -18599,21 +18271,20 @@ msgid "" "Run the example in QEMU with `make qemu_logger` under `src/bare-metal/aps/" "examples`." msgstr "" -"使用 `src/bare-metal/aps/examples` 下的 `make qemu_logger`。在 QEMU 中執行範" -"例。" +"使用 `src/bare-metal/aps/examples` 下的 `make qemu_logger`。在 QEMU 中執行範例。" #: src/bare-metal/aps/exceptions.md msgid "" "AArch64 defines an exception vector table with 16 entries, for 4 types of " -"exceptions (synchronous, IRQ, FIQ, SError) from 4 states (current EL with " -"SP0, current EL with SPx, lower EL using AArch64, lower EL using AArch32). " -"We implement this in assembly to save volatile registers to the stack before " +"exceptions (synchronous, IRQ, FIQ, SError) from 4 states (current EL with SP0, " +"current EL with SPx, lower EL using AArch64, lower EL using AArch32). We " +"implement this in assembly to save volatile registers to the stack before " "calling into Rust code:" msgstr "" -"AArch64 定義了包含 16 個項目的例外狀況向量表,適用於 4 種狀態的 4 種例外狀" -"況,即同步、IRQ、FIQ、SError。4 種狀態則分別為目前 EL 搭配 SP0、目前 EL 搭配 " -"SPx、較低 EL 使用 AArch64 和較低 EL 使用 AArch32。這是在組語中實作,以便在呼" -"叫 Rust 程式碼之前,將揮發性暫存器儲存至堆疊:" +"AArch64 定義了包含 16 個項目的例外狀況向量表,適用於 4 種狀態的 4 種例外狀況,即" +"同步、IRQ、FIQ、SError。4 種狀態則分別為目前 EL 搭配 SP0、目前 EL 搭配 SPx、較" +"低 EL 使用 AArch64 和較低 EL 使用 AArch32。這是在組語中實作,以便在呼叫 Rust 程" +"式碼之前,將揮發性暫存器儲存至堆疊:" #: src/bare-metal/aps/exceptions.md msgid "EL is exception level; all our examples this afternoon run in EL1." @@ -18621,33 +18292,32 @@ msgstr "EL 是指例外狀況層級,今天下午的所有範例都是在 EL1 #: src/bare-metal/aps/exceptions.md msgid "" -"For simplicity we aren't distinguishing between SP0 and SPx for the current " -"EL exceptions, or between AArch32 and AArch64 for the lower EL exceptions." +"For simplicity we aren't distinguishing between SP0 and SPx for the current EL " +"exceptions, or between AArch32 and AArch64 for the lower EL exceptions." msgstr "" -"為求簡單,我們不會針對目前 EL 例外狀況區分 SP0 和 SPx,也不會針對較低 EL 例外" -"狀況區分 AArch32 和 AArch64。" +"為求簡單,我們不會針對目前 EL 例外狀況區分 SP0 和 SPx,也不會針對較低 EL 例外狀" +"況區分 AArch32 和 AArch64。" #: src/bare-metal/aps/exceptions.md msgid "" -"For this example we just log the exception and power down, as we don't " -"expect any of them to actually happen." +"For this example we just log the exception and power down, as we don't expect " +"any of them to actually happen." msgstr "" -"在此範例中,我們只需記錄例外狀況並關機,因為我們並不預期會實際發生任何例外狀" -"況。" +"在此範例中,我們只需記錄例外狀況並關機,因為我們並不預期會實際發生任何例外狀況。" #: src/bare-metal/aps/exceptions.md msgid "" -"We can think of exception handlers and our main execution context more or " -"less like different threads. [`Send` and `Sync`](../../concurrency/send-sync." -"md) will control what we can share between them, just like with threads. For " -"example, if we want to share some value between exception handlers and the " -"rest of the program, and it's `Send` but not `Sync`, then we'll need to wrap " -"it in something like a `Mutex` and put it in a static." +"We can think of exception handlers and our main execution context more or less " +"like different threads. [`Send` and `Sync`](../../concurrency/send-sync.md) " +"will control what we can share between them, just like with threads. For " +"example, if we want to share some value between exception handlers and the rest " +"of the program, and it's `Send` but not `Sync`, then we'll need to wrap it in " +"something like a `Mutex` and put it in a static." msgstr "" "例外狀況處理常式和主執行環境,其實可以約略視為不同執行緒。[`Send` 和 `Sync`]" -"(../../concurrency/send-sync.md) 會控管可在它們之間分享的內容,就像執行緒一" -"樣。舉例來說,如要在例外狀況處理常式與程式其餘部分之間分享某個值,而且是 " -"`Send` (而非 `Sync`),我們就需要將該值包裝在 `Mutex` 等項目中並放入靜態項目。" +"(../../concurrency/send-sync.md) 會控管可在它們之間分享的內容,就像執行緒一樣。" +"舉例來說,如要在例外狀況處理常式與程式其餘部分之間分享某個值,而且是 `Send` (而" +"非 `Sync`),我們就需要將該值包裝在 `Mutex` 等項目中並放入靜態項目。" #: src/bare-metal/aps/other-projects.md msgid "[oreboot](https://github.com/oreboot/oreboot)" @@ -18678,8 +18348,8 @@ msgid "" "Initialisation, UART driver, simple bootloader, JTAG, exception levels, " "exception handling, page tables" msgstr "" -"初始化、UART 驅動程式、簡易系統啟動載入程式、JTAG、例外狀況層級、例外狀況處" -"理、分頁表" +"初始化、UART 驅動程式、簡易系統啟動載入程式、JTAG、例外狀況層級、例外狀況處理、" +"分頁表" #: src/bare-metal/aps/other-projects.md msgid "" @@ -18702,8 +18372,8 @@ msgid "" "The RaspberryPi OS tutorial runs Rust code before the MMU and caches are " "enabled. This will read and write memory (e.g. the stack). However:" msgstr "" -"RaspberryPi OS 教學課程會在啟用 MMU 和快取之前,執行 Rust 程式碼。這會讀取及" -"寫入記憶體,例如堆疊。不過,請注意以下幾點:" +"RaspberryPi OS 教學課程會在啟用 MMU 和快取之前,執行 Rust 程式碼。這會讀取及寫入" +"記憶體,例如堆疊。不過,請注意以下幾點:" #: src/bare-metal/aps/other-projects.md msgid "" @@ -18713,8 +18383,8 @@ msgid "" "necessarily the case in general." msgstr "" "如果沒有 MMU 和快取,未對齊的存取會發生錯誤。建構時使用的是 `aarch64-unknown-" -"none`,這會設定 `+strict-align`,防止編譯器產生未對齊的存取,因此應該不會出" -"錯,但這不一定是一般情況。" +"none`,這會設定 `+strict-align`,防止編譯器產生未對齊的存取,因此應該不會出錯," +"但這不一定是一般情況。" #: src/bare-metal/aps/other-projects.md msgid "" @@ -18726,10 +18396,10 @@ msgid "" "alright in this particular case (running directly on the hardware with no " "hypervisor), but isn't a good pattern in general." msgstr "" -"如果是在 VM 中執行,可能會導致快取一致性問題。問題在於 VM 會在快取已停用時直" -"接存取記憶體,而主機具有相同記憶體的可快取別名。即使主機未明確存取記憶體,推" -"測存取行為仍可能導致快取填補,而存取之間的變更就會遺失。同樣地,這在本例中不" -"成問題 (直接在硬體上執行,沒有管理程序),但一般不建議採用這種模式。" +"如果是在 VM 中執行,可能會導致快取一致性問題。問題在於 VM 會在快取已停用時直接存" +"取記憶體,而主機具有相同記憶體的可快取別名。即使主機未明確存取記憶體,推測存取行" +"為仍可能導致快取填補,而存取之間的變更就會遺失。同樣地,這在本例中不成問題 (直接" +"在硬體上執行,沒有管理程序),但一般不建議採用這種模式。" #: src/bare-metal/useful-crates.md msgid "Useful crates" @@ -18744,57 +18414,53 @@ msgstr "以下將介紹幾個 Crate,可用來解決一些裸機程式設計的 #: src/bare-metal/useful-crates/zerocopy.md msgid "" "The [`zerocopy`](https://docs.rs/zerocopy/) crate (from Fuchsia) provides " -"traits and macros for safely converting between byte sequences and other " -"types." +"traits and macros for safely converting between byte sequences and other types." msgstr "" -"[`zerocopy`](https://docs.rs/zerocopy/) Crate (來自 Fuchsia) 提供特徵和巨集," -"可在位元組序列和其他型別之間安全地轉換。" +"[`zerocopy`](https://docs.rs/zerocopy/) Crate (來自 Fuchsia) 提供特徵和巨集,可" +"在位元組序列和其他型別之間安全地轉換。" #: src/bare-metal/useful-crates/zerocopy.md msgid "" "This is not suitable for MMIO (as it doesn't use volatile reads and writes), " -"but can be useful for working with structures shared with hardware e.g. by " -"DMA, or sent over some external interface." +"but can be useful for working with structures shared with hardware e.g. by DMA, " +"or sent over some external interface." msgstr "" -"這不適合 MMIO (因為並非採用揮發性讀取和寫入方法),但很適合搭配使用與硬體共用" -"的結構 (例如藉由 DMA),或透過外部介面傳送的結構。" +"這不適合 MMIO (因為並非採用揮發性讀取和寫入方法),但很適合搭配使用與硬體共用的結" +"構 (例如藉由 DMA),或透過外部介面傳送的結構。" #: src/bare-metal/useful-crates/zerocopy.md msgid "" -"`FromBytes` can be implemented for types for which any byte pattern is " -"valid, and so can safely be converted from an untrusted sequence of bytes." +"`FromBytes` can be implemented for types for which any byte pattern is valid, " +"and so can safely be converted from an untrusted sequence of bytes." msgstr "" -"`FromBytes` 可針對任何位元組模式有效的型別實作,因此可從不受信任的位元組序列" -"安全地完成轉換。" +"`FromBytes` 可針對任何位元組模式有效的型別實作,因此可從不受信任的位元組序列安全" +"地完成轉換。" #: src/bare-metal/useful-crates/zerocopy.md msgid "" "Attempting to derive `FromBytes` for these types would fail, because " -"`RequestType` doesn't use all possible u32 values as discriminants, so not " -"all byte patterns are valid." +"`RequestType` doesn't use all possible u32 values as discriminants, so not all " +"byte patterns are valid." msgstr "" "嘗試衍生這些型別的 `FromBytes` 會失敗,因為 `RequestType` 不會使用所有可能的 " "u32 值做為判別值,所以並非所有位元組模式都有效。" #: src/bare-metal/useful-crates/zerocopy.md -msgid "" -"`zerocopy::byteorder` has types for byte-order aware numeric primitives." +msgid "`zerocopy::byteorder` has types for byte-order aware numeric primitives." msgstr "`zerocopy::byteorder` 的型別適用於瞭解位元組順序的數值基元。" #: src/bare-metal/useful-crates/zerocopy.md msgid "" -"Run the example with `cargo run` under `src/bare-metal/useful-crates/" -"zerocopy-example/`. (It won't run in the Playground because of the crate " -"dependency.)" +"Run the example with `cargo run` under `src/bare-metal/useful-crates/zerocopy-" +"example/`. (It won't run in the Playground because of the crate dependency.)" msgstr "" -"使用 `src/bare-metal/useful-crates/zerocopy-example/` 下的 `cargo run` 執行範" -"例 (在 Playground 中,範例會因為 Crate 依附元件而無法執行)。" +"使用 `src/bare-metal/useful-crates/zerocopy-example/` 下的 `cargo run` 執行範例 " +"(在 Playground 中,範例會因為 Crate 依附元件而無法執行)。" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "" -"The [`aarch64-paging`](https://crates.io/crates/aarch64-paging) crate lets " -"you create page tables according to the AArch64 Virtual Memory System " -"Architecture." +"The [`aarch64-paging`](https://crates.io/crates/aarch64-paging) crate lets you " +"create page tables according to the AArch64 Virtual Memory System Architecture." msgstr "" "[`aarch64-paging`](https://crates.io/crates/aarch64-paging) Crate 可用來根據 " "AArch64 虛擬記憶體系統架構,建立分頁表。" @@ -18813,42 +18479,41 @@ msgstr "// Set `TTBR0_EL1` to activate the page table.\n" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "" -"For now it only supports EL1, but support for other exception levels should " -"be straightforward to add." +"For now it only supports EL1, but support for other exception levels should be " +"straightforward to add." msgstr "目前僅支援 EL1,但應該很容易新增其他例外狀況層級的支援功能。" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "" -"This is used in Android for the [Protected VM Firmware](https://cs.android." -"com/android/platform/superproject/+/master:packages/modules/Virtualization/" -"pvmfw/)." +"This is used in Android for the [Protected VM Firmware](https://cs.android.com/" +"android/platform/superproject/+/master:packages/modules/Virtualization/pvmfw/)." msgstr "" -"這是用於 Android 中的[受保護 VM 韌體](https://cs.android.com/android/" -"platform/superproject/+/master:packages/modules/Virtualization/pvmfw/)。" +"這是用於 Android 中的[受保護 VM 韌體](https://cs.android.com/android/platform/" +"superproject/+/master:packages/modules/Virtualization/pvmfw/)。" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "" -"There's no easy way to run this example, as it needs to run on real hardware " -"or under QEMU." +"There's no easy way to run this example, as it needs to run on real hardware or " +"under QEMU." msgstr "執行這個範例並不容易,因為需要在實際硬體上執行,或是使用 QEMU。" #: src/bare-metal/useful-crates/buddy_system_allocator.md msgid "" -"[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) " -"is a third-party crate implementing a basic buddy system allocator. It can " -"be used both for [`LockedHeap`](https://docs.rs/buddy_system_allocator/0.9.0/" +"[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) is " +"a third-party crate implementing a basic buddy system allocator. It can be used " +"both for [`LockedHeap`](https://docs.rs/buddy_system_allocator/0.9.0/" "buddy_system_allocator/struct.LockedHeap.html) implementing [`GlobalAlloc`]" "(https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc.html) so you can use " -"the standard `alloc` crate (as we saw [before](../alloc.md)), or for " -"allocating other address space. For example, we might want to allocate MMIO " -"space for PCI BARs:" +"the standard `alloc` crate (as we saw [before](../alloc.md)), or for allocating " +"other address space. For example, we might want to allocate MMIO space for PCI " +"BARs:" msgstr "" -"[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) " -"是實作基本夥伴系統分配器的第三方 Crate。這可供 [`LockedHeap`](https://docs." -"rs/buddy_system_allocator/0.9.0/buddy_system_allocator/struct.LockedHeap." -"html) 實作 [`GlobalAlloc`](https://doc.rust-lang.org/core/alloc/trait." -"GlobalAlloc.html),以便使用標準 `alloc` Crate,如[先前](../alloc.md)所見,或" -"用來分配其他位址空間。例如,我們可能會想針對 PCI BAR 分配 MMIO 空間:" +"[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) 是實" +"作基本夥伴系統分配器的第三方 Crate。這可供 [`LockedHeap`](https://docs.rs/" +"buddy_system_allocator/0.9.0/buddy_system_allocator/struct.LockedHeap.html) 實" +"作 [`GlobalAlloc`](https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc." +"html),以便使用標準 `alloc` Crate,如[先前](../alloc.md)所見,或用來分配其他位址" +"空間。例如,我們可能會想針對 PCI BAR 分配 MMIO 空間:" #: src/bare-metal/useful-crates/buddy_system_allocator.md msgid "PCI BARs always have alignment equal to their size." @@ -18856,30 +18521,28 @@ msgstr "PCI BAR 的對齊情形一律會等於其大小。" #: src/bare-metal/useful-crates/buddy_system_allocator.md msgid "" -"Run the example with `cargo run` under `src/bare-metal/useful-crates/" -"allocator-example/`. (It won't run in the Playground because of the crate " -"dependency.)" +"Run the example with `cargo run` under `src/bare-metal/useful-crates/allocator-" +"example/`. (It won't run in the Playground because of the crate dependency.)" msgstr "" -"使用 `src/bare-metal/useful-crates/allocator-example/` 下的 `cargo run` 執行" -"範例 (在 Playground 中,範例會因為 Crate 依附元件而無法執行)。" +"使用 `src/bare-metal/useful-crates/allocator-example/` 下的 `cargo run` 執行範" +"例 (在 Playground 中,範例會因為 Crate 依附元件而無法執行)。" #: src/bare-metal/useful-crates/tinyvec.md msgid "" "Sometimes you want something which can be resized like a `Vec`, but without " -"heap allocation. [`tinyvec`](https://crates.io/crates/tinyvec) provides " -"this: a vector backed by an array or slice, which could be statically " -"allocated or on the stack, which keeps track of how many elements are used " -"and panics if you try to use more than are allocated." +"heap allocation. [`tinyvec`](https://crates.io/crates/tinyvec) provides this: a " +"vector backed by an array or slice, which could be statically allocated or on " +"the stack, which keeps track of how many elements are used and panics if you " +"try to use more than are allocated." msgstr "" -"有時候,您會希望有項目可以像 `Vec` 一樣調整大小,但沒有堆積分配量。" -"[`tinyvec`](https://crates.io/crates/tinyvec) 提供這項機制:這個向量由陣列或" -"切片支援,能以靜態方式分配或置於堆疊,進而追蹤元素用量,以及因您嘗試使用的量" -"超出分配量所導致的恐慌。" +"有時候,您會希望有項目可以像 `Vec` 一樣調整大小,但沒有堆積分配量。[`tinyvec`]" +"(https://crates.io/crates/tinyvec) 提供這項機制:這個向量由陣列或切片支援,能以" +"靜態方式分配或置於堆疊,進而追蹤元素用量,以及因您嘗試使用的量超出分配量所導致的" +"恐慌。" #: src/bare-metal/useful-crates/tinyvec.md msgid "" -"`tinyvec` requires that the element type implement `Default` for " -"initialisation." +"`tinyvec` requires that the element type implement `Default` for initialisation." msgstr "為初始化,`tinyvec` 規定元素型別須實作 `Default`。" #: src/bare-metal/useful-crates/tinyvec.md @@ -18894,16 +18557,16 @@ msgid "" "interior mutability, such as for sharing state between different CPUs?" msgstr "" "`std::sync::Mutex` 和其他來自 `std::sync` 的同步基元,都無法用於 `core` 或 " -"`alloc`。我們能如何管理同步處理作業或內部可變動性 (例如為了在不同 CPU 之間共" -"用狀態) 呢?" +"`alloc`。我們能如何管理同步處理作業或內部可變動性 (例如為了在不同 CPU 之間共用狀" +"態) 呢?" #: src/bare-metal/useful-crates/spin.md msgid "" "The [`spin`](https://crates.io/crates/spin) crate provides spinlock-based " "equivalents of many of these primitives." msgstr "" -"[`spin`](https://crates.io/crates/spin) Crate 針對許多這類基元,提供以自旋鎖" -"為基礎的同等項目。" +"[`spin`](https://crates.io/crates/spin) Crate 針對許多這類基元,提供以自旋鎖為基" +"礎的同等項目。" #: src/bare-metal/useful-crates/spin.md msgid "Be careful to avoid deadlock if you take locks in interrupt handlers." @@ -18923,25 +18586,24 @@ msgid "" "useful types for late initialisation with a slightly different approach to " "`spin::once::Once`." msgstr "" -"[`once_cell`](https://crates.io/crates/once_cell) Crate 也具備一些實用型別," -"適合用於晚期初始化,與 `spin::once::Once` 的做法略有不同。" +"[`once_cell`](https://crates.io/crates/once_cell) Crate 也具備一些實用型別,適合" +"用於晚期初始化,與 `spin::once::Once` 的做法略有不同。" #: src/bare-metal/useful-crates/spin.md -msgid "" -"The Rust Playground includes `spin`, so this example will run fine inline." +msgid "The Rust Playground includes `spin`, so this example will run fine inline." msgstr "Rust Playground 包含 `spin`,因此這個範例可在行內執行。" #: src/bare-metal/android.md msgid "" -"To build a bare-metal Rust binary in AOSP, you need to use a " -"`rust_ffi_static` Soong rule to build your Rust code, then a `cc_binary` " -"with a linker script to produce the binary itself, and then a `raw_binary` " -"to convert the ELF to a raw binary ready to be run." +"To build a bare-metal Rust binary in AOSP, you need to use a `rust_ffi_static` " +"Soong rule to build your Rust code, then a `cc_binary` with a linker script to " +"produce the binary itself, and then a `raw_binary` to convert the ELF to a raw " +"binary ready to be run." msgstr "" "如要在 Android 開放原始碼計畫中建構 Rust 裸機開發二進位檔,您需要使用 " "`rust_ffi_static` Soong 規則建構 Rust 程式碼,接著使用具有連接器指令碼的 " -"`cc_binary` 產生二進位檔,並以 `raw_binary` 將 ELF 轉換為準備好執行的原始二進" -"位檔。" +"`cc_binary` 產生二進位檔,並以 `raw_binary` 將 ELF 轉換為準備好執行的原始二進位" +"檔。" #: src/bare-metal/android/vmbase.md msgid "vmbase" @@ -18950,13 +18612,13 @@ msgstr "vmbase" #: src/bare-metal/android/vmbase.md msgid "" "For VMs running under crosvm on aarch64, the [vmbase](https://android." -"googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/" -"master/vmbase/) library provides a linker script and useful defaults for the " -"build rules, along with an entry point, UART console logging and more." +"googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/master/" +"vmbase/) library provides a linker script and useful defaults for the build " +"rules, along with an entry point, UART console logging and more." msgstr "" -"針對在 aarch64 的 crosvm 下運作的 VM,[vmbase](https://android.googlesource." -"com/platform/packages/modules/Virtualization/+/refs/heads/master/vmbase/) 程" -"式庫提供連接器指令碼和實用的建構規則預設值,以及進入點、UART 控制台記錄等。" +"針對在 aarch64 的 crosvm 下運作的 VM,[vmbase](https://android.googlesource.com/" +"platform/packages/modules/Virtualization/+/refs/heads/master/vmbase/) 程式庫提供" +"連接器指令碼和實用的建構規則預設值,以及進入點、UART 控制台記錄等。" #: src/bare-metal/android/vmbase.md msgid "" @@ -18969,8 +18631,8 @@ msgid "" "The `vmbase` entry point handles console initialisation, and issues a " "PSCI_SYSTEM_OFF to shutdown the VM if your main function returns." msgstr "" -"`vmbase` 進入點會處理控制台初始化作業,並在主函式傳回時發出 PSCI_SYSTEM_OFF " -"來關閉 VM。" +"`vmbase` 進入點會處理控制台初始化作業,並在主函式傳回時發出 PSCI_SYSTEM_OFF 來關" +"閉 VM。" #: src/exercises/bare-metal/afternoon.md msgid "We will write a driver for the PL031 real-time clock device." @@ -18982,43 +18644,42 @@ msgid "" "afternoon.md) provided." msgstr "完成練習後,您可以看看我們提供的[解決方案](solutions-afternoon.md)。" -#: src/exercises/bare-metal/rtc.md -#: src/exercises/bare-metal/solutions-afternoon.md +#: src/exercises/bare-metal/rtc.md src/exercises/bare-metal/solutions-afternoon.md msgid "RTC driver" msgstr "RTC 驅動程式" #: src/exercises/bare-metal/rtc.md msgid "" "The QEMU aarch64 virt machine has a [PL031](https://developer.arm.com/" -"documentation/ddi0224/c) real-time clock at 0x9010000. For this exercise, " -"you should write a driver for it." +"documentation/ddi0224/c) real-time clock at 0x9010000. For this exercise, you " +"should write a driver for it." msgstr "" -"QEMU aarch64 虛擬機器的 [PL031](https://developer.arm.com/documentation/" -"ddi0224/c) 即時時鐘位於 0x9010000。在這個練習中,您應為該時鐘編寫驅動程式。" +"QEMU aarch64 虛擬機器的 [PL031](https://developer.arm.com/documentation/ddi0224/" +"c) 即時時鐘位於 0x9010000。在這個練習中,您應為該時鐘編寫驅動程式。" #: src/exercises/bare-metal/rtc.md 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." -"io/crates/chrono) Crate 設定日期/時間格式。" +"使用該時鐘將目前時間顯示至序列控制台。您可以使用 [`chrono`](https://crates.io/" +"crates/chrono) Crate 設定日期/時間格式。" #: src/exercises/bare-metal/rtc.md msgid "" "Use the match register and raw interrupt status to busy-wait until a given " -"time, e.g. 3 seconds in the future. (Call [`core::hint::spin_loop`](https://" -"doc.rust-lang.org/core/hint/fn.spin_loop.html) inside the loop.)" +"time, e.g. 3 seconds in the future. (Call [`core::hint::spin_loop`](https://doc." +"rust-lang.org/core/hint/fn.spin_loop.html) inside the loop.)" msgstr "" -"使用比對暫存器和原始中斷狀態,忙碌等待至指定時間,例如未來 3 秒 (呼叫迴圈中" -"的 [`core::hint::spin_loop`](https://doc.rust-lang.org/core/hint/fn." -"spin_loop.html))。" +"使用比對暫存器和原始中斷狀態,忙碌等待至指定時間,例如未來 3 秒 (呼叫迴圈中的 " +"[`core::hint::spin_loop`](https://doc.rust-lang.org/core/hint/fn.spin_loop." +"html))。" #: src/exercises/bare-metal/rtc.md msgid "" -"_Extension if you have time:_ Enable and handle the interrupt generated by " -"the RTC match. You can use the driver provided in the [`arm-gic`](https://" -"docs.rs/arm-gic/) crate to configure the Arm Generic Interrupt Controller." +"_Extension if you have time:_ Enable and handle the interrupt generated by the " +"RTC match. You can use the driver provided in the [`arm-gic`](https://docs.rs/" +"arm-gic/) crate to configure the Arm Generic Interrupt Controller." msgstr "" "擴充功能 (如有時間):啟用並處理因 RTC 比對而產生的中斷情形。您可以使用 [`arm-" "gic`](https://docs.rs/arm-gic/) Crate 中提供的驅動程式,設定 Arm 泛型中斷控制" @@ -19033,16 +18694,16 @@ msgid "" "Once the interrupt is enabled, you can put the core to sleep via `arm_gic::" "wfi()`, which will cause the core to sleep until it receives an interrupt." msgstr "" -"啟用中斷功能後,您可以透過 `arm_gic::wfi()` 將核心設為休眠,這樣核心就會進入" -"休眠狀態,直到遭中斷為止。" +"啟用中斷功能後,您可以透過 `arm_gic::wfi()` 將核心設為休眠,這樣核心就會進入休眠" +"狀態,直到遭中斷為止。" #: src/exercises/bare-metal/rtc.md msgid "" "Download the [exercise template](../../comprehensive-rust-exercises.zip) and " "look in the `rtc` directory for the following files." msgstr "" -"請下載[練習範本](../../comprehensive-rust-exercises.zip),並在 `rtc` 目錄中查" -"看下列檔案。" +"請下載[練習範本](../../comprehensive-rust-exercises.zip),並在 `rtc` 目錄中查看" +"下列檔案。" #: src/exercises/bare-metal/rtc.md msgid "" @@ -19204,8 +18865,7 @@ msgid "" " ///\n" " /// # Safety\n" " ///\n" -" /// The given base address must point to the MMIO control registers of " -"a\n" +" /// The given base address must point to the MMIO control registers of a\n" " /// PL031 device, which must be mapped into the address space of the " "process\n" " /// as device memory and not have any other aliases.\n" @@ -19215,8 +18875,7 @@ msgstr "" " ///\n" " /// # Safety\n" " ///\n" -" /// The given base address must point to the MMIO control registers of " -"a\n" +" /// The given base address must point to the MMIO control registers of a\n" " /// PL031 device, which must be mapped into the address space of the " "process\n" " /// as device memory and not have any other aliases.\n" @@ -19243,12 +18902,10 @@ msgstr "" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" -"/// Returns whether the match register matches the RTC value, whether or " -"not\n" +"/// Returns whether the match register matches the RTC value, whether or not\n" " /// the interrupt is enabled.\n" msgstr "" -"/// Returns whether the match register matches the RTC value, whether or " -"not\n" +"/// Returns whether the match register matches the RTC value, whether or not\n" " /// the interrupt is enabled.\n" #: src/exercises/bare-metal/solutions-afternoon.md @@ -19267,14 +18924,12 @@ msgstr "" msgid "" "/// Sets or clears the interrupt mask.\n" " ///\n" -" /// When the mask is true the interrupt is enabled; when it is false " -"the\n" +" /// When the mask is true the interrupt is enabled; when it is false the\n" " /// interrupt is disabled.\n" msgstr "" "/// Sets or clears the interrupt mask.\n" " ///\n" -" /// When the mask is true the interrupt is enabled; when it is false " -"the\n" +" /// When the mask is true the interrupt is enabled; when it is false the\n" " /// interrupt is disabled.\n" #: src/exercises/bare-metal/solutions-afternoon.md @@ -19297,8 +18952,8 @@ msgid "" "compile time bugs. This is often referred to as _fearless concurrency_ since " "you can rely on the compiler to ensure correctness at runtime." msgstr "" -"在將許多執行期並行錯誤轉換為編譯期錯誤的過程中,Rust 型別系統扮演了 重要角" -"色。這通常稱為「無懼並行」,因為你可以依賴編譯器, 確保執行期能夠正確運作。" +"在將許多執行期並行錯誤轉換為編譯期錯誤的過程中,Rust 型別系統扮演了 重要角色。這" +"通常稱為「無懼並行」,因為你可以依賴編譯器, 確保執行期能夠正確運作。" #: src/concurrency.md msgid "" @@ -19312,9 +18967,9 @@ msgstr "" #: src/concurrency.md msgid "" -"The same tools that help with \"concurrent\" access in a single thread (e." -"g., a called function that might mutate an argument or save references to it " -"to read later) save us from multi-threading issues." +"The same tools that help with \"concurrent\" access in a single thread (e.g., a " +"called function that might mutate an argument or save references to it to read " +"later) save us from multi-threading issues." msgstr "" #: src/concurrency/threads.md @@ -19376,11 +19031,10 @@ msgstr "" #: src/concurrency/threads.md #, fuzzy msgid "" -"[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html) " -"returns a `JoinHandle`. Look at the docs." +"[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html) returns a " +"`JoinHandle`. Look at the docs." msgstr "" -"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) 用於定義解構函" -"式。" +"[`Drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html) 用於定義解構函式。" #: src/concurrency/threads.md msgid "" @@ -19391,11 +19045,11 @@ msgstr "" #: src/concurrency/threads.md #, fuzzy msgid "" -"Use `let handle = thread::spawn(...)` and later `handle.join()` to wait for " -"the thread to finish and have the program count all the way to 10." +"Use `let handle = thread::spawn(...)` and later `handle.join()` to wait for the " +"thread to finish and have the program count all the way to 10." msgstr "" -"請依序使用 `let handle = thread::spawn(...)` 和 `handle.join()`,等待 執行緒" -"完成運作。" +"請依序使用 `let handle = thread::spawn(...)` 和 `handle.join()`,等待 執行緒完成" +"運作。" #: src/concurrency/threads.md msgid "Now what if we want to return a value?" @@ -19408,16 +19062,16 @@ msgstr "" #: src/concurrency/threads.md #, fuzzy msgid "" -"[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html)'s " -"closure returns `T`" +"[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html)'s closure " +"returns `T`" msgstr "" -"但是,你可以使用[限定範圍執行緒](https://doc.rust-lang.org/std/thread/fn." -"scope.html)執行這項功能:" +"但是,你可以使用[限定範圍執行緒](https://doc.rust-lang.org/std/thread/fn.scope." +"html)執行這項功能:" #: src/concurrency/threads.md msgid "" -"`JoinHandle` [`.join()`](https://doc.rust-lang.org/std/thread/struct." -"JoinHandle.html#method.join) returns `thread::Result`" +"`JoinHandle` [`.join()`](https://doc.rust-lang.org/std/thread/struct.JoinHandle." +"html#method.join) returns `thread::Result`" msgstr "" #: src/concurrency/threads.md @@ -19426,8 +19080,8 @@ msgid "" "Use the `Result` return value from `handle.join()` to get access to the " "returned value." msgstr "" -"使用 `handle.join()` 的 `Result` 傳回值,取得恐慌酬載的 存取權。這個階段是提" -"起 [`Any`](https://doc.rust-lang.org/std/any/index.html) 的好時機。" +"使用 `handle.join()` 的 `Result` 傳回值,取得恐慌酬載的 存取權。這個階段是提起 " +"[`Any`](https://doc.rust-lang.org/std/any/index.html) 的好時機。" #: src/concurrency/threads.md msgid "Ok, what about the other case?" @@ -19441,11 +19095,11 @@ msgstr "在執行緒中觸發恐慌,請注意,這不會影響 `main`。" #: src/concurrency/threads.md #, fuzzy msgid "" -"Access the panic payload. This is a good time to talk about [`Any`](https://" -"doc.rust-lang.org/std/any/index.html)." +"Access the panic payload. This is a good time to talk about [`Any`](https://doc." +"rust-lang.org/std/any/index.html)." msgstr "" -"使用 `handle.join()` 的 `Result` 傳回值,取得恐慌酬載的 存取權。這個階段是提" -"起 [`Any`](https://doc.rust-lang.org/std/any/index.html) 的好時機。" +"使用 `handle.join()` 的 `Result` 傳回值,取得恐慌酬載的 存取權。這個階段是提起 " +"[`Any`](https://doc.rust-lang.org/std/any/index.html) 的好時機。" #: src/concurrency/threads.md msgid "Now we can return values from threads! What about taking inputs?" @@ -19487,35 +19141,35 @@ msgstr "一般執行緒無法借用環境的資源:" #: src/concurrency/scoped-threads.md msgid "" -"However, you can use a [scoped thread](https://doc.rust-lang.org/std/thread/" -"fn.scope.html) for this:" +"However, you can use a [scoped thread](https://doc.rust-lang.org/std/thread/fn." +"scope.html) for this:" msgstr "" -"但是,你可以使用[限定範圍執行緒](https://doc.rust-lang.org/std/thread/fn." -"scope.html)執行這項功能:" +"但是,你可以使用[限定範圍執行緒](https://doc.rust-lang.org/std/thread/fn.scope." +"html)執行這項功能:" #: src/concurrency/scoped-threads.md msgid "" "The reason for that is that when the `thread::scope` function completes, all " "the threads are guaranteed to be joined, so they can return borrowed data." msgstr "" -"原因在於 `thread::scope` 函式完成時,能保證所有執行緒都已加入,因此能夠傳回借" -"用的資料。" +"原因在於 `thread::scope` 函式完成時,能保證所有執行緒都已加入,因此能夠傳回借用" +"的資料。" #: src/concurrency/scoped-threads.md msgid "" -"Normal Rust borrowing rules apply: you can either borrow mutably by one " -"thread, or immutably by any number of threads." +"Normal Rust borrowing rules apply: you can either borrow mutably by one thread, " +"or immutably by any number of threads." msgstr "" -"適用 Rust 一般借用規則:可以由一個執行緒以可變方式借用,或者由任意數量的執行" -"緒以不可變方式借用。" +"適用 Rust 一般借用規則:可以由一個執行緒以可變方式借用,或者由任意數量的執行緒以" +"不可變方式借用。" #: src/concurrency/channels.md msgid "" -"Rust channels have two parts: a `Sender` and a `Receiver`. The two " -"parts are connected via the channel, but you only see the end-points." +"Rust channels have two parts: a `Sender` and a `Receiver`. The two parts " +"are connected via the channel, but you only see the end-points." msgstr "" -"Rust 通道分為兩個部分:`Sender` 和 `Receiver`。這兩個部分 透過通道相" -"連,但你只能看到端點。" +"Rust 通道分為兩個部分:`Sender` 和 `Receiver`。這兩個部分 透過通道相連,但" +"你只能看到端點。" #: src/concurrency/channels.md msgid "\"Received: {:?}\"" @@ -19524,19 +19178,18 @@ msgstr "\"Received: {:?}\"" #: src/concurrency/channels.md msgid "" "`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender` " -"implement `Clone` (so you can make multiple producers) but `Receiver` does " -"not." +"implement `Clone` (so you can make multiple producers) but `Receiver` does not." msgstr "" -"`mpsc` 代表多重生產者、唯一消費者。`Sender` 和 `SyncSender` 會實作 `Clone` " -"(用於製作多重生產者),但 `Receiver` 不會。" +"`mpsc` 代表多重生產者、唯一消費者。`Sender` 和 `SyncSender` 會實作 `Clone` (用於" +"製作多重生產者),但 `Receiver` 不會。" #: src/concurrency/channels.md msgid "" "`send()` and `recv()` return `Result`. If they return `Err`, it means the " "counterpart `Sender` or `Receiver` is dropped and the channel is closed." msgstr "" -"`send()` 和 `recv()` 會傳回 `Result`。如果傳回的是 `Err`,表示對應的 " -"`Sender` 或 `Receiver` 已釋放,且通道已關閉。" +"`send()` 和 `recv()` 會傳回 `Result`。如果傳回的是 `Err`,表示對應的 `Sender` " +"或 `Receiver` 已釋放,且通道已關閉。" #: src/concurrency/channels/unbounded.md msgid "You get an unbounded and asynchronous channel with `mpsc::channel()`:" @@ -19559,67 +19212,66 @@ msgid "\"Main: got {msg}\"" msgstr "\"Main: got {msg}\"" #: src/concurrency/channels/bounded.md -msgid "" -"With bounded (synchronous) channels, `send` can block the current thread:" +msgid "With bounded (synchronous) channels, `send` can block the current thread:" msgstr "有界限的同步通道可讓 `send` 阻擋現行執行緒:" #: src/concurrency/channels/bounded.md msgid "" "Calling `send` will block the current thread until there is space in the " -"channel for the new message. The thread can be blocked indefinitely if there " -"is nobody who reads from the channel." +"channel for the new message. The thread can be blocked indefinitely if there is " +"nobody who reads from the channel." msgstr "" -"呼叫 `send` 會阻塞目前執行緒,直到管道有空間接收新訊息為止。如果沒有東西讀取" -"管道內容,執行緒可能會無限期遭到阻塞。" +"呼叫 `send` 會阻塞目前執行緒,直到管道有空間接收新訊息為止。如果沒有東西讀取管道" +"內容,執行緒可能會無限期遭到阻塞。" #: src/concurrency/channels/bounded.md msgid "" -"A call to `send` will abort with an error (that is why it returns `Result`) " -"if the channel is closed. A channel is closed when the receiver is dropped." +"A call to `send` will abort with an error (that is why it returns `Result`) if " +"the channel is closed. A channel is closed when the receiver is dropped." msgstr "" -"如果管道已關閉,對 `send` 的呼叫就會取消,並顯示錯誤 (所以會傳回 `Result`)。" -"接收器遭捨棄時,管道就會關閉。" +"如果管道已關閉,對 `send` 的呼叫就會取消,並顯示錯誤 (所以會傳回 `Result`)。接收" +"器遭捨棄時,管道就會關閉。" #: src/concurrency/channels/bounded.md msgid "" -"A bounded channel with a size of zero is called a \"rendezvous channel\". " -"Every send will block the current thread until another thread calls `read`." +"A bounded channel with a size of zero is called a \"rendezvous channel\". Every " +"send will block the current thread until another thread calls `read`." msgstr "" -"大小為零的受限管道稱為「會合管道」。每項傳送作業都會阻塞目前執行緒,直到其他" -"執行緒呼叫 `read` 為止。" +"大小為零的受限管道稱為「會合管道」。每項傳送作業都會阻塞目前執行緒,直到其他執行" +"緒呼叫 `read` 為止。" #: src/concurrency/send-sync.md msgid "" -"How does Rust know to forbid shared access across threads? The answer is in " -"two traits:" +"How does Rust know to forbid shared access across threads? The answer is in two " +"traits:" msgstr "Rust 如何得知要禁止在執行緒間共享存取權?答案就在以下兩個特徵中:" #: src/concurrency/send-sync.md msgid "" -"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): a type `T` " -"is `Send` if it is safe to move a `T` across a thread boundary." +"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): a type `T` is " +"`Send` if it is safe to move a `T` across a thread boundary." msgstr "" -"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html):如果可以將 " -"`T` 在執行緒界線間安全轉移,型別 `T` 就會是 `Send`。" +"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html):如果可以將 `T` " +"在執行緒界線間安全轉移,型別 `T` 就會是 `Send`。" #: src/concurrency/send-sync.md msgid "" -"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): a type `T` " -"is `Sync` if it is safe to move a `&T` across a thread boundary." +"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): a type `T` is " +"`Sync` if it is safe to move a `&T` across a thread boundary." msgstr "" -"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html):如果可以將 " -"`&T` 在執行緒界線間安全轉移,型別 `T` 就會是 `Sync`。" +"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html):如果可以將 `&T` " +"在執行緒界線間安全轉移,型別 `T` 就會是 `Sync`。" #: src/concurrency/send-sync.md msgid "" -"`Send` and `Sync` are [unsafe traits](../unsafe/unsafe-traits.md). The " -"compiler will automatically derive them for your types as long as they only " -"contain `Send` and `Sync` types. You can also implement them manually when " -"you know it is valid." +"`Send` and `Sync` are [unsafe traits](../unsafe/unsafe-traits.md). The compiler " +"will automatically derive them for your types as long as they only contain " +"`Send` and `Sync` types. You can also implement them manually when you know it " +"is valid." msgstr "" -"`Send` 和 `Sync` 是 [不安全的特徵](../unsafe/unsafe-traits.md)。如果你的型別" -"只包含其他有 `Send` 和 `Sync` 的型別, 編譯器就會自動根據型別為你產生 `Send` " -"和 `Sync`。或許如果你知道你的型別是適用的, 也可以手動實作。" +"`Send` 和 `Sync` 是 [不安全的特徵](../unsafe/unsafe-traits.md)。如果你的型別只包" +"含其他有 `Send` 和 `Sync` 的型別, 編譯器就會自動根據型別為你產生 `Send` 和 " +"`Sync`。或許如果你知道你的型別是適用的, 也可以手動實作。" #: src/concurrency/send-sync.md msgid "" @@ -19633,35 +19285,34 @@ msgstr "這些特徵就像一般特徵,可用於泛型條件約束。" #: src/concurrency/send-sync/send.md msgid "" -"A type `T` is [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html) " -"if it is safe to move a `T` value to another thread." +"A type `T` is [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html) if " +"it is safe to move a `T` value to another thread." msgstr "" "如果可以將 `T` 值安全轉移至其他執行緒,型別 `T` 就會是 [`Send`](https://doc." "rust-lang.org/std/marker/trait.Send.html)。" #: src/concurrency/send-sync/send.md msgid "" -"The effect of moving ownership to another thread is that _destructors_ will " -"run in that thread. So the question is when you can allocate a value in one " -"thread and deallocate it in another." +"The effect of moving ownership to another thread is that _destructors_ will run " +"in that thread. So the question is when you can allocate a value in one thread " +"and deallocate it in another." msgstr "" -"將所有權轉移到其他執行緒的結果,就是「destructors」會在該執行緒中 執行。因此" -"問題是,何時能在一個執行緒中配置一個值, 並在另一個執行緒中釋放這個值的記憶" -"體。" +"將所有權轉移到其他執行緒的結果,就是「destructors」會在該執行緒中 執行。因此問題" +"是,何時能在一個執行緒中配置一個值, 並在另一個執行緒中釋放這個值的記憶體。" #: src/concurrency/send-sync/send.md msgid "" -"As an example, a connection to the SQLite library must only be accessed from " -"a single thread." +"As an example, a connection to the SQLite library must only be accessed from a " +"single thread." msgstr "舉例來說,與 SQLite 資料庫的連線必須只能透過單一執行緒 存取。" #: src/concurrency/send-sync/sync.md msgid "" -"A type `T` is [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) " -"if it is safe to access a `T` value from multiple threads at the same time." +"A type `T` is [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) if " +"it is safe to access a `T` value from multiple threads at the same time." msgstr "" -"如果可以同時從多個執行緒存取 `T` 值, 型別 `T` 就會是 [`Sync`](https://doc." -"rust-lang.org/std/marker/trait.Sync.html)。" +"如果可以同時從多個執行緒存取 `T` 值, 型別 `T` 就會是 [`Sync`](https://doc.rust-" +"lang.org/std/marker/trait.Sync.html)。" #: src/concurrency/send-sync/sync.md msgid "More precisely, the definition is:" @@ -19677,20 +19328,20 @@ msgid "" "thread-safe for shared use, it is also thread-safe to pass references of it " "across threads." msgstr "" -"這定義簡單的表示,若一個型別可以在確保執行緒安全的情況下被共用,這型別的參考" -"值也可以安全的被傳遞於其他的執行緒。" +"這定義簡單的表示,若一個型別可以在確保執行緒安全的情況下被共用,這型別的參考值也" +"可以安全的被傳遞於其他的執行緒。" #: src/concurrency/send-sync/sync.md msgid "" "This is because if a type is Sync it means that it can be shared across " "multiple threads without the risk of data races or other synchronization " -"issues, so it is safe to move it to another thread. A reference to the type " -"is also safe to move to another thread, because the data it references can " -"be accessed from any thread safely." +"issues, so it is safe to move it to another thread. A reference to the type is " +"also safe to move to another thread, because the data it references can be " +"accessed from any thread safely." msgstr "" -"原因在於如果型別為 Sync,表示能在多個執行緒之間共用,沒有資料競爭或其他同步問" -"題的風險,因此可以安全轉移到其他執行緒。此外,由於可以從任何執行緒安全存取型" -"別參考的資料,型別參考也能安全地轉移到其他執行緒。" +"原因在於如果型別為 Sync,表示能在多個執行緒之間共用,沒有資料競爭或其他同步問題" +"的風險,因此可以安全轉移到其他執行緒。此外,由於可以從任何執行緒安全存取型別參考" +"的資料,型別參考也能安全地轉移到其他執行緒。" #: src/concurrency/send-sync/examples.md msgid "`Send + Sync`" @@ -19762,8 +19413,7 @@ msgid "`!Send + Sync`" msgstr "`!Send + Sync`" #: src/concurrency/send-sync/examples.md -msgid "" -"These types are thread-safe, but they cannot be moved to another thread:" +msgid "These types are thread-safe, but they cannot be moved to another thread:" msgstr "以下型別會防護執行緒安全,但無法轉移至其他執行緒:" #: src/concurrency/send-sync/examples.md @@ -19771,8 +19421,8 @@ msgid "" "`MutexGuard`: Uses OS level primitives which must be deallocated on " "the thread which created them." msgstr "" -"`MutexGuard`:使用 OS 層級的原始元件,這類元件必須在建立該元件的 執行緒上" -"釋放記憶體。" +"`MutexGuard`:使用 OS 層級的原始元件,這類元件必須在建立該元件的 執行緒上釋放" +"記憶體。" #: src/concurrency/send-sync/examples.md msgid "`!Send + !Sync`" @@ -19807,17 +19457,16 @@ msgid "" "reference counted `T`: handles sharing between threads and takes care to " "deallocate `T` when the last reference is dropped," msgstr "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html),原子參考計數" -"為 `T`:處理執行緒間的共享狀態, 並且在最後參考被丟棄時負責釋放 `T` 的記憶" -"體。" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html),原子參考計數為 " +"`T`:處理執行緒間的共享狀態, 並且在最後參考被丟棄時負責釋放 `T` 的記憶體。" #: src/concurrency/shared_state.md msgid "" "[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html): ensures " "mutually exclusive access to the `T` value." msgstr "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html):確保能提" -"供 `T` 值的可變專屬存取權。" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html):確保能提供 " +"`T` 值的可變專屬存取權。" #: src/concurrency/shared_state/arc.md msgid "" @@ -19839,25 +19488,23 @@ msgstr "\"v: {v:?}\"" msgid "" "`Arc` stands for \"Atomic Reference Counted\", a thread safe version of `Rc` " "that uses atomic operations." -msgstr "" -"`Arc` 代表「原子參考計數」,這個 `Rc` 的執行緒安全版本會採用原子性 運算。" +msgstr "`Arc` 代表「原子參考計數」,這個 `Rc` 的執行緒安全版本會採用原子性 運算。" #: src/concurrency/shared_state/arc.md #, fuzzy msgid "" -"`Arc` implements `Clone` whether or not `T` does. It implements `Send` " -"and `Sync` if and only if `T` implements them both." +"`Arc` implements `Clone` whether or not `T` does. It implements `Send` and " +"`Sync` if and only if `T` implements them both." msgstr "" "`Arc` 會實作 `Clone`,與 `T` 無關。如果 `T` 同時實作 `Send` 和 `Sync`, " "`Arc` 也會實作這兩者。" #: src/concurrency/shared_state/arc.md msgid "" -"`Arc::clone()` has the cost of atomic operations that get executed, but " -"after that the use of the `T` is free." +"`Arc::clone()` has the cost of atomic operations that get executed, but after " +"that the use of the `T` is free." msgstr "" -"`Arc::clone()` 會導致執行原子性運算的費用,但之後使用得到的 `T` 不需任何費" -"用。" +"`Arc::clone()` 會導致執行原子性運算的費用,但之後使用得到的 `T` 不需任何費用。" #: src/concurrency/shared_state/arc.md msgid "" @@ -19877,8 +19524,8 @@ msgid "" "interface (another form of [interior mutability](../../borrowing/interior-" "mutability)):" msgstr "" -"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) 可確保執行" -"互斥功能,「並」在唯讀介面背後授予 `T` 的可變存取權:" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) 可確保執行互" +"斥功能,「並」在唯讀介面背後授予 `T` 的可變存取權:" #: src/concurrency/shared_state/mutex.md msgid "\"v: {:?}\"" @@ -19886,8 +19533,8 @@ msgstr "\"v: {:?}\"" #: src/concurrency/shared_state/mutex.md msgid "" -"Notice how we have a [`impl Sync for Mutex`](https://doc.rust-" -"lang.org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E) blanket " +"Notice how we have a [`impl Sync for Mutex`](https://doc.rust-lang." +"org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E) blanket " "implementation." msgstr "" "請留意我們如何進行 [`impl Sync for Mutex`](https://doc.rust-lang." @@ -19896,8 +19543,8 @@ msgstr "" #: src/concurrency/shared_state/mutex.md #, fuzzy msgid "" -"`Mutex` in Rust looks like a collection with just one element --- the " -"protected data." +"`Mutex` in Rust looks like a collection with just one element --- the protected " +"data." msgstr "Rust 中的 `Mutex` 就像是只有一個元素的集合,也就是受保護的資料。" #: src/concurrency/shared_state/mutex.md @@ -19911,8 +19558,8 @@ msgid "" "You can get an `&mut T` from an `&Mutex` by taking the lock. The " "`MutexGuard` ensures that the `&mut T` doesn't outlive the lock being held." msgstr "" -"只要使用這個鎖,就能從 `&Mutex` 取得 `&mut T`。`MutexGuard` 可確保 `&mut " -"T` 的壽命不會超過所持有的鎖。" +"只要使用這個鎖,就能從 `&Mutex` 取得 `&mut T`。`MutexGuard` 可確保 `&mut T` " +"的壽命不會超過所持有的鎖。" #: src/concurrency/shared_state/mutex.md #, fuzzy @@ -19933,16 +19580,16 @@ msgstr "為何 `lock()` 會傳回 `Result`?" #: src/concurrency/shared_state/mutex.md msgid "" -"If the thread that held the `Mutex` panicked, the `Mutex` becomes " -"\"poisoned\" to signal that the data it protected might be in an " -"inconsistent state. Calling `lock()` on a poisoned mutex fails with a " -"[`PoisonError`](https://doc.rust-lang.org/std/sync/struct.PoisonError.html). " -"You can call `into_inner()` on the error to recover the data regardless." +"If the thread that held the `Mutex` panicked, the `Mutex` becomes \"poisoned\" " +"to signal that the data it protected might be in an inconsistent state. Calling " +"`lock()` on a poisoned mutex fails with a [`PoisonError`](https://doc.rust-lang." +"org/std/sync/struct.PoisonError.html). You can call `into_inner()` on the error " +"to recover the data regardless." msgstr "" -"如果持有 `Mutex` 的執行緒發生恐慌,`Mutex` 就會「中毒」,指出 其保護的資料可" -"能處於不一致的狀態。如果對已中毒的互斥鎖呼叫 `lock()`, 會發生 " -"[`PoisonError`](https://doc.rust-lang.org/std/sync/struct.PoisonError.html) " -"錯誤。無論如何,你都可以對錯誤呼叫 `into_inner()` 來復原 資料。" +"如果持有 `Mutex` 的執行緒發生恐慌,`Mutex` 就會「中毒」,指出 其保護的資料可能處" +"於不一致的狀態。如果對已中毒的互斥鎖呼叫 `lock()`, 會發生 [`PoisonError`]" +"(https://doc.rust-lang.org/std/sync/struct.PoisonError.html) 錯誤。無論如何,你" +"都可以對錯誤呼叫 `into_inner()` 來復原 資料。" #: src/concurrency/shared_state/example.md msgid "Let us see `Arc` and `Mutex` in action:" @@ -19962,8 +19609,7 @@ msgstr "重要部分:" #: src/concurrency/shared_state/example.md msgid "" -"`v` is wrapped in both `Arc` and `Mutex`, because their concerns are " -"orthogonal." +"`v` is wrapped in both `Arc` and `Mutex`, because their concerns are orthogonal." msgstr "`v` 已同時納入 `Arc` 和 `Mutex`,因為兩者的考量互不相關。" #: src/concurrency/shared_state/example.md @@ -19999,8 +19645,8 @@ msgid "" "Multi-threaded link checker: a larger project where you'll use Cargo to " "download dependencies and then check links in parallel." msgstr "" -"多執行緒連結檢查工具:您可以在這項大型專案中使用 Cargo 下載依附元件,然後同時" -"檢查連結。" +"多執行緒連結檢查工具:您可以在這項大型專案中使用 Cargo 下載依附元件,然後同時檢" +"查連結。" #: src/exercises/concurrency/dining-philosophers.md msgid "The dining philosophers problem is a classic problem in concurrency:" @@ -20008,30 +19654,27 @@ msgstr "哲學家就餐問題是經典的並行練習題:" #: src/exercises/concurrency/dining-philosophers.md msgid "" -"Five philosophers dine together at the same table. Each philosopher has " -"their own place at the table. There is a fork between each plate. The dish " -"served is a kind of spaghetti which has to be eaten with two forks. Each " -"philosopher can only alternately think and eat. Moreover, a philosopher can " -"only eat their spaghetti when they have both a left and right fork. Thus two " -"forks will only be available when their two nearest neighbors are thinking, " -"not eating. After an individual philosopher finishes eating, they will put " -"down both forks." -msgstr "" -"五位哲學家要在同一張餐桌上一起用餐,他們各有自己的座位。每兩個餐盤之間有一支" -"叉子。餐盤裡裝著某種義大利麵,必須使用兩支叉子才能享用。哲學家無法同時思考和" -"進食,而且必須左右手都拿著叉子,才能吃到義大利麵。因此,只有身旁的兩位哲學家" -"在思考 (而非進食) 時,才能取得兩支叉子。某個哲學家吃完後,會同時放下兩支叉" -"子。" +"Five philosophers dine together at the same table. Each philosopher has their " +"own place at the table. There is a fork between each plate. The dish served is " +"a kind of spaghetti which has to be eaten with two forks. Each philosopher can " +"only alternately think and eat. Moreover, a philosopher can only eat their " +"spaghetti when they have both a left and right fork. Thus two forks will only " +"be available when their two nearest neighbors are thinking, not eating. After " +"an individual philosopher finishes eating, they will put down both forks." +msgstr "" +"五位哲學家要在同一張餐桌上一起用餐,他們各有自己的座位。每兩個餐盤之間有一支叉" +"子。餐盤裡裝著某種義大利麵,必須使用兩支叉子才能享用。哲學家無法同時思考和進食," +"而且必須左右手都拿著叉子,才能吃到義大利麵。因此,只有身旁的兩位哲學家在思考 (而" +"非進食) 時,才能取得兩支叉子。某個哲學家吃完後,會同時放下兩支叉子。" #: src/exercises/concurrency/dining-philosophers.md msgid "" -"You will need a local [Cargo installation](../../cargo/running-locally.md) " -"for this exercise. Copy the code below to a file called `src/main.rs`, fill " -"out the blanks, and test that `cargo run` does not deadlock:" +"You will need a local [Cargo installation](../../cargo/running-locally.md) for " +"this exercise. Copy the code below to a file called `src/main.rs`, fill out the " +"blanks, and test that `cargo run` does not deadlock:" msgstr "" -"這項練習需要在本機[安裝 Cargo](../../cargo/running-locally.md)。請將以下程式" -"碼複製到名為 `src/main.rs` 的檔案、填寫空白處,然後測試 `cargo run` 不會發生" -"死結:" +"這項練習需要在本機[安裝 Cargo](../../cargo/running-locally.md)。請將以下程式碼複" +"製到名為 `src/main.rs` 的檔案、填寫空白處,然後測試 `cargo run` 不會發生死結:" #: src/exercises/concurrency/dining-philosophers.md #: src/exercises/concurrency/dining-philosophers-async.md @@ -20142,22 +19785,21 @@ msgstr "" #: src/exercises/concurrency/link-checker.md msgid "" -"Let us use our new knowledge to create a multi-threaded link checker. It " -"should start at a webpage and check that links on the page are valid. It " -"should recursively check other pages on the same domain and keep doing this " -"until all pages have been validated." +"Let us use our new knowledge to create a multi-threaded link checker. It should " +"start at a webpage and check that links on the page are valid. It should " +"recursively check other pages on the same domain and keep doing this until all " +"pages have been validated." msgstr "" -"讓我們運用所學的新知識,建立多執行緒連結檢查工具。該工具應從網頁開始,檢查頁" -"面上的連結是否有效,並應以遞迴方式檢查相同網域中的其他頁面,直到驗證完所有頁" -"面為止。" +"讓我們運用所學的新知識,建立多執行緒連結檢查工具。該工具應從網頁開始,檢查頁面上" +"的連結是否有效,並應以遞迴方式檢查相同網域中的其他頁面,直到驗證完所有頁面為止。" #: src/exercises/concurrency/link-checker.md msgid "" "For this, you will need an HTTP client such as [`reqwest`](https://docs.rs/" "reqwest/). Create a new Cargo project and `reqwest` it as a dependency with:" msgstr "" -"為此,您需要使用 HTTP 用戶端,例如 [`reqwest`](https://docs.rs/reqwest/)。請" -"建立新的 Cargo 專案,並使用以下指令,將 `reqwest` 設為依附元件:" +"為此,您需要使用 HTTP 用戶端,例如 [`reqwest`](https://docs.rs/reqwest/)。請建立" +"新的 Cargo 專案,並使用以下指令,將 `reqwest` 設為依附元件:" #: src/exercises/concurrency/link-checker.md msgid "" @@ -20169,23 +19811,21 @@ msgstr "" #: src/exercises/concurrency/link-checker.md msgid "" -"You will also need a way to find links. We can use [`scraper`](https://docs." -"rs/scraper/) for that:" +"You will also need a way to find links. We can use [`scraper`](https://docs.rs/" +"scraper/) for that:" msgstr "" -"您也需要設法找出連結。為此,我們可以使用 [`scraper`](https://docs.rs/" -"scraper/):" +"您也需要設法找出連結。為此,我們可以使用 [`scraper`](https://docs.rs/scraper/):" #: src/exercises/concurrency/link-checker.md msgid "" -"Finally, we'll need some way of handling errors. We use [`thiserror`]" -"(https://docs.rs/thiserror/) for that:" +"Finally, we'll need some way of handling errors. We use [`thiserror`](https://" +"docs.rs/thiserror/) for that:" msgstr "" "最後,我們需要處理錯誤的方法。為此,我們會使用 [`thiserror`](https://docs.rs/" "thiserror/):" #: src/exercises/concurrency/link-checker.md -msgid "" -"The `cargo add` calls will update the `Cargo.toml` file to look like this:" +msgid "The `cargo add` calls will update the `Cargo.toml` file to look like this:" msgstr "`cargo add` 呼叫會更新 `Cargo.toml` 檔案,如下所示:" #: src/exercises/concurrency/link-checker.md @@ -20198,8 +19838,7 @@ msgid "" "publish = false\n" "\n" "[dependencies]\n" -"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-" -"tls\"] }\n" +"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-tls\"] }\n" "scraper = \"0.13.0\"\n" "thiserror = \"1.0.37\"\n" "```" @@ -20212,19 +19851,18 @@ msgstr "" "publish = false\n" "\n" "[dependencies]\n" -"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-" -"tls\"] }\n" +"reqwest = { version = \"0.11.12\", features = [\"blocking\", \"rustls-tls\"] }\n" "scraper = \"0.13.0\"\n" "thiserror = \"1.0.37\"\n" "```" #: src/exercises/concurrency/link-checker.md msgid "" -"You can now download the start page. Try with a small site such as `https://" -"www.google.org/`." +"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:" @@ -20281,12 +19919,12 @@ msgstr "" #: src/exercises/concurrency/link-checker.md msgid "" -"Extend this to recursively extract links from all pages on the `www.google." -"org` domain. Put an upper limit of 100 pages or so so that you don't end up " -"being blocked by the site." +"Extend this to recursively extract links from all pages on the `www.google.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` 網域中所有頁面上的連結。將頁面" -"上限設為 100 個左右,以免遭到網站封鎖。" +"拓展這項功能,以遞迴方式擷取 `www.google.org` 網域中所有頁面上的連結。將頁面上限" +"設為 100 個左右,以免遭到網站封鎖。" #: src/exercises/concurrency/solutions-morning.md msgid "Concurrency Morning Exercise" @@ -20323,10 +19961,8 @@ msgid "([back to exercise](link-checker.md))" msgstr "([返回練習](link-checker.md))" #: src/exercises/concurrency/solutions-morning.md -msgid "" -"/// Determine whether links within the given page should be extracted.\n" -msgstr "" -"/// Determine whether links within the given page should be extracted.\n" +msgid "/// Determine whether links within the given page should be extracted.\n" +msgstr "/// Determine whether links within the given page should be extracted.\n" #: src/exercises/concurrency/solutions-morning.md msgid "" @@ -20354,26 +19990,26 @@ msgstr "非同步的 Rust" #: src/async.md msgid "" -"\"Async\" is a concurrency model where multiple tasks are executed " -"concurrently by executing each task until it would block, then switching to " -"another task that is ready to make progress. The model allows running a " -"larger number of tasks on a limited number of threads. This is because the " -"per-task overhead is typically very low and operating systems provide " -"primitives for efficiently identifying I/O that is able to proceed." +"\"Async\" is a concurrency model where multiple tasks are executed concurrently " +"by executing each task until it would block, then switching to another task " +"that is ready to make progress. The model allows running a larger number of " +"tasks on a limited number of threads. This is because the per-task overhead is " +"typically very low and operating systems provide primitives for efficiently " +"identifying I/O that is able to proceed." msgstr "" -"「非同步(async)」是一種將多個任務併行執行的模式。在這樣的模式中,當其中一個" -"任務進入阻塞狀態時,系統會去執行至另一個可執行的任務。這種模式允許在執行緒數" -"量有限的環境下執行大量的任務,這是因為每個任務所造成的開銷通常都很低,而且作" -"業系統提供的基本功能能夠有效地辨識可處理的 I/O。" +"「非同步(async)」是一種將多個任務併行執行的模式。在這樣的模式中,當其中一個任" +"務進入阻塞狀態時,系統會去執行至另一個可執行的任務。這種模式允許在執行緒數量有限" +"的環境下執行大量的任務,這是因為每個任務所造成的開銷通常都很低,而且作業系統提供" +"的基本功能能夠有效地辨識可處理的 I/O。" #: src/async.md msgid "" "Rust's asynchronous operation is based on \"futures\", which represent work " -"that may be completed in the future. Futures are \"polled\" until they " -"signal that they are complete." +"that may be completed in the future. Futures are \"polled\" until they signal " +"that they are complete." msgstr "" -"Rust 的非同步操作是透過「future」來處理,代表可能在未來完成的工作。Future 會" -"處在被「輪詢(poll)」的狀態,直到它送出信號來表示工作已經處理完成。" +"Rust 的非同步操作是透過「future」來處理,代表可能在未來完成的工作。Future 會處在" +"被「輪詢(poll)」的狀態,直到它送出信號來表示工作已經處理完成。" #: src/async.md msgid "" @@ -20387,25 +20023,24 @@ msgid "" "callback-based, and not polled. Async Python programs require a \"loop\", " "similar to a runtime in Rust." msgstr "" -"Python 有一個類似的模型 `asyncio`。不過 `asyncio` 的 `Future` 類型是根據回呼" -"函數(callback)而非輪詢。非同步的 Python 程式需要「迴圈(loop)」來處理,類" -"似於 Rust 的執行環境。" +"Python 有一個類似的模型 `asyncio`。不過 `asyncio` 的 `Future` 類型是根據回呼函數" +"(callback)而非輪詢。非同步的 Python 程式需要「迴圈(loop)」來處理,類似於 " +"Rust 的執行環境。" #: src/async.md msgid "" "JavaScript's `Promise` is similar, but again callback-based. The language " -"runtime implements the event loop, so many of the details of Promise " -"resolution are hidden." +"runtime implements the event loop, so many of the details of Promise resolution " +"are hidden." msgstr "" -"JavaScript 的 `Promise` 也是類似的概念,但仍是基於回呼函數。JavaScript 的語言" -"執行環境實作了事件迴圈(event loop),所以隱藏了很多關於 Promise 的處理細節。" +"JavaScript 的 `Promise` 也是類似的概念,但仍是基於回呼函數。JavaScript 的語言執" +"行環境實作了事件迴圈(event loop),所以隱藏了很多關於 Promise 的處理細節。" #: src/async/async-await.md msgid "" "At a high level, async Rust code looks very much like \"normal\" sequential " "code:" -msgstr "" -"從高層次的角度來看,非同步的 Rust 程式碼看起來很像「一般的」同步程式碼:" +msgstr "從高層次的角度來看,非同步的 Rust 程式碼看起來很像「一般的」同步程式碼:" #: src/async/async-await.md msgid "\"Count is: {i}!\"" @@ -20416,8 +20051,8 @@ msgid "" "Note that this is a simplified example to show the syntax. There is no long " "running operation or any real concurrency in it!" msgstr "" -"注意這只是一個簡化過的程式碼,目的是要示範程式語法。這份範例程式碼當中並沒有" -"需要長時間運行的操作,也沒有真正的併行處理!" +"注意這只是一個簡化過的程式碼,目的是要示範程式語法。這份範例程式碼當中並沒有需要" +"長時間運行的操作,也沒有真正的併行處理!" #: src/async/async-await.md msgid "What is the return type of an async call?" @@ -20430,15 +20065,15 @@ msgstr "在 `main` 函數中使用 `let feature: () = async_main(10);` 以查看 #: src/async/async-await.md #, fuzzy msgid "" -"The \"async\" keyword is syntactic sugar. The compiler replaces the return " -"type with a future." +"The \"async\" keyword is syntactic sugar. The compiler replaces the return type " +"with a future." msgstr "" "「async」這個關鍵字只是個程式碼語法糖。編譯器會將函數回傳型態以 future 取代。" #: src/async/async-await.md msgid "" -"You cannot make `main` async, without additional instructions to the " -"compiler on how to use the returned future." +"You cannot make `main` async, without additional instructions to the compiler " +"on how to use the returned future." msgstr "" "你不能把 `main` 函數標示成非同步函數,除非你對編譯器額外設定了如何處理回傳的 " "future 的方式。" @@ -20449,16 +20084,16 @@ msgid "" "You need an executor to run async code. `block_on` blocks the current thread " "until the provided future has run to completion." msgstr "" -"你需要處理器去執行非同步的程式碼。`block_on` 會阻塞當前的執行緒,直到 future " -"已執行完畢。" +"你需要處理器去執行非同步的程式碼。`block_on` 會阻塞當前的執行緒,直到 future 已" +"執行完畢。" #: src/async/async-await.md msgid "" -"`.await` asynchronously waits for the completion of another operation. " -"Unlike `block_on`, `.await` doesn't block the current thread." +"`.await` asynchronously waits for the completion of another operation. Unlike " +"`block_on`, `.await` doesn't block the current thread." msgstr "" -"`.await` 會非同步地等待其他操作執行完畢。別於 `block_on`,`.await` 不會阻塞當" -"前的執行緒。" +"`.await` 會非同步地等待其他操作執行完畢。別於 `block_on`,`.await` 不會阻塞當前" +"的執行緒。" #: src/async/async-await.md #, fuzzy @@ -20469,69 +20104,67 @@ msgstr "`.await` 只能用在 `async` 函數(或程式碼區塊,之後會介 #: src/async/futures.md msgid "" -"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) is a " -"trait, implemented by objects that represent an operation that may not be " -"complete yet. A future can be polled, and `poll` returns a [`Poll`](https://" -"doc.rust-lang.org/std/task/enum.Poll.html)." +"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) is a trait, " +"implemented by objects that represent an operation that may not be complete " +"yet. A future can be polled, and `poll` returns a [`Poll`](https://doc.rust-" +"lang.org/std/task/enum.Poll.html)." msgstr "" -"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) 是一種特" -"徵,物件實作這種特徵時,代表作業或許尚未完成。Future 可供輪詢,而 `poll` 會傳" -"回 [`Poll`](https://doc.rust-lang.org/std/task/enum.Poll.html)。" +"[`Future`](https://doc.rust-lang.org/std/future/trait.Future.html) 是一種特徵," +"物件實作這種特徵時,代表作業或許尚未完成。Future 可供輪詢,而 `poll` 會傳回 " +"[`Poll`](https://doc.rust-lang.org/std/task/enum.Poll.html)。" #: src/async/futures.md msgid "" -"An async function returns an `impl Future`. It's also possible (but " -"uncommon) to implement `Future` for your own types. For example, the " -"`JoinHandle` returned from `tokio::spawn` implements `Future` to allow " -"joining to it." +"An async function returns an `impl Future`. It's also possible (but uncommon) " +"to implement `Future` for your own types. For example, the `JoinHandle` " +"returned from `tokio::spawn` implements `Future` to allow joining to it." msgstr "" -"非同步函式會傳回 `impl Future`。您也可以為自己的型別實作 `Future`,但不常見。" -"舉例來說,從 `tokio::spawn` 傳回的 `JoinHandle` 會實作 `Future`,以便允許會" -"合。" +"非同步函式會傳回 `impl Future`。您也可以為自己的型別實作 `Future`,但不常見。舉" +"例來說,從 `tokio::spawn` 傳回的 `JoinHandle` 會實作 `Future`,以便允許會合。" #: src/async/futures.md msgid "" -"The `.await` keyword, applied to a Future, causes the current async function " -"to pause until that Future is ready, and then evaluates to its output." +"The `.await` keyword, applied to a Future, causes the current async function to " +"pause until that Future is ready, and then evaluates to its output." msgstr "" -"套用至 Future 的 `.await` 關鍵字會暫停目前的非同步函式,直到 Future 準備就" -"緒,接著則會計算其輸出內容。" +"套用至 Future 的 `.await` 關鍵字會暫停目前的非同步函式,直到 Future 準備就緒,接" +"著則會計算其輸出內容。" #: src/async/futures.md msgid "" -"The `Future` and `Poll` types are implemented exactly as shown; click the " -"links to show the implementations in the docs." +"The `Future` and `Poll` types are implemented exactly as shown; click the links " +"to show the implementations in the docs." msgstr "" "`Future` 和 `Poll` 型別的實作方式完全相同。點選連結即可在文件中查看實作方式。" #: src/async/futures.md msgid "" -"We will not get to `Pin` and `Context`, as we will focus on writing async " -"code, rather than building new async primitives. Briefly:" +"We will not get to `Pin` and `Context`, as we will focus on writing async code, " +"rather than building new async primitives. Briefly:" msgstr "" -"我們不會探討 `Pin` 和 `Context`,因為我們會專注於編寫非同步程式碼,而非建立新" -"的非同步基元。簡單來說:" +"我們不會探討 `Pin` 和 `Context`,因為我們會專注於編寫非同步程式碼,而非建立新的" +"非同步基元。簡單來說:" #: src/async/futures.md msgid "" -"`Context` allows a Future to schedule itself to be polled again when an " -"event occurs." +"`Context` allows a Future to schedule itself to be polled again when an event " +"occurs." msgstr "`Context` 允許 Future 在事件發生時安排自身再次接受輪詢。" #: src/async/futures.md msgid "" -"`Pin` ensures that the Future isn't moved in memory, so that pointers into " -"that future remain valid. This is required to allow references to remain " -"valid after an `.await`." +"`Pin` ensures that the Future isn't moved in memory, so that pointers into that " +"future remain valid. This is required to allow references to remain valid after " +"an `.await`." msgstr "" -"`Pin` 可確保 Future 在記憶體中不被移動,這樣該 Future 的指標仍維持有效。如要" -"允許參照在 `.await` 後持續有效,這麼做就有必要。" +"`Pin` 可確保 Future 在記憶體中不被移動,這樣該 Future 的指標仍維持有效。如要允許" +"參照在 `.await` 後持續有效,這麼做就有必要。" #: src/async/runtimes.md msgid "" "A _runtime_ provides support for performing operations asynchronously (a " -"_reactor_) and is responsible for executing futures (an _executor_). Rust " -"does not have a \"built-in\" runtime, but several options are available:" +"_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 沒有「內建」執行階段,但提供多種選項:" @@ -20542,17 +20175,17 @@ msgid "" "functionality like [Hyper](https://hyper.rs/) for HTTP or [Tonic](https://" "github.com/hyperium/tonic) for gRPC." msgstr "" -"[Tokio](https://tokio.rs/):效能良好,具有完善的功能生態系統,例如適用於 " -"HTTP 的 [Hyper](https://hyper.rs/),或適用於 gRPC 的 [Tonic](https://github." -"com/hyperium/tonic)。" +"[Tokio](https://tokio.rs/):效能良好,具有完善的功能生態系統,例如適用於 HTTP " +"的 [Hyper](https://hyper.rs/),或適用於 gRPC 的 [Tonic](https://github.com/" +"hyperium/tonic)。" #: src/async/runtimes.md msgid "" -"[async-std](https://async.rs/): aims to be a \"std for async\", and includes " -"a basic runtime in `async::task`." +"[async-std](https://async.rs/): aims to be a \"std for async\", and includes a " +"basic runtime in `async::task`." msgstr "" -"[async-std](https://async.rs/):目標是成為「async 的 std」,並在 `async::" -"task` 中含有基本執行環境。" +"[async-std](https://async.rs/):目標是成為「async 的 std」,並在 `async::task` " +"中含有基本執行環境。" #: src/async/runtimes.md msgid "[smol](https://docs.rs/smol/latest/smol/): simple and lightweight" @@ -20565,8 +20198,8 @@ msgid "" "async/src/lib.rs) already has one." msgstr "" "許多大型應用程式都有專屬的執行環境。例如,[Fuchsia](https://fuchsia." -"googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-async/src/lib.rs) " -"已有一個執行環境。" +"googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-async/src/lib.rs) 已" +"有一個執行環境。" #: src/async/runtimes.md msgid "" @@ -20574,19 +20207,18 @@ msgid "" "playground. The playground also does not permit any I/O, so most interesting " "async things can't run in the playground." msgstr "" -"請注意,在列出的執行環境中,Rust Playground 只支援 Tokio。Playground 也不允許" -"任何 I/O,因此大部分有趣的非同步作業皆無法在 Playground 中執行。" +"請注意,在列出的執行環境中,Rust Playground 只支援 Tokio。Playground 也不允許任" +"何 I/O,因此大部分有趣的非同步作業皆無法在 Playground 中執行。" #: src/async/runtimes.md msgid "" "Futures are \"inert\" in that they do not do anything (not even start an I/O " "operation) unless there is an executor polling them. This differs from JS " -"Promises, for example, which will run to completion even if they are never " -"used." +"Promises, for example, which will run to completion even if they are never used." msgstr "" -"除非接受執行器輪詢,否則 Future 不會執行任何作業 (甚至不會啟動 I/O 作業),因" -"此 Future 是「惰性」的。這一點與 JS Promise 不同。舉例來說,後者即使從未使用" -"過,仍會執行至完成為止。" +"除非接受執行器輪詢,否則 Future 不會執行任何作業 (甚至不會啟動 I/O 作業),因此 " +"Future 是「惰性」的。這一點與 JS Promise 不同。舉例來說,後者即使從未使用過,仍" +"會執行至完成為止。" #: src/async/runtimes/tokio.md msgid "Tokio provides:" @@ -20634,8 +20266,8 @@ msgid "" "cancellation. `tokio::spawn` returns a handle which can be awaited to wait " "until it finishes." msgstr "" -"為什麼 `count_to` (通常) 不會達到 10?這是非同步取消的例子。直到 `tokio::" -"spawn` 完成前,所傳回的控制代碼可以接受等待。" +"為什麼 `count_to` (通常) 不會達到 10?這是非同步取消的例子。直到 `tokio::spawn` " +"完成前,所傳回的控制代碼可以接受等待。" #: src/async/runtimes/tokio.md msgid "Try `count_to(10).await` instead of spawning." @@ -20651,15 +20283,14 @@ msgstr "Rust 的工作系統是採用輕量執行緒的形式。" #: src/async/tasks.md msgid "" -"A task has a single top-level future which the executor polls to make " -"progress. That future may have one or more nested futures that its `poll` " -"method polls, corresponding loosely to a call stack. Concurrency within a " -"task is possible by polling multiple child futures, such as racing a timer " -"and an I/O operation." +"A task has a single top-level future which the executor polls to make progress. " +"That future may have one or more nested futures that its `poll` method polls, " +"corresponding loosely to a call stack. Concurrency within a task is possible by " +"polling multiple child futures, such as racing a timer and an I/O operation." msgstr "" -"一項工作具有一個頂層 Future,執行器會輪詢該 Future 來推動進度。該 Future 可能" -"有一或多個巢狀 Future,供其 `poll` 方法輪詢,可約略對應至呼叫堆疊。藉由輪詢多" -"個子項 Future (例如競爭的計時器和 I/O 作業),即可在工作內實現並行機制。" +"一項工作具有一個頂層 Future,執行器會輪詢該 Future 來推動進度。該 Future 可能有" +"一或多個巢狀 Future,供其 `poll` 方法輪詢,可約略對應至呼叫堆疊。藉由輪詢多個子" +"項 Future (例如競爭的計時器和 I/O 作業),即可在工作內實現並行機制。" #: src/async/tasks.md msgid "\"127.0.0.1:0\"" @@ -20686,40 +20317,39 @@ msgid "\"Thanks for dialing in, {name}!\\n\"" msgstr "\"Thanks for dialing in, {name}!\\n\"" #: src/async/tasks.md src/async/control-flow/join.md -msgid "" -"Copy this example into your prepared `src/main.rs` and run it from there." +msgid "Copy this example into your prepared `src/main.rs` and run it from there." msgstr "將這個範例複製到準備好的 `src/main.rs`,然後從中執行。" #: src/async/tasks.md msgid "" -"Try connecting to it with a TCP connection tool like [nc](https://www.unix." -"com/man-page/linux/1/nc/) or [telnet](https://www.unix.com/man-page/linux/1/" +"Try connecting to it with a TCP connection tool like [nc](https://www.unix.com/" +"man-page/linux/1/nc/) or [telnet](https://www.unix.com/man-page/linux/1/" "telnet/)." msgstr "" -"請嘗試利用 TCP 連線工具來連線,例如 [nc](https://www.unix.com/man-page/" -"linux/1/nc/) 或 [telnet](https://www.unix.com/man-page/linux/1/telnet/)。" +"請嘗試利用 TCP 連線工具來連線,例如 [nc](https://www.unix.com/man-page/linux/1/" +"nc/) 或 [telnet](https://www.unix.com/man-page/linux/1/telnet/)。" #: src/async/tasks.md msgid "" -"Ask students to visualize what the state of the example server would be with " -"a few connected clients. What tasks exist? What are their Futures?" +"Ask students to visualize what the state of the example server would be with a " +"few connected clients. What tasks exist? What are their Futures?" msgstr "" -"請學生以圖像呈現範例伺服器具有幾個已連線用戶端時的狀態。會有哪些工作?Future " -"為何?" +"請學生以圖像呈現範例伺服器具有幾個已連線用戶端時的狀態。會有哪些工作?Future 為" +"何?" #: src/async/tasks.md msgid "" "This is the first time we've seen an `async` block. This is similar to a " -"closure, but does not take any arguments. Its return value is a Future, " -"similar to an `async fn`." +"closure, but does not take any arguments. Its return value is a Future, similar " +"to an `async fn`." msgstr "" "這是我們第一次看到 `async` 區塊,與閉包類似,但不接受任何引數。其回傳值為 " "Future,類似於 `async fn`。" #: src/async/tasks.md msgid "" -"Refactor the async block into a function, and improve the error handling " -"using `?`." +"Refactor the async block into a function, and improve the error handling using " +"`?`." msgstr "將非同步區塊重構為函式,並使用 `?` 改善錯誤處理機制。" #: src/async/channels.md @@ -20766,8 +20396,8 @@ msgstr "請嘗試移除 `std::mem::drop` 呼叫。會發生什麼情況?為什 #: src/async/channels.md msgid "" "The [Flume](https://docs.rs/flume/latest/flume/) crate has channels that " -"implement both `sync` and `async` `send` and `recv`. This can be convenient " -"for complex applications with both IO and heavy CPU processing tasks." +"implement both `sync` and `async` `send` and `recv`. This can be convenient for " +"complex applications with both IO and heavy CPU processing tasks." msgstr "" "[Flume](https://docs.rs/flume/latest/flume/) Crate 具有同時實作 `sync` 和 " "`async` 的 `send` 和 `recv` 的管道。對於有 IO 和大量 CPU 處理工作的複雜應用程" @@ -20775,12 +20405,11 @@ msgstr "" #: src/async/channels.md msgid "" -"What makes working with `async` channels preferable is the ability to " -"combine them with other `future`s to combine them and create complex control " -"flow." +"What makes working with `async` channels preferable is the ability to combine " +"them with other `future`s to combine them and create complex control flow." msgstr "" -"之所以較適合使用 `async` 管道,是因為這類管道能與其他 `future` 管道結合,進而" -"建立複雜的控制流程。" +"之所以較適合使用 `async` 管道,是因為這類管道能與其他 `future` 管道結合,進而建" +"立複雜的控制流程。" #: src/async/control-flow.md msgid "Futures Control Flow" @@ -20788,12 +20417,11 @@ msgstr "Future 控制流程" #: src/async/control-flow.md msgid "" -"Futures can be combined together to produce concurrent compute flow graphs. " -"We have already seen tasks, that function as independent threads of " -"execution." +"Futures can be combined together to produce concurrent compute flow graphs. We " +"have already seen tasks, that function as independent threads of execution." msgstr "" -"Future 可以合併,產生並行運算流程圖。我們已介紹過工作,工作的功能類似於獨立的" -"執行作業執行緒。" +"Future 可以合併,產生並行運算流程圖。我們已介紹過工作,工作的功能類似於獨立的執" +"行作業執行緒。" #: src/async/control-flow.md msgid "[Join](control-flow/join.md)" @@ -20805,9 +20433,9 @@ msgstr "[選取](control-flow/select.md)" #: src/async/control-flow/join.md msgid "" -"A join operation waits until all of a set of futures are ready, and returns " -"a collection of their results. This is similar to `Promise.all` in " -"JavaScript or `asyncio.gather` in Python." +"A join operation waits until all of a set of futures are ready, and returns a " +"collection of their results. This is similar to `Promise.all` in JavaScript or " +"`asyncio.gather` in Python." msgstr "" "會合作業會等待整個 Future 集合準備就緒,然後蒐集多個結果一次回傳。這類似於 " "JavaScript 中的 `Promise.all` 或 Python 中的 `asyncio.gather`。" @@ -20831,12 +20459,12 @@ msgstr "\"BAD_URL\"" #: src/async/control-flow/join.md msgid "" "For multiple futures of disjoint types, you can use `std::future::join!` but " -"you must know how many futures you will have at compile time. This is " -"currently in the `futures` crate, soon to be stabilised in `std::future`." +"you must know how many futures you will have at compile time. This is currently " +"in the `futures` crate, soon to be stabilised in `std::future`." msgstr "" -"若是多個不同型別的 Future,您可以使用 `std::future::join!`,但必須知道編譯時" -"會有多少 Future。這目前位於 `futures` Crate 中,不久後就會在 `std::future` 中" -"推出穩定版。" +"若是多個不同型別的 Future,您可以使用 `std::future::join!`,但必須知道編譯時會有" +"多少 Future。這目前位於 `futures` Crate 中,不久後就會在 `std::future` 中推出穩" +"定版。" #: src/async/control-flow/join.md msgid "" @@ -20846,34 +20474,33 @@ msgstr "`join` 的風險是某個 Future 可能無法解決,導致程式停滯 #: src/async/control-flow/join.md msgid "" -"You can also combine `join_all` with `join!` for instance to join all " -"requests to an http service as well as a database query. Try adding a " -"`tokio::time::sleep` to the future, using `futures::join!`. This is not a " -"timeout (that requires `select!`, explained in the next chapter), but " -"demonstrates `join!`." +"You can also combine `join_all` with `join!` for instance to join all requests " +"to an http service as well as a database query. Try adding a `tokio::time::" +"sleep` to the future, using `futures::join!`. This is not a timeout (that " +"requires `select!`, explained in the next chapter), but demonstrates `join!`." msgstr "" -"舉例來說,您也可以併用 `join_all` 和 `join!`,讓所有要求會合至 HTTP 服務和資" -"料庫查詢。請嘗試使用 `futures::join!`,將 `tokio::time::sleep` 新增至 " -"Future。這並非逾時 (逾時需要 `select!`,下一章會說明),而是示範 `join!`。" +"舉例來說,您也可以併用 `join_all` 和 `join!`,讓所有要求會合至 HTTP 服務和資料庫" +"查詢。請嘗試使用 `futures::join!`,將 `tokio::time::sleep` 新增至 Future。這並非" +"逾時 (逾時需要 `select!`,下一章會說明),而是示範 `join!`。" #: src/async/control-flow/select.md msgid "" -"A select operation waits until any of a set of futures is ready, and " -"responds to that future's result. In JavaScript, this is similar to `Promise." -"race`. In Python, it compares to `asyncio.wait(task_set, return_when=asyncio." +"A select operation waits until any of a set of futures is ready, and responds " +"to that future's result. In JavaScript, this is similar to `Promise.race`. In " +"Python, it compares to `asyncio.wait(task_set, return_when=asyncio." "FIRST_COMPLETED)`." msgstr "" -"選取作業會等到任何一組 Future 準備就緒,再針對該 Future 的結果提供回應。這類" -"似於 JavaScript 中的 `Promise.race`。在 Python 中,則可與 `asyncio." -"wait(task_set, return_when=asyncio.FIRST_COMPLETED)` 比較。" +"選取作業會等到任何一組 Future 準備就緒,再針對該 Future 的結果提供回應。這類似" +"於 JavaScript 中的 `Promise.race`。在 Python 中,則可與 `asyncio.wait(task_set, " +"return_when=asyncio.FIRST_COMPLETED)` 比較。" #: src/async/control-flow/select.md msgid "" -"Similar to a match statement, the body of `select!` has a number of arms, " -"each of the form `pattern = future => statement`. When a `future` is ready, " -"its return value is destructured by the `pattern`. The `statement` is then " -"run with the resulting variables. The `statement` result becomes the result " -"of the `select!` macro." +"Similar to a match statement, the body of `select!` has a number of arms, each " +"of the form `pattern = future => statement`. When a `future` is ready, its " +"return value is destructured by the `pattern`. The `statement` is then run with " +"the resulting variables. The `statement` result becomes the result of the " +"`select!` macro." msgstr "" "類似於比對陳述式,`select!` 的主體有多個分支,格式皆為 `pattern = future => " "statement`。當 `future` 準備就緒時,回傳值會由 `pattern` 解構。接著," @@ -20907,40 +20534,40 @@ msgstr "\"Winner is {winner:?}\"" #: src/async/control-flow/select.md msgid "" "In this example, we have a race between a cat and a dog. " -"`first_animal_to_finish_race` listens to both channels and will pick " -"whichever arrives first. Since the dog takes 50ms, it wins against the cat " -"that take 500ms." +"`first_animal_to_finish_race` listens to both channels and will pick whichever " +"arrives first. Since the dog takes 50ms, it wins against the cat that take " +"500ms." msgstr "" -"這個範例是貓狗賽跑。`first_animal_to_finish_race` 會監聽兩個管道,並挑選先抵" -"達者。狗花了 50 毫秒,因此贏過花費 500 毫秒的貓。" +"這個範例是貓狗賽跑。`first_animal_to_finish_race` 會監聽兩個管道,並挑選先抵達" +"者。狗花了 50 毫秒,因此贏過花費 500 毫秒的貓。" #: src/async/control-flow/select.md msgid "" -"You can use `oneshot` channels in this example as the channels are supposed " -"to receive only one `send`." +"You can use `oneshot` channels in this example as the channels are supposed to " +"receive only one `send`." msgstr "在這個範例中,您可以使用 `oneshot` 管道,因為管道只應接收一個 `send`。" #: src/async/control-flow/select.md msgid "" -"Try adding a deadline to the race, demonstrating selecting different sorts " -"of futures." +"Try adding a deadline to the race, demonstrating selecting different sorts of " +"futures." msgstr "嘗試為賽跑加上期限,示範選擇各種 Future 的情形。" #: src/async/control-flow/select.md msgid "" -"Note that `select!` drops unmatched branches, which cancels their futures. " -"It is easiest to use when every execution of `select!` creates new futures." +"Note that `select!` drops unmatched branches, which cancels their futures. It " +"is easiest to use when every execution of `select!` creates new futures." msgstr "" -"請注意,`select!` 會捨棄不相符的分支版本,這會取消 Future。若每次執行 " -"`select!` 時都會建立新的 Future,就最容易使用這種做法。" +"請注意,`select!` 會捨棄不相符的分支版本,這會取消 Future。若每次執行 `select!` " +"時都會建立新的 Future,就最容易使用這種做法。" #: src/async/control-flow/select.md msgid "" -"An alternative is to pass `&mut future` instead of the future itself, but " -"this can lead to issues, further discussed in the pinning slide." +"An alternative is to pass `&mut future` instead of the future itself, but this " +"can lead to issues, further discussed in the pinning slide." msgstr "" -"替代方法是傳遞 `&mut future`,而非傳遞 Future 本身,但這可能導致多項問題,詳" -"細討論請見 pinning 投影片。" +"替代方法是傳遞 `&mut future`,而非傳遞 Future 本身,但這可能導致多項問題,詳細討" +"論請見 pinning 投影片。" #: src/async/pitfalls.md msgid "Pitfalls of async/await" @@ -20979,13 +20606,11 @@ msgstr "阻塞執行器" #: src/async/pitfalls/blocking-executor.md msgid "" "Most async runtimes only allow IO tasks to run concurrently. This means that " -"CPU blocking tasks will block the executor and prevent other tasks from " -"being executed. An easy workaround is to use async equivalent methods where " -"possible." +"CPU blocking tasks will block the executor and prevent other tasks from being " +"executed. An easy workaround is to use async equivalent methods where possible." msgstr "" -"大多數非同步執行環境只允許並行執行 IO 工作。這表示阻塞 CPU 的工作會阻塞執行" -"器,不讓其他工作執行。一個簡單的解決方法,就是盡可能使用與非同步機制同等的方" -"法。" +"大多數非同步執行環境只允許並行執行 IO 工作。這表示阻塞 CPU 的工作會阻塞執行器," +"不讓其他工作執行。一個簡單的解決方法,就是盡可能使用與非同步機制同等的方法。" #: src/async/pitfalls/blocking-executor.md msgid "\"future {id} slept for {duration_ms}ms, finished after {}ms\"" @@ -21003,12 +20628,12 @@ msgstr "執行程式碼,然後您會發現休眠狀態是連續發生,而非 #: src/async/pitfalls/blocking-executor.md msgid "" -"The `\"current_thread\"` flavor puts all tasks on a single thread. This " -"makes the effect more obvious, but the bug is still present in the multi-" -"threaded flavor." +"The `\"current_thread\"` flavor puts all tasks on a single thread. This makes " +"the effect more obvious, but the bug is still present in the multi-threaded " +"flavor." msgstr "" -"`\"current_thread\"` 變種版本會將所有工作放在單一執行緒。這樣的效果更加明顯," -"但多執行緒變種版本仍存在該錯誤。" +"`\"current_thread\"` 變種版本會將所有工作放在單一執行緒。這樣的效果更加明顯,但" +"多執行緒變種版本仍存在該錯誤。" #: src/async/pitfalls/blocking-executor.md msgid "" @@ -21020,30 +20645,29 @@ msgid "" "Another fix would be to `tokio::task::spawn_blocking` which spawns an actual " "thread and transforms its handle into a future without blocking the executor." msgstr "" -"另一個修正方式為 `tokio::task::spawn_blocking`,這可產生實際執行緒,並將控制" -"代碼轉換為 Future,而不會阻塞執行器。" +"另一個修正方式為 `tokio::task::spawn_blocking`,這可產生實際執行緒,並將控制代碼" +"轉換為 Future,而不會阻塞執行器。" #: src/async/pitfalls/blocking-executor.md msgid "" "You should not think of tasks as OS threads. They do not map 1 to 1 and most " "executors will allow many tasks to run on a single OS thread. This is " -"particularly problematic when interacting with other libraries via FFI, " -"where that library might depend on thread-local storage or map to specific " -"OS threads (e.g., CUDA). Prefer `tokio::task::spawn_blocking` in such " -"situations." +"particularly problematic when interacting with other libraries via FFI, where " +"that library might depend on thread-local storage or map to specific OS threads " +"(e.g., CUDA). Prefer `tokio::task::spawn_blocking` in such situations." msgstr "" -"請勿將工作視為 OS 執行緒。工作不會 1 對 1 對應,且大部分執行器會允許在單一 " -"OS 執行緒中執行多項工作。在透過 FFI 與其他程式庫互動時,這尤其會造成問題,因" -"為程式庫可能會依附執行緒本機儲存空間,或對應至特定 OS 執行緒 (例如 CUDA)。在" -"這種情況下,請優先使用 `tokio::task::spawn_blocking`。" +"請勿將工作視為 OS 執行緒。工作不會 1 對 1 對應,且大部分執行器會允許在單一 OS 執" +"行緒中執行多項工作。在透過 FFI 與其他程式庫互動時,這尤其會造成問題,因為程式庫" +"可能會依附執行緒本機儲存空間,或對應至特定 OS 執行緒 (例如 CUDA)。在這種情況下," +"請優先使用 `tokio::task::spawn_blocking`。" #: src/async/pitfalls/blocking-executor.md msgid "" -"Use sync mutexes with care. Holding a mutex over an `.await` may cause " -"another task to block, and that task may be running on the same thread." +"Use sync mutexes with care. Holding a mutex over an `.await` may cause another " +"task to block, and that task may be running on the same thread." msgstr "" -"請謹慎使用同步互斥鎖。將互斥鎖保留在 `.await` 上,可能會導致其他工作造成阻" -"塞,且該工作可能在同一執行緒上執行。" +"請謹慎使用同步互斥鎖。將互斥鎖保留在 `.await` 上,可能會導致其他工作造成阻塞,且" +"該工作可能在同一執行緒上執行。" #: src/async/pitfalls/pin.md msgid "" @@ -21051,17 +20675,17 @@ msgid "" "type returned is the result of a compiler transformation which turns local " "variables into data stored inside the future." msgstr "" -"非同步區塊和函式會傳回實作 `Future` 特徵的型別。傳回的型別是編譯器轉換的結" -"果,會將本機變數轉換成在 Future 中儲存的資料。" +"非同步區塊和函式會傳回實作 `Future` 特徵的型別。傳回的型別是編譯器轉換的結果,會" +"將本機變數轉換成在 Future 中儲存的資料。" #: src/async/pitfalls/pin.md msgid "" -"Some of those variables can hold pointers to other local variables. Because " -"of that, the future should never be moved to a different memory location, as " -"it would invalidate those pointers." +"Some of those variables can hold pointers to other local variables. Because of " +"that, the future should never be moved to a different memory location, as it " +"would invalidate those pointers." msgstr "" -"其中一些變數可保留指向其他本機變數的指標。因此,Future 不應移至其他記憶體位" -"置,以免這些指標失效。" +"其中一些變數可保留指向其他本機變數的指標。因此,Future 不應移至其他記憶體位置," +"以免這些指標失效。" #: src/async/pitfalls/pin.md msgid "" @@ -21070,8 +20694,8 @@ msgid "" "operations that would move the instance it points to into a different memory " "location." msgstr "" -"為避免在記憶體中移動 Future 型別,此型別只能透過固定指標輪詢。`Pin` 是參照的" -"包裝函式,會禁止所有將所指向例項移至不同記憶體位置的作業。" +"為避免在記憶體中移動 Future 型別,此型別只能透過固定指標輪詢。`Pin` 是參照的包裝" +"函式,會禁止所有將所指向例項移至不同記憶體位置的作業。" #: src/async/pitfalls/pin.md msgid "" @@ -21121,8 +20745,8 @@ msgstr "您可以將此視為演員模型的例子。演員通常會在迴圈中 #: src/async/pitfalls/pin.md msgid "" -"This serves as a summation of a few of the previous lessons, so take your " -"time with it." +"This serves as a summation of a few of the previous lessons, so take your time " +"with it." msgstr "這彙整了先前幾堂課的內容,您可以放鬆慢慢做。" #: src/async/pitfalls/pin.md @@ -21134,15 +20758,13 @@ msgstr "" "`select!`。這永遠不會執行。為什麼?" #: src/async/pitfalls/pin.md -msgid "" -"Instead, add a `timeout_fut` containing that future outside of the `loop`:" +msgid "Instead, add a `timeout_fut` containing that future outside of the `loop`:" msgstr "請改為在 `loop` 之外新增含有該 Future 的 `timeout_fut`:" #: src/async/pitfalls/pin.md msgid "" "This still doesn't work. Follow the compiler errors, adding `&mut` to the " -"`timeout_fut` in the `select!` to work around the move, then using `Box::" -"pin`:" +"`timeout_fut` in the `select!` to work around the move, then using `Box::pin`:" msgstr "" "這樣還是無法運作。請根據編譯器錯誤,將 `&mut` 新增至 `select!` 中的 " "`timeout_fut` 來處理移動作業,然後使用 `Box::pin`:" @@ -21150,65 +20772,64 @@ msgstr "" #: src/async/pitfalls/pin.md msgid "" "This compiles, but once the timeout expires it is `Poll::Ready` on every " -"iteration (a fused future would help with this). Update to reset " -"`timeout_fut` every time it expires." +"iteration (a fused future would help with this). Update to reset `timeout_fut` " +"every time it expires." msgstr "" -"這樣可以編譯,但逾時到期後,每次疊代都會是 `Poll::Ready` (熔斷型 Future 有助" -"解決這個問題)。更新即可在每次到期時重設 `timeout_fut`。" +"這樣可以編譯,但逾時到期後,每次疊代都會是 `Poll::Ready` (熔斷型 Future 有助解決" +"這個問題)。更新即可在每次到期時重設 `timeout_fut`。" #: src/async/pitfalls/pin.md msgid "" "Box allocates on the heap. In some cases, `std::pin::pin!` (only recently " -"stabilized, with older code often using `tokio::pin!`) is also an option, " -"but that is difficult to use for a future that is reassigned." +"stabilized, with older code often using `tokio::pin!`) is also an option, but " +"that is difficult to use for a future that is reassigned." msgstr "" "Box 會在堆積上分配。在某些情況下,也可以採用 `std::pin::pin!` (最近才推出穩定" "版,舊版程式碼通常使用 `tokio::pin!`),但這不容易用於已重新指派的 Future。" #: src/async/pitfalls/pin.md msgid "" -"Another alternative is to not use `pin` at all but spawn another task that " -"will send to a `oneshot` channel every 100ms." +"Another alternative is to not use `pin` at all but spawn another task that will " +"send to a `oneshot` channel every 100ms." msgstr "" -"另一個替代方案是完全不使用 `pin`,改為產生另一項工作,該工作每 100 毫秒就會傳" -"送至 `oneshot` 管道。" +"另一個替代方案是完全不使用 `pin`,改為產生另一項工作,該工作每 100 毫秒就會傳送" +"至 `oneshot` 管道。" #: src/async/pitfalls/pin.md msgid "" -"Data that contains pointers to itself is called self-referential. Normally, " -"the Rust borrow checker would prevent self-referential data from being " -"moved, as the references cannot outlive the data they point to. However, the " -"code transformation for async blocks and functions is not verified by the " -"borrow checker." +"Data that contains pointers to itself is called self-referential. Normally, the " +"Rust borrow checker would prevent self-referential data from being moved, as " +"the references cannot outlive the data they point to. However, the code " +"transformation for async blocks and functions is not verified by the borrow " +"checker." msgstr "" -"包含指向自己的指標的資料稱為自我參照。一般而言,Rust 借用檢查器會禁止移動自我" -"參照資料,因為參照的留存時間不會超過其指向的資料。不過,非同步區塊和函式的程" -"式碼轉換不會由借用檢查器驗證。" +"包含指向自己的指標的資料稱為自我參照。一般而言,Rust 借用檢查器會禁止移動自我參" +"照資料,因為參照的留存時間不會超過其指向的資料。不過,非同步區塊和函式的程式碼轉" +"換不會由借用檢查器驗證。" #: src/async/pitfalls/pin.md msgid "" -"`Pin` is a wrapper around a reference. An object cannot be moved from its " -"place using a pinned pointer. However, it can still be moved through an " -"unpinned pointer." +"`Pin` is a wrapper around a reference. An object cannot be moved from its place " +"using a pinned pointer. However, it can still be moved through an unpinned " +"pointer." msgstr "" -"`Pin` 是參照的包裝函式。如要從現有位置移動物件,使用固定指標是行不通的。但若" -"使用未固定的指標,則仍可以移動物件。" +"`Pin` 是參照的包裝函式。如要從現有位置移動物件,使用固定指標是行不通的。但若使用" +"未固定的指標,則仍可以移動物件。" #: src/async/pitfalls/pin.md msgid "" -"The `poll` method of the `Future` trait uses `Pin<&mut Self>` instead of " -"`&mut Self` to refer to the instance. That's why it can only be called on a " -"pinned pointer." +"The `poll` method of the `Future` trait uses `Pin<&mut Self>` instead of `&mut " +"Self` to refer to the instance. That's why it can only be called on a pinned " +"pointer." msgstr "" "`Future` 特徵的 `poll` 方法是使用 `Pin<&mut Self>` 參照例項,而非使用 `&mut " "Self`。因此,您只能在固定指標上呼叫這個方法。" #: src/async/pitfalls/async-traits.md msgid "" -"Async methods in traits are were stabilized only recently, in the 1.75 " -"release. This required support for using return-position `impl Trait` (RPIT) " -"in traits, as the desugaring for `async fn` includes `-> impl Future`." +"Async methods in traits are were stabilized only recently, in the 1.75 release. " +"This required support for using return-position `impl Trait` (RPIT) in traits, " +"as the desugaring for `async fn` includes `-> impl Future`." msgstr "" #: src/async/pitfalls/async-traits.md @@ -21219,14 +20840,14 @@ msgstr "" #: src/async/pitfalls/async-traits.md msgid "" -"Return-position impl Trait captures all in-scope lifetimes (so some patterns " -"of borrowing cannot be expressed)" +"Return-position impl Trait captures all in-scope lifetimes (so some patterns of " +"borrowing cannot be expressed)" msgstr "" #: src/async/pitfalls/async-traits.md msgid "" -"Traits whose methods use return-position `impl trait` or `async` are not " -"`dyn` compatible." +"Traits whose methods use return-position `impl trait` or `async` are not `dyn` " +"compatible." msgstr "" #: src/async/pitfalls/async-traits.md @@ -21251,39 +20872,37 @@ msgid "" "`async_trait` is easy to use, but note that it's using heap allocations to " "achieve this. This heap allocation has performance overhead." msgstr "" -"`async_trait` 相當容易使用,但請注意,它是運用堆積分配來達成此效果。這種堆積" -"分配會造成效能負擔。" +"`async_trait` 相當容易使用,但請注意,它是運用堆積分配來達成此效果。這種堆積分配" +"會造成效能負擔。" #: src/async/pitfalls/async-traits.md msgid "" -"The challenges in language support for `async trait` are deep Rust and " -"probably not worth describing in-depth. Niko Matsakis did a good job of " -"explaining them in [this post](https://smallcultfollowing.com/babysteps/" -"blog/2019/10/26/async-fn-in-traits-are-hard/) if you are interested in " -"digging deeper." +"The challenges in language support for `async trait` are deep Rust and probably " +"not worth describing in-depth. Niko Matsakis did a good job of explaining them " +"in [this post](https://smallcultfollowing.com/babysteps/blog/2019/10/26/async-" +"fn-in-traits-are-hard/) if you are interested in digging deeper." msgstr "" -"有關 `async trait` 語言支援的困難處涉及艱深的 Rust,可能不適合深入介紹。如有" -"興趣深入探究,可以參閱 Niko Matsakis 的[這篇文章](https://smallcultfollowing." -"com/babysteps/blog/2019/10/26/async-fn-in-traits-are-hard/),說明得相當清楚。" +"有關 `async trait` 語言支援的困難處涉及艱深的 Rust,可能不適合深入介紹。如有興趣" +"深入探究,可以參閱 Niko Matsakis 的[這篇文章](https://smallcultfollowing.com/" +"babysteps/blog/2019/10/26/async-fn-in-traits-are-hard/),說明得相當清楚。" #: src/async/pitfalls/async-traits.md msgid "" -"Try creating a new sleeper struct that will sleep for a random amount of " -"time and adding it to the Vec." +"Try creating a new sleeper struct that will sleep for a random amount of time " +"and adding it to the Vec." msgstr "" -"嘗試建立新的休眠程式結構體,讓該結構體隨機決定休眠時間長度,然後將其新增至 " -"Vec。" +"嘗試建立新的休眠程式結構體,讓該結構體隨機決定休眠時間長度,然後將其新增至 Vec。" #: src/async/pitfalls/cancellation.md msgid "" "Dropping a future implies it can never be polled again. This is called " -"_cancellation_ and it can occur at any `await` point. Care is needed to " -"ensure the system works correctly even when futures are cancelled. For " -"example, it shouldn't deadlock or lose data." +"_cancellation_ and it can occur at any `await` point. Care is needed to ensure " +"the system works correctly even when futures are cancelled. For example, it " +"shouldn't deadlock or lose data." msgstr "" -"捨棄 Future 表示 Future 無法再供輪詢。這稱為「取消」,可能發生在任何 `await` " -"時間點。即使 Future 遭到取消,也需審慎確保系統正常運作,例如不應出現死結或遺" -"失資料。" +"捨棄 Future 表示 Future 無法再供輪詢。這稱為「取消」,可能發生在任何 `await` 時" +"間點。即使 Future 遭到取消,也需審慎確保系統正常運作,例如不應出現死結或遺失資" +"料。" #: src/async/pitfalls/cancellation.md msgid "\"not UTF-8\"" @@ -21302,13 +20921,13 @@ 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 msgid "" -"Unlike `panic` and `?`, cancellation is part of normal control flow (vs " -"error-handling)." +"Unlike `panic` and `?`, cancellation is part of normal control flow (vs error-" +"handling)." msgstr "與 `panic` 和 `?` 不同,取消是正常控制流程的一部分 (相較於錯誤處理)。" #: src/async/pitfalls/cancellation.md @@ -21317,14 +20936,12 @@ msgstr "此範例失去字串的某些部分。" #: src/async/pitfalls/cancellation.md msgid "" -"Whenever the `tick()` branch finishes first, `next()` and its `buf` are " -"dropped." +"Whenever the `tick()` branch finishes first, `next()` and its `buf` are dropped." msgstr "每當 `tick()` 分支版本先完成時,`next()` 和其 `buf` 都會遭到捨棄。" #: src/async/pitfalls/cancellation.md msgid "" -"`LinesReader` can be made cancellation-safe by making `buf` part of the " -"struct:" +"`LinesReader` can be made cancellation-safe by making `buf` part of the struct:" msgstr "`LinesReader` 可讓 `buf` 成為結構體的一部分,確保安全的取消作業:" #: src/async/pitfalls/cancellation.md @@ -21334,21 +20951,20 @@ msgstr "// prefix buf and bytes with self.\n" #: src/async/pitfalls/cancellation.md msgid "" "[`Interval::tick`](https://docs.rs/tokio/latest/tokio/time/struct.Interval." -"html#method.tick) is cancellation-safe because it keeps track of whether a " -"tick has been 'delivered'." +"html#method.tick) is cancellation-safe because it keeps track of whether a tick " +"has been 'delivered'." msgstr "" "[`Interval::tick`](https://docs.rs/tokio/latest/tokio/time/struct.Interval." "html#method.tick) 會追蹤滴答是否「已送達」,因此可確保安全的取消作業。" #: src/async/pitfalls/cancellation.md msgid "" -"[`AsyncReadExt::read`](https://docs.rs/tokio/latest/tokio/io/trait." -"AsyncReadExt.html#method.read) is cancellation-safe because it either " -"returns or doesn't read data." +"[`AsyncReadExt::read`](https://docs.rs/tokio/latest/tokio/io/trait.AsyncReadExt." +"html#method.read) is cancellation-safe because it either returns or doesn't " +"read data." msgstr "" -"[`AsyncReadExt::read`](https://docs.rs/tokio/latest/tokio/io/trait." -"AsyncReadExt.html#method.read)od.read) 只會傳回資料或不讀取資料,因此可確保安" -"全的取消作業。" +"[`AsyncReadExt::read`](https://docs.rs/tokio/latest/tokio/io/trait.AsyncReadExt." +"html#method.read)od.read) 只會傳回資料或不讀取資料,因此可確保安全的取消作業。" #: src/async/pitfalls/cancellation.md msgid "" @@ -21361,24 +20977,21 @@ msgstr "" "業。如要瞭解詳情和替代方案,請參閱說明文件。" #: src/exercises/concurrency/afternoon.md -msgid "" -"To practice your Async Rust skills, we have again two exercises for you:" +msgid "To practice your Async Rust skills, we have again two exercises for you:" msgstr "為幫助您練習非同步 Rust 技巧,我們再次提供了兩項練習:" #: src/exercises/concurrency/afternoon.md msgid "" -"Dining philosophers: we already saw this problem in the morning. This time " -"you are going to implement it with Async Rust." -msgstr "" -"哲學家就餐問題:我們早上已看過這個練習題,這次要使用非同步 Rust 來實作。" +"Dining philosophers: we already saw this problem in the morning. This time you " +"are going to implement it with Async Rust." +msgstr "哲學家就餐問題:我們早上已看過這個練習題,這次要使用非同步 Rust 來實作。" #: src/exercises/concurrency/afternoon.md msgid "" "A Broadcast Chat Application: this is a larger project that allows you " "experiment with more advanced Async Rust features." msgstr "" -"廣播即時通訊應用程式:利用這項大型專案,您可以嘗試使用更進階的非同步 Rust 功" -"能。" +"廣播即時通訊應用程式:利用這項大型專案,您可以嘗試使用更進階的非同步 Rust 功能。" #: src/exercises/concurrency/dining-philosophers-async.md msgid "Dining Philosophers --- Async" @@ -21393,12 +21006,12 @@ msgstr "請參閱[哲學家就餐問題](dining-philosophers.md),查看題目 #: src/exercises/concurrency/dining-philosophers-async.md msgid "" "As before, you will need a local [Cargo installation](../../cargo/running-" -"locally.md) for this exercise. Copy the code below to a file called `src/" -"main.rs`, fill out the blanks, and test that `cargo run` does not deadlock:" +"locally.md) for this exercise. Copy the code below to a file called `src/main." +"rs`, fill out the blanks, and test that `cargo run` does not deadlock:" msgstr "" -"和之前一樣,這項練習需要在本機[安裝 Cargo](../../cargo/running-locally.md)。" -"請將以下程式碼複製到名為 `src/main.rs` 的檔案、填寫空白處,然後測試 `cargo " -"run` 不會發生死結:" +"和之前一樣,這項練習需要在本機[安裝 Cargo](../../cargo/running-locally.md)。請將" +"以下程式碼複製到名為 `src/main.rs` 的檔案、填寫空白處,然後測試 `cargo run` 不會" +"發生死結:" #: src/exercises/concurrency/dining-philosophers-async.md #: src/exercises/concurrency/solutions-afternoon.md @@ -21412,8 +21025,8 @@ msgstr "// Make them think and eat\n" #: src/exercises/concurrency/dining-philosophers-async.md msgid "" -"Since this time you are using Async Rust, you'll need a `tokio` dependency. " -"You can use the following `Cargo.toml`:" +"Since this time you are using Async Rust, you'll need a `tokio` dependency. You " +"can use the following `Cargo.toml`:" msgstr "" "這次是使用非同步 Rust,因此會需要 `tokio` 依附元件。您可以使用下列 `Cargo." "toml`:" @@ -21444,8 +21057,8 @@ msgstr "" #: src/exercises/concurrency/dining-philosophers-async.md msgid "" -"Also note that this time you have to use the `Mutex` and the `mpsc` module " -"from the `tokio` crate." +"Also note that this time you have to use the `Mutex` and the `mpsc` module from " +"the `tokio` crate." msgstr "另請注意,這次必須使用 `tokio` Crate 中的 `Mutex` 和 `mpsc` 模組。" #: src/exercises/concurrency/dining-philosophers-async.md @@ -21455,21 +21068,20 @@ msgstr "您的實作項目能否採用單一執行緒?" #: src/exercises/concurrency/chat-app.md msgid "" "In this exercise, we want to use our new knowledge to implement a broadcast " -"chat application. We have a chat server that the clients connect to and " -"publish their messages. The client reads user messages from the standard " -"input, and sends them to the server. The chat server broadcasts each message " -"that it receives to all the clients." +"chat application. We have a chat server that the clients connect to and publish " +"their messages. The client reads user messages from the standard input, and " +"sends them to the server. The chat server broadcasts each message that it " +"receives to all the clients." msgstr "" -"在本練習中,我們要運用所學的新知識,實作廣播即時通訊應用程式。我們有一個即時" -"通訊伺服器,供用戶端連線和發布訊息。用戶端會從標準輸入內容讀取使用者訊息,然" -"後將訊息傳送至伺服器。即時通訊伺服器會將收到的每則訊息播送至所有用戶端。" +"在本練習中,我們要運用所學的新知識,實作廣播即時通訊應用程式。我們有一個即時通訊" +"伺服器,供用戶端連線和發布訊息。用戶端會從標準輸入內容讀取使用者訊息,然後將訊息" +"傳送至伺服器。即時通訊伺服器會將收到的每則訊息播送至所有用戶端。" #: src/exercises/concurrency/chat-app.md msgid "" -"For this, we use [a broadcast channel](https://docs.rs/tokio/latest/tokio/" -"sync/broadcast/fn.channel.html) on the server, and [`tokio_websockets`]" -"(https://docs.rs/tokio-websockets/) for the communication between the client " -"and the server." +"For this, we use [a broadcast channel](https://docs.rs/tokio/latest/tokio/sync/" +"broadcast/fn.channel.html) on the server, and [`tokio_websockets`](https://docs." +"rs/tokio-websockets/) for the communication between the client and the server." msgstr "" "為此,我們會使用伺服器上的[廣播通道](https://docs.rs/tokio/latest/tokio/sync/" "broadcast/fn.channel.html) 和 [`tokio_websockets`](https://docs.rs/tokio-" @@ -21495,8 +21107,8 @@ msgid "" "futures-util = { version = \"0.3.30\", features = [\"sink\"] }\n" "http = \"1.0.0\"\n" "tokio = { version = \"1.36.0\", features = [\"full\"] }\n" -"tokio-websockets = { version = \"0.7.0\", features = [\"client\", " -"\"fastrand\", \"server\", \"sha1_smol\"] }\n" +"tokio-websockets = { version = \"0.7.0\", features = [\"client\", \"fastrand\", " +"\"server\", \"sha1_smol\"] }\n" "```" msgstr "" "```toml\n" @@ -21509,8 +21121,8 @@ msgstr "" "futures-util = { version = \"0.3.30\", features = [\"sink\"] }\n" "http = \"1.0.0\"\n" "tokio = { version = \"1.36.0\", features = [\"full\"] }\n" -"tokio-websockets = { version = \"0.7.0\", features = [\"client\", " -"\"fastrand\", \"server\", \"sha1_smol\"] }\n" +"tokio-websockets = { version = \"0.7.0\", features = [\"client\", \"fastrand\", " +"\"server\", \"sha1_smol\"] }\n" "```" #: src/exercises/concurrency/chat-app.md @@ -21520,11 +21132,11 @@ msgstr "所需 API" #: src/exercises/concurrency/chat-app.md msgid "" "You are going to need the following functions from `tokio` and " -"[`tokio_websockets`](https://docs.rs/tokio-websockets/). Spend a few minutes " -"to familiarize yourself with the API." +"[`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-websockets/) " -"中的以下函式。請花幾分鐘熟悉此 API。" +"您會需要 `tokio` 和 [`tokio_websockets`](https://docs.rs/tokio-websockets/) 中的" +"以下函式。請花幾分鐘熟悉此 API。" #: src/exercises/concurrency/chat-app.md msgid "" @@ -21533,18 +21145,18 @@ msgid "" "asynchronously reading messages from a Websocket Stream." msgstr "" "由 `WebSocketStream` 實作的 [StreamExt::next()](https://docs.rs/futures-" -"util/0.3.28/futures_util/stream/trait.StreamExt.html#method.next):用於非同步" -"讀取 WebSocket 串流中的訊息。" +"util/0.3.28/futures_util/stream/trait.StreamExt.html#method.next):用於非同步讀" +"取 WebSocket 串流中的訊息。" #: src/exercises/concurrency/chat-app.md msgid "" -"[SinkExt::send()](https://docs.rs/futures-util/0.3.28/futures_util/sink/" -"trait.SinkExt.html#method.send) implemented by `WebSocketStream`: for " -"asynchronously sending messages on a Websocket Stream." +"[SinkExt::send()](https://docs.rs/futures-util/0.3.28/futures_util/sink/trait." +"SinkExt.html#method.send) implemented by `WebSocketStream`: for asynchronously " +"sending messages on a Websocket Stream." msgstr "" "由 `WebSocketStream` 實作的 [SinkExt::send()](https://docs.rs/futures-" -"util/0.3.28/futures_util/sink/trait.SinkExt.html#method.send):用於在 " -"WebSocket 串流中非同步傳送訊息。" +"util/0.3.28/futures_util/sink/trait.SinkExt.html#method.send):用於在 WebSocket " +"串流中非同步傳送訊息。" #: src/exercises/concurrency/chat-app.md msgid "" @@ -21557,11 +21169,11 @@ msgstr "" #: src/exercises/concurrency/chat-app.md msgid "" -"[Sender::subscribe()](https://docs.rs/tokio/latest/tokio/sync/broadcast/" -"struct.Sender.html#method.subscribe): for subscribing to a broadcast channel." +"[Sender::subscribe()](https://docs.rs/tokio/latest/tokio/sync/broadcast/struct." +"Sender.html#method.subscribe): for subscribing to a broadcast channel." msgstr "" -"[Sender::subscribe()](https://docs.rs/tokio/latest/tokio/sync/broadcast/" -"struct.Sender.html#method.subscribe):用於訂閱廣播管道。" +"[Sender::subscribe()](https://docs.rs/tokio/latest/tokio/sync/broadcast/struct." +"Sender.html#method.subscribe):用於訂閱廣播管道。" #: src/exercises/concurrency/chat-app.md msgid "Two binaries" @@ -21572,25 +21184,25 @@ msgid "" "Normally in a Cargo project, you can have only one binary, and one `src/main." "rs` file. In this project, we need two binaries. One for the client, and one " "for the server. You could potentially make them two separate Cargo projects, " -"but we are going to put them in a single Cargo project with two binaries. " -"For this to work, the client and the server code should go under `src/bin` " -"(see the [documentation](https://doc.rust-lang.org/cargo/reference/cargo-" -"targets.html#binaries))." +"but we are going to put them in a single Cargo project with two binaries. For " +"this to work, the client and the server code should go under `src/bin` (see the " +"[documentation](https://doc.rust-lang.org/cargo/reference/cargo-targets." +"html#binaries))." msgstr "" -"在 Cargo 專案中,通常只能有一個二進位檔,以及一個 `src/main.rs` 檔案。這項專" -"案需要兩個二進位檔,一個用於用戶端,另一個用於伺服器。您可以設為兩個不同的 " -"Cargo 專案,但我們會放入包含兩個二進位檔的單一 Cargo 專案。為順利運作,用戶端" -"和伺服器程式碼應位於 `src/bin` 下方 (請參閱[說明文件](https://doc.rust-lang." -"org/cargo/reference/cargo-targets.html#binaries))。" +"在 Cargo 專案中,通常只能有一個二進位檔,以及一個 `src/main.rs` 檔案。這項專案需" +"要兩個二進位檔,一個用於用戶端,另一個用於伺服器。您可以設為兩個不同的 Cargo 專" +"案,但我們會放入包含兩個二進位檔的單一 Cargo 專案。為順利運作,用戶端和伺服器程" +"式碼應位於 `src/bin` 下方 (請參閱[說明文件](https://doc.rust-lang.org/cargo/" +"reference/cargo-targets.html#binaries))。" #: src/exercises/concurrency/chat-app.md msgid "" -"Copy the following server and client code into `src/bin/server.rs` and `src/" -"bin/client.rs`, respectively. Your task is to complete these files as " -"described below." +"Copy the following server and client code into `src/bin/server.rs` and `src/bin/" +"client.rs`, respectively. Your task is to complete these files as described " +"below." msgstr "" -"請將以下伺服器和用戶端程式碼分別複製到 `src/bin/server.rs` 和 `src/bin/" -"client.rs` 中。請按照下方說明完成這些檔案。" +"請將以下伺服器和用戶端程式碼分別複製到 `src/bin/server.rs` 和 `src/bin/client." +"rs` 中。請按照下方說明完成這些檔案。" #: src/exercises/concurrency/chat-app.md #: src/exercises/concurrency/solutions-afternoon.md @@ -21653,9 +21265,8 @@ msgid "" "continuous loop. One task receives messages from the client and broadcasts " "them. The other sends messages received by the server to the client." msgstr "" -"提示:使用 `tokio::select!` 即可在連續迴圈中並行執行兩項工作。一項工作會收到" -"來自用戶端的訊息,然後播送訊息。另一項工作則是將伺服器收到的訊息傳送至用戶" -"端。" +"提示:使用 `tokio::select!` 即可在連續迴圈中並行執行兩項工作。一項工作會收到來自" +"用戶端的訊息,然後播送訊息。另一項工作則是將伺服器收到的訊息傳送至用戶端。" #: src/exercises/concurrency/chat-app.md msgid "Complete the main function in `src/bin/client.rs`." @@ -21664,13 +21275,13 @@ msgstr "完成 `src/bin/client.rs` 中的主函式。" #: src/exercises/concurrency/chat-app.md msgid "" "Hint: As before, use `tokio::select!` in a continuous loop for concurrently " -"performing two tasks: (1) reading user messages from standard input and " -"sending them to the server, and (2) receiving messages from the server, and " -"displaying them for the user." +"performing two tasks: (1) reading user messages from standard input and sending " +"them to the server, and (2) receiving messages from the server, and displaying " +"them for the user." msgstr "" -"提示:和先前一樣,在連續迴圈中使用 `tokio::select!` 並行執行兩項工作:(1) 從" -"標準輸入內容讀取使用者訊息,然後將訊息傳送至伺服器;(2) 接收來自伺服器的訊" -"息,並向使用者顯示訊息。" +"提示:和先前一樣,在連續迴圈中使用 `tokio::select!` 並行執行兩項工作:(1) 從標準" +"輸入內容讀取使用者訊息,然後將訊息傳送至伺服器;(2) 接收來自伺服器的訊息,並向使" +"用者顯示訊息。" #: src/exercises/concurrency/chat-app.md msgid "" @@ -21743,30 +21354,29 @@ msgstr "\"From server: {}\"" #: src/thanks.md msgid "" -"_Thank you for taking Comprehensive Rust 🦀!_ We hope you enjoyed it and " -"that it was useful." -msgstr "" -"感謝您參加 Comprehensive Rust 🦀 課程!__希望您喜歡這門課,並能學以致用。" +"_Thank you for taking Comprehensive Rust 🦀!_ We hope you enjoyed it and that " +"it was useful." +msgstr "感謝您參加 Comprehensive Rust 🦀 課程!__希望您喜歡這門課,並能學以致用。" #: src/thanks.md msgid "" -"We've had a lot of fun putting the course together. The course is not " -"perfect, so if you spotted any mistakes or have ideas for improvements, " -"please get in [contact with us on GitHub](https://github.com/google/" -"comprehensive-rust/discussions). We would love to hear from you." +"We've had a lot of fun putting the course together. The course is not perfect, " +"so if you spotted any mistakes or have ideas for improvements, 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)。我們很樂於傾聽您的意見!" +"我們在整合課程時獲得許多樂趣。但這門課並非完美無缺,因此您若發現任何錯誤,或有改" +"善的想法,歡迎[透過 GitHub 與我們聯絡](https://github.com/google/comprehensive-" +"rust/discussions)。我們很樂於傾聽您的意見!" #: src/glossary.md msgid "" -"The following is a glossary which aims to give a short definition of many " -"Rust terms. For translations, this also serves to connect the term back to " -"the English original." +"The following is a glossary which aims to give a short definition of many Rust " +"terms. For translations, this also serves to connect the term back to the " +"English original." msgstr "" -"以下詞彙解釋的目標是提供許多 Rust 詞彙的簡短定義。對翻譯而言,也可以補充說明" -"詞彙的英文原意。" +"以下詞彙解釋的目標是提供許多 Rust 詞彙的簡短定義。對翻譯而言,也可以補充說明詞彙" +"的英文原意。" #: src/glossary.md msgid "" @@ -21791,8 +21401,8 @@ msgid "" "system. See [Bare-metal Rust](bare-metal.md)." msgstr "" "Rust 裸機開發:\n" -"低階 Rust 開發作業,通常是部署至沒有作業系統的系統。請參閱 [Rust 裸機開發]" -"(bare-metal.md)相關課程。" +"低階 Rust 開發作業,通常是部署至沒有作業系統的系統。請參閱 [Rust 裸機開發](bare-" +"metal.md)相關課程。" #: src/glossary.md msgid "" @@ -21829,8 +21439,7 @@ msgstr "" #: src/glossary.md msgid "" "build: \n" -"The process of converting source code into executable code or a usable " -"program." +"The process of converting source code into executable code or a usable program." msgstr "" "建構:\n" "將原始碼轉換為可執行的程式碼或可使用的程式的程序。" @@ -21886,8 +21495,8 @@ msgstr "" #: src/glossary.md msgid "" "control flow: \n" -"The order in which the individual statements or instructions are executed in " -"a program." +"The order in which the individual statements or instructions are executed in a " +"program." msgstr "" "控制流程:\n" "個別陳述式或指示在程式中執行的順序。" @@ -21945,8 +21554,8 @@ msgstr "" #: src/glossary.md msgid "" "garbage collector: \n" -"A mechanism that automatically frees up memory occupied by objects that are " -"no longer in use." +"A mechanism that automatically frees up memory occupied by objects that are no " +"longer in use." msgstr "" "垃圾收集器:\n" "此機制會自動釋出不再使用的物件所占用的記憶體。" @@ -21954,12 +21563,11 @@ msgstr "" #: src/glossary.md msgid "" "generics: \n" -"A feature that allows writing code with placeholders for types, enabling " -"code reuse with different data types." +"A feature that allows writing code with placeholders for types, enabling code " +"reuse with different data types." msgstr "" "泛型:\n" -"這項功能允許為型別使用預留位置編寫程式碼,方便搭配不同資料型別重複使用程式" -"碼。" +"這項功能允許為型別使用預留位置編寫程式碼,方便搭配不同資料型別重複使用程式碼。" #: src/glossary.md msgid "" @@ -21998,9 +21606,9 @@ msgstr "" #: src/glossary.md msgid "" "macro: \n" -"Rust macros can be recognized by a `!` in the name. Macros are used when " -"normal functions are not enough. A typical example is `format!`, which takes " -"a variable number of arguments, which isn't supported by Rust functions." +"Rust macros can be recognized by a `!` in the name. Macros are used when normal " +"functions are not enough. A typical example is `format!`, which takes a " +"variable number of arguments, which isn't supported by Rust functions." msgstr "" "巨集:\n" "名稱中有 `!`,即為 Rust 巨集。當一般函式不夠用時,就會使用巨集。常見例子為 " @@ -22017,8 +21625,8 @@ msgstr "" #: src/glossary.md msgid "" "match: \n" -"A control flow construct in Rust that allows for pattern matching on the " -"value of an expression." +"A control flow construct in Rust that allows for pattern matching on the value " +"of an expression." msgstr "" "配對:\n" "Rust 中的控制流程結構,允許對運算式的值執行模式配對作業。" @@ -22026,8 +21634,8 @@ msgstr "" #: src/glossary.md msgid "" "memory leak: \n" -"A situation where a program fails to release memory that is no longer " -"needed, leading to a gradual increase in memory usage." +"A situation where a program fails to release memory that is no longer needed, " +"leading to a gradual increase in memory usage." msgstr "" "記憶體流失:\n" "程式無法釋放不再需要的記憶體,導致記憶體用量逐步增加。" @@ -22043,8 +21651,8 @@ msgstr "" #: src/glossary.md msgid "" "module: \n" -"A namespace that contains definitions, such as functions, types, or traits, " -"to organize code in Rust." +"A namespace that contains definitions, such as functions, types, or traits, to " +"organize code in Rust." msgstr "" "模組:\n" "包含函式、型別或特徵等定義的命名空間,用於整理 Rust 中的程式碼。" @@ -22078,8 +21686,8 @@ msgstr "" #: src/glossary.md msgid "" "panic: \n" -"An unrecoverable error condition in Rust that results in the termination of " -"the program." +"An unrecoverable error condition in Rust that results in the termination of the " +"program." msgstr "" "恐慌:\n" "Rust 中無法復原的錯誤狀況,導致程式終止。" @@ -22095,8 +21703,8 @@ msgstr "" #: src/glossary.md msgid "" "pattern: \n" -"A combination of values, literals, or structures that can be matched against " -"an expression in Rust." +"A combination of values, literals, or structures that can be matched against an " +"expression in Rust." msgstr "" "模式:\n" "值、常值或結構體的組合,可以與 Rust 中的運算式配對。" @@ -22112,8 +21720,8 @@ msgstr "" #: src/glossary.md msgid "" "program: \n" -"A set of instructions that a computer can execute to perform a specific task " -"or solve a particular problem." +"A set of instructions that a computer can execute to perform a specific task or " +"solve a particular problem." msgstr "" "程式:\n" "可供電腦執行的一組指示,用來執行特定工作或解決特定問題。" @@ -22129,8 +21737,8 @@ msgstr "" #: src/glossary.md msgid "" "receiver: \n" -"The first parameter in a Rust method that represents the instance on which " -"the method is called." +"The first parameter in a Rust method that represents the instance on which the " +"method is called." msgstr "" "接收器:\n" "Rust 方法中的第一個參數,代表呼叫該方法的例項。" @@ -22138,8 +21746,8 @@ msgstr "" #: src/glossary.md msgid "" "reference counting: \n" -"A memory management technique in which the number of references to an object " -"is tracked, and the object is deallocated when the count reaches zero." +"A memory management technique in which the number of references to an object is " +"tracked, and the object is deallocated when the count reaches zero." msgstr "" "參照計數:\n" "這種記憶體管理技術會追蹤物件的參照數量,並在計數達到零時取消分配物件。" @@ -22188,8 +21796,8 @@ msgstr "" #: src/glossary.md msgid "" "safe: \n" -"Refers to code that adheres to Rust's ownership and borrowing rules, " -"preventing memory-related errors." +"Refers to code that adheres to Rust's ownership and borrowing rules, preventing " +"memory-related errors." msgstr "" "安全:\n" "指符合 Rust 擁有權和借用規則的程式碼,可避免記憶體相關錯誤。" @@ -22222,18 +21830,18 @@ msgstr "" #: src/glossary.md msgid "" "string: \n" -"A data type storing textual data. See [`String` vs `str`](basic-syntax/" -"string-slices.html) for more." +"A data type storing textual data. See [`String` vs `str`](basic-syntax/string-" +"slices.html) for more." msgstr "" "字串:\n" -"儲存文本資料的資料型別。詳情請參閱[比較 `String` 與 `str`](basic-syntax/" -"string-slices.html) 的相關課程。" +"儲存文本資料的資料型別。詳情請參閱[比較 `String` 與 `str`](basic-syntax/string-" +"slices.html) 的相關課程。" #: src/glossary.md msgid "" "struct: \n" -"A composite data type in Rust that groups together variables of different " -"types under a single name." +"A composite data type in Rust that groups together variables of different types " +"under a single name." msgstr "" "結構體:\n" "Rust 中的複合資料型別,能以一個名稱將不同型別的變數歸入同一組。" @@ -22241,8 +21849,7 @@ msgstr "" #: src/glossary.md msgid "" "test: \n" -"A Rust module containing functions that test the correctness of other " -"functions." +"A Rust module containing functions that test the correctness of other functions." msgstr "" "測試:\n" "Rust 模組,其中的函式可測試其他函式的正確性。" @@ -22267,8 +21874,8 @@ msgstr "" #: src/glossary.md msgid "" "trait: \n" -"A collection of methods defined for an unknown type, providing a way to " -"achieve polymorphism in Rust." +"A collection of methods defined for an unknown type, providing a way to achieve " +"polymorphism in Rust." msgstr "" "特徵:\n" "為不明型別定義的一系列方法,可在 Rust 中實現多型。" @@ -22285,8 +21892,8 @@ msgstr "" #: src/glossary.md msgid "" "tuple: \n" -"A composite data type that contains variables of different types. Tuple " -"fields have no names, and are accessed by their ordinal numbers." +"A composite data type that contains variables of different types. Tuple fields " +"have no names, and are accessed by their ordinal numbers." msgstr "" "元組:\n" "包含各種變數的複合資料型別。元組欄位沒有名稱,可透過序數存取。" @@ -22294,8 +21901,8 @@ msgstr "" #: src/glossary.md msgid "" "type: \n" -"A classification that specifies which operations can be performed on values " -"of a particular kind in Rust." +"A classification that specifies which operations can be performed on values of " +"a particular kind in Rust." msgstr "" "型別:\n" "一種分類機制,能指定在 Rust 特定種類的值中可執行哪些作業。" @@ -22303,8 +21910,7 @@ msgstr "" #: src/glossary.md msgid "" "type inference: \n" -"The ability of the Rust compiler to deduce the type of a variable or " -"expression." +"The ability of the Rust compiler to deduce the type of a variable or expression." msgstr "" "型別推斷:\n" "Rust 編譯器功能,可推斷變數或運算式的型別。" @@ -22312,8 +21918,8 @@ msgstr "" #: src/glossary.md msgid "" "undefined behavior: \n" -"Actions or conditions in Rust that have no specified result, often leading " -"to unpredictable program behavior." +"Actions or conditions in Rust that have no specified result, often leading to " +"unpredictable program behavior." msgstr "" "未定義的行為:\n" "Rust 中未定義結果的動作或條件,經常導致無法預測的程式行為。" @@ -22351,8 +21957,7 @@ msgid "" "[Unsafe Rust](unsafe.html)." msgstr "" "不安全:\n" -"這個 Rust 子集可觸發「未定義的行為」。請參閱「[不安全的 Rust](unsafe." -"html)」。" +"這個 Rust 子集可觸發「未定義的行為」。請參閱「[不安全的 Rust](unsafe.html)」。" #: src/glossary.md msgid "" @@ -22382,39 +21987,39 @@ msgstr "Rust 專案中有許多資源。您可以透過這些資源瞭解 Rust #: src/other-resources.md msgid "" -"[The Rust Programming Language](https://doc.rust-lang.org/book/): the " -"canonical free book about Rust. Covers the language in detail and includes a " -"few projects for people to build." +"[The Rust Programming Language](https://doc.rust-lang.org/book/): the canonical " +"free book about Rust. Covers the language in detail and includes a few projects " +"for people to build." msgstr "" -"[The Rust Programming Language](https://doc.rust-lang.org/book/):Rust 的免費" -"標準用書,詳細介紹這個語言的種種知識,也收錄了一些可供使用者建構的專案。" +"[The Rust Programming Language](https://doc.rust-lang.org/book/):Rust 的免費標" +"準用書,詳細介紹這個語言的種種知識,也收錄了一些可供使用者建構的專案。" #: src/other-resources.md msgid "" -"[Rust By Example](https://doc.rust-lang.org/rust-by-example/): covers the " -"Rust syntax via a series of examples which showcase different constructs. " -"Sometimes includes small exercises where you are asked to expand on the code " -"in the examples." +"[Rust By Example](https://doc.rust-lang.org/rust-by-example/): covers the Rust " +"syntax via a series of examples which showcase different constructs. Sometimes " +"includes small exercises where you are asked to expand on the code in the " +"examples." msgstr "" -"[Rust By Example](https://doc.rust-lang.org/rust-by-example/):透過一系列範例" -"示範不同結構,進而介紹 Rust 語法。偶爾也會提供牛刀小試的練習,請您擴寫範例的" -"程式碼。" +"[Rust By Example](https://doc.rust-lang.org/rust-by-example/):透過一系列範例示" +"範不同結構,進而介紹 Rust 語法。偶爾也會提供牛刀小試的練習,請您擴寫範例的程式" +"碼。" #: src/other-resources.md msgid "" -"[Rust Standard Library](https://doc.rust-lang.org/std/): full documentation " -"of the standard library for Rust." +"[Rust Standard Library](https://doc.rust-lang.org/std/): full documentation of " +"the standard library for Rust." msgstr "" -"[Rust Standard Library](https://doc.rust-lang.org/std/):Rust 標準程式庫的完" -"整說明文件。" +"[Rust Standard Library](https://doc.rust-lang.org/std/):Rust 標準程式庫的完整說" +"明文件。" #: src/other-resources.md msgid "" -"[The Rust Reference](https://doc.rust-lang.org/reference/): an incomplete " -"book which describes the Rust grammar and memory model." +"[The Rust Reference](https://doc.rust-lang.org/reference/): an incomplete book " +"which describes the Rust grammar and memory model." msgstr "" -"[The Rust Reference](https://doc.rust-lang.org/reference/):本書並不完整,但" -"會說明 Rust 文法和記憶體模型。" +"[The Rust Reference](https://doc.rust-lang.org/reference/):本書並不完整,但會說" +"明 Rust 文法和記憶體模型。" #: src/other-resources.md msgid "More specialized guides hosted on the official Rust site:" @@ -22423,11 +22028,10 @@ msgstr "在 Rust 官方網站上還有更多專業指南:" #: src/other-resources.md msgid "" "[The Rustonomicon](https://doc.rust-lang.org/nomicon/): covers unsafe Rust, " -"including working with raw pointers and interfacing with other languages " -"(FFI)." +"including working with raw pointers and interfacing with other languages (FFI)." msgstr "" -"[The Rustonomicon](https://doc.rust-lang.org/nomicon/):說明不安全的 Rust,包" -"括如何使用原始指標並與其他語言 (FFI) 互動。" +"[The Rustonomicon](https://doc.rust-lang.org/nomicon/):說明不安全的 Rust,包括" +"如何使用原始指標並與其他語言 (FFI) 互動。" #: src/other-resources.md msgid "" @@ -22435,17 +22039,16 @@ msgid "" "covers the new asynchronous programming model which was introduced after the " "Rust Book was written." msgstr "" -"[Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/):" -"主要探討在 Rust 標準用書出版後問世的全新非同步程式設計模型。" +"[Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/):主" +"要探討在 Rust 標準用書出版後問世的全新非同步程式設計模型。" #: src/other-resources.md msgid "" -"[The Embedded Rust Book](https://doc.rust-lang.org/stable/embedded-book/): " -"an introduction to using Rust on embedded devices without an operating " -"system." +"[The Embedded Rust Book](https://doc.rust-lang.org/stable/embedded-book/): an " +"introduction to using Rust on embedded devices without an operating system." msgstr "" -"[The Embedded Rust Book](https://doc.rust-lang.org/stable/embedded-book/):說" -"明如何在沒有作業系統的內嵌裝置上使用 Rust。" +"[The Embedded Rust Book](https://doc.rust-lang.org/stable/embedded-book/):說明" +"如何在沒有作業系統的內嵌裝置上使用 Rust。" #: src/other-resources.md msgid "Unofficial Learning Material" @@ -22460,84 +22063,83 @@ msgid "" "[Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/): covers Rust " "from the perspective of low-level C programmers." msgstr "" -"[Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/):以低階 C 程" -"式設計師的角度介紹 Rust。" +"[Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/):以低階 C 程式設" +"計師的角度介紹 Rust。" #: src/other-resources.md msgid "" "[Rust for Embedded C Programmers](https://docs.opentitan.org/doc/ug/" -"rust_for_c/): covers Rust from the perspective of developers who write " -"firmware in C." +"rust_for_c/): covers Rust from the perspective of developers who write firmware " +"in C." msgstr "" "[Rust for Embedded C Programmers](https://docs.opentitan.org/doc/ug/" "rust_for_c/):從以 C 語言編寫韌體的開發人員角度介紹 Rust。" #: src/other-resources.md msgid "" -"[Rust for professionals](https://overexact.com/rust-for-professionals/): " -"covers the syntax of Rust using side-by-side comparisons with other " -"languages such as C, C++, Java, JavaScript, and Python." +"[Rust for professionals](https://overexact.com/rust-for-professionals/): covers " +"the syntax of Rust using side-by-side comparisons with other languages such as " +"C, C++, Java, JavaScript, and Python." msgstr "" -"[Rust for professionals](https://overexact.com/rust-for-professionals/):利用" -"與其他語言 (例如 C、C++、Java、JavaScript 和 Python) 並列比較的方式介紹 Rust " -"語法。" +"[Rust for professionals](https://overexact.com/rust-for-professionals/):利用與" +"其他語言 (例如 C、C++、Java、JavaScript 和 Python) 並列比較的方式介紹 Rust 語" +"法。" #: src/other-resources.md msgid "" "[Rust on Exercism](https://exercism.org/tracks/rust): 100+ exercises to help " "you learn Rust." msgstr "" -"[Rust on Exercism](https://exercism.org/tracks/rust):提供超過 100 項練習幫助" -"您學習 Rust。" +"[Rust on Exercism](https://exercism.org/tracks/rust):提供超過 100 項練習幫助您" +"學習 Rust。" #: src/other-resources.md msgid "" -"[Ferrous Teaching Material](https://ferrous-systems.github.io/teaching-" -"material/index.html): a series of small presentations covering both basic " -"and advanced part of the Rust language. Other topics such as WebAssembly, " -"and async/await are also covered." +"[Ferrous Teaching Material](https://ferrous-systems.github.io/teaching-material/" +"index.html): a series of small presentations covering both basic and advanced " +"part of the Rust language. Other topics such as WebAssembly, and async/await " +"are also covered." msgstr "" -"[Ferrous Teaching Material](https://ferrous-systems.github.io/teaching-" -"material/index.html):一系列精簡簡報,涵蓋 Rust 語言的基礎和進階部分,並說明 " -"WebAssembly 和 async/await 等其他主題。" +"[Ferrous Teaching Material](https://ferrous-systems.github.io/teaching-material/" +"index.html):一系列精簡簡報,涵蓋 Rust 語言的基礎和進階部分,並說明 WebAssembly " +"和 async/await 等其他主題。" #: src/other-resources.md msgid "" "[Beginner's Series to Rust](https://docs.microsoft.com/en-us/shows/beginners-" -"series-to-rust/) and [Take your first steps with Rust](https://docs." -"microsoft.com/en-us/learn/paths/rust-first-steps/): two Rust guides aimed at " -"new developers. The first is a set of 35 videos and the second is a set of " -"11 modules which covers Rust syntax and basic constructs." +"series-to-rust/) and [Take your first steps with Rust](https://docs.microsoft." +"com/en-us/learn/paths/rust-first-steps/): two Rust guides aimed at new " +"developers. The first is a set of 35 videos and the second is a set of 11 " +"modules which covers Rust syntax and basic constructs." msgstr "" -"「[Rust 初學者系列](https://docs.microsoft.com/zh-TW/shows/beginners-series-" -"to-rust/)」和「[使用 Rust 邁出您的第一步](https://docs.microsoft.com/zh-TW/" -"learn/paths/rust-first-steps/)」:專為新手開發人員編寫的兩份 Rust 指南。前者" -"包含一套 35 部的影片,後者則是一套 11 個模組的課程,探討 Rust 語法和基本結" -"構。" +"「[Rust 初學者系列](https://docs.microsoft.com/zh-TW/shows/beginners-series-to-" +"rust/)」和「[使用 Rust 邁出您的第一步](https://docs.microsoft.com/zh-TW/learn/" +"paths/rust-first-steps/)」:專為新手開發人員編寫的兩份 Rust 指南。前者包含一套 " +"35 部的影片,後者則是一套 11 個模組的課程,探討 Rust 語法和基本結構。" #: src/other-resources.md msgid "" -"[Learn Rust With Entirely Too Many Linked Lists](https://rust-unofficial." -"github.io/too-many-lists/): in-depth exploration of Rust's memory management " -"rules, through implementing a few different types of list structures." +"[Learn Rust With Entirely Too Many Linked Lists](https://rust-unofficial.github." +"io/too-many-lists/): in-depth exploration of Rust's memory management rules, " +"through implementing a few different types of list structures." msgstr "" -"[Learn Rust With Entirely Too Many Linked Lists](https://rust-unofficial." -"github.io/too-many-lists/):透過實作幾種不同型別的清單結構,深入探討 Rust 的" -"記憶體管理規則。" +"[Learn Rust With Entirely Too Many Linked Lists](https://rust-unofficial.github." +"io/too-many-lists/):透過實作幾種不同型別的清單結構,深入探討 Rust 的記憶體管理" +"規則。" #: src/other-resources.md msgid "" -"Please see the [Little Book of Rust Books](https://lborb.github.io/book/) " -"for even more Rust books." +"Please see the [Little Book of Rust Books](https://lborb.github.io/book/) for " +"even more Rust books." msgstr "" -"如需更多 Rust 相關書籍,請參閱 [Little Book of Rust Books](https://lborb." -"github.io/book/)。" +"如需更多 Rust 相關書籍,請參閱 [Little Book of Rust Books](https://lborb.github." +"io/book/)。" #: src/credits.md msgid "" "The material here builds on top of the many great sources of Rust " -"documentation. See the page on [other resources](other-resources.md) for a " -"full list of useful resources." +"documentation. See the page on [other resources](other-resources.md) for a full " +"list of useful resources." msgstr "" "這份教材是以許多優質的 Rust 說明文件來源為基礎。請參閱 [其他資源](other-" "resources.md) 頁面,查看完整的實用資源清單。" @@ -22549,8 +22151,8 @@ msgid "" "rust/blob/main/LICENSE) for details." msgstr "" "Comprehensive Rust 的教材是根據 Apache 授權條款第 2.0 版取得授權,詳情請參閱 " -"[`LICENSE`](https://github.com/google/comprehensive-rust/blob/main/LICENSE) " -"頁面。" +"[`LICENSE`](https://github.com/google/comprehensive-rust/blob/main/LICENSE) 頁" +"面。" #: src/credits.md msgid "Rust by Example" @@ -22558,14 +22160,13 @@ msgstr "Rust by Example" #: src/credits.md msgid "" -"Some examples and exercises have been copied and adapted from [Rust by " -"Example](https://doc.rust-lang.org/rust-by-example/). Please see the " -"`third_party/rust-by-example/` directory for details, including the license " -"terms." +"Some examples and exercises have been copied and adapted from [Rust by Example]" +"(https://doc.rust-lang.org/rust-by-example/). Please see the `third_party/rust-" +"by-example/` directory for details, including the license terms." msgstr "" "部分範例和習題是複製自 [Rust by Example](https://doc.rust-lang.org/rust-by-" -"example/),並經過調整。詳情請參閱 `third_party/rust-by-example/` 目錄,包括授" -"權條款。" +"example/),並經過調整。詳情請參閱 `third_party/rust-by-example/` 目錄,包括授權" +"條款。" #: src/credits.md msgid "Rust on Exercism" @@ -22577,9 +22178,8 @@ msgid "" "exercism.org/tracks/rust). Please see the `third_party/rust-on-exercism/` " "directory for details, including the license terms." msgstr "" -"部分習題是複製自 [Exercism 上的 Rust](https://exercism.org/tracks/rust) 相關" -"內容,並經過調整。詳情請參閱 `third_party/rust-on-exercism/` 目錄,包括授權條" -"款。" +"部分習題是複製自 [Exercism 上的 Rust](https://exercism.org/tracks/rust) 相關內" +"容,並經過調整。詳情請參閱 `third_party/rust-on-exercism/` 目錄,包括授權條款。" #: src/credits.md msgid "CXX" @@ -22587,13 +22187,13 @@ msgstr "CXX" #: src/credits.md msgid "" -"The [Interoperability with C++](android/interoperability/cpp.md) section " -"uses an image from [CXX](https://cxx.rs/). Please see the `third_party/cxx/` " +"The [Interoperability with C++](android/interoperability/cpp.md) section uses " +"an image from [CXX](https://cxx.rs/). Please see the `third_party/cxx/` " "directory for details, including the license terms." msgstr "" -"在「互通性」該節的「[與 C++](android/interoperability/cpp.md)」部分中,所使用" -"的圖片是出自 [CXX](https://cxx.rs/)。詳情請參閱 `third_party/cxx/` 目錄,包括" -"授權條款。" +"在「互通性」該節的「[與 C++](android/interoperability/cpp.md)」部分中,所使用的" +"圖片是出自 [CXX](https://cxx.rs/)。詳情請參閱 `third_party/cxx/` 目錄,包括授權" +"條款。" #~ msgid "Small Example" #~ msgstr "簡短範例" @@ -22911,20 +22511,20 @@ msgstr "" #~ "(but any LSP compatible editor works)." #~ msgstr "" #~ "這樣一來,\\[rust-analyzer\\]\\[1\\] 就能跳至定義。建議您使用 [VS Code]" -#~ "(https://code.visualstudio.com/) 編輯程式碼,不過任何與 LSP 相容的編輯器都" -#~ "能運作。" +#~ "(https://code.visualstudio.com/) 編輯程式碼,不過任何與 LSP 相容的編輯器都能" +#~ "運作。" #~ msgid "" #~ "Some folks also like to use the [JetBrains](https://www.jetbrains.com/" #~ "clion/) family of IDEs, which do their own analysis but have their own " -#~ "tradeoffs. If you prefer them, you can install the [Rust Plugin](https://" -#~ "www.jetbrains.com/rust/). Please take note that as of January 2023 " -#~ "debugging only works on the CLion version of the JetBrains IDEA suite." +#~ "tradeoffs. If you prefer them, you can install the [Rust Plugin](https://www." +#~ "jetbrains.com/rust/). Please take note that as of January 2023 debugging " +#~ "only works on the CLion version of the JetBrains IDEA suite." #~ msgstr "" -#~ "有些人也偏好使用 [JetBrains](https://www.jetbrains.com/clion/) 系列的 " -#~ "IDE,這些工具會自行分析,但也各有缺點。如果您偏好這些工具,可以安裝 [Rust " -#~ "外掛程式](https://www.jetbrains.com/rust/)。請注意,自 2023 年 1 月起,偵" -#~ "錯功能僅適用於 JetBrains IDEA 套件的 CLion 版本。" +#~ "有些人也偏好使用 [JetBrains](https://www.jetbrains.com/clion/) 系列的 IDE,這" +#~ "些工具會自行分析,但也各有缺點。如果您偏好這些工具,可以安裝 [Rust 外掛程式]" +#~ "(https://www.jetbrains.com/rust/)。請注意,自 2023 年 1 月起,偵錯功能僅適用" +#~ "於 JetBrains IDEA 套件的 CLion 版本。" #~ msgid "" #~ "```rust,editable\n" @@ -23033,12 +22633,11 @@ msgstr "" #~ "了。Rust 處理記憶體的方式是一大特色,我們應該立即向學生展示這一點。" #~ msgid "" -#~ "If you're teaching this in a classroom, this is a good place to go over " -#~ "the schedule. We suggest splitting the day into two parts (following the " -#~ "slides):" +#~ "If you're teaching this in a classroom, this is a good place to go over the " +#~ "schedule. We suggest splitting the day into two parts (following the slides):" #~ msgstr "" -#~ "如果您是在教室授課,就很適合參考這裡的時間表。建議您將一天分為兩部分 (根據" -#~ "投影片安排):" +#~ "如果您是在教室授課,就很適合參考這裡的時間表。建議您將一天分為兩部分 (根據投" +#~ "影片安排):" #~ msgid "Morning: 9:00 to 12:00," #~ msgstr "上午:9 點到 12 點" @@ -23050,8 +22649,7 @@ msgstr "" #~ "You can of course adjust this as necessary. Please make sure to include " #~ "breaks, we recommend a break every hour!" #~ msgstr "" -#~ "您當然可以視需要調整這個時間表。但請務必要加入休息時段,建議每小時休息一" -#~ "次!" +#~ "您當然可以視需要調整這個時間表。但請務必要加入休息時段,建議每小時休息一次!" #~ msgid "Here is a small example program in Rust:" #~ msgstr "以下是使用 Rust 語言的簡短範例程式:" @@ -23066,33 +22664,32 @@ msgstr "" #~ msgid "" #~ "Explain that all variables are statically typed. Try removing `i32` to " -#~ "trigger type inference. Try with `i8` instead and trigger a runtime " -#~ "integer overflow." +#~ "trigger type inference. Try with `i8` instead and trigger a runtime integer " +#~ "overflow." #~ msgstr "" -#~ "解釋所有變數都是靜態的。試著移除 `i32` 來觸發型別推斷。接著嘗試改用 `i8`," -#~ "並觸發執行階段的整數溢位現象。" +#~ "解釋所有變數都是靜態的。試著移除 `i32` 來觸發型別推斷。接著嘗試改用 `i8`,並" +#~ "觸發執行階段的整數溢位現象。" #~ msgid "Change `let mut x` to `let x`, discuss the compiler error." #~ msgstr "將 `let mut x` 改為 `let x`,討論編譯器錯誤。" #~ msgid "" -#~ "Show how `print!` gives a compilation error if the arguments don't match " -#~ "the format string." +#~ "Show how `print!` gives a compilation error if the arguments don't match the " +#~ "format string." #~ msgstr "說明如果引數與格式字串不符,`print!` 會如何呈現編譯錯誤。" #~ msgid "" #~ "Show how you need to use `{}` as a placeholder if you want to print an " #~ "expression which is more complex than just a single variable." -#~ msgstr "" -#~ "說明要輸出比單一變數更複雜的運算式時,需如何使用 `{}` 做為預留位置。" +#~ msgstr "說明要輸出比單一變數更複雜的運算式時,需如何使用 `{}` 做為預留位置。" #~ msgid "" #~ "Show the students the standard library, show them how to search for `std::" #~ "fmt` which has the rules of the formatting mini-language. It's important " #~ "that the students become familiar with searching in the standard library." #~ msgstr "" -#~ "向學生介紹標準程式庫,示範如何搜尋具有格式化迷你語言規則的 `std::fmt`。請" -#~ "務必確保學生熟悉如何在標準程式庫中搜尋。" +#~ "向學生介紹標準程式庫,示範如何搜尋具有格式化迷你語言規則的 `std::fmt`。請務必" +#~ "確保學生熟悉如何在標準程式庫中搜尋。" #~ msgid "Compile time memory safety." #~ msgstr "在編譯期間確保記憶體安全性。" @@ -23116,51 +22713,50 @@ msgstr "" #~ msgid "" #~ "You can use [`Box::leak`](https://doc.rust-lang.org/std/boxed/struct.Box." -#~ "html#method.leak) to leak a pointer. A use of this could be to get " -#~ "runtime-initialized and runtime-sized static variables" +#~ "html#method.leak) to leak a pointer. A use of this could be to get runtime-" +#~ "initialized and runtime-sized static variables" #~ msgstr "" #~ "您可能會使用 [`Box::leak`](https://doc.rust-lang.org/std/boxed/struct.Box." -#~ "html#method.leak),以致洩漏指標。如果您為了取得在執行階段中初始化或設定大" -#~ "小的靜態變數,就可能發生這個情況。" +#~ "html#method.leak),以致洩漏指標。如果您為了取得在執行階段中初始化或設定大小的" +#~ "靜態變數,就可能發生這個情況。" #~ msgid "" -#~ "You can use [`std::mem::forget`](https://doc.rust-lang.org/std/mem/fn." -#~ "forget.html) to make the compiler \"forget\" about a value (meaning the " -#~ "destructor is never run)." +#~ "You can use [`std::mem::forget`](https://doc.rust-lang.org/std/mem/fn.forget." +#~ "html) to make the compiler \"forget\" about a value (meaning the destructor " +#~ "is never run)." #~ msgstr "" #~ "您可能會透過 [`std::mem::forget`](https://doc.rust-lang.org/std/mem/fn." #~ "forget.html) 讓編譯器「忘記」某個值 (亦即解構函式永遠不會執行)。" #~ msgid "" -#~ "You can also accidentally create a [reference cycle](https://doc.rust-" -#~ "lang.org/book/ch15-06-reference-cycles.html) with `Rc` or `Arc`." +#~ "You can also accidentally create a [reference cycle](https://doc.rust-lang." +#~ "org/book/ch15-06-reference-cycles.html) with `Rc` or `Arc`." #~ msgstr "" -#~ "您也可能會不小心使用 `Rc` 或 `Arc` 建立[參照循環](https://doc.rust-lang." -#~ "org/book/ch15-06-reference-cycles.html)。" +#~ "您也可能會不小心使用 `Rc` 或 `Arc` 建立[參照循環](https://doc.rust-lang.org/" +#~ "book/ch15-06-reference-cycles.html)。" #~ msgid "" -#~ "In fact, some will consider infinitely populating a collection a memory " -#~ "leak and Rust does not protect from those." +#~ "In fact, some will consider infinitely populating a collection a memory leak " +#~ "and Rust does not protect from those." #~ msgstr "" -#~ "事實上,有些人會認為無限地填充集合是一種記憶體流失,而 Rust 並不能避免這種" -#~ "情況。" +#~ "事實上,有些人會認為無限地填充集合是一種記憶體流失,而 Rust 並不能避免這種情" +#~ "況。" #~ msgid "" -#~ "For the purpose of this course, \"No memory leaks\" should be understood " -#~ "as \"Pretty much no _accidental_ memory leaks\"." +#~ "For the purpose of this course, \"No memory leaks\" should be understood as " +#~ "\"Pretty much no _accidental_ memory leaks\"." #~ msgstr "" -#~ "因此,以本課程的宗旨來說,「沒有記憶體流失」應理解為「幾乎沒有『意外的』記" -#~ "憶體流失」。" +#~ "因此,以本課程的宗旨來說,「沒有記憶體流失」應理解為「幾乎沒有『意外的』記憶" +#~ "體流失」。" #~ msgid "" -#~ "Bounds checking cannot be disabled with a compiler flag. It can also not " -#~ "be disabled directly with the `unsafe` keyword. However, `unsafe` allows " -#~ "you to call functions such as `slice::get_unchecked` which does not do " -#~ "bounds checking." +#~ "Bounds checking cannot be disabled with a compiler flag. It can also not be " +#~ "disabled directly with the `unsafe` keyword. However, `unsafe` allows you to " +#~ "call functions such as `slice::get_unchecked` which does not do bounds " +#~ "checking." #~ msgstr "" -#~ "您無法使用編譯器參數停用邊界檢查,也無法直接透過 `unsafe` 關鍵字停用。不" -#~ "過,您可以使用 `unsafe` 呼叫 `slice::get_unchecked` 這類不執行邊界檢查的函" -#~ "式。" +#~ "您無法使用編譯器參數停用邊界檢查,也無法直接透過 `unsafe` 關鍵字停用。不過," +#~ "您可以使用 `unsafe` 呼叫 `slice::get_unchecked` 這類不執行邊界檢查的函式。" #~ msgid "Language Features" #~ msgstr "語言特色" @@ -23169,40 +22765,40 @@ msgstr "" #~ msgstr "工具" #~ msgid "" -#~ "Zero-cost abstractions, similar to C++, means that you don't have to " -#~ "'pay' for higher-level programming constructs with memory or CPU. For " -#~ "example, writing a loop using `for` should result in roughly the same low " -#~ "level instructions as using the `.iter().fold()` construct." +#~ "Zero-cost abstractions, similar to C++, means that you don't have to 'pay' " +#~ "for higher-level programming constructs with memory or CPU. For example, " +#~ "writing a loop using `for` should result in roughly the same low level " +#~ "instructions as using the `.iter().fold()` construct." #~ msgstr "" -#~ "與 C++ 類似,零成本抽象化機制是指您不必為使用記憶體或 CPU 的高階程式設計結" -#~ "構「付費」。舉例來說,使用 `for` 編寫迴圈時,應產生與使用 `.iter()." -#~ "fold()` 結構大致相同的低階指示。" +#~ "與 C++ 類似,零成本抽象化機制是指您不必為使用記憶體或 CPU 的高階程式設計結構" +#~ "「付費」。舉例來說,使用 `for` 編寫迴圈時,應產生與使用 `.iter().fold()` 結構" +#~ "大致相同的低階指示。" #~ msgid "" -#~ "It may be worth mentioning that Rust enums are 'Algebraic Data Types', " -#~ "also known as 'sum types', which allow the type system to express things " -#~ "like `Option` and `Result`." +#~ "It may be worth mentioning that Rust enums are 'Algebraic Data Types', also " +#~ "known as 'sum types', which allow the type system to express things like " +#~ "`Option` and `Result`." #~ msgstr "" -#~ "值得一提的是,Rust 列舉屬於「代數資料型別」(也稱為「加總型別」),可讓型別" -#~ "系統表達 `Option` 和 `Result` 等項目。" +#~ "值得一提的是,Rust 列舉屬於「代數資料型別」(也稱為「加總型別」),可讓型別系統" +#~ "表達 `Option` 和 `Result` 等項目。" #~ msgid "" #~ "Remind people to read the errors --- many developers have gotten used to " #~ "ignore lengthy compiler output. The Rust compiler is significantly more " -#~ "talkative than other compilers. It will often provide you with " -#~ "_actionable_ feedback, ready to copy-paste into your code." +#~ "talkative than other compilers. It will often provide you with _actionable_ " +#~ "feedback, ready to copy-paste into your code." #~ msgstr "" -#~ "提醒使用者詳讀錯誤訊息,許多開發人員已習慣忽略冗長的編譯器輸出結果。Rust " -#~ "編譯器的表達能力比其他編譯器高出許多,通常都會提供「實用」的意見回饋,您可" -#~ "以直接將其複製貼到程式碼中。" +#~ "提醒使用者詳讀錯誤訊息,許多開發人員已習慣忽略冗長的編譯器輸出結果。Rust 編譯" +#~ "器的表達能力比其他編譯器高出許多,通常都會提供「實用」的意見回饋,您可以直接" +#~ "將其複製貼到程式碼中。" #~ msgid "" -#~ "The Rust standard library is small compared to languages like Java, " -#~ "Python, and Go. Rust does not come with several things you might consider " -#~ "standard and essential:" +#~ "The Rust standard library is small compared to languages like Java, Python, " +#~ "and Go. Rust does not come with several things you might consider standard " +#~ "and essential:" #~ msgstr "" -#~ "與 Java、Python 和 Go 等語言相比,Rust 標準程式庫較小。Rust 並不提供某些您" -#~ "可能認為是標準和基本項目的內容:" +#~ "與 Java、Python 和 Go 等語言相比,Rust 標準程式庫較小。Rust 並不提供某些您可" +#~ "能認為是標準和基本項目的內容:" #~ msgid "a random number generator, but see [rand](https://docs.rs/rand/)." #~ msgstr "隨機號碼產生器,請參閱 [rand](https://docs.rs/rand/)。" @@ -23216,35 +22812,35 @@ msgstr "" #~ msgid "" #~ "The reasoning behind this is that functionality in the standard library " #~ "cannot go away, so it has to be very stable. For the examples above, the " -#~ "Rust community is still working on finding the best solution --- and " -#~ "perhaps there isn't a single \"best solution\" for some of these things." +#~ "Rust community is still working on finding the best solution --- and perhaps " +#~ "there isn't a single \"best solution\" for some of these things." #~ msgstr "" -#~ "未提供此支援的原因是,標準程式庫中的功能無法移除,因此必須相當穩定。對於以" -#~ "上範例,Rust 社群仍在努力尋找最佳解決方案,但其中某幾個例子或許並沒有單一" -#~ "的「最佳解決方案」。" +#~ "未提供此支援的原因是,標準程式庫中的功能無法移除,因此必須相當穩定。對於以上" +#~ "範例,Rust 社群仍在努力尋找最佳解決方案,但其中某幾個例子或許並沒有單一的「最" +#~ "佳解決方案」。" #~ msgid "" #~ "Rust comes with a built-in package manager in the form of Cargo and this " -#~ "makes it trivial to download and compile third-party crates. A " -#~ "consequence of this is that the standard library can be smaller." +#~ "makes it trivial to download and compile third-party crates. A consequence " +#~ "of this is that the standard library can be smaller." #~ msgstr "" #~ "Rust 內建採用 Cargo 形式的套件管理工具,因此可讓您輕鬆下載及編譯第三方 " #~ "Crate。這樣一來,就可以縮小標準程式庫的規模。" #~ msgid "" #~ "Discovering good third-party crates can be a problem. Sites like help with this by letting you compare health metrics for crates " -#~ "to find a good and trusted one." +#~ "lib.rs/> help with this by letting you compare health metrics for crates to " +#~ "find a good and trusted one." #~ msgstr "" -#~ "如何找到理想的第三方 Crate 可能是一大問題。但請放心, 這" -#~ "類網站可協助您比較 Crate 的健康指標,找出優質且值得信賴的 Crate。" +#~ "如何找到理想的第三方 Crate 可能是一大問題。但請放心, 這類網" +#~ "站可協助您比較 Crate 的健康指標,找出優質且值得信賴的 Crate。" #~ msgid "" #~ "[rust-analyzer](https://rust-analyzer.github.io/) is a well supported LSP " #~ "implementation used in major IDEs and text editors." #~ msgstr "" -#~ "[rust-analyzer](https://rust-analyzer.github.io/) 是廣受支援的 LSP 實作項" -#~ "目,適用於主要的 IDE 和文字編輯器。" +#~ "[rust-analyzer](https://rust-analyzer.github.io/) 是廣受支援的 LSP 實作項目," +#~ "適用於主要的 IDE 和文字編輯器。" #~ msgid "Much of the Rust syntax will be familiar to you from C, C++ or Java:" #~ msgstr "如果您有 C、C++ 或 Java 基礎,會覺得大部分的 Rust 語法都似曾相識:" @@ -23253,8 +22849,8 @@ msgstr "" #~ msgstr "區塊和範圍會以大括號分隔。" #~ msgid "" -#~ "Line comments are started with `//`, block comments are delimited by `/" -#~ "* ... */`." +#~ "Line comments are started with `//`, block comments are delimited by `/* ... " +#~ "*/`." #~ msgstr "行註解以 `//` 開頭,區塊註解則以 `/* ... */` 分隔。" #~ msgid "Keywords like `if` and `while` work the same." @@ -23291,15 +22887,14 @@ msgstr "" #~ msgstr "元組:" #~ msgid "" -#~ "The empty tuple `()` is also known as the \"unit type\". It is both a " -#~ "type, and the only valid value of that type - that is to say both the " -#~ "type and its value are expressed as `()`. It is used to indicate, for " -#~ "example, that a function or expression has no return value, as we'll see " -#~ "in a future slide. " +#~ "The empty tuple `()` is also known as the \"unit type\". It is both a type, " +#~ "and the only valid value of that type - that is to say both the type and its " +#~ "value are expressed as `()`. It is used to indicate, for example, that a " +#~ "function or expression has no return value, as we'll see in a future slide. " #~ msgstr "" -#~ "空白元組 `()` 也稱為「單位型別」。它既是型別,也是該型別唯一的有效值,亦即" -#~ "該型別及其值都以 `()` 表示。舉例來說,空白元組可用於表示函式或運算式沒有任" -#~ "何回傳值,我們會在之後的投影片看到這個例子。" +#~ "空白元組 `()` 也稱為「單位型別」。它既是型別,也是該型別唯一的有效值,亦即該" +#~ "型別及其值都以 `()` 表示。舉例來說,空白元組可用於表示函式或運算式沒有任何回" +#~ "傳值,我們會在之後的投影片看到這個例子。" #~ msgid "" #~ "You can think of it as `void` that can be familiar to you from other " @@ -23315,8 +22910,8 @@ msgstr "" #~ msgstr "指派至 `ref_x` 時,我們必須對其解除參照,這類似於 C 和 C++ 指標。" #~ msgid "" -#~ "References that are declared as `mut` can be bound to different values " -#~ "over their lifetime." +#~ "References that are declared as `mut` can be bound to different values over " +#~ "their lifetime." #~ msgstr "宣告為 `mut` 的參照可在其生命週期內綁定至不同的值。" #~ msgid "A reference is said to \"borrow\" the value it refers to." @@ -23342,35 +22937,33 @@ msgstr "" #~ "A Rust version of the famous [FizzBuzz](https://en.wikipedia.org/wiki/" #~ "Fizz_buzz) interview question:" #~ msgstr "" -#~ "這是知名面試問題 [FizzBuzz](https://en.wikipedia.org/wiki/Fizz_buzz) 的 " -#~ "Rust 版本:" +#~ "這是知名面試問題 [FizzBuzz](https://en.wikipedia.org/wiki/Fizz_buzz) 的 Rust " +#~ "版本:" #~ msgid "" -#~ "We refer in `main` to a function written below. Neither forward " -#~ "declarations nor headers are necessary. " +#~ "We refer in `main` to a function written below. Neither forward declarations " +#~ "nor headers are necessary. " #~ msgstr "我們在 `main` 中參照以下所寫的函式。不需前向宣告,也不需標頭。" #~ msgid "" #~ "The range expression in the `for` loop in `print_fizzbuzz_to()` contains " #~ "`=n`, which causes it to include the upper bound." #~ msgstr "" -#~ "`print_fizzbuzz_to()` 中 `for` 迴圈的範圍運算式含有 `=n`,因此會包含上限" -#~ "值。" +#~ "`print_fizzbuzz_to()` 中 `for` 迴圈的範圍運算式含有 `=n`,因此會包含上限值。" #~ msgid "" #~ "All language items in Rust can be documented using special `///` syntax." #~ msgstr "Rust 中的所有語言項目都能以特殊的 `///` 語法來描述使用方法。" #~ msgid "" -#~ "This course does not include rustdoc on slides, just to save space, but " -#~ "in real code they should be present." +#~ "This course does not include rustdoc on slides, just to save space, but in " +#~ "real code they should be present." #~ msgstr "" -#~ "本課程未在投影片中加入 rustdoc 只是為了節省空間,但在實際程式碼中不應這麼" -#~ "做。" +#~ "本課程未在投影片中加入 rustdoc 只是為了節省空間,但在實際程式碼中不應這麼做。" #~ msgid "" -#~ "Inner doc comments are discussed later (in the page on modules) and need " -#~ "not be addressed here." +#~ "Inner doc comments are discussed later (in the page on modules) and need not " +#~ "be addressed here." #~ msgstr "文件內註解會在稍後討論 (在模組相關頁面中),因此這裡不需提到。" #~ msgid "" @@ -23406,12 +22999,12 @@ msgstr "" #~ msgstr "不過,函式參數可能為泛型:" #~ msgid "" -#~ "When using generics, the standard library's `Into` can provide a kind " -#~ "of limited polymorphism on argument types. We will see more details in a " -#~ "later section." +#~ "When using generics, the standard library's `Into` can provide a kind of " +#~ "limited polymorphism on argument types. We will see more details in a later " +#~ "section." #~ msgstr "" -#~ "使用泛型時,標準程式庫的 `Into` 可以為引數型別提供一種受限的多態性。我" -#~ "們會在後續章節中進一步說明。" +#~ "使用泛型時,標準程式庫的 `Into` 可以為引數型別提供一種受限的多態性。我們會" +#~ "在後續章節中進一步說明。" #~ msgid "Day 1: Morning Exercises" #~ msgstr "第 1 天:上午練習" @@ -23430,64 +23023,62 @@ msgstr "" #~ msgid "" #~ "Use a local Rust installation, if possible. This way you can get auto-" -#~ "completion in your editor. See the page about [Using Cargo](../../cargo." -#~ "md) for details on installing Rust." +#~ "completion in your editor. See the page about [Using Cargo](../../cargo.md) " +#~ "for details on installing Rust." #~ msgstr "" -#~ "如果可以,請在本機安裝 Rust。這樣即可在編輯器中使用自動完成功能。如要進一" -#~ "步瞭解如何安裝 Rust,請參閱「[使用 Cargo](../../cargo.md)」。" +#~ "如果可以,請在本機安裝 Rust。這樣即可在編輯器中使用自動完成功能。如要進一步瞭" +#~ "解如何安裝 Rust,請參閱「[使用 Cargo](../../cargo.md)」。" #~ msgid "Alternatively, use the Rust Playground." #~ msgstr "或者,您也可以使用 Rust Playground。" #~ msgid "" -#~ "The code snippets are not editable on purpose: the inline code snippets " -#~ "lose their state if you navigate away from the page." +#~ "The code snippets are not editable on purpose: the inline code snippets lose " +#~ "their state if you navigate away from the page." #~ msgstr "" -#~ "系統會特意將程式碼片段設為無法編輯:如果您離開網頁,內嵌程式碼片段的狀態就" -#~ "會遺失。" +#~ "系統會特意將程式碼片段設為無法編輯:如果您離開網頁,內嵌程式碼片段的狀態就會" +#~ "遺失。" #~ msgid "" #~ "Rust will not automatically apply _implicit conversions_ between types " #~ "([unlike C++](https://en.cppreference.com/w/cpp/language/" #~ "implicit_conversion)). You can see this in a program like this:" #~ msgstr "" -#~ "Rust 不會自動在型別間套用「隱含轉換」 ([與 C++ 不同](https://en." -#~ "cppreference.com/w/cpp/language/implicit_conversion))。您可以在類似下方的" -#~ "程式中發現這點:" +#~ "Rust 不會自動在型別間套用「隱含轉換」 ([與 C++ 不同](https://en.cppreference." +#~ "com/w/cpp/language/implicit_conversion))。您可以在類似下方的程式中發現這點:" #~ msgid "" -#~ "The Rust integer types all implement the [`From`](https://doc.rust-" -#~ "lang.org/std/convert/trait.From.html) and [`Into`](https://doc.rust-" -#~ "lang.org/std/convert/trait.Into.html) traits to let us convert between " -#~ "them. The `From` trait has a single `from()` method and similarly, the " -#~ "`Into` trait has a single `into()` method. Implementing these traits " -#~ "is how a type expresses that it can be converted into another type." +#~ "The Rust integer types all implement the [`From`](https://doc.rust-lang." +#~ "org/std/convert/trait.From.html) and [`Into`](https://doc.rust-lang.org/" +#~ "std/convert/trait.Into.html) traits to let us convert between them. The " +#~ "`From` trait has a single `from()` method and similarly, the `Into` " +#~ "trait has a single `into()` method. Implementing these traits is how a type " +#~ "expresses that it can be converted into another type." #~ msgstr "" #~ "Rust 整數型別全都會實作 [`From`](https://doc.rust-lang.org/std/convert/" -#~ "trait.From.html) 和 [`Into`](https://doc.rust-lang.org/std/convert/" -#~ "trait.Into.html) 特徵,方便我們在兩者間轉換。`From` 特徵有單一的 " -#~ "`from() 方法;同樣地,`Into` 特徵也有單一的 `into()` 方法。實作這些特" -#~ "徵,是型別表示自身可轉換為另一種型別的方式。" +#~ "trait.From.html) 和 [`Into`](https://doc.rust-lang.org/std/convert/trait." +#~ "Into.html) 特徵,方便我們在兩者間轉換。`From` 特徵有單一的 `from() 方法;" +#~ "同樣地,`Into` 特徵也有單一的 `into()` 方法。實作這些特徵,是型別表示自身" +#~ "可轉換為另一種型別的方式。" #~ msgid "" #~ "The standard library has an implementation of `From for i16`, which " #~ "means that we can convert a variable `x` of type `i8` to an `i16` by " -#~ "calling `i16::from(x)`. Or, simpler, with `x.into()`, because `From " -#~ "for i16` implementation automatically create an implementation of " -#~ "`Into for i8`." +#~ "calling `i16::from(x)`. Or, simpler, with `x.into()`, because `From for " +#~ "i16` implementation automatically create an implementation of `Into for " +#~ "i8`." #~ msgstr "" #~ "標準程式庫會內有 `From for i16` 實作項目,這表示我們可以呼叫 `i16::" -#~ "from(x)`,將類型 `i8` 的變數 `x` 轉換為 `i16`。或者,更簡單的方法是使用 " -#~ "`x.into()`,因為 `From for i16` 實作會自動建立 `Into for i8` 的實" -#~ "作。" +#~ "from(x)`,將類型 `i8` 的變數 `x` 轉換為 `i16`。或者,更簡單的方法是使用 `x." +#~ "into()`,因為 `From for i16` 實作會自動建立 `Into for i8` 的實作。" #~ msgid "" -#~ "The same applies for your own `From` implementations for your own types, " -#~ "so it is sufficient to only implement `From` to get a respective `Into` " +#~ "The same applies for your own `From` implementations for your own types, so " +#~ "it is sufficient to only implement `From` to get a respective `Into` " #~ "implementation automatically." #~ msgstr "" -#~ "這同樣適用於您自身型別專屬的 `From` 實作,因此只要實作 `From`,就能自動取" -#~ "得相應的 `Into` 實作。" +#~ "這同樣適用於您自身型別專屬的 `From` 實作,因此只要實作 `From`,就能自動取得相" +#~ "應的 `Into` 實作。" #~ msgid "Execute the above program and look at the compiler error." #~ msgstr "執行上述程式,並查看編譯器錯誤。" @@ -23499,14 +23090,13 @@ msgstr "" #~ "Change the types of `x` and `y` to other things (such as `f32`, `bool`, " #~ "`i128`) to see which types you can convert to which other types. Try " #~ "converting small types to big types and the other way around. Check the " -#~ "[standard library documentation](https://doc.rust-lang.org/std/convert/" -#~ "trait.From.html) to see if `From` is implemented for the pairs you " -#~ "check." +#~ "[standard library documentation](https://doc.rust-lang.org/std/convert/trait." +#~ "From.html) to see if `From` is implemented for the pairs you check." #~ msgstr "" -#~ "將 `x` 和 `y` 的型別變更為其他型別 (例如 `f32`、`bool`、`i128`),查看這些" -#~ "型別可以轉換成其他哪些型別。不妨試著將小型別轉換成大型別,反之亦然。接著參" -#~ "閱[標準程式庫說明文件](https://doc.rust-lang.org/std/convert/trait.From." -#~ "html),瞭解系統是否已為您查看的配對實作 `From`。" +#~ "將 `x` 和 `y` 的型別變更為其他型別 (例如 `f32`、`bool`、`i128`),查看這些型別" +#~ "可以轉換成其他哪些型別。不妨試著將小型別轉換成大型別,反之亦然。接著參閱[標準" +#~ "程式庫說明文件](https://doc.rust-lang.org/std/convert/trait.From.html),瞭解" +#~ "系統是否已為您查看的配對實作 `From`。" #~ msgid "Arrays and `for` Loops" #~ msgstr "陣列和 `for` 迴圈" @@ -23515,8 +23105,8 @@ msgstr "" #~ msgstr "我們已瞭解陣列的宣告方式可能如下:" #~ msgid "" -#~ "You can print such an array by asking for its debug representation with " -#~ "`{:?}`:" +#~ "You can print such an array by asking for its debug representation with `{:?}" +#~ "`:" #~ msgstr "您可以使用 `{:?}` 偵錯表示法輸出這樣的陣列:" #~ msgid "" @@ -23528,52 +23118,52 @@ msgstr "" #~ msgstr "加分題" #~ msgid "" -#~ "Could you use `&[i32]` slices instead of hard-coded 3 × 3 matrices for " -#~ "your argument and return types? Something like `&[&[i32]]` for a two-" -#~ "dimensional slice-of-slices. Why or why not?" +#~ "Could you use `&[i32]` slices instead of hard-coded 3 × 3 matrices for your " +#~ "argument and return types? Something like `&[&[i32]]` for a two-dimensional " +#~ "slice-of-slices. Why or why not?" #~ msgstr "" -#~ "您是否能夠使用 `&[i32]` 切片 (而非硬式編碼的 3 × 3 矩陣) 做為引數和傳回型" -#~ "別?例如針對二維切片使用 `&[&[i32]]`。原因為何?" +#~ "您是否能夠使用 `&[i32]` 切片 (而非硬式編碼的 3 × 3 矩陣) 做為引數和傳回型別?" +#~ "例如針對二維切片使用 `&[&[i32]]`。原因為何?" #~ msgid "" -#~ "See the [`ndarray` crate](https://docs.rs/ndarray/) for a production " -#~ "quality implementation." +#~ "See the [`ndarray` crate](https://docs.rs/ndarray/) for a production quality " +#~ "implementation." #~ msgstr "" -#~ "請參閱 [`ndarray` Crate](https://docs.rs/ndarray/),瞭解如何在確保實際工作" -#~ "環境品質的情況下實作。" +#~ "請參閱 [`ndarray` Crate](https://docs.rs/ndarray/),瞭解如何在確保實際工作環" +#~ "境品質的情況下實作。" #~ msgid "" #~ "The solution and the answer to the bonus section are available in the " #~ "[Solution](solutions-morning.md#arrays-and-for-loops) section." #~ msgstr "" -#~ "如需加分題的解決方案和答案,請前往「[解決方案](solutions-morning." -#~ "md#arrays-and-for-loops)」一節。" +#~ "如需加分題的解決方案和答案,請前往「[解決方案](solutions-morning.md#arrays-" +#~ "and-for-loops)」一節。" #~ msgid "" #~ "Due to type inference the `i32` is optional. We will gradually show the " #~ "types less and less as the course progresses." #~ msgstr "" -#~ "由於型別推論的關係,`i32` 為選用項目。隨著課程進行,我們會逐漸減少示範型別" -#~ "的比例。" +#~ "由於型別推論的關係,`i32` 為選用項目。隨著課程進行,我們會逐漸減少示範型別的" +#~ "比例。" #~ msgid "" #~ "The following code tells the compiler to copy into a certain generic " #~ "container without the code ever explicitly specifying the contained type, " #~ "using `_` as a placeholder:" #~ msgstr "" -#~ "以下程式碼會指示編譯器使用 `_` 做為預留位置,進而複製到特定泛型容器中,而" -#~ "無須明確指出包含的型別:" +#~ "以下程式碼會指示編譯器使用 `_` 做為預留位置,進而複製到特定泛型容器中,而無須" +#~ "明確指出包含的型別:" #~ msgid "Static and Constant Variables" #~ msgstr "靜態和常數變數" #~ msgid "" -#~ "The following code demonstrates why the compiler can't simply reuse " -#~ "memory locations when shadowing an immutable variable in a scope, even if " -#~ "the type does not change." +#~ "The following code demonstrates why the compiler can't simply reuse memory " +#~ "locations when shadowing an immutable variable in a scope, even if the type " +#~ "does not change." #~ msgstr "" -#~ "下列程式碼說明遮蔽範圍中不可變動的變數時,為何編譯器就是無法重複使用記憶體" -#~ "位置 (即使型別未變更也一樣)。" +#~ "下列程式碼說明遮蔽範圍中不可變動的變數時,為何編譯器就是無法重複使用記憶體位" +#~ "置 (即使型別未變更也一樣)。" #~ msgid "First, let's refresh how memory management works." #~ msgstr "首先,讓我們回顧記憶體管理的運作方式。" @@ -23607,8 +23197,7 @@ msgstr "" #~ " unsafe {\n" #~ " let (capacity, ptr, len): (usize, usize, usize) = std::mem::" #~ "transmute(s1);\n" -#~ " println!(\"ptr = {ptr:#x}, len = {len}, capacity = " -#~ "{capacity}\");\n" +#~ " println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" #~ " }\n" #~ "}\n" #~ "```" @@ -23625,8 +23214,7 @@ msgstr "" #~ " unsafe {\n" #~ " let (capacity, ptr, len): (usize, usize, usize) = std::mem::" #~ "transmute(s1);\n" -#~ " println!(\"ptr = {ptr:#x}, len = {len}, capacity = " -#~ "{capacity}\");\n" +#~ " println!(\"ptr = {ptr:#x}, len = {len}, capacity = {capacity}\");\n" #~ " }\n" #~ "}\n" #~ "```" @@ -23667,23 +23255,23 @@ msgstr "" #~ "```" #~ msgid "" -#~ "Memory is leaked if the function returns early between `malloc` and " -#~ "`free`: the pointer is lost and we cannot deallocate the memory." +#~ "Memory is leaked if the function returns early between `malloc` and `free`: " +#~ "the pointer is lost and we cannot deallocate the memory." #~ msgstr "" -#~ "如果函式在 `malloc` 和 `free` 之間提早傳回記憶體,就會發生記憶體泄漏:指標" -#~ "遺失,我們也無法釋放記憶體。" +#~ "如果函式在 `malloc` 和 `free` 之間提早傳回記憶體,就會發生記憶體泄漏:指標遺" +#~ "失,我們也無法釋放記憶體。" #~ msgid "" #~ "Constructors and destructors let you hook into the lifetime of an object." #~ msgstr "建構函式和解構函式可讓您掌握物件的生命週期。" #~ msgid "" -#~ "By wrapping a pointer in an object, you can free memory when the object " -#~ "is destroyed. The compiler guarantees that this happens, even if an " -#~ "exception is raised." +#~ "By wrapping a pointer in an object, you can free memory when the object is " +#~ "destroyed. The compiler guarantees that this happens, even if an exception " +#~ "is raised." #~ msgstr "" -#~ "只要在物件中包裝指標,即可在物件刪除時釋放記憶體。即使發生例外狀況,編譯器" -#~ "仍會保證執行這項作業。" +#~ "只要在物件中包裝指標,即可在物件刪除時釋放記憶體。即使發生例外狀況,編譯器仍" +#~ "會保證執行這項作業。" #~ msgid "" #~ "This is often called _resource acquisition is initialization_ (RAII) and " @@ -23704,12 +23292,11 @@ msgstr "" #~ "```" #~ msgid "" -#~ "The `std::unique_ptr` object is allocated on the stack, and points to " -#~ "memory allocated on the heap." +#~ "The `std::unique_ptr` object is allocated on the stack, and points to memory " +#~ "allocated on the heap." #~ msgstr "`std::unique_ptr` 物件會在堆疊上配置,並指向在堆積上配置的記憶體。" -#~ msgid "" -#~ "At the end of `say_hello`, the `std::unique_ptr` destructor will run." +#~ msgid "At the end of `say_hello`, the `std::unique_ptr` destructor will run." #~ msgstr "`say_hello` 結束時,`std::unique_ptr` 解構函式就會執行。" #~ msgid "The destructor frees the `Person` object it points to." @@ -23773,12 +23360,12 @@ msgstr "" #~ msgstr "像 Java 一樣安全又正確,但沒有垃圾回收機制。" #~ msgid "" -#~ "Depending on which abstraction (or combination of abstractions) you " -#~ "choose, can be a single unique pointer, reference counted, or atomically " -#~ "reference counted." +#~ "Depending on which abstraction (or combination of abstractions) you choose, " +#~ "can be a single unique pointer, reference counted, or atomically reference " +#~ "counted." #~ msgstr "" -#~ "可以是單一不重複指標、採用參考計數或採用原子參考計數,須視您選擇的抽象方" -#~ "法 (或抽象方法組合) 而定。" +#~ "可以是單一不重複指標、採用參考計數或採用原子參考計數,須視您選擇的抽象方法 " +#~ "(或抽象方法組合) 而定。" #~ msgid "Scope-based like C++, but the compiler enforces full adherence." #~ msgstr "像 C++ 一樣的作用域式管理,但編譯器會強制遵循完整規定。" @@ -23787,8 +23374,8 @@ msgstr "" #~ "A Rust user can choose the right abstraction for the situation, some even " #~ "have no cost at runtime like C." #~ msgstr "" -#~ "Rust 使用者可選擇適合情境的抽象方法,部分方法甚至像 C 一樣在執行階段無額外" -#~ "成本。" +#~ "Rust 使用者可選擇適合情境的抽象方法,部分方法甚至像 C 一樣在執行階段無額外成" +#~ "本。" #~ msgid "It achieves this by modeling _ownership_ explicitly." #~ msgstr "實現這種記憶體管理的方法是明確建立「所有權」模型。" @@ -23796,18 +23383,18 @@ msgstr "" #~ msgid "" #~ "If asked how at this point, you can mention that in Rust this is usually " #~ "handled by RAII wrapper types such as [Box](https://doc.rust-lang.org/std/" -#~ "boxed/struct.Box.html), [Vec](https://doc.rust-lang.org/std/vec/struct." -#~ "Vec.html), [Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html), or [Arc]" +#~ "boxed/struct.Box.html), [Vec](https://doc.rust-lang.org/std/vec/struct.Vec." +#~ "html), [Rc](https://doc.rust-lang.org/std/rc/struct.Rc.html), or [Arc]" #~ "(https://doc.rust-lang.org/std/sync/struct.Arc.html). These encapsulate " -#~ "ownership and memory allocation via various means, and prevent the " -#~ "potential errors in C." +#~ "ownership and memory allocation via various means, and prevent the potential " +#~ "errors in C." #~ msgstr "" -#~ "如果這時學員詢問相關做法,您可以表示這在 Rust 中通常會以 RAII 包裝函式型別" -#~ "處理,例如 [Box](https://doc.rust-lang.org/std/boxed/struct.Box.html)、" -#~ "[Vec](https://doc.rust-lang.org/std/vec/struct.Vec.html)、[Rc](https://" -#~ "doc.rust-lang.org/std/rc/struct.Rc.html) 或 [Arc](https://doc.rust-lang." -#~ "org/std/sync/struct.Arc.html)。這些型別會透過多種方法封裝所有權和記憶體配" -#~ "置,防止在 C 中可能出現的錯誤。" +#~ "如果這時學員詢問相關做法,您可以表示這在 Rust 中通常會以 RAII 包裝函式型別處" +#~ "理,例如 [Box](https://doc.rust-lang.org/std/boxed/struct.Box.html)、[Vec]" +#~ "(https://doc.rust-lang.org/std/vec/struct.Vec.html)、[Rc](https://doc.rust-" +#~ "lang.org/std/rc/struct.Rc.html) 或 [Arc](https://doc.rust-lang.org/std/sync/" +#~ "struct.Arc.html)。這些型別會透過多種方法封裝所有權和記憶體配置,防止在 C 中可" +#~ "能出現的錯誤。" #~ msgid "" #~ "You may be asked about destructors here, the [Drop](https://doc.rust-lang." @@ -23962,8 +23549,7 @@ msgstr "" #~ msgid "The heap data from `s1` is reused for `s2`." #~ msgstr "系統會為 `s2` 重複使用 `s1` 的堆積資料。" -#~ msgid "" -#~ "When `s1` goes out of scope, nothing happens (it has been moved from)." +#~ msgid "When `s1` goes out of scope, nothing happens (it has been moved from)." #~ msgstr "當 `s1` 超出範圍時,系統不會執行任何動作,因為 `s1` 已移出。" #~ msgid "" @@ -24150,12 +23736,12 @@ msgstr "" #~ "```" #~ msgid "" -#~ "If students ask about `derive`, it is sufficient to say that this is a " -#~ "way to generate code in Rust at compile time. In this case the default " +#~ "If students ask about `derive`, it is sufficient to say that this is a way " +#~ "to generate code in Rust at compile time. In this case the default " #~ "implementations of `Copy` and `Clone` traits are generated." #~ msgstr "" -#~ "如有學員問起 `derive`,只需回答這是在 Rust 編譯時間中產生程式碼的方式。在" -#~ "這種情形下,系統會產生 `Copy` 和 `Clone` 特徵的預設實作方式。" +#~ "如有學員問起 `derive`,只需回答這是在 Rust 編譯時間中產生程式碼的方式。在這種" +#~ "情形下,系統會產生 `Copy` 和 `Clone` 特徵的預設實作方式。" #~ msgid "" #~ "```rust,editable\n" @@ -24263,8 +23849,7 @@ msgstr "" #~ msgid "A borrowed value has a _lifetime_:" #~ msgstr "借用的值具有「生命週期」:" -#~ msgid "" -#~ "The lifetime can be implicit: `add(p1: &Point, p2: &Point) -> Point`." +#~ msgid "The lifetime can be implicit: `add(p1: &Point, p2: &Point) -> Point`." #~ msgstr "生命週期可以採用隱含方式:`add(p1: &Point, p2: &Point) -> Point`。" #~ msgid "Lifetimes can also be explicit: `&'a Point`, `&'document str`." @@ -24276,8 +23861,8 @@ msgstr "" #~ msgstr "請將 `&'a Point` 讀做「至少對生命週期 `a` 有效的借用 `Point`」。" #~ msgid "" -#~ "Lifetimes are always inferred by the compiler: you cannot assign a " -#~ "lifetime yourself." +#~ "Lifetimes are always inferred by the compiler: you cannot assign a lifetime " +#~ "yourself." #~ msgstr "生命週期一律會由編譯器推論:您無法自行指派生命週期。" #~ msgid "" @@ -24376,14 +23961,13 @@ msgstr "" #~ msgstr "請注意,這在 `p3` 超越 `p2` 並繼續留存後,就沒有編譯。" #~ msgid "" -#~ "Reset the workspace and change the function signature to `fn " -#~ "left_most<'a, 'b>(p1: &'a Point, p2: &'a Point) -> &'b Point`. This will " -#~ "not compile because the relationship between the lifetimes `'a` and `'b` " -#~ "is unclear." +#~ "Reset the workspace and change the function signature to `fn left_most<'a, " +#~ "'b>(p1: &'a Point, p2: &'a Point) -> &'b Point`. This will not compile " +#~ "because the relationship between the lifetimes `'a` and `'b` is unclear." #~ msgstr "" -#~ "重設工作區,並將函式簽章變更為 `fn left_most<'a, 'b>(p1: &'a Point, p2: " -#~ "&'a Point) -> &'b Point`。這不會編譯,因為生命週期 `'a` 和 `'b` 之間的關係" -#~ "不明確。" +#~ "重設工作區,並將函式簽章變更為 `fn left_most<'a, 'b>(p1: &'a Point, p2: &'a " +#~ "Point) -> &'b Point`。這不會編譯,因為生命週期 `'a` 和 `'b` 之間的關係不明" +#~ "確。" #~ msgid "Another way to explain it:" #~ msgstr "另一種說明方式:" @@ -24394,8 +23978,7 @@ msgstr "" #~ msgstr "函式會借用兩個值的兩個參照,而函式會傳回另一個參照。" #~ msgid "" -#~ "It must have come from one of those two inputs (or from a global " -#~ "variable)." +#~ "It must have come from one of those two inputs (or from a global variable)." #~ msgstr "該參照必須來自這兩種輸入來源的其中之一 (或來自全域變數)。" #~ msgid "" @@ -24403,8 +23986,8 @@ msgstr "" #~ "returned reference is not used for longer than a variable from where the " #~ "reference came from." #~ msgstr "" -#~ "究竟是哪一個來源?編譯器需要知道來源為何,因此在呼叫點上,所傳回參照的使用" -#~ "時間不會長於來自參照來源的變數。" +#~ "究竟是哪一個來源?編譯器需要知道來源為何,因此在呼叫點上,所傳回參照的使用時" +#~ "間不會長於來自參照來源的變數。" #~ msgid "" #~ "```rust,editable\n" @@ -24455,8 +24038,8 @@ msgstr "" #~ "We will learn much more about structs and the `Vec` type tomorrow. For " #~ "now, you just need to know part of its API:" #~ msgstr "" -#~ "明天我們會進一步講解結構體和 `Vec` 型別。現階段,您只需要瞭解相關 API " -#~ "的部分內容:" +#~ "明天我們會進一步講解結構體和 `Vec` 型別。現階段,您只需要瞭解相關 API 的部" +#~ "分內容:" #~ msgid "[Solution](solutions-afternoon.md#designing-a-library)" #~ msgstr "[解決方案](solutions-afternoon.md#designing-a-library)" @@ -24464,20 +24047,20 @@ msgstr "" #~ msgid "" #~ "The ownership model of Rust affects many APIs. An example of this is the " #~ "[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) and " -#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator." -#~ "html) traits." +#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +#~ "traits." #~ msgstr "" -#~ "Rust 的擁有權模型會影響許多 API。[`Iterator`](https://doc.rust-lang.org/" -#~ "std/iter/trait.Iterator.html) 和 [`IntoIterator`](https://doc.rust-lang." -#~ "org/std/iter/trait.IntoIterator.html) 特徵就是一例。" +#~ "Rust 的擁有權模型會影響許多 API。[`Iterator`](https://doc.rust-lang.org/std/" +#~ "iter/trait.Iterator.html) 和 [`IntoIterator`](https://doc.rust-lang.org/std/" +#~ "iter/trait.IntoIterator.html) 特徵就是一例。" #~ msgid "" -#~ "Traits are like interfaces: they describe behavior (methods) for a type. " -#~ "The `Iterator` trait simply says that you can call `next` until you get " -#~ "`None` back:" +#~ "Traits are like interfaces: they describe behavior (methods) for a type. The " +#~ "`Iterator` trait simply says that you can call `next` until you get `None` " +#~ "back:" #~ msgstr "" -#~ "特徵就像介面一樣,可以說明型別的行為 (方法)。`Iterator` 特徵就是指您可以呼" -#~ "叫 `next`,直到取回 `None` 為止:" +#~ "特徵就像介面一樣,可以說明型別的行為 (方法)。`Iterator` 特徵就是指您可以呼叫 " +#~ "`next`,直到取回 `None` 為止:" #~ msgid "You use this trait like this:" #~ msgstr "您可以像下方這樣使用這個特徵:" @@ -24496,26 +24079,24 @@ msgstr "" #~ "loops. They call `into_iter()` on an expression and iterates over the " #~ "resulting iterator:" #~ msgstr "" -#~ "現在我們已瞭解 `Iterator` 和 `IntoIterator`,可以建構 `for` 迴圈了。這會在" -#~ "運算式上呼叫 `into_iter()`,並對產生的疊代器進行疊代:" +#~ "現在我們已瞭解 `Iterator` 和 `IntoIterator`,可以建構 `for` 迴圈了。這會在運" +#~ "算式上呼叫 `into_iter()`,並對產生的疊代器進行疊代:" #, fuzzy #~ msgid "Structs, enums, methods." #~ msgstr "結構體和方法。" #~ msgid "" -#~ "Control flow constructs: `if`, `if let`, `while`, `while let`, `break`, " -#~ "and `continue`." +#~ "Control flow constructs: `if`, `if let`, `while`, `while let`, `break`, and " +#~ "`continue`." #~ msgstr "" -#~ "控制流程結構:`if`、`if let`、`while`、`while let`、`break` 和 " -#~ "`continue`。" +#~ "控制流程結構:`if`、`if let`、`while`、`while let`、`break` 和 `continue`。" #~ msgid "" #~ "The Standard Library: `String`, `Option` and `Result`, `Vec`, `HashMap`, " #~ "`Rc` and `Arc`." #~ msgstr "" -#~ "標準程式庫:`String`、`Option` 和 `Result`、`Vec`、`HashMap`、`Rc` 和 " -#~ "`Arc`。" +#~ "標準程式庫:`String`、`Option` 和 `Result`、`Vec`、`HashMap`、`Rc` 和 `Arc`。" #~ msgid "Modules: visibility, paths, and filesystem hierarchy." #~ msgstr "模組:瀏覽權限、路徑和檔案系統階層。" @@ -24532,8 +24113,8 @@ msgstr "" #~ "您可以將 `Self` 用做型別來編寫 `new` 函式,因為它可和結構體型別名稱互通。" #~ msgid "" -#~ "Implement the `Default` trait for the struct. Define some fields and use " -#~ "the default values for the other fields." +#~ "Implement the `Default` trait for the struct. Define some fields and use the " +#~ "default values for the other fields." #~ msgstr "" #~ "實作結構體的 `Default` 特徵。請定義部分欄位,並針對其他欄位使用預設值。" @@ -24541,11 +24122,11 @@ msgstr "" #~ msgstr "方法會在 `impl` 區塊中定義。" #~ msgid "" -#~ "Use struct update syntax to define a new structure using `peter`. Note " -#~ "that the variable `peter` will no longer be accessible afterwards." +#~ "Use struct update syntax to define a new structure using `peter`. Note that " +#~ "the variable `peter` will no longer be accessible afterwards." #~ msgstr "" -#~ "使用結構體更新語法,利用 `peter` 定義新結構。請注意,`peter` 這個變數之後" -#~ "將再也無法存取。" +#~ "使用結構體更新語法,利用 `peter` 定義新結構。請注意,`peter` 這個變數之後將再" +#~ "也無法存取。" #~ msgid "" #~ "Use `{:#?}` when printing structs to request the `Debug` representation." @@ -24608,18 +24189,18 @@ msgstr "" #~ "This page offers an enum type `CoinFlip` with two variants `Heads` and " #~ "`Tail`. You might note the namespace when using variants." #~ msgstr "" -#~ "本頁面提供列舉類別 `CoinFlip`,以及 `Heads` 和 `Tail` 這兩個變體。您可以在" -#~ "使用變體時記下命名空間。" +#~ "本頁面提供列舉類別 `CoinFlip`,以及 `Heads` 和 `Tail` 這兩個變體。您可以在使" +#~ "用變體時記下命名空間。" #~ msgid "In both, associated functions are defined within an `impl` block." #~ msgstr "無論使用何者,相關函式都會在 `impl` 區塊中定義。" #~ msgid "" -#~ "You can define richer enums where the variants carry data. You can then " -#~ "use the `match` statement to extract the data from each variant:" +#~ "You can define richer enums where the variants carry data. You can then use " +#~ "the `match` statement to extract the data from each variant:" #~ msgstr "" -#~ "您可以定義更豐富的列舉,讓列舉的變體攜帶資料。接著,您可以使用 `match` 陳" -#~ "述式,從各個變體擷取資料:" +#~ "您可以定義更豐富的列舉,讓列舉的變體攜帶資料。接著,您可以使用 `match` 陳述" +#~ "式,從各個變體擷取資料:" #~ msgid "" #~ "```rust,editable\n" @@ -24634,8 +24215,7 @@ msgstr "" #~ " match event {\n" #~ " WebEvent::PageLoad => println!(\"page loaded\"),\n" #~ " WebEvent::KeyPress(c) => println!(\"pressed '{c}'\"),\n" -#~ " WebEvent::Click { x, y } => println!(\"clicked at x={x}, " -#~ "y={y}\"),\n" +#~ " WebEvent::Click { x, y } => println!(\"clicked at x={x}, y={y}\"),\n" #~ " }\n" #~ "}\n" #~ "\n" @@ -24662,8 +24242,7 @@ msgstr "" #~ " match event {\n" #~ " WebEvent::PageLoad => println!(\"page loaded\"),\n" #~ " WebEvent::KeyPress(c) => println!(\"pressed '{c}'\"),\n" -#~ " WebEvent::Click { x, y } => println!(\"clicked at x={x}, " -#~ "y={y}\"),\n" +#~ " WebEvent::Click { x, y } => println!(\"clicked at x={x}, y={y}\"),\n" #~ " }\n" #~ "}\n" #~ "\n" @@ -24679,11 +24258,11 @@ msgstr "" #~ "```" #~ msgid "" -#~ "The expression is matched against the patterns from top to bottom. There " -#~ "is no fall-through like in C or C++." +#~ "The expression is matched against the patterns from top to bottom. There is " +#~ "no fall-through like in C or C++." #~ msgstr "" -#~ "系統會從上到下將運算式與模式進行配對。在 Rust 中,不會像在 C 或 C++ 中一樣" -#~ "出現貫穿 (fall-through) 情形。" +#~ "系統會從上到下將運算式與模式進行配對。在 Rust 中,不會像在 C 或 C++ 中一樣出" +#~ "現貫穿 (fall-through) 情形。" #~ msgid "" #~ "The match expression has a value. The value is the last expression in the " @@ -24694,8 +24273,8 @@ msgstr "" #~ "Starting from the top we look for what pattern matches the value then run " #~ "the code following the arrow. Once we find a match, we stop. " #~ msgstr "" -#~ "我們會從上方開始尋找符合該值的模式,然後執行箭頭後方的程式碼。一旦發現相符" -#~ "項目,就會停止。" +#~ "我們會從上方開始尋找符合該值的模式,然後執行箭頭後方的程式碼。一旦發現相符項" +#~ "目,就會停止。" #~ msgid "`match` inspects a hidden discriminant field in the `enum`." #~ msgstr "`match` 會檢查 `enum` 中隱藏的判別值欄位。" @@ -24706,16 +24285,16 @@ msgstr "" #~ msgstr "只要呼叫 `std::mem::discriminant()`,就有可能擷取該判別值。\\`" #~ msgid "" -#~ "This is useful, for example, if implementing `PartialEq` for structs " -#~ "where comparing field values doesn't affect equality." +#~ "This is useful, for example, if implementing `PartialEq` for structs where " +#~ "comparing field values doesn't affect equality." #~ msgstr "" -#~ "舉例來說,如果在為結構體實作 `PartialEq` 時,比較欄位值不會對相等性造成影" -#~ "響,這種做法就很實用。" +#~ "舉例來說,如果在為結構體實作 `PartialEq` 時,比較欄位值不會對相等性造成影響," +#~ "這種做法就很實用。" #~ msgid "" #~ "`WebEvent::Click { ... }` is not exactly the same as `WebEvent::" -#~ "Click(Click)` with a top level `struct Click { ... }`. The inlined " -#~ "version cannot implement traits, for example." +#~ "Click(Click)` with a top level `struct Click { ... }`. The inlined version " +#~ "cannot implement traits, for example." #~ msgstr "" #~ "`WebEvent::Click { ... }` 與具有頂層 `struct Click { ... }` 的 `WebEvent::" #~ "Click(Click)` 並非完全相同。舉例來說,內嵌版本無法實作特徵。" @@ -24809,24 +24388,22 @@ msgstr "" #~ msgstr "`dbg_size!(bool)`:大小為 1 個位元組,對齊:1 個位元組。" #~ msgid "" -#~ "`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (niche " -#~ "optimization, see below)," +#~ "`dbg_size!(Option)`: size 1 bytes, align: 1 bytes (niche optimization, " +#~ "see below)," #~ msgstr "" -#~ "`dbg_size!(Option)`:大小為 1 個位元組,對齊:1 個位元組 (區位最佳" -#~ "化,請見下文)。" +#~ "`dbg_size!(Option)`:大小為 1 個位元組,對齊:1 個位元組 (區位最佳化," +#~ "請見下文)。" -#~ msgid "" -#~ "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," +#~ msgid "`dbg_size!(&i32)`: size 8 bytes, align: 8 bytes (on a 64-bit machine)," #~ msgstr "" -#~ "`dbg_size!(&i32)`:大小為 8 個位元組,對齊:8 個位元組 (在 64 位元機器" -#~ "上)。" +#~ "`dbg_size!(&i32)`:大小為 8 個位元組,對齊:8 個位元組 (在 64 位元機器上)。" #~ msgid "" #~ "`dbg_size!(Option<&i32>)`: size 8 bytes, align: 8 bytes (null pointer " #~ "optimization, see below)." #~ msgstr "" -#~ "`dbg_size!(Option<&i32>)`:大小為 8 個位元組,對齊:8 個位元組 (空值指標最" -#~ "佳化,請見下文)。" +#~ "`dbg_size!(Option<&i32>)`:大小為 8 個位元組,對齊:8 個位元組 (空值指標最佳" +#~ "化,請見下文)。" #~ msgid "" #~ "Niche optimization: Rust will merge use unused bit patterns for the enum " @@ -24907,11 +24484,10 @@ msgstr "" #~ "```" #~ msgid "" -#~ "More complex example if you want to discuss what happens when we chain " -#~ "more than 256 `Option`s together." +#~ "More complex example if you want to discuss what happens when we chain more " +#~ "than 256 `Option`s together." #~ msgstr "" -#~ "如果想討論將超過 256 個 `Option` 鏈結在一起的情況,可以使用下列更複雜的範" -#~ "例。" +#~ "如果想討論將超過 256 個 `Option` 鏈結在一起的情況,可以使用下列更複雜的範例。" #~ msgid "" #~ "```rust,editable\n" @@ -24948,18 +24524,15 @@ msgstr "" #~ " assert_eq!(many_options!(false, @@), " #~ "Some(Some(Some(Some(false)))));\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 128 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 128 Option's.\");\n" #~ " dbg_bits!(many_options!(false, @@@@@@@), u8);\n" #~ " dbg_bits!(many_options!(true, @@@@@@@), u8);\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 256 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 256 Option's.\");\n" #~ " dbg_bits!(many_options!(false, @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(true, @@@@@@@@), u16);\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 257 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 257 Option's.\");\n" #~ " dbg_bits!(many_options!(Some(false), @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(Some(true), @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(None::, @@@@@@@@), u16);\n" @@ -25000,18 +24573,15 @@ msgstr "" #~ " assert_eq!(many_options!(false, @@), " #~ "Some(Some(Some(Some(false)))));\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 128 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 128 Option's.\");\n" #~ " dbg_bits!(many_options!(false, @@@@@@@), u8);\n" #~ " dbg_bits!(many_options!(true, @@@@@@@), u8);\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 256 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 256 Option's.\");\n" #~ " dbg_bits!(many_options!(false, @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(true, @@@@@@@@), u16);\n" #~ "\n" -#~ " println!(\"Bitwise representation of a chain of 257 Option's." -#~ "\");\n" +#~ " println!(\"Bitwise representation of a chain of 257 Option's.\");\n" #~ " dbg_bits!(many_options!(Some(false), @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(Some(true), @@@@@@@@), u16);\n" #~ " dbg_bits!(many_options!(None::, @@@@@@@@), u16);\n" @@ -25024,14 +24594,13 @@ msgstr "" #~ msgid "" #~ "Consider emphasizing \"shared and immutable\" and \"unique and mutable\". " -#~ "These constraints always come together in Rust due to borrow checker " -#~ "rules, and `self` is no exception. It isn't possible to reference a " -#~ "struct from multiple locations and call a mutating (`&mut self`) method " -#~ "on it." +#~ "These constraints always come together in Rust due to borrow checker rules, " +#~ "and `self` is no exception. It isn't possible to reference a struct from " +#~ "multiple locations and call a mutating (`&mut self`) method on it." #~ msgstr "" -#~ "建議您強調「共用且不可變動」,以及「不重複且可變動」這兩個概念。由於借用檢" -#~ "查器規則的關係,這些限制在 Rust 中一律會一起出現,而 `self` 也不例外。您無" -#~ "法從多個位置參照結構體,並對其呼叫變異 (`&mut self`) 方法。" +#~ "建議您強調「共用且不可變動」,以及「不重複且可變動」這兩個概念。由於借用檢查" +#~ "器規則的關係,這些限制在 Rust 中一律會一起出現,而 `self` 也不例外。您無法從" +#~ "多個位置參照結構體,並對其呼叫變異 (`&mut self`) 方法。" #~ msgid "All four methods here use a different method receiver." #~ msgstr "這裡的四個方法都使用不同的方法接收器。" @@ -25040,31 +24609,28 @@ msgstr "" #~ "You can point out how that changes what the function can do with the " #~ "variable values and if/how it can be used again in `main`." #~ msgstr "" -#~ "您可以指出這會如何變更函式能對變數值執行的動作,以及可否/如何在 `main` 中" -#~ "再次使用該函式。" +#~ "您可以指出這會如何變更函式能對變數值執行的動作,以及可否/如何在 `main` 中再次" +#~ "使用該函式。" #~ msgid "" -#~ "You can showcase the error that appears when trying to call `finish` " -#~ "twice." +#~ "You can showcase the error that appears when trying to call `finish` twice." #~ msgstr "您可以演示嘗試呼叫 `finish` 兩次時會出現什麼錯誤。" #~ msgid "" #~ "Note that although the method receivers are different, the non-static " -#~ "functions are called the same way in the main body. Rust enables " -#~ "automatic referencing and dereferencing when calling methods. Rust " -#~ "automatically adds in the `&`, `*`, `muts` so that that object matches " -#~ "the method signature." +#~ "functions are called the same way in the main body. Rust enables automatic " +#~ "referencing and dereferencing when calling methods. Rust automatically adds " +#~ "in the `&`, `*`, `muts` so that that object matches the method signature." #~ msgstr "" -#~ "請注意,雖然方法接收器不同,但主體中非靜態函式的呼叫方式相同。Rust 會在呼" -#~ "叫方法時啟用自動參照和取消參照功能,並自動加入 `&`、`*`、`muts`,讓該物件" -#~ "與方法簽章相符。" +#~ "請注意,雖然方法接收器不同,但主體中非靜態函式的呼叫方式相同。Rust 會在呼叫方" +#~ "法時啟用自動參照和取消參照功能,並自動加入 `&`、`*`、`muts`,讓該物件與方法簽" +#~ "章相符。" #~ msgid "" #~ "You might point out that `print_laps` is using a vector that is iterated " #~ "over. We describe vectors in more detail in the afternoon. " #~ msgstr "" -#~ "您或許可以指出 `print_laps` 使用了不斷疊代的向量。我們會在下午詳細介紹向" -#~ "量。" +#~ "您或許可以指出 `print_laps` 使用了不斷疊代的向量。我們會在下午詳細介紹向量。" #~ msgid "The `_` pattern is a wildcard pattern which matches any value." #~ msgstr "`_` 模式是可與任何值配對的萬用字元模式。" @@ -25073,30 +24639,29 @@ msgstr "" #~ "It can be useful to show how binding works, by for instance replacing a " #~ "wildcard character with a variable, or removing the quotes around `q`." #~ msgstr "" -#~ "示範綁定的運作方式可能會很有幫助,例如您可以將萬用字元取代為變數,或是移" -#~ "除 `q` 前後的引號。" +#~ "示範綁定的運作方式可能會很有幫助,例如您可以將萬用字元取代為變數,或是移除 " +#~ "`q` 前後的引號。" #~ msgid "You can demonstrate matching on a reference." #~ msgstr "您可以在參照項目上示範如何配對。" #~ msgid "" -#~ "This might be a good time to bring up the concept of irrefutable " -#~ "patterns, as the term can show up in error messages." +#~ "This might be a good time to bring up the concept of irrefutable patterns, " +#~ "as the term can show up in error messages." #~ msgstr "" -#~ "這時候可能很適合提到「不可反駁的模式」這個概念,因為這個詞可能會出現在錯誤" -#~ "消息中。" +#~ "這時候可能很適合提到「不可反駁的模式」這個概念,因為這個詞可能會出現在錯誤消" +#~ "息中。" #~ msgid "You can also destructure `structs`:" #~ msgstr "您也可以解構 `struct`:" #~ msgid "" -#~ "You can destructure arrays, tuples, and slices by matching on their " -#~ "elements:" +#~ "You can destructure arrays, tuples, and slices by matching on their elements:" #~ msgstr "您可以在陣列、元組和切片的元素上配對,藉此解構陣列、元組和切片:" #~ msgid "" -#~ "Destructuring of slices of unknown length also works with patterns of " -#~ "fixed length." +#~ "Destructuring of slices of unknown length also works with patterns of fixed " +#~ "length." #~ msgstr "您可以解構未知長度的切片,同樣的方法也適用於固定長度的模式。" #~ msgid "Create a new pattern using `_` to represent an element. " @@ -25110,19 +24675,17 @@ msgstr "" #~ "elements." #~ msgstr "向學員指出為了因應不同元素數量的情況,`..` 會如何展開。" -#~ msgid "" -#~ "Show matching against the tail with patterns `[.., b]` and `[a@..,b]`" +#~ msgid "Show matching against the tail with patterns `[.., b]` and `[a@..,b]`" #~ msgstr "向學員說明與模式 (`[.., b]` 和 `[a@..,b]`) 末端的配對情形。" #~ msgid "" #~ "When matching, you can add a _guard_ to a pattern. This is an arbitrary " #~ "Boolean expression which will be executed if the pattern matches:" #~ msgstr "" -#~ "配對時,您可以為模式新增「守衛」。這是任意的布林運算式,會在模式配對成功時" -#~ "執行:" +#~ "配對時,您可以為模式新增「守衛」。這是任意的布林運算式,會在模式配對成功時執" +#~ "行:" -#~ msgid "" -#~ "You can use the variables defined in the pattern in your if expression." +#~ msgid "You can use the variables defined in the pattern in your if expression." #~ msgstr "您可以在 if 運算式中使用模式內定義的變數。" #~ msgid "Day 2: Morning Exercises" @@ -25135,20 +24698,20 @@ msgstr "" #~ msgstr "多邊形結構體" #~ msgid "" -#~ "We will create a `Polygon` struct which contain some points. Copy the " -#~ "code below to and fill in the missing " -#~ "methods to make the tests pass:" +#~ "We will create a `Polygon` struct which contain some points. Copy the code " +#~ "below to and fill in the missing methods to " +#~ "make the tests pass:" #~ msgstr "" -#~ "我們會建立一個包含某幾個點的 `Polygon` 結構體。請將下方程式碼複製到 " -#~ ",並填入缺少的方法,設法通過測試:" +#~ "我們會建立一個包含某幾個點的 `Polygon` 結構體。請將下方程式碼複製到 ,並填入缺少的方法,設法通過測試:" #~ msgid "" -#~ "Since the method signatures are missing from the problem statements, the " -#~ "key part of the exercise is to specify those correctly. You don't have to " -#~ "modify the tests." +#~ "Since the method signatures are missing from the problem statements, the key " +#~ "part of the exercise is to specify those correctly. You don't have to modify " +#~ "the tests." #~ msgstr "" -#~ "由於問題陳述式缺少方法簽章,因此練習的關鍵部分就是正確指定這些簽章。您不需" -#~ "要修改測試。" +#~ "由於問題陳述式缺少方法簽章,因此練習的關鍵部分就是正確指定這些簽章。您不需要" +#~ "修改測試。" #~ msgid "Other interesting parts of the exercise:" #~ msgstr "練習中的其他有趣部分如下:" @@ -25156,25 +24719,24 @@ msgstr "" #~ msgid "" #~ "Derive a `Copy` trait for some structs, as in tests the methods sometimes " #~ "don't borrow their arguments." -#~ msgstr "" -#~ "針對部分結構體衍生 `Copy` 特徵,因為在測試中,方法有時不會借用其引數。" +#~ msgstr "針對部分結構體衍生 `Copy` 特徵,因為在測試中,方法有時不會借用其引數。" #~ msgid "" -#~ "Discover that `Add` trait must be implemented for two objects to be " -#~ "addable via \"+\". Note that we do not discuss generics until Day 3." +#~ "Discover that `Add` trait must be implemented for two objects to be addable " +#~ "via \"+\". Note that we do not discuss generics until Day 3." #~ msgstr "" -#~ "發現必須實作 `Add` 特徵才能透過「+」新增兩個物件。請注意,我們在第 3 天以" -#~ "前不會討論泛型。" +#~ "發現必須實作 `Add` 特徵才能透過「+」新增兩個物件。請注意,我們在第 3 天以前不" +#~ "會討論泛型。" #~ msgid "" -#~ "As we have seen, `if` is an expression in Rust. It is used to " -#~ "conditionally evaluate one of two blocks, but the blocks can have a value " -#~ "which then becomes the value of the `if` expression. Other control flow " -#~ "expressions work similarly in Rust." +#~ "As we have seen, `if` is an expression in Rust. It is used to conditionally " +#~ "evaluate one of two blocks, but the blocks can have a value which then " +#~ "becomes the value of the `if` expression. Other control flow expressions " +#~ "work similarly in Rust." #~ msgstr "" -#~ "如同我們所見,`if` 是 Rust 中的一種表達式。它可以用來根據條件執行兩個區塊" -#~ "之中的一個,而區塊的執行結果可以進一步轉變成 `if` 表達式的賦值。其他控制流" -#~ "程表達式在 Rust 中也有類似的用法。" +#~ "如同我們所見,`if` 是 Rust 中的一種表達式。它可以用來根據條件執行兩個區塊之中" +#~ "的一個,而區塊的執行結果可以進一步轉變成 `if` 表達式的賦值。其他控制流程表達" +#~ "式在 Rust 中也有類似的用法。" #~ msgid "" #~ "```rust,editable\n" @@ -25216,8 +24778,8 @@ msgstr "" #~ "```" #~ msgid "" -#~ "The same rule is used for functions: the value of the function body is " -#~ "the return value:" +#~ "The same rule is used for functions: the value of the function body is the " +#~ "return value:" #~ msgstr "同樣的規則也適用於函式:函式的數值即為函式本體的回傳值:" #~ msgid "" @@ -25319,18 +24881,18 @@ msgstr "" #~ "`if let` can be more concise than `match`, e.g., when only one case is " #~ "interesting. In contrast, `match` requires all branches to be covered." #~ msgstr "" -#~ "`if let` 可以比 `match` 更為精簡,例如只有一個有趣案例時。相對地,`match` " -#~ "必須涵蓋所有分支。" +#~ "`if let` 可以比 `match` 更為精簡,例如只有一個有趣案例時。相對地,`match` 必" +#~ "須涵蓋所有分支。" #~ msgid "" -#~ "Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-" -#~ "example/flow_control/let_else.html) construct allows to do a " -#~ "destructuring assignment, or if it fails, have a non-returning block " -#~ "branch (panic/return/break/continue):" +#~ "Since 1.65, a similar [let-else](https://doc.rust-lang.org/rust-by-example/" +#~ "flow_control/let_else.html) construct allows to do a destructuring " +#~ "assignment, or if it fails, have a non-returning block branch (panic/return/" +#~ "break/continue):" #~ msgstr "" #~ "自 1.65 版起,類似的 [let-else](https://doc.rust-lang.org/rust-by-example/" -#~ "flow_control/let_else.html) 結構可以解構指派項目,或在失敗時具有不會傳回的" -#~ "區塊分支 (panic/return/break/continue):" +#~ "flow_control/let_else.html) 結構可以解構指派項目,或在失敗時具有不會傳回的區" +#~ "塊分支 (panic/return/break/continue):" #~ msgid "" #~ "```rust,editable\n" @@ -25417,14 +24979,13 @@ msgstr "" #~ msgstr "`for` 迴圈" #~ msgid "" -#~ "The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) is " -#~ "closely related to the [`while let` loop](while-let-expression.md). It " -#~ "will automatically call `into_iter()` on the expression and then iterate " -#~ "over it:" +#~ "The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) is closely " +#~ "related to the [`while let` loop](while-let-expression.md). It will " +#~ "automatically call `into_iter()` on the expression and then iterate over it:" #~ msgstr "" -#~ "[`for` 迴圈](https://doc.rust-lang.org/std/keyword.for.html)與 [`while " -#~ "let` 迴圈](while-let-expression.md)密切相關,會自動在運算式上呼叫 " -#~ "`into_iter()`,然後對其進行疊代:" +#~ "[`for` 迴圈](https://doc.rust-lang.org/std/keyword.for.html)與 [`while let` " +#~ "迴圈](while-let-expression.md)密切相關,會自動在運算式上呼叫 `into_iter()`," +#~ "然後對其進行疊代:" #~ msgid "" #~ "```rust,editable\n" @@ -25465,16 +25026,16 @@ msgstr "" #~ msgstr "`(0..10)` 是實作 `Iterator` 特徵的範圍。" #~ msgid "" -#~ "`step_by` is a method that returns another `Iterator` that skips every " -#~ "other element. " +#~ "`step_by` is a method that returns another `Iterator` that skips every other " +#~ "element. " #~ msgstr "`step_by` 這個方法會傳回另一個略過其他所有元素的 `Iterator`。" #~ msgid "" #~ "Modify the elements in the vector and explain the compiler errors. Change " #~ "vector `v` to be mutable and the for loop to `for x in v.iter_mut()`." #~ msgstr "" -#~ "請修改向量中的元素,並說明編譯器錯誤。將向量 `v` 變更為可變動項,並將 for " -#~ "迴圈變更為 `for x in v.iter_mut()`。" +#~ "請修改向量中的元素,並說明編譯器錯誤。將向量 `v` 變更為可變動項,並將 for 迴" +#~ "圈變更為 `for x in v.iter_mut()`。" #~ msgid "`loop` expressions" #~ msgstr "`loop` 運算式" @@ -25483,8 +25044,8 @@ msgstr "" #~ "Finally, there is a [`loop` keyword](https://doc.rust-lang.org/reference/" #~ "expressions/loop-expr.html#infinite-loops) which creates an endless loop." #~ msgstr "" -#~ "最後,有一個 [`loop` 關鍵字](https://doc.rust-lang.org/reference/" -#~ "expressions/loop-expr.html#infinite-loops)會建立無限迴圈。" +#~ "最後,有一個 [`loop` 關鍵字](https://doc.rust-lang.org/reference/expressions/" +#~ "loop-expr.html#infinite-loops)會建立無限迴圈。" #~ msgid "Here you must either `break` or `return` to stop the loop:" #~ msgstr "這時您必須執行 `break` 或 `return` 來停止迴圈:" @@ -25528,13 +25089,13 @@ msgstr "" #~ msgstr "請使用 `break 8` 等值中斷 `loop`,然後顯示出來。" #~ msgid "" -#~ "The [`match` keyword](https://doc.rust-lang.org/reference/expressions/" -#~ "match-expr.html) is used to match a value against one or more patterns. " -#~ "In that sense, it works like a series of `if let` expressions:" +#~ "The [`match` keyword](https://doc.rust-lang.org/reference/expressions/match-" +#~ "expr.html) is used to match a value against one or more patterns. In that " +#~ "sense, it works like a series of `if let` expressions:" #~ msgstr "" -#~ "[`match` 關鍵字](https://doc.rust-lang.org/reference/expressions/match-" -#~ "expr.html)是用來將值與一或多個模式進行比對。因此,這個關鍵字的運作方式類似" -#~ "於一系列的 `if let` 運算式:" +#~ "[`match` 關鍵字](https://doc.rust-lang.org/reference/expressions/match-expr." +#~ "html)是用來將值與一或多個模式進行比對。因此,這個關鍵字的運作方式類似於一系列" +#~ "的 `if let` 運算式:" #~ msgid "" #~ "```rust,editable\n" @@ -25570,22 +25131,21 @@ msgstr "" #~ msgstr "請移除 `.as_deref()` 並說明錯誤。" #~ msgid "" -#~ "`std::env::args().next()` returns an `Option`, but we cannot " -#~ "match against `String`." +#~ "`std::env::args().next()` returns an `Option`, but we cannot match " +#~ "against `String`." #~ msgstr "" -#~ "`std::env::args().next()` 會傳回 `Option`,但我們無法與`String` 進" -#~ "行比對。" +#~ "`std::env::args().next()` 會傳回 `Option`,但我們無法與`String` 進行" +#~ "比對。" #~ msgid "" -#~ "`as_deref()` transforms an `Option` to `Option<&T::Target>`. In our " -#~ "case, this turns `Option` into `Option<&str>`." +#~ "`as_deref()` transforms an `Option` to `Option<&T::Target>`. In our case, " +#~ "this turns `Option` into `Option<&str>`." #~ msgstr "" -#~ "`as_deref()` 會將 `Option` 轉換成 `Option<&T::Target>`。在我們的案例" -#~ "中,這會將 `Option` 轉換成`Option<&str>`。" +#~ "`as_deref()` 會將 `Option` 轉換成 `Option<&T::Target>`。在我們的案例中,這" +#~ "會將 `Option` 轉換成`Option<&str>`。" #~ msgid "" -#~ "We can now use pattern matching to match against the `&str` inside " -#~ "`Option`." +#~ "We can now use pattern matching to match against the `&str` inside `Option`." #~ msgstr "我們現在可以使用模式比對,與 `Option` 內的 `&str` 進行比對。" #~ msgid "" @@ -25627,8 +25187,7 @@ msgstr "" #~ msgid "" #~ "In this case we break the outer loop after 3 iterations of the inner loop." -#~ msgstr "" -#~ "在這個範例中,內層迴圈經過三次迭代後,我們使用 `break` 跳出外層迴圈。" +#~ msgstr "在這個範例中,內層迴圈經過三次迭代後,我們使用 `break` 跳出外層迴圈。" #~ msgid "The common vocabulary types include:" #~ msgstr "常見的詞彙型別包括:" @@ -25637,11 +25196,10 @@ msgstr "" #~ "[`Option` and `Result`](std/option-result.md) types: used for optional " #~ "values and [error handling](error-handling.md)." #~ msgstr "" -#~ "[`Option` 和 `Result`](std/option-result.md) 型別:用於選擇性的值和[錯誤處" -#~ "理](error-handling.md)。" +#~ "[`Option` 和 `Result`](std/option-result.md) 型別:用於選擇性的值和[錯誤處理]" +#~ "(error-handling.md)。" -#~ msgid "" -#~ "[`String`](std/string.md): the default string type used for owned data." +#~ msgid "[`String`](std/string.md): the default string type used for owned data." #~ msgstr "[`String`](std/string.md):用於自有資料的預設字串型別。" #~ msgid "[`Vec`](std/vec.md): a standard extensible vector." @@ -25676,13 +25234,13 @@ msgstr "" #~ msgstr "如果找到該元素,`Result::Ok` 會保留該元素所在位置的索引。" #~ msgid "" -#~ "Otherwise, `Result::Err` contains the index where such an element should " -#~ "be inserted." +#~ "Otherwise, `Result::Err` contains the index where such an element should be " +#~ "inserted." #~ msgstr "如果沒有找到,`Result::Err` 會包含應插入這類元素的索引。" #~ msgid "" -#~ "Show iterating over a vector and mutating the value: `for e in &mut v " -#~ "{ *e += 50; }`" +#~ "Show iterating over a vector and mutating the value: `for e in &mut v { *e " +#~ "+= 50; }`" #~ msgstr "示範如何對向量進行疊代並修改值:`for e in &mut v { *e += 50; }`" #~ msgid "" @@ -25696,44 +25254,42 @@ msgstr "" #, fuzzy #~ msgid "" #~ "If you need to mutate the data inside an `Rc`, you will need to wrap the " -#~ "data in a type such as [`Cell` or `RefCell`](../concurrency/shared_state/" -#~ "arc.md)." +#~ "data in a type such as [`Cell` or `RefCell`](../concurrency/shared_state/arc." +#~ "md)." #~ msgstr "" -#~ "如要在 `Rc` 內修改資料,必須將資料加入 [`Cell` 或 `RefCell`](../" -#~ "concurrency/shared_state/arc.md) 等型別中。\\* 如果是多執行緒的環境,請參" -#~ "閱 [`Arc`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)。\\* 您可" -#~ "以將共用指標「降級」為 [`Weak`](https://doc.rust-lang.org/std/rc/struct." -#~ "Weak.html) 指標,建立之後會捨棄的循環。" +#~ "如要在 `Rc` 內修改資料,必須將資料加入 [`Cell` 或 `RefCell`](../concurrency/" +#~ "shared_state/arc.md) 等型別中。\\* 如果是多執行緒的環境,請參閱 [`Arc`]" +#~ "(https://doc.rust-lang.org/std/sync/struct.Mutex.html)。\\* 您可以將共用指標" +#~ "「降級」為 [`Weak`](https://doc.rust-lang.org/std/rc/struct.Weak.html) 指標," +#~ "建立之後會捨棄的循環。" #~ msgid "Like C++'s `std::shared_ptr`." #~ msgstr "Rust 的 `Rc` 就好比是 C++ 的 `std::shared_ptr`。" #~ msgid "" -#~ "Compare the different datatypes mentioned. `Box` enables (im)mutable " -#~ "borrows that are enforced at compile time. `RefCell` enables (im)mutable " -#~ "borrows that are enforced at run time and will panic if it fails at " -#~ "runtime." +#~ "Compare the different datatypes mentioned. `Box` enables (im)mutable borrows " +#~ "that are enforced at compile time. `RefCell` enables (im)mutable borrows " +#~ "that are enforced at run time and will panic if it fails at runtime." #~ msgstr "" #~ "比較提及的不同資料型別。`Box` 可啟用在編譯時強制執行的可變/不可變借用。" -#~ "`RefCell` 可啟用在執行階段強制執行的可變/不可變借用,如果在執行階段失敗," -#~ "將觸發恐慌。" +#~ "`RefCell` 可啟用在執行階段強制執行的可變/不可變借用,如果在執行階段失敗,將觸" +#~ "發恐慌。" #~ msgid "Day 2: Afternoon Exercises" #~ msgstr "第 2 天:下午練習" -#~ msgid "" -#~ "The exercises for this afternoon will focus on strings and iterators." +#~ msgid "The exercises for this afternoon will focus on strings and iterators." #~ msgstr "今天下午的練習著重在字串和疊代器。" #~ msgid "" -#~ "In this exercise, you are implementing a routing component of a web " -#~ "server. The server is configured with a number of _path prefixes_ which " -#~ "are matched against _request paths_. The path prefixes can contain a " -#~ "wildcard character which matches a full segment. See the unit tests below." +#~ "In this exercise, you are implementing a routing component of a web server. " +#~ "The server is configured with a number of _path prefixes_ which are matched " +#~ "against _request paths_. The path prefixes can contain a wildcard character " +#~ "which matches a full segment. See the unit tests below." #~ msgstr "" -#~ "在本次練習中,您將實作網路伺服器的路由元件。伺服器設定了多個與「要求路徑」" -#~ "__相符的「路徑前置字元」__。路徑前置字元可包含與完整片段相符的萬用字元。請" -#~ "參閱下方的單元測試。" +#~ "在本次練習中,您將實作網路伺服器的路由元件。伺服器設定了多個與「要求路徑」__" +#~ "相符的「路徑前置字元」__。路徑前置字元可包含與完整片段相符的萬用字元。請參閱" +#~ "下方的單元測試。" #~ msgid "" #~ "Traits: deriving traits, default methods, and important standard library " @@ -25741,8 +25297,8 @@ msgstr "" #~ msgstr "特徵:衍生特徵、預設方法,以及重要的標準程式庫特徵。" #~ msgid "" -#~ "Generics: generic data types, generic methods, monomorphization, and " -#~ "trait objects." +#~ "Generics: generic data types, generic methods, monomorphization, and trait " +#~ "objects." #~ msgstr "泛型:泛型資料型別、泛型方法、單型,以及特徵物件。" #~ msgid "Testing: unit tests, documentation tests, and integration tests." @@ -25762,11 +25318,10 @@ msgstr "" #~ msgid "You can declare a generic type on your `impl` block:" #~ msgstr "你可以將 `impl` 區塊宣告為泛型型別:" -#~ msgid "" -#~ "Generic code is turned into non-generic code based on the call sites:" +#~ msgid "Generic code is turned into non-generic code based on the call sites:" #~ msgstr "" -#~ "Rust 在編譯時進行單型化 (Monomorphization),根據不同呼叫者,將泛型程式碼轉" -#~ "換成實際型別的程式碼:" +#~ "Rust 在編譯時進行單型化 (Monomorphization),根據不同呼叫者,將泛型程式碼轉換" +#~ "成實際型別的程式碼:" #~ msgid "behaves as if you wrote" #~ msgstr "以上程式碼等同於下方的程式碼" @@ -25778,12 +25333,12 @@ msgstr "" #~ msgstr "特徵可以依照其他特徵方法來實作行為:" #~ msgid "" -#~ "Traits may specify pre-implemented (default) methods and methods that " -#~ "users are required to implement themselves. Methods with default " -#~ "implementations can rely on required methods." +#~ "Traits may specify pre-implemented (default) methods and methods that users " +#~ "are required to implement themselves. Methods with default implementations " +#~ "can rely on required methods." #~ msgstr "" -#~ "特徵可能會指定預先實作的 (預設) 方法,以及使用者必須自行實作的方法。採用預" -#~ "設實作項目的方法可以信賴必要方法。" +#~ "特徵可能會指定預先實作的 (預設) 方法,以及使用者必須自行實作的方法。採用預設" +#~ "實作項目的方法可以信賴必要方法。" #~ msgid "" #~ "```rust,ignore\n" @@ -25811,17 +25366,16 @@ msgstr "" #~ "This example is great, because it uses `impl Display` twice. It helps to " #~ "explain that nothing here enforces that it is _the same_ `impl Display` " #~ "type. If we used a single `T: Display`, it would enforce the constraint " -#~ "that input `T` and return `T` type are the same type. It would not work " -#~ "for this particular function, as the type we expect as input is likely " -#~ "not what `format!` returns. If we wanted to do the same via `: Display` " -#~ "syntax, we'd need two independent generic parameters." +#~ "that input `T` and return `T` type are the same type. It would not work for " +#~ "this particular function, as the type we expect as input is likely not what " +#~ "`format!` returns. If we wanted to do the same via `: Display` syntax, we'd " +#~ "need two independent generic parameters." #~ msgstr "" -#~ "這個例子非常好,因為 `impl Display` 使用了兩次。這有助於說明此處沒有 任何" -#~ "項目會強制使用「相同的」`impl Display` 型別。如果我們使用單一的 `T: " -#~ "Display`,則會強制限制「輸入」`T` 和「回傳」`T` 屬於同一型別。 但這並不適" -#~ "合這個特定函式,因為我們預期做為「輸入」的型別不一定 會是 `format!` 回傳的" -#~ "內容。如要透過 `: Display` 語法執行相同操作,我們會 需要兩個獨立的泛型參" -#~ "數。" +#~ "這個例子非常好,因為 `impl Display` 使用了兩次。這有助於說明此處沒有 任何項目" +#~ "會強制使用「相同的」`impl Display` 型別。如果我們使用單一的 `T: Display`,則" +#~ "會強制限制「輸入」`T` 和「回傳」`T` 屬於同一型別。 但這並不適合這個特定函式," +#~ "因為我們預期做為「輸入」的型別不一定 會是 `format!` 回傳的內容。如要透過 `: " +#~ "Display` 語法執行相同操作,我們會 需要兩個獨立的泛型參數。" #~ msgid "" #~ "We will now look at some of the most common traits of the Rust standard " @@ -25830,21 +25384,20 @@ msgstr "" #~ msgid "" #~ "[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) and " -#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator." -#~ "html) used in `for` loops," +#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +#~ "used in `for` loops," #~ msgstr "" #~ "[`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) 和 " -#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator." -#~ "html) 用於 `for` 迴圈。" +#~ "[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html) " +#~ "用於 `for` 迴圈。" #~ msgid "" -#~ "[`From`](https://doc.rust-lang.org/std/convert/trait.From.html) and " -#~ "[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) used to " -#~ "convert values," +#~ "[`From`](https://doc.rust-lang.org/std/convert/trait.From.html) and [`Into`]" +#~ "(https://doc.rust-lang.org/std/convert/trait.Into.html) used to convert " +#~ "values," #~ msgstr "" -#~ "[`From`](https://doc.rust-lang.org/std/convert/trait.From.html) 和 " -#~ "[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) 用來轉換" -#~ "值。" +#~ "[`From`](https://doc.rust-lang.org/std/convert/trait.From.html) 和 [`Into`]" +#~ "(https://doc.rust-lang.org/std/convert/trait.Into.html) 用來轉換值。" #~ msgid "" #~ "[`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) and [`Write`]" @@ -25854,26 +25407,26 @@ msgstr "" #~ "(https://doc.rust-lang.org/std/io/trait.Write.html) 用於 IO。" #~ msgid "" -#~ "[`Add`](https://doc.rust-lang.org/std/ops/trait.Add.html), [`Mul`]" -#~ "(https://doc.rust-lang.org/std/ops/trait.Mul.html), ... used for operator " +#~ "[`Add`](https://doc.rust-lang.org/std/ops/trait.Add.html), [`Mul`](https://" +#~ "doc.rust-lang.org/std/ops/trait.Mul.html), ... used for operator " #~ "overloading, and" #~ msgstr "" -#~ "[`Add`](https://doc.rust-lang.org/std/ops/trait.Add.html)、[`Mul`]" -#~ "(https://doc.rust-lang.org/std/ops/trait.Mul.html) 等用於運算子超載。" +#~ "[`Add`](https://doc.rust-lang.org/std/ops/trait.Add.html)、[`Mul`](https://" +#~ "doc.rust-lang.org/std/ops/trait.Mul.html) 等用於運算子超載。" #~ msgid "" -#~ "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) " -#~ "used to construct a default instance of a type." +#~ "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) used " +#~ "to construct a default instance of a type." #~ msgstr "" -#~ "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) 用於" -#~ "建構型別的預設執行個體。" +#~ "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) 用於建" +#~ "構型別的預設執行個體。" #~ msgid "" -#~ "`Iterator` implements `fn collect(self) -> B where B: " -#~ "FromIterator, Self: Sized`" +#~ "`Iterator` implements `fn collect(self) -> B where B: FromIterator, Self: Sized`" #~ msgstr "" -#~ "`Iterator` implements `fn collect(self) -> B where B: " -#~ "FromIterator, Self: Sized`" +#~ "`Iterator` implements `fn collect(self) -> B where B: FromIterator, Self: Sized`" #~ msgid "`Add`, `Mul`, ..." #~ msgstr "`Add`、`Mul`..." @@ -25882,8 +25435,8 @@ msgstr "" #~ msgstr "第 3 天:上午練習" #~ msgid "" -#~ "Let us design a classical GUI library using our new knowledge of traits " -#~ "and trait objects." +#~ "Let us design a classical GUI library using our new knowledge of traits and " +#~ "trait objects." #~ msgstr "我們對特徵和特徵物件有了新的瞭解,現在來設計經典的 GUI 程式庫吧!" #~ msgid "We will have a number of widgets in our library:" @@ -25907,21 +25460,21 @@ msgstr "" #~ "Copy the code below to , fill in the missing " #~ "`draw_into` methods so that you implement the `Widget` trait:" #~ msgstr "" -#~ "請將以下程式碼複製到 ,並填入缺少的 " -#~ "`draw_into` 方法,以便實作 `Widget` 特徵:" +#~ "請將以下程式碼複製到 ,並填入缺少的 `draw_into` " +#~ "方法,以便實作 `Widget` 特徵:" #~ msgid "The output of the above program can be something simple like this:" #~ msgstr "上方程式的輸出內容可以很簡單,像下面這樣:" #~ msgid "" -#~ "If you want to draw aligned text, you can use the [fill/alignment]" -#~ "(https://doc.rust-lang.org/std/fmt/index.html#fillalignment) formatting " -#~ "operators. In particular, notice how you can pad with different " -#~ "characters (here a `'/'`) and how you can control alignment:" +#~ "If you want to draw aligned text, you can use the [fill/alignment](https://" +#~ "doc.rust-lang.org/std/fmt/index.html#fillalignment) formatting operators. In " +#~ "particular, notice how you can pad with different characters (here a `'/'`) " +#~ "and how you can control alignment:" #~ msgstr "" -#~ "如要繪製對齊的文字,可以使用 [fill/alignment](https://doc.rust-lang.org/" -#~ "std/fmt/index.html#fillalignment) 格式化運算子。請特別注意如何使用不同的字" -#~ "元 (此處為 `'/'`) 設定邊框間距,以及可以如何控制對齊方式:" +#~ "如要繪製對齊的文字,可以使用 [fill/alignment](https://doc.rust-lang.org/std/" +#~ "fmt/index.html#fillalignment) 格式化運算子。請特別注意如何使用不同的字元 (此" +#~ "處為 `'/'`) 設定邊框間距,以及可以如何控制對齊方式:" #~ msgid "" #~ "Using such alignment tricks, you can for example produce output like this:" @@ -25984,11 +25537,11 @@ msgstr "" #~ "```" #~ msgid "" -#~ "We have already seen the `Result` enum. This is used pervasively when " -#~ "errors are expected as part of normal operation:" +#~ "We have already seen the `Result` enum. This is used pervasively when errors " +#~ "are expected as part of normal operation:" #~ msgstr "" -#~ "我們先前介紹了 `Result` 列舉。當正常運作過程中預期發生錯誤時,普遍都會使用" -#~ "這個列舉:" +#~ "我們先前介紹了 `Result` 列舉。當正常運作過程中預期發生錯誤時,普遍都會使用這" +#~ "個列舉:" #~ msgid "" #~ "```rust,editable\n" @@ -26155,8 +25708,8 @@ msgstr "" #~ " fn fmt(&self, f: &mut Formatter) -> fmt::Result {\n" #~ " match self {\n" #~ " Self::IoError(e) => write!(f, \"IO error: {e}\"),\n" -#~ " Self::EmptyUsername(filename) => write!(f, \"Found no " -#~ "username in {filename}\"),\n" +#~ " Self::EmptyUsername(filename) => write!(f, \"Found no username " +#~ "in {filename}\"),\n" #~ " }\n" #~ " }\n" #~ "}\n" @@ -26171,8 +25724,7 @@ msgstr "" #~ " let mut username = String::with_capacity(100);\n" #~ " File::open(path)?.read_to_string(&mut username)?;\n" #~ " if username.is_empty() {\n" -#~ " return Err(ReadUsernameError::EmptyUsername(String::" -#~ "from(path)));\n" +#~ " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" #~ " }\n" #~ " Ok(username)\n" #~ "}\n" @@ -26202,8 +25754,8 @@ msgstr "" #~ " fn fmt(&self, f: &mut Formatter) -> fmt::Result {\n" #~ " match self {\n" #~ " Self::IoError(e) => write!(f, \"IO error: {e}\"),\n" -#~ " Self::EmptyUsername(filename) => write!(f, \"Found no " -#~ "username in {filename}\"),\n" +#~ " Self::EmptyUsername(filename) => write!(f, \"Found no username " +#~ "in {filename}\"),\n" #~ " }\n" #~ " }\n" #~ "}\n" @@ -26218,8 +25770,7 @@ msgstr "" #~ " let mut username = String::with_capacity(100);\n" #~ " File::open(path)?.read_to_string(&mut username)?;\n" #~ " if username.is_empty() {\n" -#~ " return Err(ReadUsernameError::EmptyUsername(String::" -#~ "from(path)));\n" +#~ " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" #~ " }\n" #~ " Ok(username)\n" #~ "}\n" @@ -26249,8 +25800,7 @@ msgstr "" #~ " let mut username = String::with_capacity(100);\n" #~ " fs::File::open(path)?.read_to_string(&mut username)?;\n" #~ " if username.is_empty() {\n" -#~ " return Err(ReadUsernameError::EmptyUsername(String::" -#~ "from(path)));\n" +#~ " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" #~ " }\n" #~ " Ok(username)\n" #~ "}\n" @@ -26281,8 +25831,7 @@ msgstr "" #~ " let mut username = String::with_capacity(100);\n" #~ " fs::File::open(path)?.read_to_string(&mut username)?;\n" #~ " if username.is_empty() {\n" -#~ " return Err(ReadUsernameError::EmptyUsername(String::" -#~ "from(path)));\n" +#~ " return Err(ReadUsernameError::EmptyUsername(String::from(path)));\n" #~ " }\n" #~ " Ok(username)\n" #~ "}\n" @@ -26297,17 +25846,15 @@ msgstr "" #~ "```" #~ msgid "" -#~ "`thiserror`'s derive macro automatically implements `std::error::Error`, " -#~ "and optionally `Display` (if the `#[error(...)]` attributes are provided) " -#~ "and `From` (if the `#[from]` attribute is added). It also works for " -#~ "structs." +#~ "`thiserror`'s derive macro automatically implements `std::error::Error`, and " +#~ "optionally `Display` (if the `#[error(...)]` attributes are provided) and " +#~ "`From` (if the `#[from]` attribute is added). It also works for structs." #~ msgstr "" -#~ "`thiserror` 的衍生巨集會自動實作 `std::error::Error`,並視情況實作 " -#~ "`Display` (如果提供了 `#[error(...)]` 屬性的話) 和 `From` (如果新增了 " -#~ "`#[from]` 屬性的話)。上述原則也適用於結構體。" +#~ "`thiserror` 的衍生巨集會自動實作 `std::error::Error`,並視情況實作 `Display` " +#~ "(如果提供了 `#[error(...)]` 屬性的話) 和 `From` (如果新增了 `#[from]` 屬性的" +#~ "話)。上述原則也適用於結構體。" -#~ msgid "" -#~ "It doesn't affect your public API, which makes it good for libraries." +#~ msgid "It doesn't affect your public API, which makes it good for libraries." #~ msgstr "這個不會影響你的公用API,因此這對程式庫很好。" #~ msgid "" @@ -26372,8 +25919,8 @@ msgstr "" #~ "contextual information to your errors and allows you to have fewer custom " #~ "error types:" #~ msgstr "" -#~ "透過廣泛使用的 [anyhow](https://docs.rs/anyhow/) crate,您可以為錯誤添加背" -#~ "景資訊,並減少自訂錯誤型別的數量:" +#~ "透過廣泛使用的 [anyhow](https://docs.rs/anyhow/) crate,您可以為錯誤添加背景" +#~ "資訊,並減少自訂錯誤型別的數量:" #~ msgid "" #~ "```rust,editable,compile_fail\n" @@ -26438,8 +25985,8 @@ msgstr "" #~ "Unit tests are often put in a nested module (run tests on the [Playground]" #~ "(https://play.rust-lang.org/)):" #~ msgstr "" -#~ "單元測試通常會位於巢狀模組中 (在 [Playground](https://play.rust-lang." -#~ "org/) 上執行測試):" +#~ "單元測試通常會位於巢狀模組中 (在 [Playground](https://play.rust-lang.org/) 上" +#~ "執行測試):" #~ msgid "Useful crates for writing tests" #~ msgstr "有助於編寫測試的 crate" @@ -26447,12 +25994,10 @@ msgstr "" #~ msgid "Rust comes with only basic support for writing tests." #~ msgstr "Rust 只提供基本的編寫測試支援。" -#~ msgid "" -#~ "Here are some additional crates which we recommend for writing tests:" +#~ msgid "Here are some additional crates which we recommend for writing tests:" #~ msgstr "以下列出幾個額外的 crate,建議您在編寫測試時使用:" -#~ msgid "" -#~ "[proptest](https://docs.rs/proptest): Property-based testing for Rust." +#~ msgid "[proptest](https://docs.rs/proptest): Property-based testing for Rust." #~ msgstr "" #~ "[proptest](https://docs.rs/proptest):讓您對 Rust 執行以屬性為基礎的測試。" @@ -26465,8 +26010,8 @@ msgstr "" #~ msgstr "呼叫外部程式碼" #~ msgid "" -#~ "Functions from other languages might violate the guarantees of Rust. " -#~ "Calling them is thus unsafe:" +#~ "Functions from other languages might violate the guarantees of Rust. Calling " +#~ "them is thus unsafe:" #~ msgstr "其他語言的函式可能會違反 Rust 保證,因此呼叫這類函式並不安全:" #~ msgid "Day 3: Afternoon Exercises" @@ -26478,8 +26023,7 @@ msgstr "" #~ msgid "" #~ "After looking at the exercise, you can look at the [solution](solutions-" #~ "afternoon.md) provided." -#~ msgstr "" -#~ "完成練習後,您可以看看我們提供的[解決方案](solutions-afternoon.md)。" +#~ msgstr "完成練習後,您可以看看我們提供的[解決方案](solutions-afternoon.md)。" #~ msgid "" #~ "```java\n" @@ -26542,8 +26086,8 @@ msgstr "" #~ "```" #~ msgid "" -#~ "Notice that the thread is stopped before it reaches 10 — the main thread " -#~ "is not waiting." +#~ "Notice that the thread is stopped before it reaches 10 — the main thread is " +#~ "not waiting." #~ msgstr "" #~ "請注意,執行緒會在達到 10 之前停止運作,因為主執行緒不會 等待其完成運作。" @@ -26902,17 +26446,16 @@ msgstr "" #~ "com/google/comprehensive-rust/discussions). Let us know if you have a " #~ "different or better solution than what is presented here." #~ msgstr "" -#~ "歡迎[前往 GitHub](https://github.com/google/comprehensive-rust/" -#~ "discussions)針對解決方案提問。如果您有與本書不同或更好的解決方案,請告訴我" -#~ "們。" +#~ "歡迎[前往 GitHub](https://github.com/google/comprehensive-rust/discussions)針" +#~ "對解決方案提問。如果您有與本書不同或更好的解決方案,請告訴我們。" #~ msgid "" #~ "**Note:** Please ignore the `// ANCHOR: label` and `// ANCHOR_END: label` " -#~ "comments you see in the solutions. They are there to make it possible to " -#~ "re-use parts of the solutions as the exercises." +#~ "comments you see in the solutions. They are there to make it possible to re-" +#~ "use parts of the solutions as the exercises." #~ msgstr "" -#~ "**注意:**請忽略解決方案中的 `// ANCHOR: label` 和 `// ANCHOR_END: label` " -#~ "註解。之所以有這些註解,是要方便您重複利用解決方案的某些部分來練習。" +#~ "**注意:**請忽略解決方案中的 `// ANCHOR: label` 和 `// ANCHOR_END: label` 註" +#~ "解。之所以有這些註解,是要方便您重複利用解決方案的某些部分來練習。" #~ msgid "Day 1 Morning Exercises" #~ msgstr "第 1 天:上午練習" @@ -26924,19 +26467,18 @@ msgstr "" #~ msgstr "加分題" #~ msgid "" -#~ "It requires more advanced concepts. It might seem that we could use a " -#~ "slice-of-slices (`&[&[i32]]`) as the input type to transpose and thus " -#~ "make our function handle any size of matrix. However, this quickly breaks " -#~ "down: the return type cannot be `&[&[i32]]` since it needs to own the " -#~ "data you return." +#~ "It requires more advanced concepts. It might seem that we could use a slice-" +#~ "of-slices (`&[&[i32]]`) as the input type to transpose and thus make our " +#~ "function handle any size of matrix. However, this quickly breaks down: the " +#~ "return type cannot be `&[&[i32]]` since it needs to own the data you return." #~ msgstr "" -#~ "這需要用到更進階的概念。表面上看起來我們可以使用多維度切片 (`&[&[i32]]`) " -#~ "做為轉置的輸入型別,進而讓函式處理任何大小的矩陣。但實際上這很快就會失敗," -#~ "也就是說傳回型別不能是 `&[&[i32]]`,因為它需要擁有您傳回的資料。" +#~ "這需要用到更進階的概念。表面上看起來我們可以使用多維度切片 (`&[&[i32]]`) 做為" +#~ "轉置的輸入型別,進而讓函式處理任何大小的矩陣。但實際上這很快就會失敗,也就是" +#~ "說傳回型別不能是 `&[&[i32]]`,因為它需要擁有您傳回的資料。" #~ msgid "" -#~ "You can attempt to use something like `Vec>`, but this doesn't " -#~ "work out-of-the-box either: it's hard to convert from `Vec>` to " +#~ "You can attempt to use something like `Vec>`, 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>` 這類代碼,但這也不能立即見效,因為從 " @@ -26944,20 +26486,20 @@ msgstr "" #~ "`pretty_print`。" #~ msgid "" -#~ "Once we get to traits and generics, we'll be able to use the [`std::" -#~ "convert::AsRef`](https://doc.rust-lang.org/std/convert/trait.AsRef.html) " -#~ "trait to abstract over anything that can be referenced as a slice." +#~ "Once we get to traits and generics, we'll be able to use the [`std::convert::" +#~ "AsRef`](https://doc.rust-lang.org/std/convert/trait.AsRef.html) trait to " +#~ "abstract over anything that can be referenced as a slice." #~ msgstr "" #~ "一旦瞭解特徵和泛型,我們就能使用 [`std::convert::AsRef`](https://doc.rust-" -#~ "lang.org/std/convert/trait.AsRef.html) 特徵,對任何可當做切片參照的資料進" -#~ "行抽象化。" +#~ "lang.org/std/convert/trait.AsRef.html) 特徵,對任何可當做切片參照的資料進行抽" +#~ "象化。" #~ msgid "" -#~ "In addition, the type itself would not enforce that the child slices are " -#~ "of the same length, so such variable could contain an invalid matrix." +#~ "In addition, the type itself would not enforce that the child slices are of " +#~ "the same length, so such variable could contain an invalid matrix." #~ msgstr "" -#~ "此外,型別本身不會強制規定子項切片的長度必須相同,因此這類變數可能含有無效" -#~ "的矩陣。" +#~ "此外,型別本身不會強制規定子項切片的長度必須相同,因此這類變數可能含有無效的" +#~ "矩陣。" #~ msgid "Day 1 Afternoon Exercises" #~ msgstr "第 1 天:下午練習" @@ -26998,21 +26540,20 @@ msgstr "" #~ msgid "Cell/RefCell" #~ msgstr "Cell/RefCell" -#~ msgid "" -#~ "Day 1: Basic Rust, syntax, control flow, creating and consuming values." +#~ msgid "Day 1: Basic Rust, syntax, control flow, creating and consuming values." #~ msgstr "第 1 天:Rust 基本概念、語法、控制流程、建立及取用值。" #~ msgid "" -#~ "This slide tries to make the students comfortable with Rust code. They " -#~ "will see a ton of it over the next three days so we start small with " -#~ "something familiar." +#~ "This slide tries to make the students comfortable with Rust code. They will " +#~ "see a ton of it over the next three days so we start small with something " +#~ "familiar." #~ msgstr "" -#~ "我們會藉由這張投影片,試著讓學生熟悉 Rust 程式碼。在接下來的三天裡,他們會" -#~ "大量接觸到這些內容,所以我們得從他們熟悉的小地方著手。" +#~ "我們會藉由這張投影片,試著讓學生熟悉 Rust 程式碼。在接下來的三天裡,他們會大" +#~ "量接觸到這些內容,所以我們得從他們熟悉的小地方著手。" #~ msgid "" -#~ "In a shell `rustup doc std::fmt` will open a browser on the local std::" -#~ "fmt documentation" +#~ "In a shell `rustup doc std::fmt` will open a browser on the local std::fmt " +#~ "documentation" #~ msgstr "" #~ "在殼層中,`rustup doc std::fmt` 會開啟本機 std::fmt 說明文件上的瀏覽器。" @@ -27021,14 +26562,14 @@ msgstr "" #~ "lang.org/rustc/codegen-options/index.html#overflow-checks) compile-time " #~ "flag. If enabled, the program will panic (a controlled crash of the " #~ "program), otherwise you get wrap-around semantics. By default, you get " -#~ "panics in debug mode (`cargo build`) and wrap-around in release mode " -#~ "(`cargo build --release`)." +#~ "panics in debug mode (`cargo build`) and wrap-around in release mode (`cargo " +#~ "build --release`)." #~ msgstr "" #~ "整數溢位的處理是透過 [`overflow-checks`](https://doc.rust-lang.org/rustc/" #~ "codegen-options/index.html#overflow-checks) 編譯時間標記定義的。如果啟用的" -#~ "話,程式就會恐慌 (程式受控地異常終止),如未啟用,則會發生語意迴繞現象。根" -#~ "據預設,在偵錯模式 (`cargo build`) 中會發生恐慌,在發布模式 (`cargo build " -#~ "--release`) 中會發生迴繞。" +#~ "話,程式就會恐慌 (程式受控地異常終止),如未啟用,則會發生語意迴繞現象。根據預" +#~ "設,在偵錯模式 (`cargo build`) 中會發生恐慌,在發布模式 (`cargo build --" +#~ "release`) 中會發生迴繞。" #~ msgid "Rust is built with all the experience gained in the last decades." #~ msgstr "Rust 是根據過去數十年累積的所有經驗打造而成。" @@ -27038,38 +26579,36 @@ msgstr "" #~ "`cargo test`. We will discuss these tests in the [Testing section](../" #~ "testing/doc-tests.html)." #~ msgstr "" -#~ "Rustdoc 註解可包含能使用 `cargo test` 執行及測試的程式碼片段。我們會在" -#~ "[「測試」一節](../testing/doc-tests.html)討論這些測試。" +#~ "Rustdoc 註解可包含能使用 `cargo test` 執行及測試的程式碼片段。我們會在[「測" +#~ "試」一節](../testing/doc-tests.html)討論這些測試。" -#~ msgid "" -#~ "Add a static method called `Rectangle::new` and call this from `main`:" +#~ msgid "Add a static method called `Rectangle::new` and call this from `main`:" #~ msgstr "新增名為 `Rectangle::new` 的靜態方法,然後從 `main` 呼叫此方法:" #~ msgid "" -#~ "While _technically_, Rust does not have custom constructors, static " -#~ "methods are commonly used to initialize structs (but don't have to). The " -#~ "actual constructor, `Rectangle { width, height }`, could be called " -#~ "directly. See the [Rustnomicon](https://doc.rust-lang.org/nomicon/" -#~ "constructors.html)." +#~ "While _technically_, Rust does not have custom constructors, static methods " +#~ "are commonly used to initialize structs (but don't have to). The actual " +#~ "constructor, `Rectangle { width, height }`, could be called directly. See " +#~ "the [Rustnomicon](https://doc.rust-lang.org/nomicon/constructors.html)." #~ msgstr "" -#~ "雖然「技術上」來說,Rust 沒有自訂的建構函式,但靜態方法經常用來初始化結構" -#~ "體 (儘管並非必須)。因此,您可直接呼叫實際的建構函式 `Rectangle { width, " -#~ "height }`。詳情請參閱 [Rustnomicon](https://doc.rust-lang.org/nomicon/" -#~ "constructors.html)。" +#~ "雖然「技術上」來說,Rust 沒有自訂的建構函式,但靜態方法經常用來初始化結構體 " +#~ "(儘管並非必須)。因此,您可直接呼叫實際的建構函式 `Rectangle { width, height }" +#~ "`。詳情請參閱 [Rustnomicon](https://doc.rust-lang.org/nomicon/constructors." +#~ "html)。" #~ msgid "" #~ "Add a `Rectangle::square(width: u32)` constructor to illustrate that such " #~ "static methods can take arbitrary parameters." #~ msgstr "" -#~ "新增 `Rectangle::square(width: u32)` 建構函式,說明這類靜態方法可以採用任" -#~ "意參數。" +#~ "新增 `Rectangle::square(width: u32)` 建構函式,說明這類靜態方法可以採用任意參" +#~ "數。" #~ msgid "" #~ "The use of the reference `&array` within `for n in &array` is a subtle " #~ "preview of issues of ownership that will come later in the afternoon." #~ msgstr "" -#~ "在 `for n in &array` 內使用 `&array` 參照項目是一個巧妙方式,可稍微預示下" -#~ "午將談到的擁有權問題。" +#~ "在 `for n in &array` 內使用 `&array` 參照項目是一個巧妙方式,可稍微預示下午將" +#~ "談到的擁有權問題。" #~ msgid "Without the `&`..." #~ msgstr "沒有 `&` 的影響..." @@ -27086,8 +26625,8 @@ msgstr "" #~ "An implicit array copy would have occurred. Since `i32` is a copy type, " #~ "then `[i32; 3]` is also a copy type." #~ msgstr "" -#~ "會發生隱含陣列複製的情形。由於 `i32` 是複製型別,因此 `[i32; 3]` 也會是複" -#~ "製型別。" +#~ "會發生隱含陣列複製的情形。由於 `i32` 是複製型別,因此 `[i32; 3]` 也會是複製型" +#~ "別。" #~ msgid "The Luhn algorithm," #~ msgstr "盧恩演算法" @@ -27102,11 +26641,10 @@ msgstr "" #~ msgid "" #~ "Try to solve the problem the \"simple\" way first, using `for` loops and " -#~ "integers. Then, revisit the solution and try to implement it with " -#~ "iterators." +#~ "integers. Then, revisit the solution and try to implement it with iterators." #~ msgstr "" -#~ "使用「for」迴圈和整數,先嘗試以「簡單」的方式解決問題。接著,重新查看解決" -#~ "方案,試著使用疊代器實作。" +#~ "使用「for」迴圈和整數,先嘗試以「簡單」的方式解決問題。接著,重新查看解決方" +#~ "案,試著使用疊代器實作。" #~ msgid "Stack and Heap Example" #~ msgstr "堆疊和堆積範例" @@ -27121,31 +26659,30 @@ msgstr "" #~ "Use this to model a library's book collection. Copy the code below to " #~ " and update the types to make it compile:" #~ msgstr "" -#~ "這可用來建立圖書館的館藏模型。請將下列程式碼複製到 ,然後更新型別以利編譯:" +#~ "這可用來建立圖書館的館藏模型。請將下列程式碼複製到 ,然後更新型別以利編譯:" #~ msgid "`Cell` and `RefCell`" #~ msgstr "`Cell` 和 `RefCell`" #~ msgid "" -#~ "`Cell` is typically used for simple types, as it requires copying or " -#~ "moving values. More complex interior types typically use `RefCell`, which " -#~ "tracks shared and exclusive references at runtime and panics if they are " -#~ "misused." +#~ "`Cell` is typically used for simple types, as it requires copying or moving " +#~ "values. More complex interior types typically use `RefCell`, which tracks " +#~ "shared and exclusive references at runtime and panics if they are misused." #~ msgstr "" -#~ "`Cell` 因為需要複製或移動值,通常用於簡單的型別。較複雜的內部型別通常會使" -#~ "用 `RefCell`,可在執行階段和恐慌時追蹤共用和專屬的參照 (如果這些參照遭到濫" -#~ "用的話)。" +#~ "`Cell` 因為需要複製或移動值,通常用於簡單的型別。較複雜的內部型別通常會使用 " +#~ "`RefCell`,可在執行階段和恐慌時追蹤共用和專屬的參照 (如果這些參照遭到濫用的" +#~ "話)。" #~ msgid "" -#~ "If we were using `Cell` instead of `RefCell` in this example, we would " -#~ "have to move the `Node` out of the `Rc` to push children, then move it " -#~ "back in. This is safe because there's always one, un-referenced value in " -#~ "the cell, but it's not ergonomic." +#~ "If we were using `Cell` instead of `RefCell` in this example, we would have " +#~ "to move the `Node` out of the `Rc` to push children, then move it back in. " +#~ "This is safe because there's always one, un-referenced value in the cell, " +#~ "but it's not ergonomic." #~ msgstr "" -#~ "如果我們在本例中使用 `Cell` 而非 `RefCell`,可能須將 `Node` 移出 `Rc` 才能" -#~ "推送子項,然後再將其移回。您可以放心執行這項操作,因為儲存格中始終有一個未" -#~ "參照的值,但不符人體工學。" +#~ "如果我們在本例中使用 `Cell` 而非 `RefCell`,可能須將 `Node` 移出 `Rc` 才能推" +#~ "送子項,然後再將其移回。您可以放心執行這項操作,因為儲存格中始終有一個未參照" +#~ "的值,但不符人體工學。" #~ msgid "" #~ "To do anything with a Node, you must call a `RefCell` method, usually " @@ -27155,23 +26692,22 @@ msgstr "" #~ "`borrow_mut`。" #~ msgid "" -#~ "Experiment with the code above and then consult the documentation for " -#~ "[`impl IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/" -#~ "struct.Vec.html#impl-IntoIterator-for-%26'a+Vec%3CT,+A%3E) and [`impl " -#~ "IntoIterator for Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." -#~ "html#impl-IntoIterator-for-Vec%3CT,+A%3E) to check your answers." +#~ "Experiment with the code above and then consult the documentation for [`impl " +#~ "IntoIterator for &Vec`](https://doc.rust-lang.org/std/vec/struct.Vec." +#~ "html#impl-IntoIterator-for-%26'a+Vec%3CT,+A%3E) and [`impl IntoIterator for " +#~ "Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-" +#~ "for-Vec%3CT,+A%3E) to check your answers." #~ msgstr "" -#~ "請用上方的程式碼進行試驗,並參閱 [`impl IntoIterator for &Vec`]" -#~ "(https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-for-" +#~ "請用上方的程式碼進行試驗,並參閱 [`impl IntoIterator for &Vec`](https://" +#~ "doc.rust-lang.org/std/vec/struct.Vec.html#impl-IntoIterator-for-" #~ "%26'a+Vec%3CT,+A%3E) 和 [`impl IntoIterator for Vec`](https://doc.rust-" -#~ "lang.org/std/vec/struct.Vec.html#impl-IntoIterator-for-Vec%3CT,+A%3E) 的說" -#~ "明文件確認答案。" +#~ "lang.org/std/vec/struct.Vec.html#impl-IntoIterator-for-Vec%3CT,+A%3E) 的說明" +#~ "文件確認答案。" #~ msgid "" -#~ "Rust derive macros work by automatically generating code that implements " -#~ "the specified traits for a data structure." -#~ msgstr "" -#~ "Rust 衍生巨集的運作原理是自動產生程式碼,用於實作資料結構的指定特徵。" +#~ "Rust derive macros work by automatically generating code that implements the " +#~ "specified traits for a data structure." +#~ msgstr "Rust 衍生巨集的運作原理是自動產生程式碼,用於實作資料結構的指定特徵。" #~ msgid "Move method `not_equals` to a new trait `NotEquals`." #~ msgstr "將 `not_equals` 方法移至新特徵 `NotEquals`。" @@ -27185,11 +26721,9 @@ msgstr "" #~ msgid "" #~ "With the blanket implementation, you no longer need `Equals` as a super " #~ "trait for `NotEqual`." -#~ msgstr "" -#~ "採用大量實作後,您就不再需要使用 `Equals` 做為 `NotEqual` 的超特徵。" +#~ msgstr "採用大量實作後,您就不再需要使用 `Equals` 做為 `NotEqual` 的超特徵。" -#~ msgid "" -#~ "We will design a classical GUI library using traits and trait objects." +#~ msgid "We will design a classical GUI library using traits and trait objects." #~ msgstr "我們將使用特徵和特徵物件設計一個典型的 GUI 程式庫。" #~ msgid "" @@ -27206,54 +26740,51 @@ msgstr "" #~ "`From`. Reciprocally, a function returning an `Option` can only " #~ "apply the `?` operator on a function returning an `Option`." #~ msgstr "" -#~ "函式的傳回型別必須與它呼叫的巢狀函式相容。舉例來說,傳回 `Result` " -#~ "的函式只能在傳回 `Result` 的函式上套用 `?` 運算子;無法在傳回 " +#~ "函式的傳回型別必須與它呼叫的巢狀函式相容。舉例來說,傳回 `Result` 的" +#~ "函式只能在傳回 `Result` 的函式上套用 `?` 運算子;無法在傳回 " #~ "`Option` 或 `Result` 的函式上套用該運算子,除非 " -#~ "`OtherErr` 實作了 `From` 則例外。反之,傳回 `Option` 的函式只能在" -#~ "傳回 `Option` 的函式上套用 `?` 運算子。" +#~ "`OtherErr` 實作了 `From` 則例外。反之,傳回 `Option` 的函式只能在傳" +#~ "回 `Option` 的函式上套用 `?` 運算子。" #~ msgid "" #~ "You can convert incompatible types into one another with the different " #~ "`Option` and `Result` methods such as `Option::ok_or`, `Result::ok`, " #~ "`Result::err`." #~ msgstr "" -#~ "您可以使用不同的 `Option` 和 `Result` 方法,例如 `Option::ok_or`、" -#~ "`Result::ok`、`Result::err` 等,將不相容的型別轉換為其他型別。" +#~ "您可以使用不同的 `Option` 和 `Result` 方法,例如 `Option::ok_or`、`Result::" +#~ "ok`、`Result::err` 等,將不相容的型別轉換為其他型別。" #~ msgid "" #~ "It is good practice for all error types that don't need to be `no_std` to " #~ "implement `std::error::Error`, which requires `Debug` and `Display`. The " -#~ "`Error` crate for `core` is only available in [nightly](https://github." -#~ "com/rust-lang/rust/issues/103765), so not fully `no_std` compatible yet." +#~ "`Error` crate for `core` is only available in [nightly](https://github.com/" +#~ "rust-lang/rust/issues/103765), so not fully `no_std` compatible yet." #~ msgstr "" -#~ "對所有不需要是 `no_std` 的錯誤型別來說,實作 `std::error::Error` 是很好的" -#~ "做法,`std::error::Error` 會需要 `Debug` 和 `Display`。`core` 的 `Error` " -#~ "Crate 僅於 [nightly](https://github.com/rust-lang/rust/issues/103765) 提" -#~ "供,因此與 `no_std` 尚未完全相容。" +#~ "對所有不需要是 `no_std` 的錯誤型別來說,實作 `std::error::Error` 是很好的做" +#~ "法,`std::error::Error` 會需要 `Debug` 和 `Display`。`core` 的 `Error` Crate " +#~ "僅於 [nightly](https://github.com/rust-lang/rust/issues/103765) 提供,因此與 " +#~ "`no_std` 尚未完全相容。" #~ msgid "" #~ "It's generally helpful for them to implement `Clone` and `Eq` too where " #~ "possible, to make life easier for tests and consumers of your library. In " -#~ "this case we can't easily do so, because `io::Error` doesn't implement " -#~ "them." +#~ "this case we can't easily do so, because `io::Error` doesn't implement them." #~ msgstr "" -#~ "對這種錯誤型別來說,在可能的情況下實作 `Clone` 和 `Eq` 通常也很有用,不僅" -#~ "有利於程式庫的測試,使用者也會更輕鬆。但在本例中,我們無法輕易這麼做,因" -#~ "為 `io::Error` 並未實作 `Clone` 和 `Eq`。" +#~ "對這種錯誤型別來說,在可能的情況下實作 `Clone` 和 `Eq` 通常也很有用,不僅有利" +#~ "於程式庫的測試,使用者也會更輕鬆。但在本例中,我們無法輕易這麼做,因為 `io::" +#~ "Error` 並未實作 `Clone` 和 `Eq`。" #~ msgid "" -#~ "For this exercise, we suggest using a local dev environment instead of " -#~ "the Playground. This will allow you to run your binary on your own " -#~ "machine." +#~ "For this exercise, we suggest using a local dev environment instead of the " +#~ "Playground. This will allow you to run your binary on your own machine." #~ msgstr "" -#~ "在這個練習中,建議您使用本機開發環境,不要用 Playground。這可讓您在自己的" -#~ "機器上執行二進位檔。" +#~ "在這個練習中,建議您使用本機開發環境,不要用 Playground。這可讓您在自己的機器" +#~ "上執行二進位檔。" #~ msgid "" -#~ "To get started, follow the [running locally](../../cargo/running-locally." -#~ "md) instructions." -#~ msgstr "" -#~ "首先,請按照[在本機執行](../../cargo/running-locally.md)的說明操作。" +#~ "To get started, follow the [running locally](../../cargo/running-locally.md) " +#~ "instructions." +#~ msgstr "首先,請按照[在本機執行](../../cargo/running-locally.md)的說明操作。" #~ msgid "Pattern matching" #~ msgstr "模式配對"