diff --git a/po/vi.po b/po/vi.po index 4bb314dd3e62..4521708c8216 100644 --- a/po/vi.po +++ b/po/vi.po @@ -1,3 +1,4 @@ +# msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" @@ -272,11 +273,11 @@ msgstr "Khớp giá trị" #: src/SUMMARY.md src/pattern-matching.md msgid "Destructuring Structs" -msgstr "" +msgstr "Phá hủy cấu trúc" #: src/SUMMARY.md src/pattern-matching.md msgid "Destructuring Enums" -msgstr "" +msgstr "Phá hủy Enums" #: src/SUMMARY.md src/pattern-matching.md #: src/pattern-matching/let-control-flow.md @@ -302,7 +303,7 @@ msgstr "Đặc điểm (Traits)" #: src/SUMMARY.md src/methods-and-traits/traits/implementing.md msgid "Implementing Traits" -msgstr "" +msgstr "Thực hiện các đặc điểm" #: src/SUMMARY.md src/methods-and-traits/traits/supertraits.md msgid "Supertraits" @@ -511,7 +512,7 @@ msgstr "Kiểm tra mượn (Borrow Checking)" #: src/SUMMARY.md src/borrowing.md src/borrowing/examples.md msgid "Borrow Errors" -msgstr "" +msgstr "Lỗi mượn" #: src/SUMMARY.md src/borrowing.md src/borrowing/interior-mutability.md msgid "Interior Mutability" @@ -984,333 +985,333 @@ msgstr "Lời giải bài tập" #: src/SUMMARY.md msgid "Bare Metal: Morning" -msgstr "" +msgstr "Kim loại trần: Buổi sáng" #: src/SUMMARY.md src/bare-metal/no_std.md msgid "`no_std`" -msgstr "" +msgstr "`không_std`" #: src/SUMMARY.md msgid "A Minimal Example" -msgstr "" +msgstr "Một ví dụ tối thiểu" #: src/SUMMARY.md src/bare-metal/no_std.md src/bare-metal/alloc.md msgid "`alloc`" -msgstr "" +msgstr "`phân bổ`" #: src/SUMMARY.md src/bare-metal/microcontrollers.md msgid "Microcontrollers" -msgstr "" +msgstr "Vi điều khiển" #: src/SUMMARY.md src/bare-metal/microcontrollers/mmio.md msgid "Raw MMIO" -msgstr "" +msgstr "MMIO thô" #: src/SUMMARY.md msgid "PACs" -msgstr "" +msgstr "PAC" #: src/SUMMARY.md msgid "HAL Crates" -msgstr "" +msgstr "Crate HAL" #: src/SUMMARY.md msgid "Board Support Crates" -msgstr "" +msgstr "Crate hỗ trợ bảng" #: src/SUMMARY.md msgid "The Type State Pattern" -msgstr "" +msgstr "Mẫu trạng thái loại" #: src/SUMMARY.md src/bare-metal/microcontrollers/embedded-hal.md msgid "`embedded-hal`" -msgstr "" +msgstr "`được nhúng-hal`" #: src/SUMMARY.md src/bare-metal/microcontrollers/probe-rs.md msgid "`probe-rs` and `cargo-embed`" -msgstr "" +msgstr "`probe-rs` và `cargo-embed`" #: src/SUMMARY.md src/bare-metal/microcontrollers/debugging.md msgid "Debugging" -msgstr "" +msgstr "Gỡ lỗi" #: src/SUMMARY.md msgid "Other Projects" -msgstr "" +msgstr "Dự án khác" #: src/SUMMARY.md src/exercises/bare-metal/compass.md #: src/exercises/bare-metal/solutions-morning.md msgid "Compass" -msgstr "" +msgstr "La bàn" #: src/SUMMARY.md src/concurrency/sync-exercises.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises.md #: src/concurrency/async-exercises/solutions.md msgid "Solutions" -msgstr "" +msgstr "Giải pháp" #: src/SUMMARY.md msgid "Bare Metal: Afternoon" -msgstr "" +msgstr "Kim loại trần: Buổi chiều" #: src/SUMMARY.md msgid "Application Processors" -msgstr "" +msgstr "Bộ xử lý ứng dụng" #: src/SUMMARY.md src/bare-metal/aps/entry-point.md msgid "Getting Ready to Rust" -msgstr "" +msgstr "Sẵn sàng để Rust" #: src/SUMMARY.md msgid "Inline Assembly" -msgstr "" +msgstr "hội nội tuyến" #: src/SUMMARY.md msgid "MMIO" -msgstr "" +msgstr "MMIO" #: src/SUMMARY.md msgid "Let's Write a UART Driver" -msgstr "" +msgstr "Hãy viết trình điều khiển UART" #: src/SUMMARY.md msgid "More Traits" -msgstr "" +msgstr "Thêm đặc điểm" #: src/SUMMARY.md msgid "A Better UART Driver" -msgstr "" +msgstr "Trình điều khiển UART tốt hơn" #: src/SUMMARY.md src/bare-metal/aps/better-uart/bitflags.md msgid "Bitflags" -msgstr "" +msgstr "Bitflag" #: src/SUMMARY.md msgid "Multiple Registers" -msgstr "" +msgstr "Nhiều thanh ghi" #: src/SUMMARY.md src/bare-metal/aps/better-uart/driver.md msgid "Driver" -msgstr "" +msgstr "Tài xế" #: src/SUMMARY.md msgid "Using It" -msgstr "" +msgstr "Sử dụng nó" #: src/SUMMARY.md src/bare-metal/aps/exceptions.md msgid "Exceptions" -msgstr "" +msgstr "Ngoại lệ" #: src/SUMMARY.md msgid "Useful Crates" -msgstr "" +msgstr "Crate hữu ích" #: src/SUMMARY.md src/bare-metal/useful-crates/zerocopy.md msgid "`zerocopy`" -msgstr "" +msgstr "`bản sao`" #: src/SUMMARY.md src/bare-metal/useful-crates/aarch64-paging.md msgid "`aarch64-paging`" -msgstr "" +msgstr "`phân trang aarch64`" #: src/SUMMARY.md src/bare-metal/useful-crates/buddy_system_allocator.md msgid "`buddy_system_allocator`" -msgstr "" +msgstr "`buddy_system_allocator`" #: src/SUMMARY.md src/bare-metal/useful-crates/tinyvec.md msgid "`tinyvec`" -msgstr "" +msgstr "`tinyvec`" #: src/SUMMARY.md src/bare-metal/useful-crates/spin.md msgid "`spin`" -msgstr "" +msgstr "`quay`" #: src/SUMMARY.md msgid "`vmbase`" -msgstr "" +msgstr "`vmbase`" #: src/SUMMARY.md msgid "RTC Driver" -msgstr "" +msgstr "Trình điều khiển RTC" #: src/SUMMARY.md msgid "Concurrency: Morning" -msgstr "" +msgstr "Đồng thời: Buổi sáng" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome.md src/concurrency/threads.md msgid "Threads" -msgstr "" +msgstr "chủ đề" #: src/SUMMARY.md src/concurrency/threads.md src/concurrency/threads/plain.md msgid "Plain Threads" -msgstr "" +msgstr "Chủ đề trơn" #: src/SUMMARY.md src/concurrency/threads.md src/concurrency/threads/scoped.md msgid "Scoped Threads" -msgstr "" +msgstr "Chủ đề có phạm vi" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome.md src/concurrency/channels.md msgid "Channels" -msgstr "" +msgstr "Kênh" #: src/SUMMARY.md src/concurrency/channels.md #: src/concurrency/channels/senders-receivers.md msgid "Senders and Receivers" -msgstr "" +msgstr "Người gửi và người nhận" #: src/SUMMARY.md src/concurrency/channels.md #: src/concurrency/channels/unbounded.md msgid "Unbounded Channels" -msgstr "" +msgstr "Kênh không giới hạn" #: src/SUMMARY.md src/concurrency/channels.md #: src/concurrency/channels/bounded.md msgid "Bounded Channels" -msgstr "" +msgstr "Kênh bị giới hạn" #: src/SUMMARY.md src/concurrency/send-sync.md msgid "`Send` and `Sync`" -msgstr "" +msgstr "`Gửi` và `Đồng bộ`" #: src/SUMMARY.md src/concurrency/send-sync.md #: src/concurrency/send-sync/marker-traits.md msgid "Marker Traits" -msgstr "" +msgstr "Đặc điểm đánh dấu" #: src/SUMMARY.md src/concurrency/send-sync/send.md msgid "`Send`" -msgstr "" +msgstr "`Gửi`" #: src/SUMMARY.md src/concurrency/send-sync/sync.md msgid "`Sync`" -msgstr "" +msgstr "`Đồng bộ`" #: src/SUMMARY.md src/concurrency/send-sync.md #: src/concurrency/send-sync/examples.md msgid "Examples" -msgstr "" +msgstr "Ví dụ" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome.md src/concurrency/shared-state.md msgid "Shared State" -msgstr "" +msgstr "Trạng thái chia sẻ" #: src/SUMMARY.md src/concurrency/shared-state/arc.md msgid "`Arc`" -msgstr "" +msgstr "`Vòng cung`" #: src/SUMMARY.md src/concurrency/shared-state/mutex.md msgid "`Mutex`" -msgstr "" +msgstr "`Tắt tiếng`" #: src/SUMMARY.md src/memory-management/review.md #: src/error-handling/try-conversions.md src/concurrency/shared-state.md #: src/concurrency/shared-state/example.md msgid "Example" -msgstr "" +msgstr "Ví dụ" #: src/SUMMARY.md src/concurrency/sync-exercises.md #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises.md msgid "Dining Philosophers" -msgstr "" +msgstr "Nhà triết học ăn uống" #: src/SUMMARY.md src/concurrency/sync-exercises.md #: src/concurrency/sync-exercises/link-checker.md msgid "Multi-threaded Link Checker" -msgstr "" +msgstr "Trình kiểm tra liên kết đa luồng" #: src/SUMMARY.md msgid "Concurrency: Afternoon" -msgstr "" +msgstr "Đồng thời: Buổi chiều" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome-async.md src/concurrency/async.md msgid "Async Basics" -msgstr "" +msgstr "Khái niệm cơ bản về không đồng bộ" #: src/SUMMARY.md src/concurrency/async/async-await.md msgid "`async`/`await`" -msgstr "" +msgstr "`không đồng bộ`/`đang chờ`" #: src/SUMMARY.md src/concurrency/async.md src/concurrency/async/futures.md msgid "Futures" -msgstr "" +msgstr "Hợp đồng tương lai" #: src/SUMMARY.md src/concurrency/async.md src/concurrency/async/runtimes.md msgid "Runtimes" -msgstr "" +msgstr "Thời gian chạy" #: src/SUMMARY.md src/concurrency/async/runtimes/tokio.md msgid "Tokio" -msgstr "" +msgstr "Tokio" #: src/SUMMARY.md src/concurrency/sync-exercises/link-checker.md #: src/concurrency/async.md src/concurrency/async/tasks.md #: src/concurrency/async-exercises/chat-app.md msgid "Tasks" -msgstr "" +msgstr "Nhiệm vụ" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome-async.md src/concurrency/async-control-flow.md msgid "Channels and Control Flow" -msgstr "" +msgstr "Kênh và luồng điều khiển" #: src/SUMMARY.md src/concurrency/async-control-flow.md #: src/concurrency/async-control-flow/channels.md msgid "Async Channels" -msgstr "" +msgstr "Kênh không đồng bộ" #: src/SUMMARY.md src/concurrency/async-control-flow.md #: src/concurrency/async-control-flow/join.md msgid "Join" -msgstr "" +msgstr "Tham gia" #: src/SUMMARY.md src/concurrency/async-control-flow.md #: src/concurrency/async-control-flow/select.md msgid "Select" -msgstr "" +msgstr "Lựa chọn" #: src/SUMMARY.md src/running-the-course/course-structure.md #: src/concurrency/welcome-async.md src/concurrency/async-pitfalls.md msgid "Pitfalls" -msgstr "" +msgstr "cạm bẫy" #: src/SUMMARY.md src/concurrency/async-pitfalls.md msgid "Blocking the Executor" -msgstr "" +msgstr "Chặn người thi hành" #: src/SUMMARY.md src/concurrency/async-pitfalls/pin.md msgid "`Pin`" -msgstr "" +msgstr "`Pin`" #: src/SUMMARY.md src/concurrency/async-pitfalls.md #: src/concurrency/async-pitfalls/async-traits.md msgid "Async Traits" -msgstr "" +msgstr "Đặc điểm không đồng bộ" #: src/SUMMARY.md src/concurrency/async-pitfalls.md #: src/concurrency/async-pitfalls/cancellation.md msgid "Cancellation" -msgstr "" +msgstr "Hủy bỏ" #: src/SUMMARY.md src/concurrency/async-exercises.md #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "Broadcast Chat Application" -msgstr "" +msgstr "Ứng dụng trò chuyện phát sóng" #: src/SUMMARY.md msgid "Final Words" -msgstr "" +msgstr "Lời cuối cùng" #: src/SUMMARY.md src/thanks.md msgid "Thanks!" -msgstr "" +msgstr "Cảm ơn!" #: src/SUMMARY.md src/glossary.md msgid "Glossary" @@ -1318,23 +1319,35 @@ msgstr "Chú giải thuật ngữ" #: src/SUMMARY.md msgid "Other Resources" -msgstr "" +msgstr "Tài nguyên khác" #: src/SUMMARY.md src/credits.md msgid "Credits" -msgstr "" +msgstr "Tín dụng" #: 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)" +msgstr "" +"[![Quy trình xây " +"dựng](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 cộng tác " +"viên](https://img.shields.io/github/contributors/google/comprehensive-" +"rust?style=flat-square)](https://github.com/google/comprehensive-" +"rust/graphs/contributors) [![GitHub " +"sao](https://img.shields.io/github/stars/google/comprehensive-" +"rust?style=flat-square)](https://github.com/google/comprehensive-" +"rust/stargazers)" #: src/index.md msgid "" @@ -1342,50 +1355,69 @@ msgid "" "course covers the full spectrum of Rust, from basic syntax to advanced " "topics like generics and error handling." msgstr "" +"Đây là một khóa học Rust miễn phí được phát triển bởi đội ngũ Android tại " +"Google. Khóa học bao quát toàn bộ các khía cạnh của Rust, từ cú pháp cơ bản " +"đến các chủ đề nâng cao như kiểu tổng quát (generics) và xử lý lỗi (error " +"handling)." #: 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." +"The latest version of the course can be found at " +". If you are reading somewhere" +" else, please check there for updates." msgstr "" +"Phiên bản mới nhất của khóa học có thể được tìm thấy tại " +". Nếu bạn đang đọc ở một nơi " +"khác, vui lòng kiểm tra tại đó để cập nhật." #: src/index.md msgid "The course is also available [as a PDF](comprehensive-rust.pdf)." -msgstr "" +msgstr "Khóa học cũng có sẵn [dưới dạng 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 "" +"Mục tiêu của khóa học là dạy bạn ngôn ngữ Rust. Chúng tôi giả định rằng bạn " +"chưa biết gì về Rust và hy vọng sẽ:" #: src/index.md -msgid "Give you a comprehensive understanding of the Rust syntax and language." +msgid "" +"Give you a comprehensive understanding of the Rust syntax and language." msgstr "" +"Cung cấp cho bạn một sự hiểu biết toàn diện về cú pháp và ngôn ngữ Rust." #: src/index.md msgid "Enable you to modify existing programs and write new programs in Rust." msgstr "" +"Giúp bạn có khả năng chỉnh sửa các chương trình hiện có và viết các chương " +"trình mới bằng Rust." #: src/index.md msgid "Show you common Rust idioms." -msgstr "" +msgstr "Hiển thị cho bạn những thành ngữ phổ biến của Rust." #: src/index.md msgid "We call the first four course days Rust Fundamentals." -msgstr "" +msgstr "Chúng tôi gọi bốn ngày học đầu tiên là Rust Fundamentals." #: src/index.md msgid "" -"Building on this, you're invited to dive into one or more specialized topics:" +"Building on this, you're invited to dive into one or more specialized " +"topics:" msgstr "" +"Dựa trên điều này, bạn được mời đi sâu vào một hoặc nhiều chủ đề chuyên " +"biệt:" #: src/index.md msgid "" "[Android](android.md): a half-day course on using Rust for Android platform " "development (AOSP). This includes interoperability with C, C++, and Java." msgstr "" +"[Android](android.md): khóa học nửa ngày về cách sử dụng Rust để phát triển " +"nền tảng Android (AOSP). Điều này bao gồm khả năng tương tác với C, C++ và " +"Java." #: src/index.md msgid "" @@ -1393,13 +1425,19 @@ msgid "" "based browsers. This includes interoperability with C++ and how to include " "third-party crates in Chromium." msgstr "" +"[Chromium](chromium.md): khóa học nửa ngày về cách sử dụng Rust trong các " +"trình duyệt dựa trên Chromium. Điều này bao gồm khả năng tương tác với C++ " +"và cách đưa các crate của bên thứ ba vào Chromium." #: src/index.md msgid "" "[Bare-metal](bare-metal.md): a whole-day class on using Rust for bare-metal " -"(embedded) development. Both microcontrollers and application processors are " -"covered." +"(embedded) development. Both microcontrollers and application processors are" +" covered." msgstr "" +"[Bare-metal](bare-metal.md): lớp học cả ngày về cách sử dụng Rust để phát " +"triển bare-metal (nhúng). Cả bộ vi điều khiển và bộ xử lý ứng dụng đều được " +"đề cập." #: src/index.md msgid "" @@ -1408,27 +1446,36 @@ msgid "" "mutexes) and async/await concurrency (cooperative multitasking using " "futures)." msgstr "" +"[Concurrency](concurrency.md): lớp học cả ngày về đồng thời ở Rust. Chúng " +"tôi đề cập đến cả tính đồng thời cổ điển (lập lịch ưu tiên bằng cách sử dụng" +" luồng và mutex) và đồng thời không đồng bộ/chờ đợi (đa nhiệm hợp tác sử " +"dụng tương lai)." #: src/index.md msgid "Non-Goals" -msgstr "" +msgstr "Không có mục tiêu" #: 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:" msgstr "" +"Rust là một ngôn ngữ lớn và chúng ta sẽ không thể học hết nó trong vài ngày " +"tới. Một số mục tiêu không phải của khóa học này là:" #: src/index.md msgid "" -"Learning how to develop macros: please see [Chapter 19.5 in the Rust Book]" -"(https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by Example]" -"(https://doc.rust-lang.org/rust-by-example/macros.html) instead." +"Learning how to develop macros: please see [Chapter 19.5 in the Rust " +"Book](https://doc.rust-lang.org/book/ch19-06-macros.html) and [Rust by " +"Example](https://doc.rust-lang.org/rust-by-example/macros.html) instead." msgstr "" +"Tìm hiểu cách phát triển macro: thay vào đó, vui lòng xem [Chương 19.5 trong" +" Sách Rust](https://doc.rust-lang.org/book/ch19-06-macros.html) và [Rust by " +"Ví dụ](https://doc.rust-lang.org/rust-by-example/macros.html)." #: src/index.md msgid "Assumptions" -msgstr "" +msgstr "Giả định" #: src/index.md msgid "" @@ -1436,12 +1483,17 @@ msgid "" "statically-typed language and we will sometimes make comparisons with C and " "C++ to better explain or contrast the Rust approach." msgstr "" +"Khóa học giả định rằng bạn đã biết cách lập trình. Rust là một ngôn ngữ có " +"kiểu gõ tĩnh và đôi khi chúng tôi sẽ so sánh với C và C++ để giải thích hoặc" +" đối chiếu rõ hơn cách tiếp cận của 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." +"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 "" +"Nếu bạn biết cách lập trình bằng ngôn ngữ được gõ động như Python hoặc " +"JavaScript, thì bạn cũng có thể làm theo được." #: src/index.md msgid "" @@ -1449,6 +1501,10 @@ msgid "" "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 "" +"Đây là ví dụ về _ghi chú của người nói_. Chúng tôi sẽ sử dụng những thông " +"tin này để thêm thông tin bổ sung vào các slide. Đây có thể là những điểm " +"chính mà người hướng dẫn nên đề cập cũng như câu trả lời cho các câu hỏi " +"điển hình xuất hiện trong lớp." #: src/running-the-course.md src/running-the-course/course-structure.md msgid "This page is for the course instructor." @@ -1465,13 +1521,13 @@ msgstr "" #: src/running-the-course.md 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." +"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 "" "Chúng tôi mở lớp từ 9 giờ sáng đến 4 giờ chiều, trong đó có 1 tiếng nghỉ " -"trưa. Một ngày học bao gồm lớp buổi sáng và lớp buổi chiều, mỗi buổi kéo dài " -"3 tiếng. Một buổi học sẽ được chia thành nhiều quãng nghỉ để học sinh có " +"trưa. Một ngày học bao gồm lớp buổi sáng và lớp buổi chiều, mỗi buổi kéo dài" +" 3 tiếng. Một buổi học sẽ được chia thành nhiều quãng nghỉ để học sinh có " "thời gian thực hành." #: src/running-the-course.md @@ -1496,8 +1552,8 @@ msgstr "" #: src/running-the-course.md 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 " +"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." msgstr "" @@ -1512,33 +1568,34 @@ msgid "" "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 " +"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 "" "Tìm một căn phòng đủ lớn để chứa tất cả học viên. Chúng tôi khuyến nghị một " "lớp nên từ 15 đến 25 người, đủ nhỏ để mọi người có thể thoải mái đưa ra các " "câu hỏi --- và nó cũng đủ để người hướng dẫn có thể trả lời hết các câu hỏi " -"đó. Hãy đảm bảo rằng phòng học có đủ _ghế_ cho cả bạn và học sinh: bạn đương " -"nhiên cần ngồi dạy với laptop của bạn. Đặc biệt, bạn sẽ hướng dẫn và thực " -"hành mẫu rất nhiều bài live-coding, nên một cái ghế sẽ có ích hơn là một cái " -"bục giảng đó." +"đó. Hãy đảm bảo rằng phòng học có đủ _ghế_ cho cả bạn và học sinh: bạn đương" +" nhiên cần ngồi dạy với laptop của bạn. Đặc biệt, bạn sẽ hướng dẫn và thực " +"hành mẫu rất nhiều bài live-coding, nên một cái ghế sẽ có ích hơn là một cái" +" bục giảng đó." #: 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." -msgstr "" -"Trong ngày học, hãy đến lớp sớm một chút để chuẩn bị sẵn sàng mọi thứ. Chúng " -"tôi khuyến khích chạy trực tiếp lệnh `mdbook serve` trên laptop của bạn " -"(tham khảo hướng dẫn cài đặt ở [đây](https://github.com/google/comprehensive-" -"rust#building)). Việc này giúp đảm bảo việc chuyển trang của bạn được diễn " -"ra mượt mà nhất, ngoài ra còn cho phép bạn sửa lỗi chính tả trực tiếp khi " -"bạn hoặc ai đó phát hiện ra." +"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 "" +"Trong ngày học, hãy đến lớp sớm một chút để chuẩn bị sẵn sàng mọi thứ. Chúng" +" tôi khuyến khích chạy trực tiếp lệnh `mdbook serve` trên laptop của bạn " +"(tham khảo hướng dẫn cài đặt ở " +"[đây](https://github.com/google/comprehensive-rust#building)). Việc này giúp" +" đảm bảo việc chuyển trang của bạn được diễn ra mượt mà nhất, ngoài ra còn " +"cho phép bạn sửa lỗi chính tả trực tiếp khi bạn hoặc ai đó phát hiện ra." #: src/running-the-course.md msgid "" @@ -1569,18 +1626,19 @@ 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)!" +"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)!" msgstr "" -"Sau khi khóa học kết thúc, rất mong nhận được [feedback](https://github.com/" -"google/comprehensive-rust/discussions/86) từ bạn để chúng tôi có thể hoàn " -"thiện khóa học hơn nữa. Chúng tôi rất vui lòng khi được biết những gì mang " -"lại hiệu quả cho bạn và những gì cần cải thiện thêm. Ngoài ra, học viên của " -"bạn cũng có thể tích cực gửi feedback cho chúng tôi tại [đây](https://github." -"com/google/comprehensive-rust/discussions/100)!" +"Sau khi khóa học kết thúc, rất mong nhận được " +"[feedback](https://github.com/google/comprehensive-rust/discussions/86) từ " +"bạn để chúng tôi có thể hoàn thiện khóa học hơn nữa. Chúng tôi rất vui lòng " +"khi được biết những gì mang lại hiệu quả cho bạn và những gì cần cải thiện " +"thêm. Ngoài ra, học viên của bạn cũng có thể tích cực gửi feedback cho chúng" +" tôi tại [đây](https://github.com/google/comprehensive-" +"rust/discussions/100)!" #: src/running-the-course/course-structure.md msgid "Rust Fundamentals" @@ -1609,7 +1667,7 @@ msgstr "Ngày 1 Buổi Sáng (2 tiếng và 5 phút, bao gồm thời gian ngh #: src/welcome-day-4-afternoon.md src/concurrency/welcome.md #: src/concurrency/welcome-async.md msgid "Segment" -msgstr "" +msgstr "Phân đoạn" #: src/running-the-course/course-structure.md src/welcome-day-1.md #: src/hello-world.md src/types-and-values.md src/control-flow-basics.md @@ -1632,13 +1690,13 @@ msgstr "Thời lượng" #: src/running-the-course/course-structure.md src/welcome-day-1.md #: src/types-and-values.md src/control-flow-basics.md src/tuples-and-arrays.md -#: src/user-defined-types.md src/generics.md src/std-types.md src/std-traits.md -#: src/memory-management.md src/smart-pointers.md src/lifetimes.md -#: src/iterators.md src/modules.md src/testing.md src/error-handling.md -#: src/unsafe-rust.md src/concurrency/shared-state.md +#: src/user-defined-types.md src/generics.md src/std-types.md +#: src/std-traits.md src/memory-management.md src/smart-pointers.md +#: src/lifetimes.md src/iterators.md src/modules.md src/testing.md +#: src/error-handling.md src/unsafe-rust.md src/concurrency/shared-state.md #: src/concurrency/async-control-flow.md src/concurrency/async-pitfalls.md msgid "5 minutes" -msgstr "" +msgstr "5 phút" #: src/running-the-course/course-structure.md src/welcome-day-1.md #: src/types-and-values.md src/control-flow-basics.md src/tuples-and-arrays.md @@ -1646,12 +1704,12 @@ msgstr "" #: src/modules.md src/concurrency/welcome.md src/concurrency/threads.md #: src/concurrency/shared-state.md msgid "15 minutes" -msgstr "" +msgstr "15 phút" #: src/running-the-course/course-structure.md src/welcome-day-1.md #: src/welcome-day-2-afternoon.md src/welcome-day-4.md msgid "40 minutes" -msgstr "" +msgstr "40 phút" #: src/running-the-course/course-structure.md msgid "Day 1 Afternoon (2 hours and 35 minutes, including breaks)" @@ -1659,18 +1717,18 @@ msgstr "Ngày 1 Buổi Chiều (2 tiếng và 35 phút, bao gồm thời gian ng #: src/running-the-course/course-structure.md src/welcome-day-1-afternoon.md msgid "35 minutes" -msgstr "" +msgstr "35 phút" #: src/running-the-course/course-structure.md src/welcome-day-1-afternoon.md #: src/welcome-day-3.md src/welcome-day-3-afternoon.md #: src/welcome-day-4-afternoon.md src/concurrency/welcome-async.md msgid "55 minutes" -msgstr "" +msgstr "55 phút" #: src/running-the-course/course-structure.md src/welcome-day-1-afternoon.md #: src/welcome-day-2.md src/welcome-day-3-afternoon.md msgid "50 minutes" -msgstr "" +msgstr "50 phút" #: src/running-the-course/course-structure.md msgid "Day 2 Morning (2 hours and 10 minutes, including breaks)" @@ -1682,12 +1740,12 @@ msgstr "Ngày 2 Buổi Sáng (2 tiếng và 55 phút, bao gồm thời gian ngh #: src/welcome-day-3.md src/borrowing.md src/welcome-day-4.md src/modules.md #: src/testing.md src/error-handling.md msgid "3 minutes" -msgstr "" +msgstr "3 phút" #: src/running-the-course/course-structure.md src/welcome-day-2.md #: src/welcome-day-3.md msgid "1 hour" -msgstr "" +msgstr "1 giờ" #: src/running-the-course/course-structure.md msgid "Day 2 Afternoon (4 hours, including breaks)" @@ -1695,11 +1753,11 @@ msgstr "Ngày 2 Buổi Chiều (3 tiếng và 10 phút, bao gồm thời gian ng #: src/running-the-course/course-structure.md src/welcome-day-2-afternoon.md msgid "1 hour and 20 minutes" -msgstr "" +msgstr "1 giờ 20 phút" #: src/running-the-course/course-structure.md src/welcome-day-2-afternoon.md msgid "1 hour and 40 minutes" -msgstr "" +msgstr "1 giờ 40 phút" #: src/running-the-course/course-structure.md msgid "Day 3 Morning (2 hours and 20 minutes, including breaks)" @@ -1715,7 +1773,7 @@ msgstr "Ngày 4 Buổi Sáng (2 tiếng và 40 phút, bao gồm thời gian ngh #: src/running-the-course/course-structure.md src/welcome-day-4.md msgid "45 minutes" -msgstr "" +msgstr "45 phút" #: src/running-the-course/course-structure.md msgid "Day 4 Afternoon (2 hours and 10 minutes, including breaks)" @@ -1723,7 +1781,7 @@ msgstr "Ngày 4 Buổi Chiều (2 tiếng và 10 phút, bao gồm thời gian ng #: src/running-the-course/course-structure.md src/welcome-day-4-afternoon.md msgid "1 hour and 5 minutes" -msgstr "" +msgstr "1 giờ 5 phút" #: src/running-the-course/course-structure.md msgid "Deep Dives" @@ -1734,8 +1792,8 @@ msgid "" "In addition to the 4-day class on Rust Fundamentals, we cover some more " "specialized topics:" msgstr "" -"Ngoài lớp học \"4 ngày\" về Rust căn bản ra, chúng tôi còn cung cấp thêm một " -"số chủ đề chuyên sâu sau:" +"Ngoài lớp học \"4 ngày\" về Rust căn bản ra, chúng tôi còn cung cấp thêm một" +" số chủ đề chuyên sâu sau:" #: src/running-the-course/course-structure.md msgid "Rust in Android" @@ -1743,8 +1801,8 @@ msgstr "Rust trong Android" #: 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 " +"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." msgstr "" "Chủ đề chuyên sâu [Rust trong Android](../android.md) là khóa học nửa ngày " @@ -1753,29 +1811,32 @@ msgstr "" #: 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/`." -msgstr "" -"Bạn sẽ cần cài sẵn [AOSP checkout](https://source.android.com/docs/setup/" -"download/downloading), rồi tạo một checkout cho [repository của khóa học]" -"(https://github.com/google/comprehensive-rust) và di chuyển thư mục `src/" -"android/` tới thư mục root của AOSP checkout trên. Việc này sẽ đảm bảo hệ " -"thống build của Android tìm được file `Android.bp` trong thư mục `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 "" +"Bạn sẽ cần cài sẵn [AOSP " +"checkout](https://source.android.com/docs/setup/download/downloading), rồi " +"tạo một checkout cho [repository của khóa " +"học](https://github.com/google/comprehensive-rust) và di chuyển thư mục " +"`src/android/` tới thư mục root của AOSP checkout trên. Việc này sẽ đảm bảo " +"hệ thống build của Android tìm được file `Android.bp` trong thư mục " +"`src/android/`." #: 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 " +"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." msgstr "" "Hãy chắc chắn rằng lệnh `adb sync` hoạt động được với trình giả lập hoặc " -"thiết bị thực của bạn, và pre-build tất cả ví dụ Android bằng `src/android/" -"build_all.sh`. Bạn có thể đọc script để xem các lệnh mà nó chạy và xác nhận " -"rằng mọi thứ đều hoạt động khi bạn kích hoạt bằng tay." +"thiết bị thực của bạn, và pre-build tất cả ví dụ Android bằng " +"`src/android/build_all.sh`. Bạn có thể đọc script để xem các lệnh mà nó chạy" +" và xác nhận rằng mọi thứ đều hoạt động khi bạn kích hoạt bằng tay." #: src/running-the-course/course-structure.md msgid "Rust in Chromium" @@ -1785,11 +1846,11 @@ msgstr "Rust trong Chromium" 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." +"Chromium's `gn` build system, bringing in third-party libraries (\"crates\")" +" and C++ interoperability." msgstr "" -"Chủ đề chuyên sâu [Rust trong Chromium](../chromium.md) là khóa học nửa ngày " -"hướng dẫn sử dụng Rust như là một phần của trình duyệt nhân Chromium, bao " +"Chủ đề chuyên sâu [Rust trong Chromium](../chromium.md) là khóa học nửa ngày" +" hướng dẫn sử dụng Rust như là một phần của trình duyệt nhân Chromium, bao " "gồm hệ thống build `gn`, đưa vào thư viện bên thứ ba (\"crates\") và tính " "tương tác với C++." @@ -1799,11 +1860,11 @@ msgid "" "[recommended](../chromium/setup.md) for speed but any build will work. " "Ensure that you can run the Chromium browser that you've built." msgstr "" -"Bạn sẽ cần có khả năng build được Chromium --- chúng tôi [đề xuất](../" -"chromium/setup.md) build bằng công cụ xây dựng thành phần, debug bởi tốc độ " -"ấn tượng của nó. Dù sao thì bất kỳ cách build nào cũng đều hoạt động được, " -"chỉ cần bạn đảm bảo rằng mình sẽ chạy được trình duyệt Chromium vừa build " -"xong." +"Bạn sẽ cần có khả năng build được Chromium --- chúng tôi [đề " +"xuất](../chromium/setup.md) build bằng công cụ xây dựng thành phần, debug " +"bởi tốc độ ấn tượng của nó. Dù sao thì bất kỳ cách build nào cũng đều hoạt " +"động được, chỉ cần bạn đảm bảo rằng mình sẽ chạy được trình duyệt Chromium " +"vừa build xong." #: src/running-the-course/course-structure.md msgid "Bare-Metal Rust" @@ -1821,14 +1882,14 @@ msgstr "" #: 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 "" -"Về phần vi điều khiển, bạn sẽ cần mua trước bo mạch [BBC micro:bit](https://" -"microbit.org/) v2. Mỗi người sẽ cần cài đặt một số packages dựa theo miêu tả " -"ở [trang chào mừng](../bare-metal.md)." +"Về phần vi điều khiển, bạn sẽ cần mua trước bo mạch [BBC " +"micro:bit](https://microbit.org/) v2. Mỗi người sẽ cần cài đặt một số " +"packages dựa theo miêu tả ở [trang chào mừng](../bare-metal.md)." #: src/running-the-course/course-structure.md msgid "Concurrency in Rust" @@ -1839,14 +1900,14 @@ msgid "" "The [Concurrency in Rust](../concurrency.md) deep dive is a full day class " "on classical as well as `async`/`await` concurrency." msgstr "" -"Chủ đề chuyên sâu [Tính đồng thời trong Rust](../concurrency.md) là khóa học " -"một ngày hướng dẫn về khái niệm đồng thời `async`/`await` điển hình." +"Chủ đề chuyên sâu [Tính đồng thời trong Rust](../concurrency.md) là khóa học" +" một ngày hướng dẫn về khái niệm đồng thời `async`/`await` điển hình." #: 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 "" "Bạn sẽ cần thiết lập một crate mới và tải xuống các gói phụ thuộc cần thiết " "để sẵn sàng chạy. Rồi bạn có thể copy/paste các ví dụ vào `src/main.rs` để " @@ -1862,24 +1923,24 @@ msgstr "Ngày 3 Buổi Sáng (2 tiếng và 20 phút, bao gồm thời gian ngh #: src/concurrency/welcome.md src/concurrency/sync-exercises.md #: src/concurrency/welcome-async.md src/concurrency/async-exercises.md msgid "30 minutes" -msgstr "" +msgstr "30 phút" #: src/running-the-course/course-structure.md src/methods-and-traits.md -#: src/std-types.md src/std-traits.md src/memory-management.md src/borrowing.md -#: src/concurrency/welcome.md src/concurrency/sync-exercises.md -#: src/concurrency/welcome-async.md src/concurrency/async-pitfalls.md -#: src/concurrency/async-exercises.md +#: src/std-types.md src/std-traits.md src/memory-management.md +#: src/borrowing.md src/concurrency/welcome.md +#: src/concurrency/sync-exercises.md src/concurrency/welcome-async.md +#: src/concurrency/async-pitfalls.md src/concurrency/async-exercises.md msgid "20 minutes" -msgstr "" +msgstr "20 phút" #: src/running-the-course/course-structure.md src/concurrency/welcome.md msgid "Send and Sync" -msgstr "" +msgstr "Gửi và đồng bộ hóa" #: src/running-the-course/course-structure.md src/concurrency/welcome.md #: src/concurrency/welcome-async.md msgid "1 hour and 10 minutes" -msgstr "" +msgstr "1 giờ 10 phút" #: src/running-the-course/course-structure.md msgid "Afternoon (3 hours and 20 minutes, including breaks)" @@ -1938,67 +1999,77 @@ msgid "" "The course has been translated into other languages by a set of wonderful " "volunteers:" msgstr "" -"Khóa học này đã được dịch ra các ngôn ngữ sau nhờ các tình nguyện viên tuyệt " -"vời:" +"Khóa học này đã được dịch ra các ngôn ngữ sau nhờ các tình nguyện viên tuyệt" +" vời:" #: src/running-the-course/translations.md 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 " +"by [@rastringer](https://github.com/rastringer), " +"[@hugojacob](https://github.com/hugojacob), " +"[@joaovicmendes](https://github.com/joaovicmendes), and " "[@henrif75](https://github.com/henrif75)." msgstr "" "[Tiếng Bồ Đào Nha - Brasil](https://google.github.io/comprehensive-rust/pt-" -"BR/) bởi [@rastringer](https://github.com/rastringer), [@hugojacob](https://" -"github.com/hugojacob), [@joaovicmendes](https://github.com/joaovicmendes), " -"và [@henrif75](https://github.com/henrif75)." +"BR/) bởi [@rastringer](https://github.com/rastringer), " +"[@hugojacob](https://github.com/hugojacob), " +"[@joaovicmendes](https://github.com/joaovicmendes), và " +"[@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)." +"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 "" "[Tiếng Trung Giản Thể](https://google.github.io/comprehensive-rust/zh-CN/) " -"bởi [@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), và [@nodmp]" -"(https://github.com/nodmp)." +"bởi [@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), và " +"[@nodmp](https://github.com/nodmp)." #: src/running-the-course/translations.md msgid "" "[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)." +"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 "" "[Tiếng Trung Phồn Thể](https://google.github.io/comprehensive-rust/zh-TW/) " -"bởi [@hueich](https://github.com/hueich), [@victorhsieh](https://github.com/" -"victorhsieh), [@mingyc](https://github.com/mingyc), [@kuanhungchen](https://" -"github.com/kuanhungchen), và [@johnathan79717](https://github.com/" -"johnathan79717)." +"bởi [@hueich](https://github.com/hueich), " +"[@victorhsieh](https://github.com/victorhsieh), " +"[@mingyc](https://github.com/mingyc), " +"[@kuanhungchen](https://github.com/kuanhungchen), và " +"[@johnathan79717](https://github.com/johnathan79717)." #: src/running-the-course/translations.md msgid "" -"[Korean](https://google.github.io/comprehensive-rust/ko/) by [@keispace]" -"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp), " -"[@jooyunghan](https://github.com/jooyunghan), and [@namhyung](https://github." -"com/namhyung)." +"[Korean](https://google.github.io/comprehensive-rust/ko/) by " +"[@keispace](https://github.com/keispace), " +"[@jiyongp](https://github.com/jiyongp), " +"[@jooyunghan](https://github.com/jooyunghan), and " +"[@namhyung](https://github.com/namhyung)." msgstr "" -"[Tiếng Hàn](https://google.github.io/comprehensive-rust/ko/) bởi [@keispace]" -"(https://github.com/keispace), [@jiyongp](https://github.com/jiyongp), " -"[@jooyunghan](https://github.com/jooyunghan), và [@namhyung](https://github." -"com/namhyung)." +"[Tiếng Hàn](https://google.github.io/comprehensive-rust/ko/) bởi " +"[@keispace](https://github.com/keispace), " +"[@jiyongp](https://github.com/jiyongp), " +"[@jooyunghan](https://github.com/jooyunghan), và " +"[@namhyung](https://github.com/namhyung)." #: src/running-the-course/translations.md 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 "" "[Tiếng Tây Ban Nha](https://google.github.io/comprehensive-rust/es/) và " "[@deavid](https://github.com/deavid)." @@ -2024,76 +2095,79 @@ msgstr "" #: src/running-the-course/translations.md msgid "" -"[Bengali](https://google.github.io/comprehensive-rust/bn/) by [@raselmandol]" -"(https://github.com/raselmandol)." +"[Bengali](https://google.github.io/comprehensive-rust/bn/) by " +"[@raselmandol](https://github.com/raselmandol)." msgstr "" "[Tiếng Bengal](https://google.github.io/comprehensive-rust/bn/) bởi " "[@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), [@vcaen](https://github.com/vcaen) and " -"[@AdrienBaudemont](https://github.com/AdrienBaudemont)." +"[French](https://google.github.io/comprehensive-rust/fr/) by " +"[@KookaS](https://github.com/KookaS), [@vcaen](https://github.com/vcaen) and" +" [@AdrienBaudemont](https://github.com/AdrienBaudemont)." msgstr "" -"[Tiếng Pháp](https://google.github.io/comprehensive-rust/fr/) bởi [@KookaS]" -"(https://github.com/KookaS), [@vcaen](https://github.com/vcaen) và " +"[Tiếng Pháp](https://google.github.io/comprehensive-rust/fr/) bởi " +"[@KookaS](https://github.com/KookaS), [@vcaen](https://github.com/vcaen) và " "[@AdrienBaudemont](https://github.com/AdrienBaudemont)." #: 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 "" -"[Tiếng Đức](https://google.github.io/comprehensive-rust/de/) bởi [@Throvn]" -"(https://github.com/Throvn) và [@ronaldfw](https://github.com/ronaldfw)." +"[Tiếng Đức](https://google.github.io/comprehensive-rust/de/) bởi " +"[@Throvn](https://github.com/Throvn) và " +"[@ronaldfw](https://github.com/ronaldfw)." #: src/running-the-course/translations.md msgid "" -"[Japanese](https://google.github.io/comprehensive-rust/ja/) by [@CoinEZ-JPN]" -"(https://github.com/CoinEZ) and [@momotaro1105](https://github.com/" -"momotaro1105)." +"[Japanese](https://google.github.io/comprehensive-rust/ja/) by [@CoinEZ-" +"JPN](https://github.com/CoinEZ) and " +"[@momotaro1105](https://github.com/momotaro1105)." msgstr "" "[Tiếng Nhật](https://google.github.io/comprehensive-rust/ja/) bởi [@CoinEZ-" -"JPN](https://github.com/CoinEZ) và [@momotaro1105](https://github.com/" -"momotaro1105)." +"JPN](https://github.com/CoinEZ) và " +"[@momotaro1105](https://github.com/momotaro1105)." #: src/running-the-course/translations.md msgid "" "[Italian](https://google.github.io/comprehensive-rust/it/) by " -"[@henrythebuilder](https://github.com/henrythebuilder) and [@detro](https://" -"github.com/detro)." +"[@henrythebuilder](https://github.com/henrythebuilder) and " +"[@detro](https://github.com/detro)." msgstr "" "[Tiếng Ý](https://google.github.io/comprehensive-rust/it/) bởi " -"[@henrythebuilder](https://github.com/henrythebuilder) và [@detro](https://" -"github.com/detro)." +"[@henrythebuilder](https://github.com/henrythebuilder) và " +"[@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)." +"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)." msgstr "" -"Nếu bạn muốn đóng góp giúp đỡ, vui lòng xem [hướng dẫn của chúng tôi]" -"(https://github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md) để " -"biết nên bắt đầu như thế nào. Các bản dịch được hợp tác cùng hoàn thành trên " -"một bản [issue tracker](https://github.com/google/comprehensive-rust/" -"issues/1957)." +"Nếu bạn muốn đóng góp giúp đỡ, vui lòng xem [hướng dẫn của chúng " +"tôi](https://github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md)" +" để biết nên bắt đầu như thế nào. Các bản dịch được hợp tác cùng hoàn thành " +"trên một bản [issue tracker](https://github.com/google/comprehensive-" +"rust/issues/1957)." #: 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 "" -"Khi bạn bắt đầu đọc về Rust, bạn sẽ rất nhanh chóng được thấy [Cargo]" -"(https://doc.rust-lang.org/cargo/), một công cụ tiêu chuẩn xây dựng và chạy " -"ứng dụng Rust, nằm trong hệ sinh thái của Rust. Trong phần này, chúng tôi sẽ " -"tóm tắt ngắn gọn Cargo là gì, nó phù hợp với hệ sinh thái rộng lớn hơn ra " -"sao, và nó phù hợp với khóa đào tạo như thế nào." +"Khi bạn bắt đầu đọc về Rust, bạn sẽ rất nhanh chóng được thấy " +"[Cargo](https://doc.rust-lang.org/cargo/), một công cụ tiêu chuẩn xây dựng " +"và chạy ứng dụng Rust, nằm trong hệ sinh thái của Rust. Trong phần này, " +"chúng tôi sẽ tóm tắt ngắn gọn Cargo là gì, nó phù hợp với hệ sinh thái rộng " +"lớn hơn ra sao, và nó phù hợp với khóa đào tạo như thế nào." #: src/cargo.md msgid "Installation" @@ -2109,28 +2183,30 @@ msgid "" "(`rustc`). You will also get `rustup`, a command line utility that you can " "use to install to different compiler versions." msgstr "" -"Bạn sẽ nhận được công cụ xây dựng Cargo (`cargo`) và trình biên dịch Rust " +"Bạn sẽ nhận được công cụ xây dựng Cargo (`cargo`) và compiler Rust " "(`rustc`). Bạn cũng sẽ có `rustup`, một tiện ích dòng lệnh mà bạn có thể sử " -"dụng để cài đặt các phiên bản khác nhau cho trình biên dịch." +"dụng để cài đặt các phiên bản khác nhau cho compiler." #: 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 " -"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/)." -msgstr "" -"Sau khi cài đặt Rust thành công, bạn nên cấu hình trình Text Editor hoặc IDE " -"của bạn để hoạt động với Rust. Hầu hết các Text Editor như [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), v.v... đều áp dụng [rust-analyzer](https://rust-analyzer." -"github.io/) để thực hiện tính năng auto-completion và jump-to-definition. " -"Bên cạnh đó, vẫn còn một IDE khác khá phổ biến được phát triển bởi JetBrains " -"là [RustRover](https://www.jetbrains.com/rust/)." +"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/)." +msgstr "" +"Sau khi cài đặt Rust thành công, bạn nên cấu hình trình Text Editor hoặc IDE" +" của bạn để hoạt động với Rust. Hầu hết các Text Editor như [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), v.v... đều áp dụng [rust-" +"analyzer](https://rust-analyzer.github.io/) để thực hiện tính năng auto-" +"completion và jump-to-definition. Bên cạnh đó, vẫn còn một IDE khác khá phổ " +"biến được phát triển bởi JetBrains là " +"[RustRover](https://www.jetbrains.com/rust/)." #: src/cargo.md msgid "" @@ -2150,18 +2226,19 @@ msgstr "Hệ Sinh Thái Rust" #: src/cargo/rust-ecosystem.md msgid "" -"The Rust ecosystem consists of a number of tools, of which the main ones are:" +"The Rust ecosystem consists of a number of tools, of which the main ones " +"are:" msgstr "" -"Hệ sinh thái của Rust bao gồm một số lượng đáng kể các công cụ, trong đó nổi " -"bật nhất như là:" +"Hệ sinh thái của Rust bao gồm một số lượng đáng kể các công cụ, trong đó nổi" +" bật nhất như là:" #: src/cargo/rust-ecosystem.md msgid "" "`rustc`: the Rust compiler which turns `.rs` files into binaries and other " "intermediate formats." msgstr "" -"`rustc`: trình biên dịch Rust, thứ mà sẽ \"dịch\" các file `.rs` sang dạng " -"nhị phân hoặc các formats bậc trung khác." +"`rustc`: compiler Rust, thứ mà sẽ \"dịch\" các file `.rs` sang dạng nhị phân" +" hoặc các formats bậc trung khác." #: src/cargo/rust-ecosystem.md msgid "" @@ -2170,9 +2247,9 @@ msgid "" "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`: trình quản lý các gói phụ thuộc và công cụ xây dựng cho Rust. Cargo " -"sẽ tải các gói phụ thuộc, thường được lưu trữ trên , rồi " -"đưa chúng cho `rustc` khi bạn xây dựng dự án. Cargo còn có các trình chạy " +"`cargo`: trình quản lý các gói phụ thuộc và công cụ xây dựng cho Rust. Cargo" +" sẽ tải các gói phụ thuộc, thường được lưu trữ trên , rồi" +" đưa chúng cho `rustc` khi bạn xây dựng dự án. Cargo còn có các trình chạy " "kiểm thử được cài sẵn phục vụ cho việc thực thi các đơn vị kiểm thử." #: src/cargo/rust-ecosystem.md @@ -2207,8 +2284,7 @@ msgstr "" "--- cùng với đó chúng kích hoạt thêm các chức năng mới." #: 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 "Có tổng cộng ba kênh phát hành: \"stable\", \"beta\", và \"nightly\"." #: src/cargo/rust-ecosystem.md @@ -2216,33 +2292,35 @@ msgid "" "New features are being tested on \"nightly\", \"beta\" is what becomes " "\"stable\" every six weeks." msgstr "" -"Các tính năng mới dang được thử nghiệm trên \"nightly\", còn \"beta\" sẽ trở " -"thành \"stable\" sau mỗi sáu tuần." +"Các tính năng mới dang được thử nghiệm trên \"nightly\", còn \"beta\" sẽ trở" +" thành \"stable\" sau mỗi sáu tuần." #: src/cargo/rust-ecosystem.md msgid "" -"Dependencies can also be resolved from alternative [registries](https://doc." -"rust-lang.org/cargo/reference/registries.html), git, folders, and more." +"Dependencies can also be resolved from alternative " +"[registries](https://doc.rust-lang.org/cargo/reference/registries.html), " +"git, folders, and more." msgstr "" -"Các gói phụ thuộc cũng có thể được phân giải từ các [hệ thống đăng ký]" -"(https://doc.rust-lang.org/cargo/reference/registries.html) thay thế, git, " -"các thư mục, v.v..." +"Các gói phụ thuộc cũng có thể được phân giải từ các [hệ thống đăng " +"ký](https://doc.rust-lang.org/cargo/reference/registries.html) thay thế, " +"git, các thư mục, v.v..." #: 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." +"current edition is Rust 2021. Previous editions were Rust 2015 and Rust " +"2018." msgstr "" -"Rust còn có nhiều [phiên bản lớn](https://doc.rust-lang.org/edition-guide/): " -"Rust 2021 là bản hiện tại, Rust 2018, và Rust 2015." +"Rust còn có nhiều [phiên bản lớn](https://doc.rust-lang.org/edition-guide/):" +" Rust 2021 là bản hiện tại, Rust 2018, và Rust 2015." #: src/cargo/rust-ecosystem.md msgid "" "The editions are allowed to make backwards incompatible changes to the " "language." msgstr "" -"Các phiên bản lớn được cho phép thực hiện các thay đổi không tương thích đối " -"với ngôn ngữ." +"Các phiên bản lớn được cho phép thực hiện các thay đổi không tương thích đối" +" với ngôn ngữ." #: src/cargo/rust-ecosystem.md msgid "" @@ -2257,17 +2335,17 @@ msgid "" "To avoid splitting the ecosystem, Rust compilers can mix code written for " "different editions." msgstr "" -"Nhằm tránh hệ sinh thái bị chia nhỏ ra, trình biên dịch Rust có thể trộn lẫn " -"các đoạn mã được viết dưới các phiên bản lớn khác nhau." +"Nhằm tránh hệ sinh thái bị chia nhỏ ra, compiler Rust có thể trộn lẫn các " +"đoạn mã được viết dưới các phiên bản lớn khác nhau." #: src/cargo/rust-ecosystem.md msgid "" "Mention that it is quite rare to ever use the compiler directly not through " "`cargo` (most users never do)." msgstr "" -"Hãy đề cập với người học rằng việc sử dụng trình biên dịch trực tiếp mà " -"không thông qua `cargo` là việc rất hiếm (hầu hết người dùng không bao giờ " -"làm như vậy)." +"Hãy đề cập với người học rằng việc sử dụng compiler trực tiếp mà không thông" +" qua `cargo` là việc rất hiếm (hầu hết người dùng không bao giờ làm như " +"vậy)." #: src/cargo/rust-ecosystem.md msgid "" @@ -2283,7 +2361,8 @@ msgid "Project/package structure" msgstr "Cấu trúc dự án/bộ phần mềm." #: src/cargo/rust-ecosystem.md -msgid "[workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)" +msgid "" +"[workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)" msgstr "" "[Workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)." @@ -2294,19 +2373,19 @@ 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 "" -"[Build scripting](https://doc.rust-lang.org/cargo/reference/build-scripts." -"html)." +"[Build scripting](https://doc.rust-lang.org/cargo/reference/build-" +"scripts.html)." #: src/cargo/rust-ecosystem.md msgid "" -"[global installation](https://doc.rust-lang.org/cargo/commands/cargo-install." -"html)" +"[global installation](https://doc.rust-lang.org/cargo/commands/cargo-" +"install.html)" msgstr "" -"[Cài đặt trên toàn môi trường](https://doc.rust-lang.org/cargo/commands/" -"cargo-install.html)." +"[Cài đặt trên toàn môi trường](https://doc.rust-" +"lang.org/cargo/commands/cargo-install.html)." #: src/cargo/rust-ecosystem.md msgid "" @@ -2319,7 +2398,8 @@ msgstr "" #: src/cargo/rust-ecosystem.md msgid "" "Read more from the [official Cargo Book](https://doc.rust-lang.org/cargo/)" -msgstr "Tham khảo thêm tại [The Cargo Book](https://doc.rust-lang.org/cargo/)." +msgstr "" +"Tham khảo thêm tại [The Cargo Book](https://doc.rust-lang.org/cargo/)." #: src/cargo/code-samples.md msgid "Code Samples in This Training" @@ -2327,9 +2407,9 @@ msgstr "Code Mẫu Trong Khóa Đào Tạo" #: src/cargo/code-samples.md msgid "" -"For this training, we will mostly explore the Rust language through examples " -"which can be executed through your browser. This makes the setup much easier " -"and ensures a consistent experience for everyone." +"For this training, we will mostly explore the Rust language through examples" +" which can be executed through your browser. This makes the setup much " +"easier and ensures a consistent experience for everyone." msgstr "" "Với khóa đào tạo này, chúng ta sẽ hầu như khám phá ngôn ngữ Rust qua các ví " "dụ có thể thực thi được ngay trên trình duyệt của mình. Việc này giúp cho " @@ -2339,11 +2419,11 @@ msgstr "" #: 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." +"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 "" -"Cài đặt Cargo vẫn được khuyến khích: nó sẽ giúp bạn làm các bài thực hành dễ " -"hơn. Trong ngày học cuối cùng, chúng tôi sẽ làm một bài tập lớn để cho bạn " +"Cài đặt Cargo vẫn được khuyến khích: nó sẽ giúp bạn làm các bài thực hành dễ" +" hơn. Trong ngày học cuối cùng, chúng tôi sẽ làm một bài tập lớn để cho bạn " "thấy cách làm việc với các gói phụ thuộc và bạn sẽ cần Cargo để làm nó." #: src/cargo/code-samples.md @@ -2385,8 +2465,8 @@ msgid "" "the page! This is the reason that the students should solve the exercises " "using a local Rust installation or via the Playground." msgstr "" -"Các Playgrounds được nhúng bị mất trạng thái tạm thời ở thời điểm bạn chuyển " -"sang trang khác! Vì lý do này, các học sinh nên giải các bài thực hành sử " +"Các Playgrounds được nhúng bị mất trạng thái tạm thời ở thời điểm bạn chuyển" +" sang trang khác! Vì lý do này, các học sinh nên giải các bài thực hành sử " "dụng Rust đã được cài đặt trong máy tính riêng hoặc qua Playground thực sự." #: src/cargo/running-locally.md @@ -2401,11 +2481,11 @@ msgid "" "should give you a working `rustc` and `cargo`. At the time of writing, the " "latest stable Rust release has these version numbers:" msgstr "" -"Nếu bạn muốn thử nghiệm code trong hệ thống riêng của bạn, vậy thì trước hết " -"bạn cần phải cài đặt Rust. Hãy tuân theo [các hướng dẫn trong Rust Book]" -"(https://doc.rust-lang.org/book/ch01-01-installation.html). Bạn sẽ học được " -"cách sử dụng `rustc` và `cargo` ở đây. Tại thời điểm bài này được viết, " -"phiên bản ổn định mới nhất của Rust có các số phiên bản sau:" +"Nếu bạn muốn thử nghiệm code trong hệ thống riêng của bạn, vậy thì trước hết" +" bạn cần phải cài đặt Rust. Hãy tuân theo [các hướng dẫn trong Rust " +"Book](https://doc.rust-lang.org/book/ch01-01-installation.html). Bạn sẽ học " +"được cách sử dụng `rustc` và `cargo` ở đây. Tại thời điểm bài này được viết," +" phiên bản ổn định mới nhất của Rust có các số phiên bản sau:" #: src/cargo/running-locally.md msgid "" @@ -2429,10 +2509,11 @@ msgstr "Nhấn vào nút \"Copy to clipboard\" trong ví dụ mà bạn muốn c #: src/cargo/running-locally.md msgid "" -"Use `cargo new exercise` to create a new `exercise/` directory for your code:" +"Use `cargo new exercise` to create a new `exercise/` directory for your " +"code:" msgstr "" -"Sử dụng `cargo new exercise` để tạo một thư mục `exercise/` mới cho code của " -"bạn:" +"Sử dụng `cargo new exercise` để tạo một thư mục `exercise/` mới cho code của" +" bạn:" #: src/cargo/running-locally.md msgid "" @@ -2444,7 +2525,8 @@ msgstr "" #: 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" +"example, using the example on the previous page, make `src/main.rs` look " +"like" msgstr "" "Thay thế khung code trong `src/main.rs` với code riêng của bạn. Chẳng hạn, " "sử dụng ví dụ ở trang trước, viết `src/main.rs` sao cho thành như sau" @@ -2456,14 +2538,15 @@ msgstr "Sử dụng `cargo run` để build và chạy tệp nhị phân vừa #: 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/`." +"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 "" -"Sử dụng `cargo check` để kiểm tra nhanh dự án của bạn, sử dụng `cargo build` " -"để biên dịch nó mà không chạy nó luôn. Bạn có thể tìm các tệp được tạo ra ở " -"`target/debug/` cho debug build thông thường. Sử dụng `cargo build --" -"release` để xuất ra bản build tối ưu cho việc xuất bản ở `target/release/`." +"Sử dụng `cargo check` để kiểm tra nhanh dự án của bạn, sử dụng `cargo build`" +" để biên dịch nó mà không chạy nó luôn. Bạn có thể tìm các tệp được tạo ra ở" +" `target/debug/` cho debug build thông thường. Sử dụng `cargo build " +"--release` để xuất ra bản build tối ưu cho việc xuất bản ở " +"`target/release/`." #: src/cargo/running-locally.md msgid "" @@ -2471,8 +2554,8 @@ msgid "" "run `cargo` commands, it will automatically download and compile missing " "dependencies for you." msgstr "" -"Bạn có thể thêm các gói phụ thuộc vào dự án của bạn bằng cách chỉnh sửa file " -"`Cargo.toml`. Khi bạn chạy các lệnh `cargo`, nó sẽ tự động tải về và biên " +"Bạn có thể thêm các gói phụ thuộc vào dự án của bạn bằng cách chỉnh sửa file" +" `Cargo.toml`. Khi bạn chạy các lệnh `cargo`, nó sẽ tự động tải về và biên " "dịch các gói phụ thuộc bị thiếu cho bạn." #: src/cargo/running-locally.md @@ -2494,8 +2577,8 @@ msgid "" "This is the first day of Rust Fundamentals. We will cover a lot of ground " "today:" msgstr "" -"Đây là ngày học đầu tiên của Rust Căn Bản. Sẽ có rất nhiều nội dung mà chúng " -"ta bao quát trong hôm nay:" +"Đây là ngày học đầu tiên của Rust Căn Bản. Sẽ có rất nhiều nội dung mà chúng" +" ta bao quát trong hôm nay:" #: src/welcome-day-1.md msgid "" @@ -2542,7 +2625,8 @@ msgstr "Hãy lưu ý các học viên rằng:" #: src/welcome-day-1.md msgid "" "They should ask questions when they get them, don't save them to the end." -msgstr "Học viên nên đặt câu hỏi bất kì khi nào thay vì đợi đến cuối buổi học." +msgstr "" +"Học viên nên đặt câu hỏi bất kì khi nào thay vì đợi đến cuối buổi học." #: src/welcome-day-1.md msgid "" @@ -2553,30 +2637,31 @@ msgstr "Lớp học rất khuyến khích có nhiều sự tương tác và th #: src/welcome-day-1.md 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 " +"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 "" -"Với vai trò là người hướng dẫn, bạn nên giữ các cuộc thảo luận sao cho không " -"bị lạc đề, chẳng hạn, thử giới hạn các cuộc thảo luận xung quanh cách Rust " +"Với vai trò là người hướng dẫn, bạn nên giữ các cuộc thảo luận sao cho không" +" bị lạc đề, chẳng hạn, thử giới hạn các cuộc thảo luận xung quanh cách Rust " "hoạt động so với vài ngôn ngữ khác. Việc cân bằng này có thể sẽ khá khó " "khăn, nhưng ta thà chấp nhận nó để học viên thấy hứng thú hơn là việc giao " "tiếp một chiều." #: src/welcome-day-1.md msgid "" -"The questions will likely mean that we talk about things ahead of the slides." +"The questions will likely mean that we talk about things ahead of the " +"slides." msgstr "Một phần có thể bị hỏi trước khi ta học tới slide của phần đó." #: 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." +"Remember that the slides are just a support and you are free to skip them as" +" you like." msgstr "" "Đây là điều hoàn toàn chấp nhận được! Nhắc lại kiến thức là một phần quan " -"trọng của việc học. Hãy nhớ rằng các slides chỉ là công cụ hỗ trợ cho bạn và " -"bạn có thể bỏ qua chúng nếu muốn." +"trọng của việc học. Hãy nhớ rằng các slides chỉ là công cụ hỗ trợ cho bạn và" +" bạn có thể bỏ qua chúng nếu muốn." #: src/welcome-day-1.md msgid "" @@ -2598,9 +2683,9 @@ msgid "" msgstr "" "Nếu bạn đang giảng bài này trên lớp, thì bạn nên vắn tắt một lượt mục lục " "trên. Hãy ghi nhớ rằng cuối mỗi mục nhỏ sẽ có một bài thực hành, sau đó là " -"giờ nghỉ giải lao. Hãy lên kế hoạch để chữa bài thực hành sau giờ nghỉ. Thời " -"gian ở sau mỗi đề mục là nhằm giúp bạn giữ đúng tiến độ khóa học, nhưng bạn " -"cũng có thể thoải mái điều chỉnh linh hoạt nếu cần thiết!" +"giờ nghỉ giải lao. Hãy lên kế hoạch để chữa bài thực hành sau giờ nghỉ. Thời" +" gian ở sau mỗi đề mục là nhằm giúp bạn giữ đúng tiến độ khóa học, nhưng bạn" +" cũng có thể thoải mái điều chỉnh linh hoạt nếu cần thiết!" #: src/hello-world.md src/concurrency/send-sync.md msgid "This segment should take about 15 minutes. It contains:" @@ -2618,7 +2703,7 @@ msgstr "Phần này sẽ kéo dài khoảng 15 phút, bao gồm:" #: src/concurrency/async-control-flow.md src/concurrency/async-pitfalls.md #: src/concurrency/async-exercises.md msgid "Slide" -msgstr "" +msgstr "Cầu trượt" #: src/hello-world.md src/references.md src/user-defined-types.md #: src/pattern-matching.md src/methods-and-traits.md src/generics.md @@ -2628,18 +2713,18 @@ msgstr "" #: src/concurrency/shared-state.md src/concurrency/async.md #: src/concurrency/async-control-flow.md src/concurrency/async-pitfalls.md msgid "10 minutes" -msgstr "" +msgstr "10 phút" #: src/hello-world.md src/control-flow-basics.md src/user-defined-types.md #: src/memory-management.md src/concurrency/channels.md #: src/concurrency/send-sync.md msgid "2 minutes" -msgstr "" +msgstr "2 phút" #: 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 là một ngôn ngữ lập trình mới được phát hành [phiên bản 1.0 vào năm " "2015](https://blog.rust-lang.org/2015/05/15/Rust-1.0.html):" @@ -2654,19 +2739,19 @@ msgstr "`rustc` sử dụng LLVM làm bộ dịch backend." #: src/hello-world/what-is-rust.md msgid "" -"Rust supports many [platforms and architectures](https://doc.rust-lang.org/" -"nightly/rustc/platform-support.html):" +"Rust supports many [platforms and architectures](https://doc.rust-" +"lang.org/nightly/rustc/platform-support.html):" msgstr "" -"Rust hỗ trợ rất nhiều [nền tảng và kiểu kiến trúc](https://doc.rust-lang.org/" -"nightly/rustc/platform-support.html):" +"Rust hỗ trợ rất nhiều [nền tảng và kiểu kiến trúc](https://doc.rust-" +"lang.org/nightly/rustc/platform-support.html):" #: src/hello-world/what-is-rust.md msgid "x86, ARM, WebAssembly, ..." -msgstr "" +msgstr "x86, ARM, WebAssembly, ..." #: src/hello-world/what-is-rust.md msgid "Linux, Mac, Windows, ..." -msgstr "" +msgstr "Linux, Mac, Windows,..." #: src/hello-world/what-is-rust.md msgid "Rust is used for a wide range of devices:" @@ -2723,121 +2808,142 @@ msgstr "" #: src/hello-world/benefits.md msgid "Some unique selling points of Rust:" -msgstr "" +msgstr "Một số điểm bán hàng độc đáo của Rust:" #: src/hello-world/benefits.md msgid "" -"_Compile time memory safety_ - whole classes of memory bugs are prevented at " -"compile time" +"_Compile time memory safety_ - whole classes of memory bugs are prevented at" +" compile time" msgstr "" +"_An toàn bộ nhớ trong thời gian biên dịch_ - toàn bộ các loại lỗi bộ nhớ " +"được ngăn chặn tại thời điểm biên dịch" #: src/hello-world/benefits.md msgid "No uninitialized variables." -msgstr "" +msgstr "Không có biến chưa được khởi tạo." #: src/hello-world/benefits.md msgid "No double-frees." -msgstr "" +msgstr "Không có sự giải phóng kép." #: src/hello-world/benefits.md msgid "No use-after-free." -msgstr "" +msgstr "Không sử dụng sau miễn phí." #: src/hello-world/benefits.md msgid "No `NULL` pointers." -msgstr "" +msgstr "Không có con trỏ `NULL`." #: src/hello-world/benefits.md msgid "No forgotten locked mutexes." -msgstr "" +msgstr "Không quên các mutex bị khóa." #: src/hello-world/benefits.md msgid "No data races between threads." -msgstr "" +msgstr "Không có cuộc đua dữ liệu giữa các chủ đề." #: src/hello-world/benefits.md msgid "No iterator invalidation." -msgstr "" +msgstr "Không có sự vô hiệu của iterator." #: src/hello-world/benefits.md msgid "" "_No undefined runtime behavior_ - what a Rust statement does is never left " "unspecified" msgstr "" +"_Không có hành vi thời gian chạy không xác định_ - những gì câu lệnh Rust " +"làm không bao giờ được xác định" #: src/hello-world/benefits.md msgid "Array access is bounds checked." -msgstr "" +msgstr "Truy cập mảng được kiểm tra giới hạn." #: src/hello-world/benefits.md msgid "Integer overflow is defined (panic or wrap-around)." -msgstr "" +msgstr "Tràn số nguyên được xác định (hoảng loạn hoặc bao bọc)." #: src/hello-world/benefits.md msgid "" "_Modern language features_ - as expressive and ergonomic as higher-level " "languages" msgstr "" +"_Các tính năng ngôn ngữ hiện đại_ - biểu cảm và tiện dụng như các ngôn ngữ " +"cấp cao hơn" #: src/hello-world/benefits.md msgid "Enums and pattern matching." -msgstr "" +msgstr "Enums và khớp mẫu." #: src/hello-world/benefits.md msgid "Generics." -msgstr "" +msgstr "Thuốc generic." #: src/hello-world/benefits.md msgid "No overhead FFI." -msgstr "" +msgstr "Không có FFI chi phí." #: src/hello-world/benefits.md msgid "Zero-cost abstractions." -msgstr "" +msgstr "Trừu tượng không tốn chi phí." #: src/hello-world/benefits.md msgid "Great compiler errors." -msgstr "" +msgstr "Lỗi biên dịch lớn." #: src/hello-world/benefits.md msgid "Built-in dependency manager." -msgstr "" +msgstr "Trình quản lý phụ thuộc tích hợp." #: src/hello-world/benefits.md msgid "Built-in support for testing." -msgstr "" +msgstr "Hỗ trợ tích hợp để thử nghiệm." #: src/hello-world/benefits.md msgid "Excellent Language Server Protocol support." -msgstr "" +msgstr "Hỗ trợ giao thức máy chủ ngôn ngữ tuyệt vời." #: src/hello-world/benefits.md msgid "" "Do not spend much time here. All of these points will be covered in more " "depth later." msgstr "" +"Đừng dành nhiều thời gian ở đây. Tất cả những điểm này sẽ được đề cập sâu " +"hơn sau này." #: 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:" msgstr "" +"Đảm bảo hỏi cả lớp họ có kinh nghiệm sử dụng ngôn ngữ nào. Tùy thuộc vào câu" +" trả lời, bạn có thể nêu bật các tính năng khác nhau của 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 " -"constructs like pattern matching and built-in dependency management." +"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 "" +"Kinh nghiệm với C hoặc C++: Rust loại bỏ toàn bộ lớp _lỗi thời gian chạy_ " +"thông qua trình kiểm tra mượn. Bạn nhận được hiệu suất như trong C và C++, " +"nhưng bạn không gặp phải vấn đề về an toàn bộ nhớ. Ngoài ra, bạn còn có được" +" một ngôn ngữ hiện đại với các cấu trúc như khớp mẫu và quản lý phụ thuộc " +"tích hợp sẵn." #: 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)" +"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 "" +"Trải nghiệm với Java, Go, Python, JavaScript...: Bạn có được sự an toàn về " +"bộ nhớ giống như trong các ngôn ngữ đó, cộng với cảm giác ngôn ngữ cấp cao " +"tương tự. Ngoài ra, bạn còn có được hiệu suất nhanh và có thể dự đoán được " +"như C và C++ (không có trình thu gom rác) cũng như quyền truy cập vào phần " +"cứng cấp thấp (nếu bạn cần)" #: src/hello-world/playground.md msgid "" @@ -2849,16 +2955,16 @@ msgstr "" "[Sân chơi cho Rust (*Rust Playground*)](https://play.rust-lang.org/) cho " "phép chúng ta chạy thử những đoạn code ngắn viết bằng Rust, đặc biệt là các " "ví dụ và bài tập trong khoá học này. Hãy mở Rust Playground và chạy thử " -"chương trình “hello-world”. Rust Playground đi kèm với một vài tính năng hữu " -"ích:" +"chương trình “hello-world”. Rust Playground đi kèm với một vài tính năng hữu" +" ích:" #: src/hello-world/playground.md msgid "" "Under \"Tools\", use the `rustfmt` option to format your code in the " "\"standard\" way." msgstr "" -"Ở phần “Công cụ (*Tools*)”, sử dụng tuỳ chọn`rustfmt` để định dạng đoạn code " -"của bạn theo cách “tiêu chuẩn”." +"Ở phần “Công cụ (*Tools*)”, sử dụng tuỳ chọn`rustfmt` để định dạng đoạn code" +" của bạn theo cách “tiêu chuẩn”." #: src/hello-world/playground.md msgid "" @@ -2869,7 +2975,8 @@ msgstr "" "Rust có hai “chế độ” chính để tạo code: Gỡ lỗi (*Debug*) (thêm nhiều thông " "tin hỗ trợ trong quá trình chạy (*runtime*), ít tối ưu hơn) và Phát hành " "(*Release*) (ít thông tin hỗ trợ trong quá trình chạy (*runtime*), tối ưu " -"hoá nhiều hơn). Các tuỳ chọn này có trong mục “Gỡ lỗi (*Debug*)” ở phía trên." +"hoá nhiều hơn). Các tuỳ chọn này có trong mục “Gỡ lỗi (*Debug*)” ở phía " +"trên." #: src/hello-world/playground.md msgid "" @@ -2883,8 +2990,8 @@ msgstr "" 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 " +"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 "" "Hãy khuyến khích học viên sử dụng Rust Playground để thử nghiệm trong giờ " @@ -2903,8 +3010,8 @@ msgid "" "Let us jump into the simplest possible Rust program, a classic Hello World " "program:" msgstr "" -"Chúng ta hãy cùng bước vào chương trình Rust đơn giản nhất, một chương trình " -"Hello World điển hình:" +"Chúng ta hãy cùng bước vào chương trình Rust đơn giản nhất, một chương trình" +" Hello World điển hình:" #: src/types-and-values/hello-world.md msgid "\"Hello 🌍!\"" @@ -2942,14 +3049,15 @@ msgid "" "see a ton of it over the next four days so we start small with something " "familiar." msgstr "" -"Slide này là nhằm cố gắng giúp các học viên thấy thoải mái với Rust code. Họ " -"sẽ được thấy hàng tấn đoạn code tương tự trong bốn ngày tiếp theo nên ta có " -"thể bắt đầu với những thứ nhỏ bé quen thuộc trước." +"Slide này là nhằm cố gắng giúp các học viên thấy thoải mái với Rust code. Họ" +" sẽ được thấy hàng tấn đoạn code tương tự trong bốn ngày tiếp theo nên ta có" +" thể bắt đầu với những thứ nhỏ bé quen thuộc trước." #: src/types-and-values/hello-world.md msgid "" "Rust is very much like other languages in the C/C++/Java tradition. It is " -"imperative and it doesn't try to reinvent things unless absolutely necessary." +"imperative and it doesn't try to reinvent things unless absolutely " +"necessary." msgstr "" "Rust khá giống với các ngôn ngữ truyền thống như C/C++/Java, đó là điều bắt " "buộc. Nó cũng cố tránh sáng tạo lại những thứ đã có trừ khi thực sự cần " @@ -2966,16 +3074,16 @@ msgid "" "Rust uses macros for situations where you want to have a variable number of " "arguments (no function [overloading](../control-flow-basics/functions.md))." msgstr "" -"Rust sử dụng các macro trong các tình huống như khi bạn muốn có số lượng đối " -"số thay đổi (không bao gồm [nạp chồng hàm](../control-flow-basics/functions." -"md))." +"Rust sử dụng các macro trong các tình huống như khi bạn muốn có số lượng đối" +" số thay đổi (không bao gồm [nạp chồng hàm](../control-flow-" +"basics/functions.md))." #: 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)." +"hygienic](https://veykril.github.io/tlborm/decl-" +"macros/minutiae/hygiene.html)." msgstr "" "Macros được gọi là 'hygienic' khi chúng không vô tình bắt các định danh từ " "phạm vi mà chúng được sử dụng. Rust macros thực chất chỉ là [hygienic từng " @@ -2984,20 +3092,20 @@ msgstr "" #: src/types-and-values/hello-world.md msgid "" "Rust is multi-paradigm. For example, it has powerful [object-oriented " -"programming features](https://doc.rust-lang.org/book/ch17-00-oop.html), and, " -"while it is not a functional language, it includes a range of [functional " +"programming features](https://doc.rust-lang.org/book/ch17-00-oop.html), and," +" 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 là ngôn ngữ đa mô hình. Ví dụ, nó có các [tính năng hướng đối tượng]" -"(https://doc.rust-lang.org/book/ch17-00-oop.html) mạnh mẽ, và dù cho nó " -"không phải là một ngôn ngữ lập trình chức năng, nó vẫn bao gồm nhiều [khái " -"niệm lập trình hàm](https://doc.rust-lang.org/book/ch13-00-functional-" +"Rust là ngôn ngữ đa mô hình. Ví dụ, nó có các [tính năng hướng đối " +"tượng](https://doc.rust-lang.org/book/ch17-00-oop.html) mạnh mẽ, và dù cho " +"nó không phải là một ngôn ngữ lập trình chức năng, nó vẫn bao gồm nhiều " +"[khái niệm lập trình hàm](https://doc.rust-lang.org/book/ch13-00-functional-" "features.html)." #: src/types-and-values/variables.md msgid "" -"Rust provides type safety via static typing. Variable bindings are made with " -"`let`:" +"Rust provides type safety via static typing. Variable bindings are made with" +" `let`:" msgstr "" "Rust cung cấp tính năng an toàn kiểu thông qua kiểu dữ liệu tĩnh. Việc liên " "kết biến được thực thi bằng `let`:" @@ -3005,7 +3113,7 @@ msgstr "" #: src/types-and-values/variables.md src/control-flow-basics/loops/for.md #: src/control-flow-basics/blocks-and-scopes.md msgid "\"x: {x}\"" -msgstr "" +msgstr "\"x: {x}\"" #: src/types-and-values/variables.md msgid "" @@ -3026,8 +3134,8 @@ msgstr "" #: 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." +"time, but type inference (covered later) allows the programmer to omit it in" +" many cases." msgstr "" "Ở đây, từ khóa `i32` chỉ kiểu dữ liệu của biến. Từ khóa này là bắt buộc cho " "việc biên dịch, nhưng trong nhiều trường hợp, suy luận kiểu (sẽ được thảo " @@ -3135,9 +3243,9 @@ msgstr "Ngoài ra, còn có một vài cú pháp không được kể đến #: 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`." +"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`." msgstr "" "Tất cả dấu gạch dưới trong số đều có thể bỏ qua, chúng chỉ nhằm cho mục " "đích dễ đọc mã. Vậy nên, `1_000` có thể được viết thành `1000` (hoặc " @@ -3153,12 +3261,13 @@ msgid "" "meaning should be clear: it takes three integers, and returns an integer. " "Functions will be covered in more detail later." msgstr "" -"Đây là lần đầu tiên ta thấy một hàm mới ngoài hàm `main`, nhưng hàm này cũng " -"có logic rõ ràng dễ hiểu: nó nhận ba số nguyên, và trả lại một số nguyên. " +"Đây là lần đầu tiên ta thấy một hàm mới ngoài hàm `main`, nhưng hàm này cũng" +" có logic rõ ràng dễ hiểu: nó nhận ba số nguyên, và trả lại một số nguyên. " "Chi tiết về hàm sẽ được bao quát sau." #: src/types-and-values/arithmetic.md -msgid "Arithmetic is very similar to other languages, with similar precedence." +msgid "" +"Arithmetic is very similar to other languages, with similar precedence." msgstr "" "Số học trong Rust cũng rất giống với các ngôn ngữ khác, với tiền đề giống " "nhau." @@ -3171,8 +3280,8 @@ msgid "" msgstr "" "Vậy còn hiên tượng tràn số nguyên thì sao? Trong C và C++, vấn đề tràn số " "nguyên _có dấu_ thực ra lại không được xác định, và nó có thể xảy ra theo " -"các cách khác nhau trên các nền tảng hoặc trình biên dịch khác nhau. Còn " -"trong Rust, nó được xác định rõ ràng." +"các cách khác nhau trên các nền tảng hoặc compiler khác nhau. Còn trong " +"Rust, nó được xác định rõ ràng." #: src/types-and-values/arithmetic.md msgid "" @@ -3191,12 +3300,11 @@ msgstr "" #: 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." +"In fact, the compiler will detect overflow of constant expressions, which is" +" why the example requires a separate function." msgstr "" -"Trên thực tế, trình biên dịch sẽ phát hiện ra tràn số nguyên trong các biểu " -"thức hằng số, vì thế nên ta cần phải tách ra các hàm riêng ở trong ví dụ " -"trên." +"Trên thực tế, compiler sẽ phát hiện ra tràn số nguyên trong các biểu thức " +"hằng số, vì thế nên ta cần phải tách ra các hàm riêng ở trong ví dụ trên." #: src/types-and-values/inference.md msgid "Rust will look at how the variable is _used_ to determine the type:" @@ -3209,8 +3317,8 @@ msgid "" "This slide demonstrates how the Rust compiler infers types based on " "constraints given by variable declarations and usages." msgstr "" -"Slide này cho ta thấy cách mà trình biên dịch Rust đoán kiểu dữ liệu dựa " -"trên các ràng buộc từ việc khai báo và sử dụng biến." +"Slide này cho ta thấy cách mà compiler Rust đoán kiểu dữ liệu dựa trên các " +"ràng buộc từ việc khai báo và sử dụng biến." #: src/types-and-values/inference.md msgid "" @@ -3223,8 +3331,8 @@ msgstr "" "Một điều quan trọng cần lưu ý đó là việc khai báo các biến như trên không " "phải là một dạng khai báo động theo kiểu \"any\" mà có thể gán được bất kỳ " "dữ liệu nào. Mã máy được sinh ra từ cách khai báo này cũng giống như cách " -"khai báo một kiểu dữ liệu cụ thể. Trình biên dịch sẽ lo liệu những việc này " -"cho ta và giúp ta viết những đoạn mã ngắn gọn hơn." +"khai báo một kiểu dữ liệu cụ thể. compiler sẽ lo liệu những việc này cho ta " +"và giúp ta viết những đoạn mã ngắn gọn hơn." #: src/types-and-values/inference.md msgid "" @@ -3247,16 +3355,16 @@ msgid "" "number is calculated recursively as the sum of the n-1'th and n-2'th " "Fibonacci numbers." msgstr "" -"Hai số Fibonacci đầu tiên mang giá trị `1`. Với n > 2, số Fibonacci thứ n sẽ " -"được tính đệ quy bằng với tổng của số Fibonacci thứ n - 1 và n - 2." +"Hai số Fibonacci đầu tiên mang giá trị `1`. Với n > 2, số Fibonacci thứ n sẽ" +" được tính đệ quy bằng với tổng của số Fibonacci thứ n - 1 và 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 "" -"Hãy viết một hàm `fib(n)` để tính số Fibonacci thứ n. Khi nào thì hàm này sẽ " -"gây lỗi?" +"Hãy viết một hàm `fib(n)` để tính số Fibonacci thứ n. Khi nào thì hàm này sẽ" +" gây lỗi?" #: src/types-and-values/exercise.md msgid "// The base case.\n" @@ -3281,7 +3389,7 @@ msgstr "Lệnh `if`" #: src/control-flow-basics.md src/pattern-matching.md src/concurrency/async.md #: src/concurrency/async-control-flow.md msgid "4 minutes" -msgstr "" +msgstr "4 phút" #: src/control-flow-basics.md msgid "break and continue" @@ -3293,12 +3401,13 @@ msgstr "Lệnh `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 "" -"Học viên sử dụng [lệnh `if`](https://doc.rust-lang.org/reference/expressions/" -"if-expr.html#if-expressions) giống hệt như lệnh `if` ở những ngôn ngữ lập " -"trình khác" +"Học viên sử dụng [lệnh `if`](https://doc.rust-" +"lang.org/reference/expressions/if-expr.html#if-expressions) giống hệt như " +"lệnh `if` ở những ngôn ngữ lập trình khác" #: src/control-flow-basics/if.md msgid "\"zero!\"" @@ -3345,8 +3454,8 @@ msgstr "" #: 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." +"separate it from the next statement. Remove the `;` before `println!` to see" +" the compiler error." msgstr "" "Khi `if` được sử dụng cho một biểu thức, biểu thức đó phải có dấu `;` để " "tách biệt nó khỏi lệnh tiếp theo. Loại bỏ dấu `;` sau `println!` để thấy " @@ -3363,12 +3472,12 @@ 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." +"expr.html#predicate-loops) works much like in other languages, executing the" +" loop body as long as the condition is true." msgstr "" -"[Từ khóa `while`](https://doc.rust-lang.org/reference/expressions/loop-expr." -"html#predicate-loops) hoạt đông tương tự như những ngôn ngữ lập trình khác, " -"thực hiện vòng lặp lại một khối lệnh trong khi điều kiện còn đúng" +"[Từ khóa `while`](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#predicate-loops) hoạt đông tương tự như những ngôn ngữ lập trình " +"khác, thực hiện vòng lặp lại một khối lệnh trong khi điều kiện còn đúng" #: src/control-flow-basics/loops.md msgid "\"Final x: {x}\"" @@ -3379,7 +3488,8 @@ msgid "" "The [`for` loop](https://doc.rust-lang.org/std/keyword.for.html) iterates " "over ranges of values or the items in a collection:" msgstr "" -"[Từ khóa `for`] lặp lại qua chuỗi dữ liệu hoặc các phần tử trong một tập hợp:" +"[Từ khóa `for`] lặp lại qua chuỗi dữ liệu hoặc các phần tử trong một tập " +"hợp:" #: src/control-flow-basics/loops/for.md msgid "\"elem: {elem}\"" @@ -3405,8 +3515,8 @@ msgstr "" #: src/control-flow-basics/loops/loop.md msgid "" -"The [`loop` statement](https://doc.rust-lang.org/std/keyword.loop.html) just " -"loops forever, until a `break`." +"The [`loop` statement](https://doc.rust-lang.org/std/keyword.loop.html) just" +" loops forever, until a `break`." msgstr "" "[Từ khóa `loop`](https://doc.rust-lang.org/std/keyword.loop.html) là một " "vòng lặp bất tận, cho tới khi `break`." @@ -3417,12 +3527,13 @@ msgstr "\"{i}\"" #: src/control-flow-basics/break-continue.md msgid "" -"If you want to immediately start the next iteration use [`continue`](https://" -"doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)." +"If you want to immediately start the next iteration use " +"[`continue`](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#continue-expressions)." msgstr "" -"Nếu học viên muốn bắt đầu vòng lặp tiếp theo thì hãy sử dụng [`continue`]" -"(https://doc.rust-lang.org/reference/expressions/loop-expr.html#continue-" -"expressions)." +"Nếu học viên muốn bắt đầu vòng lặp tiếp theo thì hãy sử dụng " +"[`continue`](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#continue-expressions)." #: src/control-flow-basics/break-continue.md msgid "" @@ -3431,10 +3542,10 @@ msgid "" "`loop`, this can take an optional expression that becomes the value of the " "`loop` expression." msgstr "" -"Nếu học viên muốn kết thúc một vòng lặp sớm, sử dụng [`break`](https://doc." -"rust-lang.org/reference/expressions/loop-expr.html#break-expressions). Đối " -"với `loop`, từ khóa này có thể dùng một biểu thức tùy chọn trở thành giá trị " -"của biểu thức `loop` " +"Nếu học viên muốn kết thúc một vòng lặp sớm, sử dụng " +"[`break`](https://doc.rust-lang.org/reference/expressions/loop-" +"expr.html#break-expressions). Đối với `loop`, từ khóa này có thể dùng một " +"biểu thức tùy chọn trở thành giá trị của biểu thức `loop` " #: src/control-flow-basics/break-continue.md src/std-traits/exercise.md #: src/std-traits/solution.md src/smart-pointers/trait-objects.md @@ -3450,8 +3561,8 @@ msgid "" "Both `continue` and `break` can optionally take a label argument which is " "used to break out of nested loops:" msgstr "" -"Cả `continue` và `break` có thể sử dụng một nhãn tùy chọn để được sử dụng để " -"thoát ra khỏi những vòng lặp lồng nhau" +"Cả `continue` và `break` có thể sử dụng một nhãn tùy chọn để được sử dụng để" +" thoát ra khỏi những vòng lặp lồng nhau" #: src/control-flow-basics/break-continue/labels.md msgid "\"elements searched: {elements_searched}\"" @@ -3473,13 +3584,13 @@ msgstr "Blocks (khối lệnh)" #: src/control-flow-basics/blocks-and-scopes.md msgid "" -"A block in Rust contains a sequence of expressions, enclosed by braces `{}`. " -"Each block has a value and a type, which are those of the last expression of " -"the block:" +"A block in Rust contains a sequence of expressions, enclosed by braces `{}`." +" Each block has a value and a type, which are those of the last expression " +"of the block:" msgstr "" -"Mỗi block trong Rust chứa một chuỗi những biểu thức, được bao bọc bởi dấu `{}" -"`. Mỗi block có một giá trị và một kiểu dữ liệu tương ứng với biểu thức cuối " -"cùng của block đó:" +"Mỗi block trong Rust chứa một chuỗi những biểu thức, được bao bọc bởi dấu " +"`{}`. Mỗi block có một giá trị và một kiểu dữ liệu tương ứng với biểu thức " +"cuối cùng của block đó:" #: src/control-flow-basics/blocks-and-scopes.md msgid "\"y: {y}\"" @@ -3495,8 +3606,8 @@ msgstr "" #: src/control-flow-basics/blocks-and-scopes.md 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`." +"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 "" "Giáo viên có thể trình bày rằng giá trị của block thay đổi bằng cách thay " "đổi dòng cuối cùng của block đó. Ví dụ, thêm vào hoặc loại bỏ dấu `;` hoặc " @@ -3518,9 +3629,9 @@ msgstr "" msgid "\"before: {a}\"" msgstr "\"ban đầu: {a}\"" -#: src/control-flow-basics/blocks-and-scopes/scopes.md src/generics/exercise.md -#: src/generics/solution.md src/std-traits/from-and-into.md -#: src/lifetimes/solution.md +#: src/control-flow-basics/blocks-and-scopes/scopes.md +#: src/generics/exercise.md src/generics/solution.md +#: src/std-traits/from-and-into.md src/lifetimes/solution.md msgid "\"hello\"" msgstr "\"hello\"" @@ -3548,13 +3659,13 @@ msgstr "" #: src/control-flow-basics/blocks-and-scopes/scopes.md 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." +"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 "" -"Shadow khác với mutation (đột biến), bởi vì sau khi shadow tất cả các vị trí " -"bộ nhớ của biến đó cùng đồng thời tồn tại. Tất cả đều tồn tại dưới cùng một " -"tên, biến nào được sử dụng trong chương trình tùy thuộc vào việc học viên sử " -"dụng chúng ở đâu trong mã." +"Shadow khác với mutation (đột biến), bởi vì sau khi shadow tất cả các vị trí" +" bộ nhớ của biến đó cùng đồng thời tồn tại. Tất cả đều tồn tại dưới cùng một" +" tên, biến nào được sử dụng trong chương trình tùy thuộc vào việc học viên " +"sử dụng chúng ở đâu trong mã." #: src/control-flow-basics/blocks-and-scopes/scopes.md msgid "A shadowing variable can have a different type." @@ -3564,11 +3675,11 @@ msgstr "" #: src/control-flow-basics/blocks-and-scopes/scopes.md msgid "" -"Shadowing looks obscure at first, but is convenient for holding on to values " -"after `.unwrap()`." +"Shadowing looks obscure at first, but is convenient for holding on to values" +" after `.unwrap()`." msgstr "" -"Shadowing có thể khó hiểu ban đầu, nhưng hữu dụng trong việc giữ giá trị sau " -"khi `.unwrap()`." +"Shadowing có thể khó hiểu ban đầu, nhưng hữu dụng trong việc giữ giá trị sau" +" khi `.unwrap()`." #: src/control-flow-basics/functions.md msgid "" @@ -3585,18 +3696,18 @@ msgid "" "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 "" -"Biểu thức cuối cùng trong hàm (hay một khối) sẽ trở thành giá trị tả về. Đơn " -"giản bằng cách bỏ qua dấu `;` ở cuối biểu thức. Từ khóa `return` có thể sử " -"dụng để trả về sớm, nhưng \"giá trị trần (bare value)\" là triết lí ngôn ngữ " -"(idiomatic) khi đặt ở cuối hàm (tái cấu trúc `gcd` dể sử dụng `return`)." +"Biểu thức cuối cùng trong hàm (hay một khối) sẽ trở thành giá trị tả về. Đơn" +" giản bằng cách bỏ qua dấu `;` ở cuối biểu thức. Từ khóa `return` có thể sử " +"dụng để trả về sớm, nhưng \"giá trị trần (bare value)\" là triết lí ngôn ngữ" +" (idiomatic) khi đặt ở cuối hàm (tái cấu trúc `gcd` dể sử dụng `return`)." #: 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 "" -"Một số hàm sẽ không có giá trị trở về, sẽ trả về 'kiểu dữ liệu', `()`. Trình " -"biên dịch sẽ kết luận rằng kiểu dữ liệu sẽ là `-> ()` nếu kiểu dữ liệu trả " +"Một số hàm sẽ không có giá trị trở về, sẽ trả về 'kiểu dữ liệu', `()`. Trình" +" biên dịch sẽ kết luận rằng kiểu dữ liệu sẽ là `-> ()` nếu kiểu dữ liệu trả " "về được bỏ qua." #: src/control-flow-basics/functions.md @@ -3628,26 +3739,26 @@ msgid "" "variable number of arguments. They are distinguished by a `!` at the end. " "The Rust standard library includes an assortment of useful macros." msgstr "" -"Macros được triển khai qua mã Rust trong quá trình biên dịch, và có thể nhận " -"nhiều những biến khác nhau. Macros được nhận diện bởi dấu `!` ở sau cùng. " -"Rust standard library (Thư viện Rust căn bản) bao gồm nhiều loại macros hữu " -"dụng khác nhau." +"Macros được triển khai qua mã Rust trong quá compiler, và có thể nhận nhiều " +"những biến khác nhau. Macros được nhận diện bởi dấu `!` ở sau cùng. Rust " +"standard library (Thư viện Rust căn bản) bao gồm nhiều loại macros hữu dụng " +"khác nhau." #: src/control-flow-basics/macros.md msgid "" -"`println!(format, ..)` prints a line to standard output, applying formatting " -"described in [`std::fmt`](https://doc.rust-lang.org/std/fmt/index.html)." +"`println!(format, ..)` prints a line to standard output, applying formatting" +" described in [`std::fmt`](https://doc.rust-lang.org/std/fmt/index.html)." msgstr "" "`println!(format, ..)` in nội dung ra standard output, áp dụng format được " "miêu tả trong [`std::fmt`](https://doc.rust-lang.org/std/fmt/index.html)." #: src/control-flow-basics/macros.md msgid "" -"`format!(format, ..)` works just like `println!` but returns the result as a " -"string." +"`format!(format, ..)` works just like `println!` but returns the result as a" +" string." msgstr "" -"`format!(format, ..)` hoạt động tương tự như `println!` nhưng trả về dữ liệu " -"ở dạng `string`." +"`format!(format, ..)` hoạt động tương tự như `println!` nhưng trả về dữ liệu" +" ở dạng `string`." #: src/control-flow-basics/macros.md msgid "`dbg!(expression)` logs the value of the expression and returns it." @@ -3676,17 +3787,17 @@ 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." +"how to use them. Why they are defined as macros, and what they expand to, is" +" not especially critical." msgstr "" "Bài học được rút ra trong chương này là những cú pháp thông dụng tiện nghi " -"trên tồn tại, và các sử dụng chúng. Tại sao chúng được định nghĩa là macros, " -"với cách những macros triền khai qua đều không quan trọng." +"trên tồn tại, và các sử dụng chúng. Tại sao chúng được định nghĩa là macros," +" với cách những macros triền khai qua đều không quan trọng." #: src/control-flow-basics/macros.md msgid "" -"The course does not cover defining macros, but a later section will describe " -"use of derive macros." +"The course does not cover defining macros, but a later section will describe" +" use of derive macros." msgstr "" "Khóa học này sẽ không đi qua về định nghĩ macros, nhưng những chương tiếp " "theo sẽ đề cập tới sử dụng derive macros." @@ -3696,9 +3807,9 @@ msgid "" "The [Collatz Sequence](https://en.wikipedia.org/wiki/Collatz_conjecture) is " "defined as follows, for an arbitrary n" msgstr "" -"[Chuỗi Collatz](https://vi.wikipedia.org/wiki/" -"Gi%E1%BA%A3_thuy%E1%BA%BFt_Collatz) được định nghĩa như sau: với một giá trị " -"bất kì n" +"[Chuỗi " +"Collatz](https://vi.wikipedia.org/wiki/Gi%E1%BA%A3_thuy%E1%BA%BFt_Collatz) " +"được định nghĩa như sau: với một giá trị bất kì n" #: src/control-flow-basics/exercise.md msgid "1" @@ -3850,8 +3961,8 @@ msgstr "chuỗi chấm dứt." #: src/control-flow-basics/exercise.md msgid "" -"Write a function to calculate the length of the collatz sequence for a given " -"initial `n`." +"Write a function to calculate the length of the collatz sequence for a given" +" initial `n`." msgstr "" "Viết một hàm để tính độ dài chủa chuỗi Collatz với một giá trị ban đầu `n`" @@ -3866,7 +3977,7 @@ msgstr "\"Độ dài: {}\"" #: src/welcome-day-1-afternoon.md src/welcome-day-2-afternoon.md #: src/welcome-day-3-afternoon.md src/welcome-day-4-afternoon.md msgid "Welcome Back" -msgstr "" +msgstr "Chào mừng trở lại" #: src/welcome-day-1-afternoon.md msgid "" @@ -3883,11 +3994,15 @@ msgstr "Phần này sẽ kéo dài khoảng 35 phút, bao gồm:" #: src/tuples-and-arrays/arrays.md 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 " +"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 "" +"Một giá trị của kiểu mảng `[T; N]` chứa các phần tử `N` (hằng số thời gian " +"biên dịch) cùng loại `T`. Lưu ý rằng độ dài của mảng là _part của kiểu_ của " +"nó_, có nghĩa là `[u8; 3]` và `[u8; 4]` được coi là hai loại khác nhau. Các " +"lát cắt có kích thước được xác định trong thời gian chạy sẽ được đề cập sau." #: src/tuples-and-arrays/arrays.md msgid "" @@ -3895,10 +4010,13 @@ msgid "" "runtime. Rust can usually optimize these checks away, and they can be " "avoided using unsafe Rust." msgstr "" +"Hãy thử truy cập một phần tử mảng ngoài giới hạn. Truy cập mảng được kiểm " +"tra khi chạy. Rust thường có thể tối ưu hóa các bước kiểm tra này và có thể " +"tránh được chúng bằng cách sử dụng Rust không an toàn." #: src/tuples-and-arrays/arrays.md msgid "We can use literals to assign values to arrays." -msgstr "" +msgstr "Chúng ta có thể sử dụng hằng số để gán giá trị cho mảng." #: src/tuples-and-arrays/arrays.md msgid "" @@ -3908,49 +4026,67 @@ msgid "" "only implement the debug output. This means that we must use debug output " "here." msgstr "" +"Macro `println!` yêu cầu triển khai gỡ lỗi với tham số định dạng `?`: `{}` " +"cung cấp đầu ra mặc định, `{:?}` cung cấp đầu ra gỡ lỗi. Các loại như số " +"nguyên và chuỗi triển khai đầu ra mặc định, nhưng mảng chỉ triển khai đầu ra" +" gỡ lỗi. Điều này có nghĩa là chúng ta phải sử dụng đầu ra gỡ lỗi ở đây." #: src/tuples-and-arrays/arrays.md msgid "" "Adding `#`, eg `{a:#?}`, invokes a \"pretty printing\" format, which can be " "easier to read." msgstr "" +"Việc thêm `#`, ví dụ `{a:#?}`, sẽ tạo ra một định dạng \"in đẹp\", có thể dễ" +" đọc hơn." #: src/tuples-and-arrays/tuples.md msgid "Like arrays, tuples have a fixed length." -msgstr "" +msgstr "Giống như mảng, bộ dữ liệu có độ dài cố định." #: src/tuples-and-arrays/tuples.md msgid "Tuples group together values of different types into a compound type." msgstr "" +"Các bộ dữ liệu nhóm các giá trị thuộc các loại khác nhau thành một loại kết " +"hợp." #: 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`." msgstr "" +"Các trường của một bộ dữ liệu có thể được truy cập theo dấu chấm và chỉ mục " +"của giá trị, ví dụ: `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." msgstr "" +"Bộ dữ liệu trống `()` được gọi là \"loại đơn vị\" và biểu thị sự vắng mặt " +"của giá trị trả về, tương tự như `void` trong các ngôn ngữ khác." #: src/tuples-and-arrays/iteration.md msgid "The `for` statement supports iterating over arrays (but not tuples)." msgstr "" +"Câu lệnh `for` hỗ trợ lặp lại các mảng (nhưng không hỗ trợ bộ dữ liệu)." #: src/tuples-and-arrays/iteration.md msgid "" "This functionality uses the `IntoIterator` trait, but we haven't covered " "that yet." msgstr "" +"Chức năng này sử dụng đặc điểm `IntoIterator`, nhưng chúng tôi chưa đề cập " +"đến điều đó." #: 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 " +"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 "" +"Ở đây macro `assert_ne!` là mới. Ngoài ra còn có các macro `assert_eq!` và " +"`assert!`. Chúng luôn được kiểm tra trong khi các biến thể chỉ gỡ lỗi như " +"`debug_assert!` biên dịch thành không có gì trong bản phát hành." #: src/tuples-and-arrays/destructuring.md msgid "" @@ -3958,16 +4094,22 @@ msgid "" "extract the inner values into local variables. This can be done manually by " "directly accessing the inner values:" msgstr "" +"Khi làm việc với các bộ dữ liệu và các giá trị có cấu trúc khác, người ta " +"thường muốn trích xuất các giá trị bên trong thành các biến cục bộ. Điều này" +" có thể được thực hiện thủ công bằng cách truy cập trực tiếp vào các giá trị" +" bên trong:" #: src/tuples-and-arrays/destructuring.md msgid "\"left: {left}, right: {right}\"" -msgstr "" +msgstr "\"trái: {trái}, phải: {phải}\"" #: src/tuples-and-arrays/destructuring.md msgid "" "However, Rust also supports using pattern matching to destructure a larger " "value into its constituent parts:" msgstr "" +"Tuy nhiên, Rust cũng hỗ trợ sử dụng khớp mẫu để phân tách giá trị lớn hơn " +"thành các phần cấu thành của nó:" #: src/tuples-and-arrays/destructuring.md msgid "" @@ -3975,12 +4117,16 @@ msgid "" "statically verify that the value on the right of `=` has the same structure " "as the pattern." msgstr "" +"Các mẫu được sử dụng ở đây là \"không thể bác bỏ\", nghĩa là compiler có thể" +" xác minh tĩnh rằng giá trị ở bên phải của `=` có cùng cấu trúc với mẫu." #: 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." msgstr "" +"Tên biến là một mẫu không thể chối cãi, luôn khớp với bất kỳ giá trị nào, do" +" đó tại sao chúng ta cũng có thể sử dụng `let` để khai báo một biến." #: src/tuples-and-arrays/destructuring.md msgid "" @@ -3988,37 +4134,46 @@ msgid "" "comparison and destructuring to happen at the same time. This form of " "pattern matching will be discussed in more detail later." msgstr "" +"Rust cũng hỗ trợ sử dụng các mẫu trong các điều kiện, cho phép so sánh đẳng " +"thức và phá hủy xảy ra cùng một lúc. Hình thức khớp mẫu này sẽ được thảo " +"luận chi tiết hơn sau." #: src/tuples-and-arrays/destructuring.md msgid "" "Edit the examples above to show the compiler error when the pattern doesn't " "match the value being matched on." msgstr "" +"Chỉnh sửa các ví dụ ở trên để hiển thị lỗi compiler khi mẫu không khớp với " +"giá trị được khớp." #: src/tuples-and-arrays/exercise.md msgid "Arrays can contain other arrays:" -msgstr "" +msgstr "Mảng có thể chứa các mảng khác:" #: src/tuples-and-arrays/exercise.md msgid "What is the type of this variable?" -msgstr "" +msgstr "Loại biến này là gì?" #: src/tuples-and-arrays/exercise.md msgid "" "Use an array such as the above to write a function `transpose` which will " "transpose a matrix (turn rows into columns):" msgstr "" +"Sử dụng một mảng như trên để viết hàm `transpose` sẽ hoán vị một ma trận " +"(chuyển hàng thành cột):" #: src/tuples-and-arrays/exercise.md msgid "" "Copy the code below to and implement the " "function. This function only operates on 3x3 matrices." msgstr "" +"Sao chép mã bên dưới vào và triển khai chức " +"năng. Hàm này chỉ hoạt động trên ma trận 3x3." #: src/tuples-and-arrays/exercise.md src/borrowing/exercise.md #: src/unsafe-rust/exercise.md msgid "// TODO: remove this when you're done with your implementation.\n" -msgstr "" +msgstr "// VIỆC CẦN LÀM: xóa phần này khi bạn thực hiện xong.\n" #: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md msgid "//\n" @@ -4026,15 +4181,15 @@ msgstr "" #: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md msgid "// <-- the comment makes rustfmt add a newline\n" -msgstr "" +msgstr "// <-- nhận xét khiến Rustfmt thêm dòng mới\n" #: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md msgid "\"matrix: {:#?}\"" -msgstr "" +msgstr "\"ma trận: {:#?}\"" #: src/tuples-and-arrays/exercise.md src/tuples-and-arrays/solution.md msgid "\"transposed: {:#?}\"" -msgstr "" +msgstr "\"đã chuyển đổi: {:#?}\"" #: src/references.md src/smart-pointers.md src/borrowing.md #: src/error-handling.md src/concurrency/async-pitfalls.md @@ -4043,7 +4198,7 @@ msgstr "Phần này sẽ kéo dài khoảng 55 phút, bao gồm:" #: src/references.md msgid "Slices: &\\[T\\]" -msgstr "" +msgstr "Các lát: &\\[T\\]" #: src/references/shared.md msgid "" @@ -4051,6 +4206,9 @@ msgid "" "responsibility for the value, and is also called \"borrowing\". Shared " "references are read-only, and the referenced data cannot change." msgstr "" +"Một tham chiếu cung cấp một cách để truy cập một giá trị khác mà không chịu " +"trách nhiệm về giá trị đó và còn được gọi là \"mượn\". Tài liệu tham khảo " +"được chia sẻ ở dạng chỉ đọc và dữ liệu được tham chiếu không thể thay đổi." #: src/references/shared.md msgid "" @@ -4058,33 +4216,46 @@ msgid "" "with the `&` operator. The `*` operator \"dereferences\" a reference, " "yielding its value." msgstr "" +"Tham chiếu được chia sẻ tới loại `T` có loại `&T`. Một giá trị tham chiếu " +"được tạo bằng toán tử `&`. Toán tử `*` \"dereferences\" một tham chiếu, mang" +" lại giá trị của nó." #: src/references/shared.md msgid "Rust will statically forbid dangling references:" -msgstr "" +msgstr "Rust sẽ cấm tĩnh các tài liệu tham khảo lơ lửng:" #: src/references/shared.md 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 " +"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." msgstr "" +"Một tham chiếu được cho là \"mượn\" giá trị mà nó đề cập đến và đây là một " +"mô hình tốt cho những sinh viên không quen với con trỏ: mã có thể sử dụng " +"tham chiếu để truy cập giá trị, nhưng vẫn được biến ban đầu \"sở hữu\". Khóa" +" học sẽ đi vào chi tiết hơn về quyền sở hữu trong ngày thứ 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 " +"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 tham chiếu được triển khai dưới dạng con trỏ và ưu điểm chính là chúng " +"có thể nhỏ hơn nhiều so với thứ chúng trỏ tới. Học sinh quen thuộc với C " +"hoặc C++ sẽ nhận ra các tài liệu tham khảo là con trỏ. Các phần sau của khóa" +" học sẽ đề cập đến cách Rust ngăn chặn các lỗi an toàn bộ nhớ phát sinh từ " +"việc sử dụng con trỏ thô." #: src/references/shared.md msgid "" "Rust does not automatically create references for you - the `&` is always " "required." msgstr "" +"Rust không tự động tạo tài liệu tham khảo cho bạn - `&` luôn được yêu cầu." #: src/references/shared.md msgid "" @@ -4092,6 +4263,8 @@ msgid "" "methods (try `r.is_ascii()`). There is no need for an `->` operator like in " "C++." msgstr "" +"Rust sẽ tự động hủy đăng ký trong một số trường hợp, đặc biệt khi gọi các " +"phương thức (thử `r.is_ascii()`). Không cần toán tử `->` như trong C++." #: src/references/shared.md msgid "" @@ -4100,69 +4273,94 @@ msgid "" "different from C++, where assignment to a reference changes the referenced " "value." msgstr "" +"Trong ví dụ này, `r` có thể thay đổi để có thể gán lại (`r = &b`). Lưu ý " +"rằng điều này liên kết lại `r`, để nó đề cập đến cái gì khác. Điều này khác " +"với C++, trong đó việc gán cho một tham chiếu sẽ thay đổi giá trị được tham " +"chiếu." #: src/references/shared.md msgid "" "A shared reference does not allow modifying the value it refers to, even if " "that value was mutable. Try `*r = 'X'`." msgstr "" +"Tham chiếu được chia sẻ không cho phép sửa đổi giá trị mà nó đề cập đến, " +"ngay cả khi giá trị đó có thể thay đổi. Hãy thử `*r = 'X'`." #: 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 đang theo dõi vòng đời của tất cả các tài liệu tham khảo để đảm bảo " +"chúng tồn tại đủ lâu. Tài liệu tham khảo lơ lửng không thể xảy ra trong Rust" +" an toàn. `x_axis` sẽ trả về một tham chiếu đến `point`, nhưng `point` sẽ bị" +" hủy phân bổ khi hàm trả về, vì vậy hàm này sẽ không biên dịch." #: src/references/shared.md msgid "We will talk more about borrowing when we get to ownership." msgstr "" +"Chúng ta sẽ nói nhiều hơn về việc vay mượn khi chúng ta có được quyền sở " +"hữu." #: src/references/exclusive.md msgid "" "Exclusive references, also known as mutable references, allow changing the " "value they refer to. They have type `&mut T`." msgstr "" +"Tham chiếu độc quyền, còn được gọi là tham chiếu có thể thay đổi, cho phép " +"thay đổi giá trị mà chúng tham chiếu đến. Họ có loại `&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 " +"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 "" +"\"Độc quyền\" có nghĩa là chỉ có thể sử dụng tham chiếu này để truy cập giá " +"trị. Không có tham chiếu nào khác (được chia sẻ hoặc độc quyền) có thể tồn " +"tại cùng lúc và giá trị được tham chiếu không thể được truy cập trong khi " +"tham chiếu độc quyền tồn tại. Hãy thử tạo `&point.0` hoặc thay đổi `point.0`" +" trong khi `x_coord` vẫn hoạt động." #: src/references/exclusive.md 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 " +"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." msgstr "" +"Hãy nhớ lưu ý sự khác biệt giữa `let mut x_coord: &i32` và `let x_coord: " +"&mut i32`. Cái đầu tiên đại diện cho một tham chiếu được chia sẻ có thể được" +" liên kết với các giá trị khác nhau, trong khi cái thứ hai thể hiện một tham" +" chiếu độc quyền cho một giá trị có thể thay đổi." #: src/references/slices.md msgid "Slices" -msgstr "" +msgstr "Lát" #: src/references/slices.md msgid "A slice gives you a view into a larger collection:" -msgstr "" +msgstr "Một lát cắt cung cấp cho bạn chế độ xem vào bộ sưu tập lớn hơn:" #: src/references/slices.md msgid "Slices borrow data from the sliced type." -msgstr "" +msgstr "Các lát mượn dữ liệu từ kiểu cắt lát." #: src/references/slices.md msgid "Question: What happens if you modify `a[3]` right before printing `s`?" -msgstr "" +msgstr "Câu hỏi: Điều gì xảy ra nếu bạn sửa đổi `a[3]` ngay trước khi in `s`?" #: src/references/slices.md msgid "" "We create a slice by borrowing `a` and specifying the starting and ending " "indexes in brackets." msgstr "" +"Chúng ta tạo một lát cắt bằng cách mượn `a` và chỉ định chỉ mục bắt đầu và " +"kết thúc trong ngoặc." #: src/references/slices.md msgid "" @@ -4170,17 +4368,24 @@ msgid "" "starting index, meaning that `&a[0..a.len()]` and `&a[..a.len()]` are " "identical." msgstr "" +"Nếu slice bắt đầu ở chỉ mục 0, cú pháp phạm vi của Rust cho phép chúng ta bỏ" +" chỉ mục bắt đầu, nghĩa là `&a[0..a.len()]` và `&a[..a.len()]` giống hệt " +"nhau." #: src/references/slices.md msgid "" "The same is true for the last index, so `&a[2..a.len()]` and `&a[2..]` are " "identical." msgstr "" +"Điều này cũng đúng với chỉ mục cuối cùng, vì vậy `&a[2..a.len()]` và " +"`&a[2..]` giống hệt nhau." #: src/references/slices.md msgid "" "To easily create a slice of the full array, we can therefore use `&a[..]`." msgstr "" +"Do đó, để dễ dàng tạo một lát của toàn bộ mảng, chúng ta có thể sử dụng " +"`&a[..]`." #: src/references/slices.md msgid "" @@ -4188,54 +4393,66 @@ msgid "" "(`&[i32]`) no longer mentions the array length. This allows us to perform " "computation on slices of different sizes." msgstr "" +"`s` là một tham chiếu đến một phần của `i32`s. Lưu ý rằng loại `s` " +"(`&[i32]`) không còn đề cập đến độ dài mảng nữa. Điều này cho phép chúng ta " +"thực hiện tính toán trên các lát có kích thước khác nhau." #: src/references/slices.md 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." +"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 "" +"Các lát cắt luôn mượn từ một đối tượng khác. Trong ví dụ này, `a` phải duy " +"trì 'sống' (trong phạm vi) ít nhất bằng lát cắt của chúng ta." #: src/references/slices.md 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 " +"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." msgstr "" +"Câu hỏi về việc sửa đổi `a[3]` có thể khơi dậy một cuộc thảo luận thú vị, " +"nhưng câu trả lời là vì lý do an toàn bộ nhớ, bạn không thể thực hiện điều " +"đó thông qua `a` tại thời điểm thực thi, nhưng bạn có thể đọc dữ liệu từ cả " +"`a` và `s` một cách an toàn. Nó hoạt động trước khi bạn tạo lát cắt và hoạt " +"động lại sau `println`, khi lát cắt không còn được sử dụng nữa." #: src/references/strings.md msgid "We can now understand the two string types in Rust:" -msgstr "" +msgstr "Bây giờ chúng ta có thể hiểu hai loại chuỗi trong Rust:" #: src/references/strings.md msgid "`&str` is a slice of UTF-8 encoded bytes, similar to `&[u8]`." -msgstr "" +msgstr "`&str` là một lát byte được mã hóa UTF-8, tương tự như `&[u8]`." #: src/references/strings.md msgid "" "`String` is an owned buffer of UTF-8 encoded bytes, similar to `Vec`." msgstr "" +"`String` là bộ đệm thuộc sở hữu của các byte được mã hóa UTF-8, tương tự như" +" `Vec`." #: src/references/strings.md src/std-traits/read-and-write.md msgid "\"World\"" -msgstr "" +msgstr "\"Thế giới\"" #: src/references/strings.md msgid "\"s1: {s1}\"" -msgstr "" +msgstr "\"s1: {s1}\"" #: src/references/strings.md msgid "\"Hello \"" -msgstr "" +msgstr "\"Xin chào \"" #: src/references/strings.md src/memory-management/move.md msgid "\"s2: {s2}\"" -msgstr "" +msgstr "\"s2: {s2}\"" #: src/references/strings.md msgid "\"s3: {s3}\"" -msgstr "" +msgstr "\"s3: {s3}\"" #: src/references/strings.md msgid "" @@ -4243,12 +4460,17 @@ msgid "" "encoded string data stored in a block of memory. String literals " "(`\"Hello\"`), are stored in the program’s binary." msgstr "" +"`&str` giới thiệu một lát chuỗi, là một tham chiếu bất biến đối với dữ liệu " +"chuỗi được mã hóa UTF-8 được lưu trữ trong một khối bộ nhớ. Chuỗi ký tự " +"(`\"Xin chào\"`), được lưu trữ trong tệp nhị phân của chương trình." #: src/references/strings.md msgid "" "Rust's `String` type is a wrapper around a vector of bytes. As with a " "`Vec`, it is owned." msgstr "" +"Kiểu `String` của Rust là một trình bao bọc xung quanh một vectơ byte. Như " +"với `Vec`, nó được sở hữu." #: src/references/strings.md msgid "" @@ -4256,12 +4478,17 @@ msgid "" "literal; `String::new()` creates a new empty string, to which string data " "can be added using the `push()` and `push_str()` methods." msgstr "" +"Như với nhiều kiểu khác `String::from()` tạo một chuỗi từ một chuỗi ký tự; " +"`String::new()` tạo một chuỗi trống mới, dữ liệu chuỗi này có thể được thêm " +"vào bằng cách sử dụng các phương thức `push()` và `push_str()`." #: src/references/strings.md msgid "" "The `format!()` macro is a convenient way to generate an owned string from " "dynamic values. It accepts the same format specification as `println!()`." msgstr "" +"Macro `format!()` là một cách thuận tiện để tạo chuỗi sở hữu từ các giá trị " +"động. Nó chấp nhận đặc tả định dạng giống như `println!()`." #: src/references/strings.md msgid "" @@ -4270,18 +4497,27 @@ msgid "" "boundaries, the expression will panic. The `chars` iterator iterates over " "characters and is preferred over trying to get character boundaries right." msgstr "" +"Bạn có thể mượn các lát `&str` từ `String` thông qua `&` và lựa chọn phạm vi" +" tùy chọn. Nếu bạn chọn một phạm vi byte không được căn chỉnh theo ranh giới" +" ký tự, biểu thức sẽ bị hoảng loạn. Trình lặp `chars` lặp qua các ký tự và " +"được ưu tiên hơn là cố gắng phân định đúng ranh giới ký tự." #: src/references/strings.md msgid "" -"For C++ programmers: think of `&str` as `std::string_view` from C++, but the " -"one that always points to a valid string in memory. Rust `String` is a rough " -"equivalent of `std::string` from C++ (main difference: it can only contain " -"UTF-8 encoded bytes and will never use a small-string optimization)." +"For C++ programmers: think of `&str` as `std::string_view` from C++, but the" +" one that always points to a valid string in memory. Rust `String` is a " +"rough 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 "" +"Đối với người lập trình C++: hãy coi `&str` là `std::string_view` trong C++," +" nhưng là chuỗi luôn trỏ đến một chuỗi hợp lệ trong bộ nhớ. Rust `String` " +"gần tương đương với `std::string` trong C++ (điểm khác biệt chính: nó chỉ có" +" thể chứa các byte được mã hóa UTF-8 và sẽ không bao giờ sử dụng tối ưu hóa " +"chuỗi nhỏ)." #: src/references/strings.md msgid "Byte strings literals allow you to create a `&[u8]` value directly:" -msgstr "" +msgstr "Chuỗi ký tự byte cho phép bạn tạo trực tiếp giá trị `&[u8]`:" #: src/references/strings.md msgid "" @@ -4289,54 +4525,63 @@ msgid "" "`r\"\\n\" == \"\\\\n\"`. You can embed double-quotes by using an equal " "amount of `#` on either side of the quotes:" msgstr "" +"Chuỗi thô cho phép bạn tạo một giá trị `&str` với các lối thoát bị vô hiệu " +"hóa: `r\"\\n\" == \"\\\\n\"`. Bạn có thể nhúng dấu ngoặc kép bằng cách sử " +"dụng số lượng `#` bằng nhau ở hai bên dấu ngoặc kép:" #: 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." +"representing a point as `[f64;3]`. It is up to you to determine the function" +" signatures." msgstr "" +"Chúng ta sẽ tạo một vài hàm tiện ích cho hình học 3 chiều, biểu thị một điểm" +" là `[f64;3]`. Việc xác định chữ ký hàm là tùy thuộc vào bạn." #: 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" +"// 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" "// root, like `v.sqrt()`.\n" msgstr "" +"// Tính độ lớn của vectơ bằng cách tính tổng bình phương tọa độ của nó\n" +"// và lấy căn bậc hai. Sử dụng phương thức `sqrt()` để tính bình phương\n" +"// gốc, như `v.sqrt()`.\n" #: src/references/exercise.md msgid "" "// Normalize a vector by calculating its magnitude and dividing all of its\n" "// coordinates by that magnitude.\n" msgstr "" +"// Chuẩn hóa một vectơ bằng cách tính độ lớn của nó và chia tất cả các giá trị của nó\n" +"// tọa độ theo độ lớn đó.\n" #: src/references/exercise.md msgid "// Use the following `main` to test your work.\n" -msgstr "" +msgstr "// Sử dụng `main` sau đây để kiểm tra tác phẩm của bạn.\n" #: src/references/exercise.md src/references/solution.md msgid "\"Magnitude of a unit vector: {}\"" -msgstr "" +msgstr "\"Độ lớn của vectơ đơn vị: {}\"" #: src/references/exercise.md src/references/solution.md msgid "\"Magnitude of {v:?}: {}\"" -msgstr "" +msgstr "\"Cường độ của {v:?}: {}\"" #: src/references/exercise.md src/references/solution.md msgid "\"Magnitude of {v:?} after normalization: {}\"" -msgstr "" +msgstr "\"Cường độ của {v:?} sau khi chuẩn hóa: {}\"" #: src/references/solution.md msgid "/// Calculate the magnitude of the given vector.\n" -msgstr "" +msgstr "/// Tính độ lớn của vectơ đã cho.\n" #: src/references/solution.md msgid "" "/// Change the magnitude of the vector to 1.0 without changing its " "direction.\n" msgstr "" +"/// Thay đổi độ lớn của vectơ thành 1.0 mà không thay đổi hướng của nó.\n" #: src/user-defined-types.md src/methods-and-traits.md src/lifetimes.md msgid "This segment should take about 50 minutes. It contains:" @@ -4344,47 +4589,51 @@ msgstr "Phần này sẽ kéo dài khoảng 50 phút, bao gồm:" #: src/user-defined-types/named-structs.md msgid "Like C and C++, Rust has support for custom structs:" -msgstr "" +msgstr "Giống như C và C++, Rust có hỗ trợ các cấu trúc tùy chỉnh:" #: src/user-defined-types/named-structs.md msgid "\"{} is {} years old\"" -msgstr "" +msgstr "\"{} là {} tuổi\"" #: src/user-defined-types/named-structs.md #: src/android/interoperability/with-c/bindgen.md msgid "\"Peter\"" -msgstr "" +msgstr "\"Peter\"" #: src/user-defined-types/named-structs.md msgid "\"Avery\"" -msgstr "" +msgstr "\"Avery\"" #: src/user-defined-types/named-structs.md msgid "\"Jackie\"" -msgstr "" +msgstr "\"Jackie\"" #: src/user-defined-types/named-structs.md src/user-defined-types/enums.md #: src/pattern-matching/match.md src/methods-and-traits/methods.md msgid "Key Points:" -msgstr "" +msgstr "Những điểm chính:" #: src/user-defined-types/named-structs.md msgid "Structs work like in C or C++." -msgstr "" +msgstr "Cấu trúc hoạt động giống như trong C hoặc C++." #: src/user-defined-types/named-structs.md msgid "Like in C++, and unlike in C, no typedef is needed to define a type." msgstr "" +"Giống như trong C++ và không giống như trong C, không cần typedef để xác " +"định một kiểu." #: src/user-defined-types/named-structs.md msgid "Unlike in C++, there is no inheritance between structs." -msgstr "" +msgstr "Không giống như C++, không có sự kế thừa giữa các cấu trúc." #: src/user-defined-types/named-structs.md msgid "" "This may be a good time to let people know there are different types of " "structs." msgstr "" +"Đây có thể là thời điểm tốt để cho mọi người biết có nhiều loại cấu trúc " +"khác nhau." #: src/user-defined-types/named-structs.md msgid "" @@ -4392,18 +4641,25 @@ msgid "" "trait on some type but don’t have any data that you want to store in the " "value itself." msgstr "" +"Các cấu trúc có kích thước bằng 0 (ví dụ: `struct Foo;`) có thể được sử dụng" +" khi triển khai một đặc điểm trên một số loại nhưng không có bất kỳ dữ liệu " +"nào mà bạn muốn lưu trữ trong chính giá trị đó." #: src/user-defined-types/named-structs.md msgid "" "The next slide will introduce Tuple structs, used when the field names are " "not important." msgstr "" +"Slide tiếp theo sẽ giới thiệu về cấu trúc Tuple, được sử dụng khi tên trường" +" không quan trọng." #: src/user-defined-types/named-structs.md msgid "" "If you already have variables with the right names, then you can create the " "struct using a shorthand." msgstr "" +"Nếu bạn đã có các biến có tên phù hợp thì bạn có thể tạo cấu trúc bằng cách " +"sử dụng tốc ký." #: src/user-defined-types/named-structs.md msgid "" @@ -4411,10 +4667,13 @@ msgid "" "old struct without having to explicitly type it all out. It must always be " "the last element." msgstr "" +"Cú pháp `..avery` cho phép chúng ta sao chép phần lớn các trường từ cấu trúc" +" cũ mà không cần phải gõ tất cả ra một cách rõ ràng. Nó phải luôn là phần tử" +" cuối cùng." #: src/user-defined-types/tuple-structs.md msgid "If the field names are unimportant, you can use a tuple struct:" -msgstr "" +msgstr "Nếu tên trường không quan trọng, bạn có thể sử dụng cấu trúc tuple:" #: src/user-defined-types/tuple-structs.md msgid "\"({}, {})\"" @@ -4423,10 +4682,12 @@ msgstr "" #: src/user-defined-types/tuple-structs.md msgid "This is often used for single-field wrappers (called newtypes):" msgstr "" +"Điều này thường được sử dụng cho các trình bao bọc một trường (được gọi là " +"newtypes):" #: src/user-defined-types/tuple-structs.md msgid "\"Ask a rocket scientist at NASA\"" -msgstr "" +msgstr "\"Hãy hỏi một nhà khoa học tên lửa tại NASA\"" #: src/user-defined-types/tuple-structs.md #: src/android/interoperability/cpp/cpp-bridge.md @@ -4437,73 +4698,88 @@ msgstr "" #: 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:" +"Newtypes are a great way to encode additional information about the value in" +" a primitive type, for example:" msgstr "" +"Newtypes là một cách tuyệt vời để mã hóa thông tin bổ sung về giá trị trong " +"kiểu nguyên thủy, ví dụ:" #: src/user-defined-types/tuple-structs.md msgid "The number is measured in some units: `Newtons` in the example above." -msgstr "" +msgstr "Con số được đo bằng một số đơn vị: `Newton` trong ví dụ trên." #: src/user-defined-types/tuple-structs.md 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)`." +"to validate it again at every use: `PhoneNumber(String)` or " +"`OddNumber(u32)`." msgstr "" +"Giá trị đã vượt qua một số xác thực khi nó được tạo, do đó bạn không còn " +"phải xác thực lại nó mỗi lần sử dụng: `PhoneNumber(String)` hoặc " +"`OddNumber(u32)`." #: src/user-defined-types/tuple-structs.md msgid "" "Demonstrate how to add a `f64` value to a `Newtons` type by accessing the " "single field in the newtype." msgstr "" +"Trình bày cách thêm giá trị `f64` vào loại `Newtons` bằng cách truy cập vào " +"một trường duy nhất trong loại mới." #: 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." msgstr "" +"Rust thường không thích những thứ không rõ ràng, như tự động mở gói hoặc ví " +"dụ như sử dụng booleans làm số nguyên." #: src/user-defined-types/tuple-structs.md msgid "Operator overloading is discussed on Day 3 (generics)." -msgstr "" +msgstr "Quá tải toán tử sẽ được thảo luận vào Ngày thứ 3 (thuốc gốc)." #: src/user-defined-types/tuple-structs.md msgid "" -"The example is a subtle reference to the [Mars Climate Orbiter](https://en." -"wikipedia.org/wiki/Mars_Climate_Orbiter) failure." +"The example is a subtle reference to the [Mars Climate " +"Orbiter](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter) failure." msgstr "" +"Ví dụ này là một tham chiếu tinh tế đến sự thất bại của [Mars Climate " +"Orbiter](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter)." #: src/user-defined-types/enums.md msgid "" "The `enum` keyword allows the creation of a type which has a few different " "variants:" -msgstr "" +msgstr "Từ khóa `enum` cho phép tạo một loại có một vài biến thể khác nhau:" #: src/user-defined-types/enums.md msgid "// Simple variant\n" -msgstr "" +msgstr "// Biến thể đơn giản\n" #: src/user-defined-types/enums.md msgid "// Tuple variant\n" -msgstr "" +msgstr "// Biến thể tuple\n" #: src/user-defined-types/enums.md msgid "// Struct variant\n" -msgstr "" +msgstr "// Biến thể cấu trúc\n" #: src/user-defined-types/enums.md msgid "\"On this turn: {:?}\"" -msgstr "" +msgstr "\"Ở lượt này: {:?}\"" #: src/user-defined-types/enums.md msgid "Enumerations allow you to collect a set of values under one type." msgstr "" +"Bảng liệt kê cho phép bạn thu thập một tập hợp các giá trị theo một loại." #: src/user-defined-types/enums.md msgid "" "`Direction` is a type with variants. There are two values of `Direction`: " "`Direction::Left` and `Direction::Right`." msgstr "" +"`Direction` là một loại có các biến thể. Có hai giá trị của `Direction`: " +"`Direction::Left` và `Direction::Right`." #: src/user-defined-types/enums.md msgid "" @@ -4511,16 +4787,22 @@ msgid "" "Rust will store a discriminant so that it knows at runtime which variant is " "in a `PlayerMove` value." msgstr "" +"`PlayerMove` là một loại có ba biến thể. Ngoài tải trọng, Rust sẽ lưu trữ " +"một giá trị phân biệt để nó biết trong thời gian chạy biến thể nào có giá " +"trị `PlayerMove`." #: src/user-defined-types/enums.md msgid "This might be a good time to compare structs and enums:" -msgstr "" +msgstr "Đây có thể là thời điểm tốt để so sánh cấu trúc và enum:" #: src/user-defined-types/enums.md msgid "" "In both, you can have a simple version without fields (unit struct) or one " "with different types of fields (variant payloads)." msgstr "" +"Trong cả hai, bạn có thể có một phiên bản đơn giản không có trường (cấu trúc" +" đơn vị) hoặc một phiên bản có các loại trường khác nhau (tải trọng biến " +"thể)." #: src/user-defined-types/enums.md msgid "" @@ -4528,14 +4810,17 @@ msgid "" "structs but then they wouldn’t be the same type as they would if they were " "all defined in an enum." msgstr "" +"Bạn thậm chí có thể triển khai các biến thể khác nhau của một enum với các " +"cấu trúc riêng biệt nhưng sau đó chúng sẽ không cùng loại nếu tất cả chúng " +"đều được xác định trong một enum." #: src/user-defined-types/enums.md msgid "Rust uses minimal space to store the discriminant." -msgstr "" +msgstr "Rust sử dụng không gian tối thiểu để lưu trữ phân biệt đối xử." #: src/user-defined-types/enums.md msgid "If necessary, it stores an integer of the smallest required size" -msgstr "" +msgstr "Nếu cần, nó lưu trữ một số nguyên có kích thước yêu cầu nhỏ nhất" #: src/user-defined-types/enums.md msgid "" @@ -4544,36 +4829,48 @@ msgid "" "optimization\"). For example, `Option<&u8>` stores either a pointer to an " "integer or `NULL` for the `None` variant." msgstr "" +"Nếu các giá trị biến thể được phép không bao gồm tất cả các mẫu bit, nó sẽ " +"sử dụng các mẫu bit không hợp lệ để mã hóa giá trị phân biệt (\"tối ưu hóa " +"thích hợp\"). Ví dụ: `Option<&u8>` lưu trữ một con trỏ tới một số nguyên " +"hoặc `NULL` cho biến thể `None`." #: src/user-defined-types/enums.md msgid "" "You can control the discriminant if needed (e.g., for compatibility with C):" msgstr "" +"Bạn có thể kiểm soát yếu tố phân biệt đối xử nếu cần (ví dụ: để tương thích " +"với C):" #: src/user-defined-types/enums.md msgid "" "Without `repr`, the discriminant type takes 2 bytes, because 10001 fits 2 " "bytes." msgstr "" +"Nếu không có `repr`, loại phân biệt sẽ mất 2 byte, vì 10001 vừa với 2 byte." #: src/user-defined-types/enums.md src/user-defined-types/static.md #: src/memory-management/review.md src/memory-management/move.md #: src/smart-pointers/box.md src/borrowing/shared.md msgid "More to Explore" -msgstr "" +msgstr "Thêm để khám phá" #: src/user-defined-types/enums.md msgid "" "Rust has several optimizations it can employ to make enums take up less " "space." msgstr "" +"Rust có một số cách tối ưu hóa mà nó có thể sử dụng để làm cho enum chiếm ít" +" không gian hơn." #: 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::>()`." +"Null pointer optimization: For [some types](https://doc.rust-" +"lang.org/std/option/#representation), Rust guarantees that `size_of::()` " +"equals `size_of::>()`." msgstr "" +"Tối ưu hóa con trỏ Null: Đối với [một số loại](https://doc.rust-" +"lang.org/std/option/#reprofessionalation), Rust đảm bảo rằng " +"`size_of::()` bằng `size_of::>()`." #: src/user-defined-types/enums.md msgid "" @@ -4581,109 +4878,147 @@ msgid "" "like in practice. It's important to note that the compiler provides no " "guarantees regarding this representation, therefore this is totally unsafe." msgstr "" +"Mã ví dụ nếu bạn muốn hiển thị cách biểu diễn bitwise _may_ trong thực tế. " +"Điều quan trọng cần lưu ý là compiler không cung cấp sự đảm bảo nào về cách " +"biểu diễn này, do đó điều này hoàn toàn không an toàn." #: src/user-defined-types/static.md msgid "`static`" -msgstr "" +msgstr "`tĩnh`" #: src/user-defined-types/static.md msgid "" "Static variables will live during the whole execution of the program, and " "therefore will not move:" msgstr "" +"Các biến tĩnh sẽ tồn tại trong toàn bộ quá trình thực thi chương trình và do" +" đó sẽ không di chuyển:" #: src/user-defined-types/static.md msgid "\"Welcome to RustOS 3.14\"" -msgstr "" +msgstr "\"Chào mừng đến với RustOS 3.14\"" #: src/user-defined-types/static.md msgid "\"{BANNER}\"" -msgstr "" +msgstr "\"{NGỌN CỜ}\"" #: src/user-defined-types/static.md 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 " +"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 "" +"Như đã lưu ý trong [Sách Rust RFC](https://rust-" +"lang.github.io/rfcs/0246-const-vs-static.html), những nội dung này không " +"được đưa vào nội tuyến khi sử dụng và có vị trí bộ nhớ liên kết thực tế. " +"Điều này hữu ích cho mã nhúng và mã không an toàn, đồng thời biến tồn tại " +"trong toàn bộ quá trình thực thi chương trình. Khi một giá trị có phạm vi " +"toàn cầu không có lý do cần nhận dạng đối tượng, `const` thường được ưu tiên" +" hơn." #: src/user-defined-types/static.md msgid "`static` is similar to mutable global variables in C++." -msgstr "" +msgstr "`static` tương tự như các biến toàn cục có thể thay đổi trong C++." #: src/user-defined-types/static.md msgid "" "`static` provides object identity: an address in memory and state as " "required by types with interior mutability such as `Mutex`." msgstr "" +"`static` cung cấp nhận dạng đối tượng: một địa chỉ trong bộ nhớ và trạng " +"thái theo yêu cầu của các loại có khả năng thay đổi bên trong, chẳng hạn như" +" `Mutex`." #: src/user-defined-types/static.md 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." +"`Sync`. Interior mutability is possible through a " +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html), atomic or " +"similar." msgstr "" +"Vì các biến `static` có thể truy cập được từ bất kỳ luồng nào nên chúng phải" +" là `Sync`. Khả năng biến đổi bên trong có thể thực hiện được thông qua " +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html), nguyên tử " +"hoặc tương tự." #: src/user-defined-types/static.md msgid "Thread-local data can be created with the macro `std::thread_local`." -msgstr "" +msgstr "Dữ liệu luồng cục bộ có thể được tạo bằng macro `std::thread_local`." #: src/user-defined-types/const.md msgid "`const`" -msgstr "" +msgstr "`const`" #: src/user-defined-types/const.md msgid "" "Constants are evaluated at compile time and their values are inlined " "wherever they are used:" msgstr "" +"Các hằng số được đánh giá tại thời điểm biên dịch và các giá trị của chúng " +"được nội tuyến ở bất cứ nơi nào chúng được sử dụng:" #: src/user-defined-types/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 "" +"Theo [Sách Rust RFC](https://rust-lang.github.io/rfcs/0246-const-vs-" +"static.html), những nội dung này được đưa vào nội dung khi sử dụng." #: src/user-defined-types/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." msgstr "" +"Chỉ các hàm được đánh dấu `const` mới có thể được gọi tại thời điểm biên " +"dịch để tạo ra các giá trị `const`. Tuy nhiên, các hàm `const` có thể được " +"gọi khi chạy." #: src/user-defined-types/const.md msgid "Mention that `const` behaves semantically similar to C++'s `constexpr`" msgstr "" +"Đề cập rằng `const` hoạt động tương tự về mặt ngữ nghĩa với `constexpr` của " +"C++" #: src/user-defined-types/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 "" +"Việc người ta cần một hằng số được đánh giá trong thời gian chạy không phải " +"là điều quá phổ biến, nhưng nó hữu ích và an toàn hơn so với việc sử dụng " +"hằng số tĩnh." #: src/user-defined-types/aliases.md msgid "" "A type alias creates a name for another type. The two types can be used " "interchangeably." msgstr "" +"Bí danh loại sẽ tạo tên cho loại khác. Hai loại có thể được sử dụng thay thế" +" cho nhau." #: src/user-defined-types/aliases.md msgid "// Aliases are more useful with long, complex types:\n" -msgstr "" +msgstr "// Bí danh hữu ích hơn với các kiểu dài và phức tạp:\n" #: src/user-defined-types/aliases.md msgid "C programmers will recognize this as similar to a `typedef`." -msgstr "" +msgstr "Các lập trình viên C sẽ nhận ra điều này tương tự như `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 " +"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 `{:?}`." msgstr "" +"Chúng ta sẽ tạo một cấu trúc dữ liệu để thể hiện một sự kiện trong hệ thống " +"điều khiển thang máy. Bạn có quyền xác định các loại và chức năng để xây " +"dựng các sự kiện khác nhau. Sử dụng `#[derive(Debug)]` để cho phép các loại " +"được định dạng bằng `{:?}`." #: src/user-defined-types/exercise.md msgid "" @@ -4691,97 +5026,100 @@ msgid "" "`main` runs without errors. The next part of the course will cover getting " "data out of these structures." msgstr "" +"Bài tập này chỉ yêu cầu tạo và điền cấu trúc dữ liệu để `main` chạy mà không" +" gặp lỗi. Phần tiếp theo của khóa học sẽ đề cập đến việc lấy dữ liệu ra khỏi" +" các cấu trúc này." #: 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" +msgid "/// An event in the elevator system that the controller must react to.\n" msgstr "" +"/// Một sự kiện trong hệ thống thang máy mà bộ điều khiển phải phản ứng.\n" #: src/user-defined-types/exercise.md msgid "// TODO: add required variants\n" -msgstr "" +msgstr "// VIỆC CẦN LÀM: thêm các biến thể cần thiết\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// A direction of travel.\n" -msgstr "" +msgstr "/// Một hướng di chuyển.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// The car has arrived on the given floor.\n" -msgstr "" +msgstr "/// Xe đã tới tầng nhất định.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// The car doors have opened.\n" -msgstr "" +msgstr "/// Cửa xe đã mở.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// The car doors have closed.\n" -msgstr "" +msgstr "/// Cửa xe đã đóng lại.\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" -msgstr "" +msgstr "/// Một nút định hướng được nhấn ở sảnh thang máy ở tầng nhất định.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "/// A floor button was pressed in the elevator car.\n" -msgstr "" +msgstr "/// Một nút bấm tầng được nhấn trong thang máy.\n" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"A ground floor passenger has pressed the up button: {:?}\"" -msgstr "" +msgstr "\"Một hành khách ở tầng trệt đã nhấn nút lên: {:?}\"" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"The car has arrived on the ground floor: {:?}\"" -msgstr "" +msgstr "\"Xe đã tới tầng trệt: {:?}\"" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"The car door opened: {:?}\"" -msgstr "" +msgstr "\"Cửa xe mở ra: {:?}\"" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"A passenger has pressed the 3rd floor button: {:?}\"" -msgstr "" +msgstr "\"Một hành khách đã nhấn nút tầng 3: {:?}\"" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"The car door closed: {:?}\"" -msgstr "" +msgstr "\"Cửa xe đóng lại: {:?}\"" #: src/user-defined-types/exercise.md src/user-defined-types/solution.md msgid "\"The car has arrived on the 3rd floor: {:?}\"" -msgstr "" +msgstr "\"Xe đã tới tầng 3: {:?}\"" #: src/user-defined-types/solution.md msgid "/// A button was pressed.\n" -msgstr "" +msgstr "/// Một nút được nhấn.\n" #: src/user-defined-types/solution.md msgid "/// The car has arrived at the given floor.\n" -msgstr "" +msgstr "/// Xe đã tới tầng nhất định.\n" #: src/user-defined-types/solution.md msgid "/// The car's doors have opened.\n" -msgstr "" +msgstr "/// Cửa xe đã mở.\n" #: src/user-defined-types/solution.md msgid "/// The car's doors have closed.\n" -msgstr "" +msgstr "/// Cửa xe đã đóng lại.\n" #: src/user-defined-types/solution.md msgid "/// A floor is represented as an integer.\n" -msgstr "" +msgstr "/// Một tầng được biểu diễn dưới dạng số nguyên.\n" #: src/user-defined-types/solution.md msgid "/// A user-accessible button.\n" -msgstr "" +msgstr "/// Một nút mà người dùng có thể truy cập.\n" #: src/user-defined-types/solution.md msgid "/// A button in the elevator lobby on the given floor.\n" -msgstr "" +msgstr "/// Một nút ở sảnh thang máy ở tầng nhất định.\n" #: src/user-defined-types/solution.md msgid "/// A floor button within the car.\n" -msgstr "" +msgstr "/// Nút bấm sàn trong xe.\n" #: src/welcome-day-2.md msgid "Welcome to Day 2" @@ -4789,8 +5127,8 @@ msgstr "Chào mừng tới Ngày 2" #: src/welcome-day-2.md msgid "" -"Now that we have seen a fair amount of Rust, today will focus on Rust's type " -"system:" +"Now that we have seen a fair amount of Rust, today will focus on Rust's type" +" system:" msgstr "" "Chúng ta đã có kiến thức tổng quan về Rust, hôm nay sẽ tập trung vào hệ " "thống kiểu trong Rust:" @@ -4835,66 +5173,71 @@ 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." msgstr "" +"Từ khóa `match` cho phép bạn so khớp một giá trị với một hoặc nhiều " +"_patterns_. Việc so sánh được thực hiện từ trên xuống dưới và trận đầu tiên " +"sẽ thắng." #: src/pattern-matching/match.md msgid "The patterns can be simple values, similarly to `switch` in C and C++:" msgstr "" +"Các mẫu có thể là các giá trị đơn giản, tương tự như `switch` trong C và " +"C++:" #: src/pattern-matching/match.md msgid "'x'" -msgstr "" +msgstr "'x'" #: src/pattern-matching/match.md msgid "'q'" -msgstr "" +msgstr "'q'" #: src/pattern-matching/match.md msgid "\"Quitting\"" -msgstr "" +msgstr "\"Bỏ cuộc\"" #: src/pattern-matching/match.md src/generics/exercise.md #: src/generics/solution.md src/std-traits/solution.md #: src/error-handling/exercise.md src/error-handling/solution.md msgid "'a'" -msgstr "" +msgstr "'Một'" #: src/pattern-matching/match.md msgid "'s'" -msgstr "" +msgstr "'S'" #: src/pattern-matching/match.md msgid "'w'" -msgstr "" +msgstr "'w'" #: src/pattern-matching/match.md msgid "'d'" -msgstr "" +msgstr "'d'" #: src/pattern-matching/match.md msgid "\"Moving around\"" -msgstr "" +msgstr "\"Di chuyển xung quanh\"" #: src/pattern-matching/match.md src/error-handling/exercise.md #: src/error-handling/solution.md msgid "'0'" -msgstr "" +msgstr "'0'" #: src/pattern-matching/match.md src/error-handling/exercise.md #: src/error-handling/solution.md msgid "'9'" -msgstr "" +msgstr "'9'" #: src/pattern-matching/match.md msgid "\"Number input\"" -msgstr "" +msgstr "\"Nhập số\"" #: src/pattern-matching/match.md msgid "\"Lowercase: {key}\"" -msgstr "" +msgstr "\"Chữ thường: {key}\"" #: src/pattern-matching/match.md msgid "\"Something else\"" -msgstr "" +msgstr "\"Cái gì khác\"" #: src/pattern-matching/match.md msgid "" @@ -4902,45 +5245,54 @@ msgid "" "expressions _must_ be exhaustive, meaning that it covers every possibility, " "so `_` is often used as the final catch-all case." msgstr "" +"Mẫu `_` là mẫu ký tự đại diện khớp với bất kỳ giá trị nào. Các biểu thức " +"_phải_ đầy đủ, nghĩa là nó bao gồm mọi khả năng, vì vậy `_` thường được sử " +"dụng làm trường hợp chung cuối cùng." #: src/pattern-matching/match.md msgid "" -"Match can be used as an expression. Just like `if`, each match arm must have " -"the same type. The type is the last expression of the block, if any. In the " -"example above, the type is `()`." +"Match can be used as an expression. Just like `if`, each match arm must have" +" the same type. The type is the last expression of the block, if any. In the" +" example above, the type is `()`." msgstr "" +"Trận đấu có thể được sử dụng như một biểu thức. Cũng giống như `if`, mỗi " +"nhánh khớp phải có cùng loại. Loại này là biểu thức cuối cùng của khối, nếu " +"có. Trong ví dụ trên, loại là `()`." #: src/pattern-matching/match.md msgid "" -"A variable in the pattern (`key` in this example) will create a binding that " -"can be used within the match arm." +"A variable in the pattern (`key` in this example) will create a binding that" +" can be used within the match arm." msgstr "" +"Một biến trong mẫu (`key` trong ví dụ này) sẽ tạo ra một liên kết có thể " +"được sử dụng trong nhánh khớp." #: src/pattern-matching/match.md msgid "A match guard causes the arm to match only if the condition is true." -msgstr "" +msgstr "Người bảo vệ trận đấu chỉ khiến cánh tay khớp nếu điều kiện là đúng." #: src/pattern-matching/match.md msgid "" "You might point out how some specific characters are being used when in a " "pattern" msgstr "" +"Bạn có thể chỉ ra cách sử dụng một số ký tự cụ thể khi ở trong một mẫu" #: src/pattern-matching/match.md msgid "`|` as an `or`" -msgstr "" +msgstr "`|` dưới dạng `hoặc`" #: src/pattern-matching/match.md msgid "`..` can expand as much as it needs to be" -msgstr "" +msgstr "`..` có thể mở rộng đến mức cần thiết" #: src/pattern-matching/match.md msgid "`1..=5` represents an inclusive range" -msgstr "" +msgstr "`1..=5` đại diện cho một phạm vi bao gồm" #: src/pattern-matching/match.md msgid "`_` is a wild card" -msgstr "" +msgstr "`_` là một ký tự đại diện" #: src/pattern-matching/match.md msgid "" @@ -4948,48 +5300,61 @@ msgid "" "we wish to concisely express more complex ideas than patterns alone would " "allow." msgstr "" +"Những người bảo vệ so khớp như một tính năng cú pháp riêng biệt rất quan " +"trọng và cần thiết khi chúng ta muốn diễn đạt chính xác những ý tưởng phức " +"tạp hơn mức mà chỉ riêng các mẫu có thể cho phép." #: 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." +"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 "" +"Chúng không giống như biểu thức `if` riêng biệt bên trong nhánh khớp. Một " +"biểu thức `if` bên trong khối nhánh (sau `=>`) xảy ra sau khi nhánh khớp " +"được chọn. Việc không thực hiện được điều kiện `if` bên trong khối đó sẽ " +"không dẫn đến việc xem xét các nhánh khác của biểu thức `match` ban đầu." #: src/pattern-matching/match.md msgid "" "The condition defined in the guard applies to every expression in a pattern " "with an `|`." msgstr "" +"Điều kiện được xác định trong bộ bảo vệ áp dụng cho mọi biểu thức trong mẫu " +"có `|`." #: src/pattern-matching/destructuring-structs.md msgid "Structs" -msgstr "" +msgstr "Cấu trúc" #: src/pattern-matching/destructuring-structs.md msgid "Like tuples, Struct can also be destructured by matching:" msgstr "" +"Giống như các bộ dữ liệu, Struct cũng có thể được hủy cấu trúc bằng cách so " +"khớp:" #: src/pattern-matching/destructuring-structs.md msgid "\"x.0 = 1, b = {b}, y = {y}\"" -msgstr "" +msgstr "\"x.0 = 1, b = {b}, y = {y}\"" #: src/pattern-matching/destructuring-structs.md msgid "\"y = 2, x = {i:?}\"" -msgstr "" +msgstr "\"y = 2, x = {i:?}\"" #: src/pattern-matching/destructuring-structs.md msgid "\"y = {y}, other fields were ignored\"" -msgstr "" +msgstr "\"y = {y}, các trường khác bị bỏ qua\"" #: src/pattern-matching/destructuring-structs.md msgid "Change the literal values in `foo` to match with the other patterns." -msgstr "" +msgstr "Thay đổi giá trị bằng chữ trong `foo` để khớp với các mẫu khác." #: src/pattern-matching/destructuring-structs.md msgid "Add a new field to `Foo` and make changes to the pattern as needed." msgstr "" +"Thêm trường mới vào `Foo` và thực hiện các thay đổi đối với mẫu nếu cần." #: src/pattern-matching/destructuring-structs.md msgid "" @@ -4997,172 +5362,223 @@ 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 "" +"Có thể khó nhận ra sự khác biệt giữa biểu thức chụp và biểu thức không đổi. " +"Hãy thử thay đổi `2` ở nhánh thứ hai thành một biến và thấy rằng nó không " +"hoạt động. Thay đổi nó thành `const` và xem nó hoạt động trở lại." #: src/pattern-matching/destructuring-enums.md msgid "Like tuples, enums can also be destructured by matching:" msgstr "" +"Giống như bộ dữ liệu, enum cũng có thể được hủy cấu trúc bằng cách so khớp:" #: src/pattern-matching/destructuring-enums.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 " +"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:" msgstr "" +"Các mẫu cũng có thể được sử dụng để liên kết các biến với các phần giá trị " +"của bạn. Đây là cách bạn kiểm tra cấu trúc của các loại của bạn. Chúng ta " +"hãy bắt đầu với một kiểu `enum` đơn giản:" #: src/pattern-matching/destructuring-enums.md msgid "\"cannot divide {n} into two equal parts\"" -msgstr "" +msgstr "\"không thể chia {n} thành hai phần bằng nhau\"" #: src/pattern-matching/destructuring-enums.md msgid "\"{n} divided in two is {half}\"" -msgstr "" +msgstr "\"{n} chia làm hai là {nửa}\"" #: src/pattern-matching/destructuring-enums.md msgid "\"sorry, an error happened: {msg}\"" -msgstr "" +msgstr "\"xin lỗi, đã xảy ra lỗi: {msg}\"" #: src/pattern-matching/destructuring-enums.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 " +"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." msgstr "" +"Ở đây chúng ta đã sử dụng các cánh tay để _destructure_ giá trị `Result`. " +"Trong nhánh đầu tiên, `half` được liên kết với giá trị bên trong biến thể " +"`Ok`. Trong nhánh thứ hai, `msg` được liên kết với thông báo lỗi." #: src/pattern-matching/destructuring-enums.md msgid "" "The `if`/`else` expression is returning an enum that is later unpacked with " "a `match`." msgstr "" +"Biểu thức `if`/`else` đang trả về một enum mà sau đó được giải nén bằng " +"`match`." #: src/pattern-matching/destructuring-enums.md msgid "" -"You can try adding a third variant to the enum definition and displaying the " -"errors when running the code. Point out the places where your code is now " +"You can try adding a third variant to the enum definition and displaying the" +" 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 "" +"Bạn có thể thử thêm biến thể thứ ba vào định nghĩa enum và hiển thị lỗi khi " +"chạy mã. Chỉ ra những chỗ mà mã của bạn hiện chưa đầy đủ và cách trình biên " +"dịch cố gắng đưa ra gợi ý cho bạn." #: src/pattern-matching/destructuring-enums.md msgid "" "The values in the enum variants can only be accessed after being pattern " "matched." msgstr "" +"Các giá trị trong các biến thể enum chỉ có thể được truy cập sau khi khớp " +"mẫu." #: src/pattern-matching/destructuring-enums.md msgid "" -"Demonstrate what happens when the search is inexhaustive. Note the advantage " -"the Rust compiler provides by confirming when all cases are handled." +"Demonstrate what happens when the search is inexhaustive. Note the advantage" +" the Rust compiler provides by confirming when all cases are handled." msgstr "" +"Chứng minh điều gì sẽ xảy ra khi việc tìm kiếm không đầy đủ. Lưu ý lợi thế " +"mà compiler Rust mang lại bằng cách xác nhận khi tất cả các trường hợp được " +"xử lý." #: src/pattern-matching/destructuring-enums.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." -msgstr "" +"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 "" +"Lưu kết quả của `divide_in_two` vào biến `result` và `match` nó trong một " +"vòng lặp. Điều đó sẽ không được biên dịch vì `msg` được sử dụng khi khớp. Để" +" khắc phục, hãy khớp `&result` thay vì `result`. Điều đó sẽ làm cho `msg` " +"trở thành một tham chiếu nên nó sẽ không bị sử dụng. [\"match " +"Ergonomics\"](https://rust-lang.github.io/rfcs/2005-match-ergonomics.html) " +"này đã xuất hiện trong Rust 2018. Nếu bạn muốn hỗ trợ Rust cũ hơn, hãy thay " +"thế `msg` bằng `ref msg` trong mẫu." #: 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:" msgstr "" +"Rust có một số cấu trúc luồng điều khiển khác với các ngôn ngữ khác. Chúng " +"được sử dụng để khớp mẫu:" #: src/pattern-matching/let-control-flow.md msgid "`if let` expressions" -msgstr "" +msgstr "biểu thức `if let`" #: src/pattern-matching/let-control-flow.md msgid "`while let` expressions" -msgstr "" +msgstr "biểu thức `while let`" #: src/pattern-matching/let-control-flow.md msgid "`match` expressions" -msgstr "" +msgstr "biểu thức `match`" #: src/pattern-matching/let-control-flow.md msgid "" -"The [`if let` expression](https://doc.rust-lang.org/reference/expressions/if-" -"expr.html#if-let-expressions) lets you execute different code depending on " -"whether a value matches a pattern:" +"The [`if let` expression](https://doc.rust-" +"lang.org/reference/expressions/if-expr.html#if-let-expressions) lets you " +"execute different code depending on whether a value matches a pattern:" msgstr "" +"Biểu thức [`if let`](https://doc.rust-lang.org/reference/expresss/if-" +"expr.html#if-let-expresss) cho phép bạn thực thi các mã khác nhau tùy thuộc " +"vào việc một giá trị có khớp với một mẫu hay không:" #: src/pattern-matching/let-control-flow.md msgid "\"slept for {:?}\"" -msgstr "" +msgstr "\"ngủ trong {:?}\"" #: src/pattern-matching/let-control-flow.md msgid "`let else` expressions" -msgstr "" +msgstr "biểu thức `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)." +"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 "" +"Đối với trường hợp phổ biến là khớp một mẫu và trả về từ hàm, hãy sử dụng " +"[`let else`](https://doc.rust-lang.org/rust-by-" +"example/flow_control/let_else.html). Trường hợp \"khác\" phải phân kỳ " +"(`return`, `break` hoặc hoảng loạn - bất cứ điều gì ngoại trừ việc rơi ra " +"khỏi cuối khối)." #: src/pattern-matching/let-control-flow.md msgid "\"got None\"" -msgstr "" +msgstr "\"none\"" #: src/pattern-matching/let-control-flow.md msgid "\"got empty string\"" -msgstr "" +msgstr "\"có chuỗi trống\"" #: src/pattern-matching/let-control-flow.md msgid "\"not a hex digit\"" -msgstr "" +msgstr "\"không phải chữ số hex\"" #: src/pattern-matching/let-control-flow.md src/pattern-matching/solution.md msgid "\"result: {:?}\"" -msgstr "" +msgstr "\"kết quả: {:?}\"" #: 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 msgid "\"foo\"" -msgstr "" +msgstr "\"foo\"" #: src/pattern-matching/let-control-flow.md msgid "" -"Like with `if let`, there is a [`while let`](https://doc.rust-lang.org/" -"reference/expressions/loop-expr.html#predicate-pattern-loops) variant which " -"repeatedly tests a value against a pattern:" +"Like with `if let`, there is a [`while let`](https://doc.rust-" +"lang.org/reference/expressions/loop-expr.html#predicate-pattern-loops) " +"variant which repeatedly tests a value against a pattern:" msgstr "" +"Giống như `if let`, có một biến thể [`while let`](https://doc.rust-" +"lang.org/reference/expresss/loop-expr.html#predicate-pattern-loops) liên tục" +" kiểm tra một giá trị theo một mẫu:" #: src/pattern-matching/let-control-flow.md 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 "" +"Ở đây [`String::pop`](https://doc.rust-" +"lang.org/stable/std/string/struct.String.html#method.pop) trả về `Some(c)` " +"cho đến khi chuỗi trống, sau đó nó sẽ trả về `None`. `while let` cho phép " +"chúng ta tiếp tục lặp qua tất cả các mục." #: src/pattern-matching/let-control-flow.md msgid "if-let" -msgstr "" +msgstr "nếu-cho phép" #: src/pattern-matching/let-control-flow.md msgid "" "Unlike `match`, `if let` does not have to cover all branches. This can make " "it more concise than `match`." msgstr "" +"Không giống như `match`, `if let` không nhất thiết phải bao gồm tất cả các " +"nhánh. Điều này có thể làm cho nó ngắn gọn hơn `match`." #: src/pattern-matching/let-control-flow.md msgid "A common usage is handling `Some` values when working with `Option`." msgstr "" +"Cách sử dụng phổ biến là xử lý các giá trị `Some` khi làm việc với `Option`." #: src/pattern-matching/let-control-flow.md msgid "" -"Unlike `match`, `if let` does not support guard clauses for pattern matching." +"Unlike `match`, `if let` does not support guard clauses for pattern " +"matching." msgstr "" +"Không giống như `match`, `if let` không hỗ trợ các mệnh đề bảo vệ để khớp " +"mẫu." #: src/pattern-matching/let-control-flow.md msgid "let-else" -msgstr "" +msgstr "đừng làm gì khác" #: src/pattern-matching/let-control-flow.md msgid "" @@ -5170,48 +5586,64 @@ msgid "" "flattening this nested code. Rewrite the awkward version for students, so " "they can see the transformation." msgstr "" +"`if-let` có thể chồng lên nhau, như được hiển thị. Cấu trúc `let-else` hỗ " +"trợ làm phẳng mã lồng nhau này. Viết lại phiên bản vụng về cho học sinh để " +"các em thấy được sự biến đổi." #: src/pattern-matching/let-control-flow.md msgid "The rewritten version is:" -msgstr "" +msgstr "Phiên bản viết lại là:" #: src/pattern-matching/let-control-flow.md msgid "while-let" -msgstr "" +msgstr "trong khi-cho phép" #: src/pattern-matching/let-control-flow.md msgid "" "Point out that the `while let` loop will keep going as long as the value " "matches the pattern." msgstr "" +"Chỉ ra rằng vòng lặp `while let` sẽ tiếp tục miễn là giá trị khớp với mẫu." #: src/pattern-matching/let-control-flow.md 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." +"statement that breaks when there is no value to unwrap for `name.pop()`. The" +" `while let` provides syntactic sugar for the above scenario." msgstr "" +"Bạn có thể viết lại vòng lặp `while let` dưới dạng vòng lặp vô hạn với câu " +"lệnh if bị ngắt khi không có giá trị nào để mở khóa cho `name.pop()`. `while" +" let` cung cấp cú pháp cho tình huống trên." #: src/pattern-matching/exercise.md msgid "Let's write a simple recursive evaluator for arithmetic expressions." -msgstr "" +msgstr "Hãy viết một trình đánh giá đệ quy đơn giản cho các biểu thức số học." #: 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 " -"tests. To evaluate a boxed expression, use the deref operator (`*`) to " +"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 "" +"Kiểu `Box` ở đây là một con trỏ thông minh và sẽ được đề cập chi tiết ở phần" +" sau của khóa học. Một biểu thức có thể được \"đóng hộp\" bằng `Box::new` " +"như đã thấy trong các thử nghiệm. Để đánh giá một biểu thức được đóng hộp, " +"hãy sử dụng toán tử deref (`*`) để \"bỏ hộp\" nó: `eval(*boxed_expr)`." #: src/pattern-matching/exercise.md 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." +"[`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." msgstr "" +"Một số biểu thức không thể đánh giá được và sẽ trả về lỗi. Loại " +"[`Result`](https://doc.rust-" +"lang.org/std/result/enum.Result.html) tiêu chuẩn là một enum đại diện cho " +"giá trị thành công (`Ok(Value)`) hoặc lỗi (`Err(String)`). Chúng tôi sẽ đề " +"cập chi tiết về loại này sau." #: src/pattern-matching/exercise.md msgid "" @@ -5220,124 +5652,151 @@ msgid "" "`todo!()` and get the tests to pass one-by-one. You can also skip a test " "temporarily with `#[ignore]`:" msgstr "" +"Sao chép và dán mã vào sân chơi Rust và bắt đầu triển khai `eval`. Sản phẩm " +"cuối cùng phải vượt qua các bài kiểm tra. Có thể hữu ích khi sử dụng " +"`todo!()` và khiến các bài kiểm tra lần lượt vượt qua. Bạn cũng có thể tạm " +"thời bỏ qua bài kiểm tra bằng `#[bỏ qua]`:" #: src/pattern-matching/exercise.md msgid "" "If you finish early, try writing a test that results in division by zero or " -"integer overflow. How could you handle this with `Result` instead of a panic?" +"integer overflow. How could you handle this with `Result` instead of a " +"panic?" msgstr "" +"Nếu bạn hoàn thành sớm, hãy thử viết một bài kiểm tra cho kết quả là chia " +"cho 0 hoặc tràn số nguyên. Làm thế nào bạn có thể giải quyết vấn đề này bằng" +" `Result` thay vì hoảng sợ?" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "/// An operation to perform on two subexpressions.\n" -msgstr "" +msgstr "/// Một thao tác thực hiện trên hai biểu thức con.\n" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "/// An expression, in tree form.\n" -msgstr "" +msgstr "/// Một biểu thức ở dạng cây.\n" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "/// An operation on two subexpressions.\n" -msgstr "" +msgstr "/// Một thao tác trên hai biểu thức con.\n" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "/// A literal value\n" -msgstr "" +msgstr "/// Một giá trị bằng chữ\n" #: src/pattern-matching/exercise.md src/pattern-matching/solution.md msgid "\"division by zero\"" -msgstr "" +msgstr "\"chia cho số 0\"" #: src/pattern-matching/solution.md msgid "\"expr: {:?}\"" -msgstr "" +msgstr "\"expr: {:?}\"" #: src/methods-and-traits/methods.md msgid "" -"Rust allows you to associate functions with your new types. You do this with " -"an `impl` block:" +"Rust allows you to associate functions with your new types. You do this with" +" an `impl` block:" msgstr "" +"Rust cho phép bạn liên kết các hàm với các kiểu mới của mình. Bạn thực hiện " +"việc này với khối `impl`:" #: src/methods-and-traits/methods.md msgid "// No receiver, a static method\n" -msgstr "" +msgstr "// Không có bộ thu, một phương thức tĩnh\n" #: src/methods-and-traits/methods.md msgid "// Exclusive borrowed read-write access to self\n" -msgstr "" +msgstr "// Quyền truy cập đọc-ghi được mượn độc quyền cho bản thân\n" #: src/methods-and-traits/methods.md msgid "// Shared and read-only borrowed access to self\n" -msgstr "" +msgstr "// Quyền truy cập được chia sẻ và chỉ đọc vào bản thân\n" #: src/methods-and-traits/methods.md msgid "\"Recorded {} laps for {}:\"" -msgstr "" +msgstr "\"Đã ghi lại {} vòng trong {}:\"" #: src/methods-and-traits/methods.md msgid "\"Lap {idx}: {lap} sec\"" -msgstr "" +msgstr "\"Vòng {idx}: {vòng} giây\"" #: src/methods-and-traits/methods.md msgid "// Exclusive ownership of self\n" -msgstr "" +msgstr "// Quyền sở hữu độc quyền của bản thân\n" #: src/methods-and-traits/methods.md msgid "\"Race {} is finished, total lap time: {}\"" -msgstr "" +msgstr "\"Cuộc đua {} đã kết thúc, tổng thời gian vòng đua: {}\"" #: src/methods-and-traits/methods.md msgid "\"Monaco Grand Prix\"" -msgstr "" +msgstr "\"Giải thưởng lớn Monaco\"" #: src/methods-and-traits/methods.md msgid "// race.add_lap(42);\n" -msgstr "" +msgstr "// race.add_lap(42);\n" #: src/methods-and-traits/methods.md msgid "" "The `self` arguments specify the \"receiver\" - the object the method acts " "on. There are several common receivers for a method:" msgstr "" +"Các đối số `self` chỉ định \"người nhận\" - đối tượng mà phương thức tác " +"động. Có một số bộ thu phổ biến cho một phương thức:" #: src/methods-and-traits/methods.md msgid "" "`&self`: borrows the object from the caller using a shared and immutable " "reference. The object can be used again afterwards." msgstr "" +"`&self`: mượn đối tượng từ người gọi bằng cách sử dụng một tham chiếu được " +"chia sẻ và không thể thay đổi. Đối tượng có thể được sử dụng lại sau đó." #: src/methods-and-traits/methods.md msgid "" "`&mut self`: borrows the object from the caller using a unique and mutable " "reference. The object can be used again afterwards." msgstr "" +"`&mut self`: mượn đối tượng từ người gọi bằng cách sử dụng một tham chiếu " +"duy nhất và có thể thay đổi. Đối tượng có thể được sử dụng lại sau đó." #: src/methods-and-traits/methods.md msgid "" -"`self`: takes ownership of the object and moves it away from the caller. The " -"method becomes the owner of the object. The object will be dropped " +"`self`: takes ownership of the object and moves it away from the caller. The" +" method becomes the owner of the object. The object will be dropped " "(deallocated) when the method returns, unless its ownership is explicitly " "transmitted. Complete ownership does not automatically mean mutability." msgstr "" +"`self`: sở hữu đối tượng và di chuyển nó ra khỏi người gọi. Phương thức trở " +"thành chủ sở hữu của đối tượng. Đối tượng sẽ bị loại bỏ (hủy phân bổ) khi " +"phương thức trả về, trừ khi quyền sở hữu của nó được truyền đi một cách rõ " +"ràng. Quyền sở hữu hoàn toàn không tự động có nghĩa là có thể thay đổi." #: src/methods-and-traits/methods.md msgid "`mut self`: same as above, but the method can mutate the object." msgstr "" +"`mut self`: tương tự như trên, nhưng phương thức có thể thay đổi đối tượng." #: src/methods-and-traits/methods.md msgid "" "No receiver: this becomes a static method on the struct. Typically used to " "create constructors which are called `new` by convention." msgstr "" +"Không có bộ thu: đây trở thành một phương thức tĩnh trên cấu trúc. Thường " +"được sử dụng để tạo các hàm tạo được gọi là `mới` theo quy ước." #: src/methods-and-traits/methods.md msgid "It can be helpful to introduce methods by comparing them to functions." msgstr "" +"Có thể hữu ích khi giới thiệu các phương thức bằng cách so sánh chúng với " +"các hàm." #: src/methods-and-traits/methods.md 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 "" +"Các phương thức được gọi trên một thể hiện của một loại (chẳng hạn như " +"struct hoặc enum), tham số đầu tiên biểu thị thể hiện đó là `self`." #: src/methods-and-traits/methods.md msgid "" @@ -5345,86 +5804,110 @@ msgid "" "syntax and to help keep them more organized. By using methods we can keep " "all the implementation code in one predictable place." msgstr "" +"Các nhà phát triển có thể chọn sử dụng các phương thức để tận dụng cú pháp " +"của bộ nhận phương thức và giúp chúng ngăn nắp hơn. Bằng cách sử dụng các " +"phương thức, chúng ta có thể giữ tất cả mã triển khai ở một nơi có thể dự " +"đoán được." #: src/methods-and-traits/methods.md msgid "Point out the use of the keyword `self`, a method receiver." -msgstr "" +msgstr "Hãy chỉ ra công dụng của từ khóa `self`, một người nhận phương thức." #: 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." msgstr "" +"Chứng tỏ rằng đó là một thuật ngữ viết tắt cho `self: Self` và có lẽ cho " +"thấy tên cấu trúc cũng có thể được sử dụng như thế nào." #: 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." msgstr "" +"Giải thích rằng `Self` là bí danh loại cho loại của khối `impl` và có thể " +"được sử dụng ở nơi khác trong khối." #: src/methods-and-traits/methods.md msgid "" "Note how `self` is used like other structs and dot notation can be used to " "refer to individual fields." msgstr "" +"Lưu ý cách `self` được sử dụng giống như các cấu trúc khác và ký hiệu dấu " +"chấm có thể được sử dụng để chỉ các trường riêng lẻ." #: src/methods-and-traits/methods.md 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 "" +"Đây có thể là thời điểm tốt để chứng minh `&self` khác với `self` như thế " +"nào bằng cách cố gắng chạy `finish` hai lần." #: 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 "" +"Ngoài các biến thể của `self`, còn có [các loại trình bao bọc đặc " +"biệt](https://doc.rust-lang.org/reference/special-types-and-traits.html) " +"được phép làm loại bộ thu, chẳng hạn như `Box`." #: src/methods-and-traits/traits.md msgid "" -"Rust lets you abstract over types with traits. They're similar to interfaces:" +"Rust lets you abstract over types with traits. They're similar to " +"interfaces:" msgstr "" +"Rust cho phép bạn trừu tượng hóa các loại có đặc điểm. Chúng tương tự như " +"giao diện:" #: src/methods-and-traits/traits.md msgid "/// Return a sentence from this pet.\n" -msgstr "" +msgstr "/// Trả lại một câu từ thú cưng này.\n" #: src/methods-and-traits/traits.md msgid "/// Print a string to the terminal greeting this pet.\n" -msgstr "" +msgstr "/// In một chuỗi ra terminal chào thú cưng này.\n" #: src/methods-and-traits/traits.md msgid "" "A trait defines a number of methods that types must have in order to " "implement the trait." msgstr "" +"Một đặc điểm xác định một số phương thức mà các kiểu phải có để triển khai " +"đặc điểm đó." #: 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." msgstr "" +"Trong phần \"Chung\", tiếp theo, chúng ta sẽ xem cách xây dựng chức năng " +"chung cho tất cả các loại triển khai một đặc điểm." #: src/methods-and-traits/traits/implementing.md msgid "\"Oh you're a cutie! What's your name? {}\"" -msgstr "" +msgstr "\"Ôi bạn thật dễ thương! Tên bạn là gì? {}\"" #: src/methods-and-traits/traits/implementing.md #: src/smart-pointers/trait-objects.md msgid "\"Woof, my name is {}!\"" -msgstr "" +msgstr "\"Wow, tên tôi là {}!\"" #: src/methods-and-traits/traits/implementing.md #: src/smart-pointers/trait-objects.md msgid "\"Fido\"" -msgstr "" +msgstr "\"Fido\"" #: src/methods-and-traits/traits/implementing.md msgid "" "To implement `Trait` for `Type`, you use an `impl Trait for Type { .. }` " "block." msgstr "" +"Để triển khai `Trait` cho `Type`, bạn sử dụng khối `impl Trait for Type { .." +" }`." #: src/methods-and-traits/traits/implementing.md msgid "" @@ -5432,6 +5915,9 @@ msgid "" "type with a `talk()` method would not automatically satisfy `Pet` unless it " "is in an `impl Pet` block." msgstr "" +"Không giống như giao diện Go, chỉ có các phương thức khớp là chưa đủ: loại " +"`Cat` có phương thức `talk()` sẽ không tự động đáp ứng `Pet` trừ khi nó nằm " +"trong khối `impl Pet`." #: src/methods-and-traits/traits/implementing.md msgid "" @@ -5439,6 +5925,10 @@ msgid "" "implementations can rely on all the methods of the trait. In this case, " "`greet` is provided, and relies on `talk`." msgstr "" +"Các đặc điểm có thể cung cấp cách triển khai mặc định của một số phương " +"pháp. Việc triển khai mặc định có thể dựa vào tất cả các phương pháp của đặc" +" điểm. Trong trường hợp này, `lời chào` được cung cấp và dựa vào `nói " +"chuyện`." #: src/methods-and-traits/traits/supertraits.md msgid "" @@ -5446,15 +5936,18 @@ msgid "" "called _supertraits_. Here, any type implementing `Pet` must implement " "`Animal`." msgstr "" +"Một đặc điểm có thể yêu cầu các kiểu triển khai nó cũng triển khai các đặc " +"điểm khác, được gọi là _supertraits_. Ở đây, bất kỳ loại triển khai `Pet` " +"nào cũng phải triển khai `Animal`." #: src/methods-and-traits/traits/supertraits.md #: src/concurrency/async-control-flow/select.md msgid "\"Rex\"" -msgstr "" +msgstr "\"Rex\"" #: src/methods-and-traits/traits/supertraits.md msgid "\"{} has {} legs\"" -msgstr "" +msgstr "\"{} có {} chân\"" #: src/methods-and-traits/traits/supertraits.md msgid "" @@ -5462,12 +5955,17 @@ msgid "" "expect this to behave like OO inheritance. It just specifies an additional " "requirement on implementations of a trait." msgstr "" +"Điều này đôi khi được gọi là \"kế thừa đặc điểm\" nhưng học viên không nên " +"mong đợi điều này hoạt động giống như kế thừa OO. Nó chỉ xác định một yêu " +"cầu bổ sung về việc triển khai một đặc điểm." #: src/methods-and-traits/traits/associated-types.md msgid "" "Associated types are placeholder types which are supplied by the trait " "implementation." msgstr "" +"Các loại liên kết là các loại giữ chỗ được cung cấp bởi việc triển khai đặc " +"điểm." #: src/methods-and-traits/traits/associated-types.md #: src/concurrency/async-control-flow/join.md @@ -5479,49 +5977,59 @@ msgid "" "Associated types are sometimes also called \"output types\". The key " "observation is that the implementer, not the caller, chooses this type." msgstr "" +"Các loại liên kết đôi khi còn được gọi là \"loại đầu ra\". Quan sát quan " +"trọng là người triển khai chứ không phải người gọi chọn loại này." #: src/methods-and-traits/traits/associated-types.md msgid "" "Many standard library traits have associated types, including arithmetic " "operators and `Iterator`." msgstr "" +"Nhiều đặc điểm thư viện tiêu chuẩn có các kiểu liên kết, bao gồm các toán tử" +" số học và `Iterator`." #: src/methods-and-traits/deriving.md msgid "" "Supported traits can be automatically implemented for your custom types, as " "follows:" msgstr "" +"Các đặc điểm được hỗ trợ có thể được triển khai tự động cho các loại tùy " +"chỉnh của bạn như sau:" #: src/methods-and-traits/deriving.md msgid "// Default trait adds `default` constructor.\n" -msgstr "" +msgstr "// Đặc điểm mặc định thêm hàm tạo `default`.\n" #: src/methods-and-traits/deriving.md msgid "// Clone trait adds `clone` method.\n" -msgstr "" +msgstr "// Đặc điểm nhân bản thêm phương thức `clone`.\n" #: src/methods-and-traits/deriving.md msgid "\"EldurScrollz\"" -msgstr "" +msgstr "\"EldurScrollz\"" #: src/methods-and-traits/deriving.md msgid "// Debug trait adds support for printing with `{:?}`.\n" -msgstr "" +msgstr "// Đặc điểm gỡ lỗi bổ sung hỗ trợ in bằng `{:?}`.\n" #: src/methods-and-traits/deriving.md msgid "\"{:?} vs. {:?}\"" -msgstr "" +msgstr "\"{:?} so với {:?}\"" #: src/methods-and-traits/deriving.md msgid "" -"Derivation is implemented with macros, and many crates provide useful derive " -"macros to add useful functionality. For example, `serde` can derive " +"Derivation is implemented with macros, and many crates provide useful derive" +" macros to add useful functionality. For example, `serde` can derive " "serialization support for a struct using `#[derive(Serialize)]`." msgstr "" +"Việc phái sinh được triển khai bằng macro và nhiều crate cung cấp các macro " +"phái sinh hữu ích để thêm chức năng hữu ích. Ví dụ: `serde` có thể lấy được " +"sự hỗ trợ tuần tự hóa cho một cấu trúc bằng cách sử dụng " +"`#[derive(Serialize)]`." #: src/methods-and-traits/exercise.md msgid "Exercise: Logger Trait" -msgstr "" +msgstr "Bài tập: Đặc điểm của Logger" #: src/methods-and-traits/exercise.md msgid "" @@ -5530,6 +6038,11 @@ msgid "" "In testing, this might put messages in the test logfile, while in a " "production build it would send messages to a log server." msgstr "" +"Hãy thiết kế một tiện ích ghi nhật ký đơn giản, sử dụng đặc điểm `Logger` " +"với phương thức `log`. Sau đó, mã có thể ghi lại tiến trình của nó có thể " +"lấy `&impl Logger`. Trong quá trình thử nghiệm, điều này có thể đưa thông " +"báo vào tệp nhật ký thử nghiệm, trong khi ở bản dựng sản xuất, nó sẽ gửi " +"thông báo đến máy chủ nhật ký." #: src/methods-and-traits/exercise.md msgid "" @@ -5537,6 +6050,9 @@ msgid "" "verbosity. Your task is to write a `VerbosityFilter` type that will ignore " "messages above a maximum verbosity." msgstr "" +"Tuy nhiên, `StderrLogger` được cung cấp bên dưới sẽ ghi lại tất cả các thông" +" báo, bất kể mức độ dài dòng. Nhiệm vụ của bạn là viết một loại " +"`VerbosityFilter` sẽ bỏ qua các thông báo trên mức độ chi tiết tối đa." #: src/methods-and-traits/exercise.md msgid "" @@ -5544,30 +6060,33 @@ msgid "" "implementing that same trait, adding behavior in the process. What other " "kinds of wrappers might be useful in a logging utility?" msgstr "" +"Đây là một mẫu phổ biến: một cấu trúc bao bọc việc triển khai đặc điểm và " +"triển khai đặc điểm đó, bổ sung thêm hành vi trong quy trình. Những loại " +"trình bao bọc nào khác có thể hữu ích trong tiện ích ghi nhật ký?" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "/// Log a message at the given verbosity level.\n" -msgstr "" +msgstr "/// Ghi nhật ký một tin nhắn ở mức độ chi tiết nhất định.\n" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "\"verbosity={verbosity}: {message}\"" -msgstr "" +msgstr "\"sự dài dòng={sự dài dòng}: {tin nhắn}\"" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "\"FYI\"" -msgstr "" +msgstr "\"Xin chào\"" #: src/methods-and-traits/exercise.md src/methods-and-traits/solution.md msgid "\"Uhoh\"" -msgstr "" +msgstr "\"Ờ\"" #: src/methods-and-traits/exercise.md msgid "// TODO: Define and implement `VerbosityFilter`.\n" -msgstr "" +msgstr "// VIỆC CẦN LÀM: Xác định và triển khai `VerbosityFilter`.\n" #: src/methods-and-traits/solution.md msgid "/// Only log messages up to the given verbosity level.\n" -msgstr "" +msgstr "/// Chỉ ghi các thông điệp ở mức độ chi tiết nhất định.\n" #: src/welcome-day-2-afternoon.md msgid "" @@ -5579,52 +6098,61 @@ msgstr "" #: src/generics.md msgid "impl Trait" -msgstr "" +msgstr "đặc điểm ngụ ý" #: src/generics.md msgid "Exercise: Generic min" -msgstr "" +msgstr "Bài tập: Tổng tối thiểu" #: src/generics/generic-functions.md 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." msgstr "" +"Rust hỗ trợ generics, cho phép bạn sử dụng các thuật toán hoặc cấu trúc dữ " +"liệu trừu tượng (chẳng hạn như sắp xếp hoặc cây nhị phân) theo các loại được" +" sử dụng hoặc lưu trữ." #: src/generics/generic-functions.md msgid "/// Pick `even` or `odd` depending on the value of `n`.\n" -msgstr "" +msgstr "/// Chọn `chẵn` hoặc `lẻ` tùy theo giá trị của `n`.\n" #: src/generics/generic-functions.md msgid "\"picked a number: {:?}\"" -msgstr "" +msgstr "\"đã chọn một số: {:?}\"" #: src/generics/generic-functions.md msgid "\"picked a tuple: {:?}\"" -msgstr "" +msgstr "\"đã chọn một bộ dữ liệu: {:?}\"" #: src/generics/generic-functions.md msgid "\"dog\"" -msgstr "" +msgstr "\"chó\"" #: src/generics/generic-functions.md msgid "\"cat\"" -msgstr "" +msgstr "\"con mèo\"" #: src/generics/generic-functions.md msgid "" "Rust infers a type for T based on the types of the arguments and return " "value." msgstr "" +"Rust suy ra một kiểu cho T dựa trên kiểu của đối số và giá trị trả về." #: 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." +"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 "" +"Điều này tương tự như các mẫu C++, nhưng Rust biên dịch một phần hàm chung " +"instant, do đó hàm đó phải hợp lệ cho tất cả các loại khớp với các ràng " +"buộc. Ví dụ: thử sửa đổi `pick` để trả về `chẵn + lẻ` nếu `n == 0`. Ngay cả " +"khi chỉ sử dụng khởi tạo `pick` với số nguyên, Rust vẫn coi nó không hợp lệ." +" C++ sẽ cho phép bạn làm điều này." #: src/generics/generic-functions.md msgid "" @@ -5632,44 +6160,54 @@ msgid "" "is a zero-cost abstraction: you get exactly the same result as if you had " "hand-coded the data structures without the abstraction." msgstr "" +"Mã chung được chuyển thành mã không chung dựa trên các trang gọi. Đây là một" +" sự trừu tượng hóa không tốn chi phí: bạn nhận được kết quả giống hệt như " +"khi bạn mã hóa các cấu trúc dữ liệu bằng tay mà không có sự trừu tượng hóa." #: src/generics/generic-data.md msgid "You can use generics to abstract over the concrete field type:" msgstr "" +"Bạn có thể sử dụng thuốc generic để trừu tượng hóa loại trường cụ thể:" #: src/generics/generic-data.md msgid "\"{integer:?} and {float:?}\"" -msgstr "" +msgstr "\"{số nguyên:?} và {float:?}\"" #: src/generics/generic-data.md msgid "\"coords: {:?}\"" -msgstr "" +msgstr "\"coords: {:?}\"" #: src/generics/generic-data.md msgid "" "_Q:_ Why `T` is specified twice in `impl Point {}`? Isn't that " "redundant?" msgstr "" +"_Q:_ Tại sao `T` được chỉ định hai lần trong `impl Điểm {}`? Điều đó " +"không phải là dư thừa sao?" #: src/generics/generic-data.md msgid "" "This is because it is a generic implementation section for generic type. " "They are independently generic." msgstr "" +"Điều này là do đây là phần triển khai chung cho loại chung. Chúng có tính " +"chung chung độc lập." #: src/generics/generic-data.md msgid "It means these methods are defined for any `T`." -msgstr "" +msgstr "Nó có nghĩa là các phương thức này được xác định cho bất kỳ `T` nào." #: src/generics/generic-data.md msgid "It is possible to write `impl Point { .. }`." -msgstr "" +msgstr "Có thể viết `impl Point { .. }`." #: src/generics/generic-data.md msgid "" "`Point` is still generic and you can use `Point`, but methods in this " "block will only be available for `Point`." msgstr "" +"`Point` vẫn là chung và bạn có thể sử dụng `Point`, nhưng các phương " +"thức trong khối này sẽ chỉ khả dụng cho `Point`." #: src/generics/generic-data.md msgid "" @@ -5677,31 +6215,39 @@ msgid "" "code to allow points that have elements of different types, by using two " "type variables, e.g., `T` and `U`." msgstr "" +"Hãy thử khai báo một biến mới `let p = Point { x: 5, y: 10.0 };`. Cập nhật " +"mã để cho phép các điểm có các phần tử thuộc các loại khác nhau, bằng cách " +"sử dụng hai biến loại, ví dụ: `T` và `U`." #: src/generics/generic-traits.md msgid "" "Traits can also be generic, just like types and functions. A trait's " "parameters get concrete types when it is used." msgstr "" +"Đặc điểm cũng có thể chung chung, giống như loại và chức năng. Các tham số " +"của một đặc điểm sẽ nhận được các loại cụ thể khi nó được sử dụng." #: src/generics/generic-traits.md msgid "\"Converted from integer: {from}\"" -msgstr "" +msgstr "\"Đã chuyển đổi từ số nguyên: {from}\"" #: src/generics/generic-traits.md msgid "\"Converted from bool: {from}\"" -msgstr "" +msgstr "\"Đã chuyển đổi từ bool: {from}\"" #: src/generics/generic-traits.md msgid "\"{from_int:?}, {from_bool:?}\"" -msgstr "" +msgstr "\"{from_int:?}, {from_bool:?}\"" #: src/generics/generic-traits.md msgid "" -"The `From` trait will be covered later in the course, but its [definition in " -"the `std` docs](https://doc.rust-lang.org/std/convert/trait.From.html) is " +"The `From` trait will be covered later in the course, but its [definition in" +" the `std` docs](https://doc.rust-lang.org/std/convert/trait.From.html) is " "simple." msgstr "" +"Đặc điểm `From` sẽ được đề cập ở phần sau của khóa học, nhưng [định nghĩa " +"của nó trong tài liệu `std`](https://doc.rust-" +"lang.org/std/convert/trait.From.html) rất đơn giản." #: src/generics/generic-traits.md msgid "" @@ -5709,108 +6255,134 @@ msgid "" "parameters. Here, `Foo::From(\"hello\")` would not compile because there is " "no `From<&str>` implementation for `Foo`." msgstr "" +"Việc triển khai đặc điểm không cần phải bao gồm tất cả các tham số loại có " +"thể có. Ở đây, `Foo::From(\"hello\")` sẽ không biên dịch vì không có triển " +"khai `From<&str>` cho `Foo`." #: src/generics/generic-traits.md msgid "" -"Generic traits take types as \"input\", while associated types are a kind of " -"\"output\" type. A trait can have multiple implementations for different " +"Generic traits take types as \"input\", while associated types are a kind of" +" \"output\" type. A trait can have multiple implementations for different " "input types." msgstr "" +"Đặc điểm chung coi các loại là \"đầu vào\", trong khi các loại liên quan là " +"một loại loại \"đầu ra\". Một đặc điểm có thể có nhiều cách triển khai cho " +"các loại đầu vào khác nhau." #: src/generics/generic-traits.md msgid "" "In fact, Rust requires that at most one implementation of a trait match for " "any type T. Unlike some other languages, Rust has no heuristic for choosing " "the \"most specific\" match. There is work on adding this support, called " -"[specialization](https://rust-lang.github.io/rfcs/1210-impl-specialization." -"html)." +"[specialization](https://rust-lang.github.io/rfcs/1210-impl-" +"specialization.html)." msgstr "" +"Trên thực tế, Rust yêu cầu tối đa một lần triển khai một đặc điểm phù hợp " +"với bất kỳ loại T nào. Không giống như một số ngôn ngữ khác, Rust không có " +"phương pháp phỏng đoán để chọn kết quả phù hợp \"cụ thể nhất\". Đang có công" +" việc bổ sung hỗ trợ này, được gọi là [chuyên môn hóa](https://rust-" +"lang.github.io/rfcs/1210-impl-specialization.html)." #: 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." +"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 "" +"Khi làm việc với generic, bạn thường muốn yêu cầu các kiểu triển khai một số" +" đặc điểm để có thể gọi các phương thức của đặc điểm này." #: src/generics/trait-bounds.md msgid "You can do this with `T: Trait` or `impl Trait`:" -msgstr "" +msgstr "Bạn có thể làm điều này với `T: Trait` hoặc `impl Trait`:" #: src/generics/trait-bounds.md msgid "// struct NotClonable;\n" -msgstr "" +msgstr "// struct NotClonable;\n" #: src/generics/trait-bounds.md msgid "\"{pair:?}\"" -msgstr "" +msgstr "\"{đôi:?}\"" #: src/generics/trait-bounds.md msgid "Try making a `NonClonable` and passing it to `duplicate`." -msgstr "" +msgstr "Hãy thử tạo một `NonClonable` và chuyển nó sang `duplicate`." #: src/generics/trait-bounds.md msgid "When multiple traits are necessary, use `+` to join them." -msgstr "" +msgstr "Khi cần nhiều đặc điểm, hãy sử dụng `+` để nối chúng." #: src/generics/trait-bounds.md msgid "Show a `where` clause, students will encounter it when reading code." -msgstr "" +msgstr "Hiển thị mệnh đề `where`, học sinh sẽ gặp phải nó khi đọc code." #: src/generics/trait-bounds.md msgid "It declutters the function signature if you have many parameters." -msgstr "" +msgstr "Nó sẽ giải mã chữ ký hàm nếu bạn có nhiều tham số." #: src/generics/trait-bounds.md msgid "It has additional features making it more powerful." -msgstr "" +msgstr "Nó có các tính năng bổ sung làm cho nó mạnh mẽ hơn." #: 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 "" +"Nếu có người hỏi thì tính năng bổ sung là kiểu bên trái của ://: có thể tùy " +"ý, như `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)`." +"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 "" +"Lưu ý rằng Rust chưa (chưa) hỗ trợ chuyên môn hóa. Ví dụ: với `trùng lặp` " +"ban đầu, việc thêm `trùng lặp (a: u32)` chuyên biệt là không hợp lệ." #: src/generics/impl-trait.md msgid "" "Similar to trait bounds, an `impl Trait` syntax can be used in function " "arguments and return values:" msgstr "" +"Tương tự như giới hạn đặc điểm, cú pháp `impl Trait` có thể được sử dụng " +"trong các đối số hàm và trả về giá trị:" #: src/generics/impl-trait.md msgid "" "// Syntactic sugar for:\n" "// fn add_42_millions>(x: T) -> i32 {\n" msgstr "" +"// Cú pháp cho:\n" +"// fn add_42_millions>(x: T) -> i32 {\n" #: src/generics/impl-trait.md msgid "\"{many}\"" -msgstr "" +msgstr "\"{nhiều}\"" #: src/generics/impl-trait.md msgid "\"{many_more}\"" -msgstr "" +msgstr "\"{many_more}\"" #: src/generics/impl-trait.md msgid "\"debuggable: {debuggable:?}\"" -msgstr "" +msgstr "\"có thể sửa lỗi: {có thể sửa lỗi:?}\"" #: src/generics/impl-trait.md 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." msgstr "" +"`impl Trait` cho phép bạn làm việc với các loại mà bạn không thể đặt tên. Ý " +"nghĩa của `Impl Trait` hơi khác một chút ở các vị trí khác nhau." #: src/generics/impl-trait.md msgid "" "For a parameter, `impl Trait` is like an anonymous generic parameter with a " "trait bound." msgstr "" +"Đối với một tham số, `impl Trait` giống như một tham số chung ẩn danh có " +"giới hạn một đặc điểm." #: src/generics/impl-trait.md msgid "" @@ -5818,6 +6390,9 @@ 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 "" +"Đối với kiểu trả về, điều đó có nghĩa là kiểu trả về là một kiểu cụ thể nào " +"đó thực hiện đặc điểm mà không cần đặt tên cho kiểu. Điều này có thể hữu ích" +" khi bạn không muốn hiển thị loại cụ thể trong API công khai." #: src/generics/impl-trait.md msgid "" @@ -5825,15 +6400,22 @@ msgid "" "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::" -">()`." +"`let x: Vec<_> = foo.collect()` or with the turbofish, " +"`foo.collect::>()`." msgstr "" +"Suy luận khó ở vị trí quay lại. Hàm trả về `impl Foo` chọn loại cụ thể mà nó" +" trả về mà không cần ghi nó vào nguồn. Một hàm trả về một kiểu chung như " +"`collect() -> B` có thể trả về bất kỳ kiểu nào thỏa mãn `B` và người gọi " +"có thể cần chọn một kiểu, chẳng hạn như với `let x: Vec<_> = foo.collect()` " +"hoặc với 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." msgstr "" +"Loại `có thể gỡ lỗi` là gì? Hãy thử `let debuggable: () = ..` để xem thông " +"báo lỗi hiển thị như thế nào." #: src/generics/exercise.md msgid "" @@ -5841,42 +6423,49 @@ msgid "" "determines the minimum of two values, using the [`Ord`](https://doc.rust-" "lang.org/stable/std/cmp/trait.Ord.html) trait." msgstr "" +"Trong bài tập ngắn này, bạn sẽ triển khai hàm `min` chung xác định giá trị " +"tối thiểu của hai giá trị bằng cách sử dụng đặc tính " +"[`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord.html)." #: src/generics/exercise.md msgid "// TODO: implement the `min` function used in `main`.\n" -msgstr "" +msgstr "// TODO: triển khai hàm `min` được sử dụng trong `main`.\n" #: src/generics/exercise.md src/generics/solution.md #: src/error-handling/exercise.md src/error-handling/solution.md msgid "'z'" -msgstr "" +msgstr "'z'" #: src/generics/exercise.md src/generics/solution.md msgid "'7'" -msgstr "" +msgstr "'7'" #: src/generics/exercise.md src/generics/solution.md msgid "'1'" -msgstr "" +msgstr "'1'" #: src/generics/exercise.md src/generics/solution.md msgid "\"goodbye\"" -msgstr "" +msgstr "\"tạm biệt\"" #: src/generics/exercise.md src/generics/solution.md msgid "\"bat\"" -msgstr "" +msgstr "\"dơi\"" #: src/generics/exercise.md src/generics/solution.md msgid "\"armadillo\"" -msgstr "" +msgstr "\"armadillo\"" #: src/generics/exercise.md msgid "" -"Show students the [`Ord`](https://doc.rust-lang.org/stable/std/cmp/trait.Ord." -"html) trait and [`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum." -"Ordering.html) enum." +"Show students the [`Ord`](https://doc.rust-" +"lang.org/stable/std/cmp/trait.Ord.html) trait and " +"[`Ordering`](https://doc.rust-lang.org/stable/std/cmp/enum.Ordering.html) " +"enum." msgstr "" +"Cho học sinh thấy đặc điểm [`Ord`](https://doc.rust-" +"lang.org/stable/std/cmp/trait.Ord.html) và [`Ordering`](https://doc.rust-" +"lang.org/stable/std/cmp/enum.Ordering.html) enum." #: src/std-types.md msgid "This segment should take about 1 hour and 20 minutes. It contains:" @@ -5892,15 +6481,15 @@ msgstr "Result" #: src/std-types.md src/std-types/string.md msgid "String" -msgstr "" +msgstr "Sợi dây" #: src/std-types.md msgid "Vec" -msgstr "" +msgstr "Vec" #: src/std-types.md msgid "HashMap" -msgstr "" +msgstr "Bản đồ băm" #: src/std-types.md msgid "" @@ -5916,9 +6505,9 @@ msgid "" "types used by Rust libraries and programs. This way, two libraries can work " "together smoothly because they both use the same `String` type." msgstr "" -"Đi kèm với Rust là một thư viện chuẩn tổng hợp các kiểu dữ liệu thông dụng." -"Nhờ đó, hai thư viện có thể hoạt động cùng nhau một cách mượt mà vì cả hai " -"đều sử dụng cùng một kiểu `String` của thư viện chuẩn." +"Đi kèm với Rust là một thư viện chuẩn tổng hợp các kiểu dữ liệu thông " +"dụng.Nhờ đó, hai thư viện có thể hoạt động cùng nhau một cách mượt mà vì cả " +"hai đều sử dụng cùng một kiểu `String` của thư viện chuẩn." #: src/std-types/std.md msgid "" @@ -5938,8 +6527,8 @@ msgstr "" #: src/std-types/std.md msgid "" -"`alloc` includes types which require a global heap allocator, such as `Vec`, " -"`Box` and `Arc`." +"`alloc` includes types which require a global heap allocator, such as `Vec`," +" `Box` and `Arc`." msgstr "" "`alloc` bao gồm các kiểu dữ liệu yêu cầu phải được cấp phát trên bộ nhớ " "heap, như `Vec`, `Box` và `Arc`." @@ -5956,29 +6545,31 @@ msgstr "Rust đi kèm với một bộ tài liệu rất chi tiết. Ví dụ:" #: src/std-types/docs.md msgid "" -"All of the details about [loops](https://doc.rust-lang.org/stable/reference/" -"expressions/loop-expr.html)." +"All of the details about [loops](https://doc.rust-" +"lang.org/stable/reference/expressions/loop-expr.html)." msgstr "" -"Tất cả chi tiết về [vòng lặp](https://doc.rust-lang.org/stable/reference/" -"expressions/loop-expr.html)." +"Tất cả chi tiết về [vòng lặp](https://doc.rust-" +"lang.org/stable/reference/expressions/loop-expr.html)." #: 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 "" -"Các kiểu dữ liệu cơ bản như [`u8`](https://doc.rust-lang.org/stable/std/" -"primitive.u8.html)." +"Các kiểu dữ liệu cơ bản như [`u8`](https://doc.rust-" +"lang.org/stable/std/primitive.u8.html)." #: src/std-types/docs.md 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)." +"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)." msgstr "" "Các kiểu dữ liệu thuộc về thư viện chuẩn như [`Option`](https://doc.rust-" -"lang.org/stable/std/option/enum.Option.html) hoặc [`BinaryHeap`](https://doc." -"rust-lang.org/stable/std/collections/struct.BinaryHeap.html)." +"lang.org/stable/std/option/enum.Option.html) hoặc " +"[`BinaryHeap`](https://doc.rust-" +"lang.org/stable/std/collections/struct.BinaryHeap.html)." #: src/std-types/docs.md msgid "In fact, you can document your own code:" @@ -5986,8 +6577,7 @@ msgstr "Ngoài ra, bạn cũng có thể tự viết tài liệu cho code của #: 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 "" @@ -5998,20 +6588,20 @@ msgstr "" #: src/std-types/docs.md 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." +"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." msgstr "" "Nội dung tài liệu sẽ được xử lý bằng Markdown. Tất cả các thư viện Rust đã " -"được publish đều sẽ tự động được công cụ [rustdoc](https://doc.rust-lang.org/" -"rustdoc/what-is-rustdoc.html) viết tài liệu, và được lưu trữ tại [`docs.rs`]" -"(https://docs.rs). Tất cả thành phần công khai trong một API nên được viết " -"tài liệu theo phương pháp này." +"được publish đều sẽ tự động được công cụ [rustdoc](https://doc.rust-" +"lang.org/rustdoc/what-is-rustdoc.html) viết tài liệu, và được lưu trữ tại " +"[`docs.rs`](https://docs.rs). Tất cả thành phần công khai trong một API nên " +"được viết tài liệu theo phương pháp này." #: 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 "" "Để viết tài liệu cho một thành phần từ bên trong thành phần đó (như bên " "trong một module), hãy sử dụng `//!` hoặc `/*! .. */`. Cú pháp trên thường " @@ -6027,22 +6617,24 @@ msgstr "" #: src/std-types/docs.md msgid "" -"Show students the generated docs for the `rand` crate at ." +"Show students the generated docs for the `rand` crate at " +"." msgstr "" -"Cho học sinh xem tài liệu được viết cho thư viện `rand` tại ." +"Cho học sinh xem tài liệu được viết cho thư viện `rand` tại " +"." #: 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`." +"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 "" -"Chúng ta đã thấy một số cách dùng `Option`. Kiểu dữ liệu này hoặc lưu trữ " -"một giá trị kiểu `T` hoặc không lưu trữ gì cả. Ví dụ, hàm [`String::find`]" -"(https://doc.rust-lang.org/stable/std/string/struct.String.html#method.find) " -"trả về một `Option`." +"Chúng ta đã thấy một số cách dùng `Option`. Kiểu dữ liệu này hoặc lưu trữ" +" một giá trị kiểu `T` hoặc không lưu trữ gì cả. Ví dụ, hàm " +"[`String::find`](https://doc.rust-" +"lang.org/stable/std/string/struct.String.html#method.find) trả về một " +"`Option`." #: src/std-types/option.md msgid "\"Löwe 老虎 Léopard Gepardi\"" @@ -6071,11 +6663,11 @@ msgstr "" #: src/std-types/option.md msgid "" -"`unwrap` will return the value in an `Option`, or panic. `expect` is similar " -"but takes an error message." +"`unwrap` will return the value in an `Option`, or panic. `expect` is similar" +" but takes an error message." msgstr "" -"`unwrap` sẽ trả về giá trị của `Option` hoặc panic. `expect` hoạt động tương " -"tự nhưng có thể truyền thêm một thông báo lỗi." +"`unwrap` sẽ trả về giá trị của `Option` hoặc panic. `expect` hoạt động tương" +" tự nhưng có thể truyền thêm một thông báo lỗi." #: src/std-types/option.md msgid "" @@ -6105,14 +6697,14 @@ msgstr "" 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." +"in the expression exercise, but generic: `Result` where `T` is used in" +" the `Ok` variant and `E` appears in the `Err` variant." msgstr "" "`Result` hoạt động tương tự như `Option`, nhưng được sử dụng để biểu diễn " "kết quả thành công hoặc thất bại của một tác vụ. Tương tự như `Res` trong " -"phần thực hành về biểu thức, `Result` cũng có hai biến thể khác nhau cho mỗi " -"trường hợp thành công và thất bại, nhưng được tổng quát hóa: `Result` " -"trong đó `T` được sử dụng trong trường hợp `Ok` và `E` xuất hiện trong " +"phần thực hành về biểu thức, `Result` cũng có hai biến thể khác nhau cho mỗi" +" trường hợp thành công và thất bại, nhưng được tổng quát hóa: `Result`" +" trong đó `T` được sử dụng trong trường hợp `Ok` và `E` xuất hiện trong " "trường hợp `Err`." #: src/std-types/result.md @@ -6141,8 +6733,8 @@ msgstr "" "Tương tự với `Option`, giá trị trả về trong trường hợp thành công được đặt " "bên trong `Result`, buộc người dùng phải trích xuất giá trị một cách rõ " "ràng, đảm bảo mọi lỗi đều được kiểm tra. Trong trường hợp mà lỗi chắc chắn " -"không thể xảy ra, `unwrap()` hoặc `expect()` có thể được gọi, bày tỏ rõ ràng " -"ý định của người viết là lỗi không thể xảy ra." +"không thể xảy ra, `unwrap()` hoặc `expect()` có thể được gọi, bày tỏ rõ ràng" +" ý định của người viết là lỗi không thể xảy ra." #: src/std-types/result.md msgid "" @@ -6199,13 +6791,13 @@ msgstr "\"s3: độ dài = {}, số ký tự = {}\"" #: 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` 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`." msgstr "" -"`String` implement [`Deref`](https://doc.rust-lang.org/std/" -"string/struct.String.html#deref-methods-str), có nghĩa tất cả các hàm của " -"`str` đều có thể được gọi trên một biến kiểu `String`." +"`String` implement [`Deref`](https://doc.rust-" +"lang.org/std/string/struct.String.html#deref-methods-str), có nghĩa tất cả " +"các hàm của `str` đều có thể được gọi trên một biến kiểu `String`." #: src/std-types/string.md msgid "" @@ -6227,13 +6819,13 @@ msgstr "" 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/" -"unicode_segmentation/struct.Graphemes.html)." +"to [grapheme clusters](https://docs.rs/unicode-" +"segmentation/latest/unicode_segmentation/struct.Graphemes.html)." msgstr "" "`String::chars` trả về một con trỏ chạy dọc theo các ký tự của chuỗi. Lưu ý " "rằng một `char` có thể khác với một \"ký tự\" thông thường bởi vì một khái " -"niệm gọi là [grapheme clusters](https://docs.rs/unicode-segmentation/latest/" -"unicode_segmentation/struct.Graphemes.html)." +"niệm gọi là [grapheme clusters](https://docs.rs/unicode-" +"segmentation/latest/unicode_segmentation/struct.Graphemes.html)." #: src/std-types/string.md msgid "" @@ -6246,8 +6838,8 @@ msgid "" "When a type implements `Deref`, the compiler will let you " "transparently call methods from `T`." msgstr "" -"Khi một kiểu dữ liệu implement `Deref`, trình biên dịch sẽ cho " -"phép gọi các hàm thuộc về `T` trên kiểu dữ liệu đó." +"Khi một kiểu dữ liệu implement `Deref`, compiler sẽ cho phép gọi" +" các hàm thuộc về `T` trên kiểu dữ liệu đó." #: src/std-types/string.md msgid "" @@ -6304,17 +6896,17 @@ msgstr "" #: 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 "" "Nhiều kiểu dữ liệu có thể được chuyển đổi thành chuỗi bằng phương thức " -"[`to_string`](https://doc.rust-lang.org/std/string/trait.ToString." -"html#tymethod.to_string). Trait này đã được implement sẵn cho tất cả các " -"kiểu dữ liệu implement `Display`, nên bất cứ giá trị nào có thể được định " -"dạng cũng có thể được chuyển thành chuỗi." +"[`to_string`](https://doc.rust-" +"lang.org/std/string/trait.ToString.html#tymethod.to_string). Trait này đã " +"được implement sẵn cho tất cả các kiểu dữ liệu implement `Display`, nên bất " +"cứ giá trị nào có thể được định dạng cũng có thể được chuyển thành chuỗi." #: src/std-types/vec.md msgid "" @@ -6350,13 +6942,13 @@ msgstr "// Loại bỏ các phần tử liên tiếp giống nhau.\n" #: src/std-types/vec.md msgid "" -"`Vec` implements [`Deref`](https://doc.rust-lang.org/std/vec/" -"struct.Vec.html#deref-methods-%5BT%5D), which means that you can call slice " -"methods on a `Vec`." +"`Vec` implements [`Deref`](https://doc.rust-" +"lang.org/std/vec/struct.Vec.html#deref-methods-%5BT%5D), which means that " +"you can call slice methods on a `Vec`." msgstr "" -"`Vec` implement [`Deref`](https://doc.rust-lang.org/std/vec/" -"struct.Vec.html#deref-methods-%5BT%5D), nên tất cả các hàm của slice đều có " -"thể được gọi trên một biến kiểu `Vec`." +"`Vec` implement [`Deref`](https://doc.rust-" +"lang.org/std/vec/struct.Vec.html#deref-methods-%5BT%5D), nên tất cả các hàm " +"của slice đều có thể được gọi trên một biến kiểu `Vec`." #: src/std-types/vec.md msgid "" @@ -6364,15 +6956,15 @@ msgid "" "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 "" -"Tương tự `String` và `HashMap`, `Vec` là một kiểu dữ liệu sử dụng để lưu trữ " -"nhiều phần tử. Dữ liệu được lưu trữ trên bộ nhớ heap, nên không cần phải " +"Tương tự `String` và `HashMap`, `Vec` là một kiểu dữ liệu sử dụng để lưu trữ" +" nhiều phần tử. Dữ liệu được lưu trữ trên bộ nhớ heap, nên không cần phải " "biết trước kích thước của dữ liệu tại thời điểm compile. Kích thước của " "`Vec` có thể thay đổi tại trong quá trình chạy." #: 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 " +"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." msgstr "" "`Vec` cũng là một kiểu dữ liệu generic, nhưng trong đa số trường hợp ta " @@ -6384,8 +6976,8 @@ msgid "" "`vec![...]` is a canonical macro to use instead of `Vec::new()` and it " "supports adding initial elements to the vector." msgstr "" -"Ta có thể sử dụng macro `vec![...]` thay vì gọi hàm `Vec::new()` để khởi tạo " -"một `Vec`. `vec![...]` còn có thể được dùng để khởi tạo vector với một số " +"Ta có thể sử dụng macro `vec![...]` thay vì gọi hàm `Vec::new()` để khởi tạo" +" một `Vec`. `vec![...]` còn có thể được dùng để khởi tạo vector với một số " "phần tử cho trước." #: src/std-types/vec.md @@ -6394,18 +6986,19 @@ msgid "" "Alternatively, using `get` will return an `Option`. The `pop` function will " "remove the last element." msgstr "" -"Để truy cập phần tử của một vector ta có thể sử dụng `[` `]`, nhưng nếu phần " -"tử được truy cập cập nằm ngoài phạm vi của vector, chương trình sẽ panic. " +"Để truy cập phần tử của một vector ta có thể sử dụng `[` `]`, nhưng nếu phần" +" tử được truy cập cập nằm ngoài phạm vi của vector, chương trình sẽ panic. " "Trong trường hợp này, ta có thể sử dụng hàm `get` để trả về một `Option`. " "Hàm `pop` sẽ loại bỏ phần tử cuối cùng của vector." #: 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." +"value of type `Vec` gives access to all of the documented slice methods, " +"too." msgstr "" -"Chúng ta sẽ đi sâu vào chi tiết về slice trong ngày 3. Bây giờ, học viên chỉ " -"cần biết rằng một biến kiểu `Vec` cũng có thể sử dụng tất cả các hàm của " +"Chúng ta sẽ đi sâu vào chi tiết về slice trong ngày 3. Bây giờ, học viên chỉ" +" cần biết rằng một biến kiểu `Vec` cũng có thể sử dụng tất cả các hàm của " "slice." #: src/std-types/hashmap.md @@ -6464,9 +7057,9 @@ msgstr "" #: 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." +"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." msgstr "" "Thử chạy đoạn code sau. Dòng đầu tiên sẽ kiểm tra xem một cuốn sách có tồn " "tại trong hashmap không, và nếu không trả về một giá trị thay thế. Dòng thứ " @@ -6486,15 +7079,17 @@ msgstr "Khác với `vec!`, Rust không cung cấp macro `hashmap!`." #: 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-" +"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 "" "Thay vào đó, kể từ phiên bản Rust 1.56, HashMap implement [`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), cho " -"phép chúng ta dễ dàng khởi tạo một hashmap từ một mảng giá trị:" +"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), cho phép " +"chúng ta dễ dàng khởi tạo một hashmap từ một mảng giá trị:" #: src/std-types/hashmap.md msgid "" @@ -6506,8 +7101,8 @@ msgstr "" #: 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, " +"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." msgstr "" "Trong những ví dụ trên, `HashMap` được sử dụng thay vì `&str` " @@ -6525,33 +7120,34 @@ msgstr "" #: 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." +"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." msgstr "" -"HashMap đi kèm với nhiều kiểu dữ liệu chỉ sử dụng làm kiểu trả về của một số " -"hàm, như `std::collections::hash_map::Keys`. Những kiểu dữ liệu này thường " +"HashMap đi kèm với nhiều kiểu dữ liệu chỉ sử dụng làm kiểu trả về của một số" +" hàm, như `std::collections::hash_map::Keys`. Những kiểu dữ liệu này thường " "xuất hiện trong tài liệu của Rust. Hãy cho học viên xem tài liệu về kiểu dữ " "liệu `Keys`, và liên hệ với hàm `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." +"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." msgstr "" "Trong bài tập này, ta sẽ chuyển một cấu trúc dữ liệu đơn giản thành một cấu " -"trúc dữ liệu generic. Chúng ta sẽ sử dụng một [`std::collections::HashMap`]" -"(https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html) để " -"theo dõi các giá trị đã xuất hiện và số lần xuất hiện của mỗi giá trị." +"trúc dữ liệu generic. Chúng ta sẽ sử dụng một " +"[`std::collections::HashMap`](https://doc.rust-" +"lang.org/stable/std/collections/struct.HashMap.html) để theo dõi các giá trị" +" đã xuất hiện và số lần xuất hiện của mỗi giá trị." #: 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." +"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 "" "Phiên bản đầu tiên của `Counter` chỉ hoạt động với các giá trị kiểu `u32`. " "Hãy biến struct `Counter` và các hàm của nó thành generic, để `Counter` có " @@ -6559,13 +7155,13 @@ msgstr "" #: 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 "" -"Nếu bạn hoàn thành sớm, hãy thử sử dụng hàm [`entry`](https://doc.rust-lang." -"org/stable/std/collections/struct.HashMap.html#method.entry) để giảm đi một " -"nửa số lần thực hiện hash lookup cần thiết để thực hiện hàm `count`." +"Nếu bạn hoàn thành sớm, hãy thử sử dụng hàm [`entry`](https://doc.rust-" +"lang.org/stable/std/collections/struct.HashMap.html#method.entry) để giảm đi" +" một nửa số lần thực hiện hash lookup cần thiết để thực hiện hàm `count`." #: src/std-types/exercise.md src/std-types/solution.md msgid "" @@ -6644,8 +7240,8 @@ msgstr "`PartialEq` và `Eq`" #: src/std-traits/comparisons.md msgid "" -"`PartialEq` is a partial equivalence relation, with required method `eq` and " -"provided method `ne`. The `==` and `!=` operators will call these methods." +"`PartialEq` is a partial equivalence relation, with required method `eq` and" +" provided method `ne`. The `==` and `!=` operators will call these methods." msgstr "" "`PartialEq` là một quan hệ tương đương một phần. Kiểu dữ liệu implement " "trait này phải định nghĩa hàm `eq`, hàm `ne` tự được định nghĩa dựa trên " @@ -6698,11 +7294,11 @@ 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 "" -"Ta có thể thực hiện overloading toán tử thông qua các trait trong [`std::" -"ops`](https://doc.rust-lang.org/std/ops/index.html):" +"Ta có thể thực hiện overloading toán tử thông qua các trait trong " +"[`std::ops`](https://doc.rust-lang.org/std/ops/index.html):" #: src/std-traits/operators.md msgid "\"{:?} + {:?} = {:?}\"" @@ -6721,18 +7317,18 @@ msgstr "" #: src/std-traits/operators.md msgid "" -"Answer: `Add:add` consumes `self`. If type `T` for which you are overloading " -"the operator is not `Copy`, you should consider overloading the operator for " -"`&T` as well. This avoids unnecessary cloning on the call site." +"Answer: `Add:add` consumes `self`. If type `T` for which you are overloading" +" the operator is not `Copy`, you should consider overloading the operator " +"for `&T` as well. This avoids unnecessary cloning on the call site." msgstr "" -"Trả lời: `Add:add` tiêu thụ `self`. Nếu kiểu `T` mà ta muốn overloading toán " -"tử không implement `Copy`, ta cũng nên cân nhắc overload toán tử cho `&T`. " +"Trả lời: `Add:add` tiêu thụ `self`. Nếu kiểu `T` mà ta muốn overloading toán" +" tử không implement `Copy`, ta cũng nên cân nhắc overload toán tử cho `&T`. " "Như vậy ta có thể tránh việc clone không cần thiết tại thời điểm gọi hàm." #: src/std-traits/operators.md msgid "" -"Why is `Output` an associated type? Could it be made a type parameter of the " -"method?" +"Why is `Output` an associated type? Could it be made a type parameter of the" +" method?" msgstr "" "Tại sao `Output` là một associated type? Có thể thay thế `Output` bằng một " "tham số generic cho hàm không?" @@ -6756,13 +7352,14 @@ msgstr "" #: 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 " -"facilitate type conversions:" +"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 "" -"Ta có thể implement trait [`From`](https://doc.rust-lang.org/std/convert/" -"trait.From.html) và [`Into`](https://doc.rust-lang.org/std/convert/trait." -"Into.html) để đơn giản hoá việc chuyển đổi kiểu dữ liệu:" +"Ta có thể implement trait [`From`](https://doc.rust-" +"lang.org/std/convert/trait.From.html) và [`Into`](https://doc.rust-" +"lang.org/std/convert/trait.Into.html) để đơn giản hoá việc chuyển đổi kiểu " +"dữ liệu:" #: src/std-traits/from-and-into.md msgid "\"{s}, {addr}, {one}, {bigger}\"" @@ -6771,20 +7368,20 @@ 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 "" "[`Into`](https://doc.rust-lang.org/std/convert/trait.Into.html) sẽ tự động " -"được implement khi [`From`](https://doc.rust-lang.org/std/convert/trait.From." -"html) được implement:" +"được implement khi [`From`](https://doc.rust-" +"lang.org/std/convert/trait.From.html) được implement:" #: 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." msgstr "" -"Vì vậy, thông thường ta chỉ cần implement `From`, vì kiểu dữ liệu của bạn sẽ " -"tự động có `Into`." +"Vì vậy, thông thường ta chỉ cần implement `From`, vì kiểu dữ liệu của bạn sẽ" +" tự động có `Into`." #: src/std-traits/from-and-into.md msgid "" @@ -6795,8 +7392,8 @@ msgid "" msgstr "" "Ngược lại, khi ta muốn khai báo 1 hàm nhận \"bất kỳ kiểu dữ liệu nào có thể " "chuyển đổi thành `String`\", ta nên sử dụng `Into`. Như vậy, hàm được khai " -"báo sẽ chấp nhận các kiểu dữ liệu implement `From` và những kiểu dữ liệu chỉ " -"implement `Into`." +"báo sẽ chấp nhận các kiểu dữ liệu implement `From` và những kiểu dữ liệu chỉ" +" implement `Into`." #: src/std-traits/casting.md msgid "" @@ -6834,8 +7431,8 @@ 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 " +"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 "" "Ép kiểu dữ liệu với `as` là một công cụ khá mạnh nên dễ bị sử dụng sai, có " @@ -6874,8 +7471,8 @@ msgstr "" #: src/std-traits/casting.md msgid "This is common in casting integers to `usize` for use as an index." msgstr "" -"Một trường hợp ngoại lệ là khi ép kiểu số nguyên sang `usize` để sử dụng làm " -"index trong array." +"Một trường hợp ngoại lệ là khi ép kiểu số nguyên sang `usize` để sử dụng làm" +" index trong array." #: src/std-traits/read-and-write.md msgid "" @@ -6883,8 +7480,8 @@ msgid "" "[`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), you can " "abstract over `u8` sources:" msgstr "" -"Bằng cách sử dụng [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) " -"và [`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), ta có " +"Bằng cách sử dụng [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html)" +" và [`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html), ta có " "thể đọc dữ liệu văn bản từ một mảng `u8`:" #: src/std-traits/read-and-write.md @@ -6901,8 +7498,8 @@ msgstr "\"số dòng trong file: {}\"" #: src/std-traits/read-and-write.md msgid "" -"Similarly, [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) lets " -"you abstract over `u8` sinks:" +"Similarly, [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) lets" +" you abstract over `u8` sinks:" msgstr "" "Tương tự, [`Write`](https://doc.rust-lang.org/std/io/trait.Write.html) cho " "phép ta ghi dữ liệu văn bản vào một mảng `u8`:" @@ -6924,8 +7521,8 @@ msgid "" "[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait " "produces a default value for a type." msgstr "" -"Kiểu dữ liệu implement trait [`Default`](https://doc.rust-lang.org/std/" -"default/trait.Default.html) sẽ sở hữu một giá trị mặc định." +"Kiểu dữ liệu implement trait [`Default`](https://doc.rust-" +"lang.org/std/default/trait.Default.html) sẽ sở hữu một giá trị mặc định." #: src/std-traits/default.md msgid "\"John Smith\"" @@ -6950,7 +7547,8 @@ msgstr "\"{:#?}\"" #: src/std-traits/default.md msgid "" -"It can be implemented directly or it can be derived via `#[derive(Default)]`." +"It can be implemented directly or it can be derived via " +"`#[derive(Default)]`." msgstr "" "Người dùng có thể trực tiếp implement trait này, hoặc derive trait này bằng " "`#[derive(Default)]`." @@ -6960,8 +7558,8 @@ msgid "" "A derived implementation will produce a value where all fields are set to " "their default values." msgstr "" -"Khi derive trait này, từng miền của giá trị mặc định được tạo ra sẽ được gán " -"bằng giá trị mặc định của kiểu dữ liệu tương ứng." +"Khi derive trait này, từng miền của giá trị mặc định được tạo ra sẽ được gán" +" bằng giá trị mặc định của kiểu dữ liệu tương ứng." #: src/std-traits/default.md msgid "This means all types in the struct must implement `Default` too." @@ -6977,7 +7575,8 @@ msgstr "" #: src/std-traits/default.md msgid "The partial struct initialization works nicely with default." -msgstr "Trait này rất hữu dụng khi ta cần khởi tạo struct chỉ với một ít miền." +msgstr "" +"Trait này rất hữu dụng khi ta cần khởi tạo struct chỉ với một ít miền." #: src/std-traits/default.md msgid "" @@ -6990,37 +7589,43 @@ msgstr "" #: src/std-traits/default.md 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 "" -"Dấu `..` còn được gọi là [ký hiệu update struct](https://doc.rust-lang.org/" -"book/ch05-01-defining-structs.html#creating-instances-from-other-instances-" -"with-struct-update-syntax)." +"Dấu `..` còn được gọi là [ký hiệu update struct](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:" +"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 "" +"Các bao đóng hoặc biểu thức lambda có các loại không thể đặt tên. Tuy nhiên," +" họ triển khai các đặc điểm [`Fn`](https://doc.rust-" +"lang.org/std/ops/trait.Fn.html), [`FnMut`](https://doc.rust-" +"lang.org/std/ops/trait.FnMut.html) và [`FnOnce`](https://doc.rust-" +"lang.org/std/ops/trait.FnOnce.html):" #: src/std-traits/closures.md msgid "\"Calling function on {input}\"" -msgstr "" +msgstr "\"Chức năng gọi trên {input}\"" #: src/std-traits/closures.md msgid "\"add_3: {}\"" -msgstr "" +msgstr "\"thêm_3: {}\"" #: src/std-traits/closures.md msgid "\"accumulate: {}\"" -msgstr "" +msgstr "\"tích lũy: {}\"" #: src/std-traits/closures.md msgid "\"multiply_sum: {}\"" -msgstr "" +msgstr "\"nhân_tổng: {}\"" #: src/std-traits/closures.md msgid "" @@ -7028,50 +7633,70 @@ msgid "" "perhaps captures nothing at all. It can be called multiple times " "concurrently." msgstr "" +"Một `Fn` (ví dụ: `add_3`) không tiêu thụ hay thay đổi các giá trị đã ghi lại" +" hoặc có thể không ghi lại gì cả. Nó có thể được gọi nhiều lần đồng thời." #: src/std-traits/closures.md msgid "" -"An `FnMut` (e.g. `accumulate`) might mutate captured values. You can call it " -"multiple times, but not concurrently." +"An `FnMut` (e.g. `accumulate`) might mutate captured values. You can call it" +" multiple times, but not concurrently." msgstr "" +"Một `FnMut` (ví dụ: `tích lũy`) có thể thay đổi các giá trị đã ghi. Bạn có " +"thể gọi nó nhiều lần, nhưng không đồng thời." #: 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." +"If you have an `FnOnce` (e.g. `multiply_sum`), you may only call it once. It" +" might consume captured values." msgstr "" +"Nếu bạn có `FnOnce` (ví dụ: `multiply_sum`), bạn chỉ có thể gọi nó một lần. " +"Nó có thể tiêu thụ các giá trị bị bắt." #: 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` là một kiểu con của `FnOnce`. `Fn` là một kiểu con của `FnMut` và " +"`FnOnce`. tức là bạn có thể sử dụng `FnMut` ở bất cứ nơi nào `FnOnce` được " +"gọi và bạn có thể sử dụng `Fn` ở bất cứ nơi nào `FnMut` hoặc `FnOnce` được " +"gọi." #: src/std-traits/closures.md msgid "" -"When you define a function that takes a closure, you should take `FnOnce` if " -"you can (i.e. you call it once), or `FnMut` else, and last `Fn`. This allows " -"the most flexibility for the caller." +"When you define a function that takes a closure, you should take `FnOnce` if" +" you can (i.e. you call it once), or `FnMut` else, and last `Fn`. This " +"allows the most flexibility for the caller." msgstr "" +"Khi bạn xác định một hàm có bao đóng, bạn nên lấy `FnOnce` nếu có thể (tức " +"là bạn gọi nó một lần) hoặc `FnMut` nếu không và cuối cùng là `Fn`. Điều này" +" mang lại sự linh hoạt nhất cho người gọi." #: src/std-traits/closures.md 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`." +"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 "" +"Ngược lại, khi bạn có một bao đóng, linh hoạt nhất bạn có thể có là `Fn` (nó" +" có thể được chuyển đi khắp mọi nơi), sau đó là `FnMut` và cuối cùng là " +"`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 "" +"compiler cũng suy ra `Copy` (ví dụ: đối với `add_3`) và `Clone` (ví dụ: " +"`multiply_sum`), tùy thuộc vào nội dung mà bao đóng nắm bắt." #: src/std-traits/closures.md msgid "" "By default, closures will capture by reference if they can. The `move` " "keyword makes them capture by value." msgstr "" +"Theo mặc định, các bao đóng sẽ thu thập bằng tham chiếu nếu có thể. Từ khóa " +"`move` làm cho chúng nắm bắt theo giá trị." #: src/std-traits/closures.md src/smart-pointers/trait-objects.md msgid "\"{} {}\"" @@ -7079,41 +7704,47 @@ msgstr "" #: src/std-traits/closures.md msgid "\"Hi\"" -msgstr "" +msgstr "\"CHÀO\"" #: src/std-traits/closures.md msgid "\"Greg\"" -msgstr "" +msgstr "\"Greg\"" #: 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 "" +"Trong ví dụ này, bạn sẽ triển khai mật mã [\"ROT13\" cổ " +"điển](https://en.wikipedia.org/wiki/ROT13). Sao chép mã này vào sân chơi và " +"triển khai các bit còn thiếu. Chỉ xoay các ký tự chữ cái ASCII, để đảm bảo " +"kết quả vẫn hợp lệ UTF-8." #: src/std-traits/exercise.md msgid "// Implement the `Read` trait for `RotDecoder`.\n" -msgstr "" +msgstr "// Triển khai trait `Read` cho `RotDecode`.\n" #: src/std-traits/exercise.md src/std-traits/solution.md msgid "\"Gb trg gb gur bgure fvqr!\"" -msgstr "" +msgstr "\"Gb trg gb gur bgure fvqr!\"" #: src/std-traits/exercise.md src/std-traits/solution.md msgid "\"To get to the other side!\"" -msgstr "" +msgstr "\"Để sang bên kia!\"" #: 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 "" +"Điều gì xảy ra nếu bạn xâu chuỗi hai phiên bản `RotDecoding` lại với nhau, " +"mỗi phiên bản xoay 13 ký tự?" #: src/std-traits/solution.md msgid "'A'" -msgstr "" +msgstr "'MỘT'" #: src/welcome-day-3.md msgid "Welcome to Day 3" @@ -7146,155 +7777,183 @@ msgstr "" #: src/memory-management.md src/memory-management/clone.md msgid "Clone" -msgstr "" +msgstr "Dòng vô tính" #: src/memory-management.md msgid "Drop" -msgstr "" +msgstr "Làm rơi" #: src/memory-management/review.md msgid "Programs allocate memory in two ways:" -msgstr "" +msgstr "Các chương trình cấp phát bộ nhớ theo hai cách:" #: src/memory-management/review.md msgid "Stack: Continuous area of memory for local variables." -msgstr "" +msgstr "Ngăn xếp: Vùng bộ nhớ liên tục cho các biến cục bộ." #: src/memory-management/review.md msgid "Values have fixed sizes known at compile time." -msgstr "" +msgstr "Các giá trị có kích thước cố định được biết tại thời điểm biên dịch." #: src/memory-management/review.md msgid "Extremely fast: just move a stack pointer." -msgstr "" +msgstr "Cực kỳ nhanh: chỉ cần di chuyển con trỏ ngăn xếp." #: src/memory-management/review.md msgid "Easy to manage: follows function calls." -msgstr "" +msgstr "Dễ quản lý: tuân theo các lệnh gọi hàm." #: src/memory-management/review.md msgid "Great memory locality." -msgstr "" +msgstr "Địa phương ký ức tuyệt vời." #: src/memory-management/review.md msgid "Heap: Storage of values outside of function calls." -msgstr "" +msgstr "Heap: Lưu trữ các giá trị bên ngoài lệnh gọi hàm." #: src/memory-management/review.md msgid "Values have dynamic sizes determined at runtime." -msgstr "" +msgstr "Các giá trị có kích thước động được xác định trong thời gian chạy." #: src/memory-management/review.md msgid "Slightly slower than the stack: some book-keeping needed." -msgstr "" +msgstr "Chậm hơn một chút so với ngăn xếp: cần ghi chép sổ sách một chút." #: src/memory-management/review.md msgid "No guarantee of memory locality." -msgstr "" +msgstr "Không đảm bảo về vị trí bộ nhớ." #: src/memory-management/review.md msgid "" "Creating a `String` puts fixed-sized metadata on the stack and dynamically " "sized data, the actual string, on the heap:" msgstr "" +"Việc tạo một `Chuỗi` sẽ đặt siêu dữ liệu có kích thước cố định vào ngăn xếp " +"và dữ liệu có kích thước động, chuỗi thực, trên heap:" #: 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." msgstr "" +"Đề cập rằng `Chuỗi` được hỗ trợ bởi `Vec`, do đó, nó có dung lượng và độ dài" +" và có thể phát triển nếu có thể thay đổi thông qua phân bổ lại trên vùng " +"heap." #: src/memory-management/review.md msgid "" -"If students ask about it, you can mention that the underlying memory is heap " -"allocated using the [System Allocator](https://doc.rust-lang.org/std/alloc/" -"struct.System.html) and custom allocators can be implemented using the " -"[Allocator API](https://doc.rust-lang.org/std/alloc/index.html)" +"If students ask about it, you can mention that the underlying memory is heap" +" allocated using the [System Allocator](https://doc.rust-" +"lang.org/std/alloc/struct.System.html) and custom allocators can be " +"implemented using the [Allocator API](https://doc.rust-" +"lang.org/std/alloc/index.html)" msgstr "" +"Nếu học sinh hỏi về điều đó, bạn có thể đề cập rằng bộ nhớ cơ bản được phân " +"bổ heap bằng [System Allocator](https://doc.rust-" +"lang.org/std/alloc/struct.System.html) và bộ cấp phát tùy chỉnh có thể được " +"triển khai bằng [API Allocator](https://doc.rust-" +"lang.org/std/alloc/index.html)" #: src/memory-management/review.md msgid "" "We can inspect the memory layout with `unsafe` Rust. However, you should " "point out that this is rightfully unsafe!" msgstr "" +"Chúng ta có thể kiểm tra bố cục bộ nhớ bằng `unsafe` Rust. Tuy nhiên, bạn " +"nên chỉ ra rằng điều này thực sự không an toàn!" #: src/memory-management/review.md src/testing/unit-tests.md msgid "' '" -msgstr "" +msgstr "''" #: src/memory-management/review.md msgid "\"world\"" -msgstr "" +msgstr "\"thế giới\"" #: 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 "" +"// ĐỪNG LÀM ĐIỀU NÀY Ở NHÀ! Chỉ dành cho mục đích giáo dục.\n" +" // Chuỗi không đảm bảo gì về bố cục của nó, vì vậy điều này có thể dẫn đến\n" +" // hành vi không xác định.\n" #: src/memory-management/review.md msgid "\"capacity = {capacity}, ptr = {ptr:#x}, len = {len}\"" -msgstr "" +msgstr "\"dung lượng = {dung lượng}, ptr = {ptr:#x}, len = {len}\"" #: src/memory-management/approaches.md msgid "Traditionally, languages have fallen into two broad categories:" -msgstr "" +msgstr "Theo truyền thống, các ngôn ngữ được chia thành hai loại lớn:" #: src/memory-management/approaches.md msgid "Full control via manual memory management: C, C++, Pascal, ..." msgstr "" +"Kiểm soát hoàn toàn thông qua quản lý bộ nhớ thủ công: C, C++, Pascal, ..." #: src/memory-management/approaches.md msgid "Programmer decides when to allocate or free heap memory." msgstr "" +"Lập trình viên quyết định thời điểm phân bổ hoặc giải phóng bộ nhớ heap." #: src/memory-management/approaches.md msgid "" "Programmer must determine whether a pointer still points to valid memory." msgstr "" +"Lập trình viên phải xác định xem con trỏ có còn trỏ đến bộ nhớ hợp lệ hay " +"không." #: src/memory-management/approaches.md msgid "Studies show, programmers make mistakes." -msgstr "" +msgstr "Nghiên cứu cho thấy, lập trình viên mắc sai lầm." #: src/memory-management/approaches.md msgid "" "Full safety via automatic memory management at runtime: Java, Python, Go, " "Haskell, ..." msgstr "" +"An toàn tuyệt đối thông qua quản lý bộ nhớ tự động khi chạy: Java, Python, " +"Go, Haskell, ..." #: src/memory-management/approaches.md msgid "" "A runtime system ensures that memory is not freed until it can no longer be " "referenced." msgstr "" +"Hệ thống thời gian chạy đảm bảo rằng bộ nhớ không được giải phóng cho đến " +"khi nó không còn được tham chiếu nữa." #: src/memory-management/approaches.md msgid "" "Typically implemented with reference counting, garbage collection, or RAII." msgstr "" +"Thường được triển khai bằng cách đếm tham chiếu, thu gom rác hoặc RAII." #: src/memory-management/approaches.md msgid "Rust offers a new mix:" -msgstr "" +msgstr "Rust đưa ra một sự kết hợp mới:" #: src/memory-management/approaches.md msgid "" "Full control _and_ safety via compile time enforcement of correct memory " "management." msgstr "" +"Kiểm soát hoàn toàn _and_ sự an toàn thông qua việc thực thi thời gian biên " +"dịch để quản lý bộ nhớ chính xác." #: src/memory-management/approaches.md msgid "It does this with an explicit ownership concept." -msgstr "" +msgstr "Nó thực hiện điều này với một khái niệm quyền sở hữu rõ ràng." #: src/memory-management/approaches.md msgid "" "This slide is intended to help students coming from other languages to put " "Rust in context." msgstr "" +"Trang trình bày này nhằm giúp học viên đến từ các ngôn ngữ khác hiểu được " +"Rust trong ngữ cảnh." #: src/memory-management/approaches.md msgid "" @@ -7302,6 +7961,9 @@ msgid "" "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 phải quản lý heap thủ công bằng `malloc` và `free`. Các lỗi phổ biến bao " +"gồm quên gọi `free`, gọi nó nhiều lần cho cùng một con trỏ hoặc hủy tham " +"chiếu một con trỏ sau khi bộ nhớ mà nó trỏ tới đã được giải phóng." #: src/memory-management/approaches.md msgid "" @@ -7310,6 +7972,10 @@ msgid "" "is freed when a function returns. It is still quite easy to mis-use these " "tools and create similar bugs to C." msgstr "" +"C++ có các công cụ như con trỏ thông minh (`unique_ptr`, `shared_ptr`) tận " +"dụng sự bảo đảm ngôn ngữ về việc gọi hàm hủy để đảm bảo bộ nhớ được giải " +"phóng khi hàm trả về. Vẫn còn khá dễ dàng sử dụng sai các công cụ này và tạo" +" ra các lỗi tương tự như C." #: src/memory-management/approaches.md msgid "" @@ -7318,34 +7984,51 @@ msgid "" "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 và Python dựa vào trình thu thập rác để xác định bộ nhớ không thể " +"truy cập được nữa và loại bỏ nó. Điều này đảm bảo rằng bất kỳ con trỏ nào " +"cũng có thể bị hủy đăng ký, loại bỏ lỗi use-after-free và các loại lỗi khác." +" Tuy nhiên, GC có chi phí thời gian chạy và khó điều chỉnh đúng cách." #: 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 -- " +"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 "" +"Trong nhiều trường hợp, mô hình sở hữu và vay mượn của Rust có thể đạt được " +"hiệu suất của C, với các hoạt động được phân bổ và tự do chính xác ở những " +"nơi chúng được yêu cầu -- không tốn chi phí. Nó cũng cung cấp các công cụ " +"tương tự như con trỏ thông minh của C++. Khi được yêu cầu, các tùy chọn khác" +" như tính tham chiếu đều có sẵn và thậm chí còn có các crate của bên thứ ba " +"để hỗ trợ thu thập rác trong thời gian chạy (không được đề cập trong lớp " +"này)." #: 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 "" +"Tất cả các liên kết biến đều có _scope_ trong đó chúng hợp lệ và sẽ là lỗi " +"khi sử dụng một biến ngoài phạm vi của nó:" #: src/memory-management/ownership.md msgid "" "We say that the variable _owns_ the value. Every Rust value has precisely " "one owner at all times." msgstr "" +"Chúng ta nói rằng biến _sở hữu_ giá trị. Mỗi giá trị Rust luôn có chính xác " +"một chủ sở hữu." #: src/memory-management/ownership.md msgid "" "At the end of the scope, the variable is _dropped_ and the data is freed. A " "destructor can run here to free up resources." msgstr "" +"Ở cuối phạm vi, biến bị _dropped_ và dữ liệu được giải phóng. Một hàm hủy có" +" thể chạy ở đây để giải phóng tài nguyên." #: src/memory-management/ownership.md msgid "" @@ -7353,38 +8036,44 @@ msgid "" "garbage collector starts with a set of \"roots\" to find all reachable " "memory. Rust's \"single owner\" principle is a similar idea." msgstr "" +"Học sinh quen với việc triển khai thu gom rác sẽ biết rằng trình thu gom rác" +" bắt đầu bằng một tập hợp \"gốc\" để tìm tất cả bộ nhớ có thể truy cập. " +"Nguyên tắc \"sở hữu duy nhất\" của Rust cũng là một ý tưởng tương tự." #: src/memory-management/move.md msgid "An assignment will transfer _ownership_ between variables:" -msgstr "" +msgstr "Một bài tập sẽ chuyển _ownership_ giữa các biến:" #: src/memory-management/move.md msgid "\"Hello!\"" -msgstr "" +msgstr "\"Xin chào!\"" #: src/memory-management/move.md msgid "// println!(\"s1: {s1}\");\n" -msgstr "" +msgstr "// println!(\"s1: {s1}\");\n" #: src/memory-management/move.md msgid "The assignment of `s1` to `s2` transfers ownership." -msgstr "" +msgstr "Việc gán `s1` cho `s2` sẽ chuyển quyền sở hữu." #: src/memory-management/move.md -msgid "When `s1` goes out of scope, nothing happens: it does not own anything." +msgid "" +"When `s1` goes out of scope, nothing happens: it does not own anything." msgstr "" +"Khi `s1` nằm ngoài phạm vi, không có gì xảy ra: nó không sở hữu bất cứ thứ " +"gì." #: src/memory-management/move.md msgid "When `s2` goes out of scope, the string data is freed." -msgstr "" +msgstr "Khi `s2` vượt quá phạm vi, dữ liệu chuỗi sẽ được giải phóng." #: src/memory-management/move.md msgid "Before move to `s2`:" -msgstr "" +msgstr "Trước khi chuyển sang `s2`:" #: src/memory-management/move.md msgid "After move to `s2`:" -msgstr "" +msgstr "Sau khi chuyển sang `s2`:" #: src/memory-management/move.md msgid "" @@ -7409,31 +8098,56 @@ msgid "" "`- - - - - - - - - - - - - -'\n" "```" msgstr "" +"``` bob\n" +" đống đống\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - -.\n" +": : : :\n" +": s1 \"(không thể truy cập)\" : : :\n" +": +----------+-------+ : : +----+----+----+----+------+----+ :\n" +": | ptr | o---+---+--+--+-->| H | e | tôi | tôi | o | ! | :\n" +": | len | 6 | : | : +----+----+----+----+----+----+ :\n" +": | công suất | 6 | : | : :\n" +": +----------+-------+ : | : :\n" +": : | `- - - - - - - - - - - - - - - - - -'\n" +": s2 : |\n" +": +----------+-------+ : |\n" +": | ptr | o---+---+--'\n" +": | len | 6 | :\n" +": | công suất | 6 | :\n" +": +----------+-------+ :\n" +": :\n" +"`- - - - - - - - - - - - - -'\n" +"```" #: src/memory-management/move.md msgid "" "When you pass a value to a function, the value is assigned to the function " "parameter. This transfers ownership:" msgstr "" +"Khi bạn truyền một giá trị cho hàm, giá trị đó sẽ được gán cho tham số của " +"hàm. Điều này chuyển quyền sở hữu:" #: src/memory-management/move.md src/memory-management/clone.md msgid "\"Hello {name}\"" -msgstr "" +msgstr "\"Xin chào {tên}\"" #: src/memory-management/move.md src/memory-management/clone.md #: src/android/interoperability/java.md msgid "\"Alice\"" -msgstr "" +msgstr "\"Alice\"" #: src/memory-management/move.md msgid "// say_hello(name);\n" -msgstr "" +msgstr "// say_hello(tên);\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!)." msgstr "" +"Đề cập rằng điều này trái ngược với các giá trị mặc định trong C++, sao chép" +" theo giá trị trừ khi bạn sử dụng `std::move` (và hàm tạo di chuyển đã được " +"xác định!)." #: src/memory-management/move.md msgid "" @@ -7441,262 +8155,327 @@ msgid "" "to manipulate the data itself is a matter of optimization, and such copies " "are aggressively optimized away." msgstr "" +"Chỉ có quyền sở hữu mới di chuyển. Việc bất kỳ mã máy nào được tạo ra để " +"thao tác với dữ liệu hay không đều là vấn đề tối ưu hóa và các bản sao đó sẽ" +" được tối ưu hóa mạnh mẽ." #: src/memory-management/move.md msgid "" "Simple values (such as integers) can be marked `Copy` (see later slides)." msgstr "" +"Các giá trị đơn giản (chẳng hạn như số nguyên) có thể được đánh dấu là `Sao " +"chép` (xem các trang trình bày sau)." #: src/memory-management/move.md msgid "In Rust, clones are explicit (by using `clone`)." -msgstr "" +msgstr "Trong Rust, các bản sao là rõ ràng (bằng cách sử dụng `clone`)." #: src/memory-management/move.md msgid "In the `say_hello` example:" -msgstr "" +msgstr "Trong ví dụ `say_hello`:" #: src/memory-management/move.md msgid "" "With the first call to `say_hello`, `main` gives up ownership of `name`. " "Afterwards, `name` cannot be used anymore within `main`." msgstr "" +"Với lệnh gọi đầu tiên tới `say_hello`, `main` sẽ từ bỏ quyền sở hữu `name`. " +"Sau đó, `name` không thể được sử dụng nữa trong `main`." #: src/memory-management/move.md msgid "" "The heap memory allocated for `name` will be freed at the end of the " "`say_hello` function." msgstr "" +"Bộ nhớ heap được phân bổ cho `name` sẽ được giải phóng khi kết thúc hàm " +"`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` có thể giữ quyền sở hữu nếu nó chuyển `name` làm tham chiếu (`&name`)" +" và nếu `say_hello` chấp nhận tham chiếu làm tham số." #: src/memory-management/move.md msgid "" -"Alternatively, `main` can pass a clone of `name` in the first call (`name." -"clone()`)." +"Alternatively, `main` can pass a clone of `name` in the first call " +"(`name.clone()`)." msgstr "" +"Ngoài ra, `main` có thể chuyển một bản sao của `name` trong lệnh gọi đầu " +"tiên (`name.clone()`)." #: src/memory-management/move.md 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 khiến việc vô tình tạo bản sao trở nên khó hơn C++ bằng cách đặt ngữ " +"nghĩa di chuyển làm mặc định và bằng cách buộc các lập trình viên tạo các " +"bản sao rõ ràng." #: src/memory-management/move.md msgid "Defensive Copies in Modern C++" -msgstr "" +msgstr "Bản sao phòng thủ trong C++ hiện đại" #: src/memory-management/move.md msgid "Modern C++ solves this differently:" -msgstr "" +msgstr "C++ hiện đại giải quyết vấn đề này theo cách khác:" #: src/memory-management/move.md msgid "\"Cpp\"" -msgstr "" +msgstr "\"Cpp\"" #: src/memory-management/move.md msgid "// Duplicate the data in s1.\n" -msgstr "" +msgstr "// Sao chép dữ liệu trong s1.\n" #: src/memory-management/move.md msgid "" -"The heap data from `s1` is duplicated and `s2` gets its own independent copy." +"The heap data from `s1` is duplicated and `s2` gets its own independent " +"copy." msgstr "" +"Dữ liệu heap từ `s1` được sao chép và `s2` có bản sao độc lập của riêng nó." #: src/memory-management/move.md msgid "When `s1` and `s2` go out of scope, they each free their own memory." -msgstr "" +msgstr "Khi `s1` và `s2` vượt quá phạm vi, chúng sẽ giải phóng bộ nhớ riêng." #: src/memory-management/move.md msgid "Before copy-assignment:" -msgstr "" +msgstr "Trước khi chuyển nhượng bản sao:" #: src/memory-management/move.md msgid "After copy-assignment:" -msgstr "" +msgstr "Sau khi gán bản sao:" #: src/memory-management/move.md msgid "" -"C++ has made a slightly different choice than Rust. Because `=` copies data, " -"the string data has to be cloned. Otherwise we would get a double-free when " -"either string goes out of scope." +"C++ has made a slightly different choice than Rust. Because `=` copies data," +" the string data has to be cloned. Otherwise we would get a double-free when" +" either string goes out of scope." msgstr "" +"C++ đã đưa ra lựa chọn hơi khác so với Rust. Vì `=` sao chép dữ liệu nên dữ " +"liệu chuỗi phải được sao chép. Nếu không, chúng tôi sẽ nhận được double-free" +" khi một trong hai chuỗi vượt quá phạm vi." #: src/memory-management/move.md 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 " +"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`." msgstr "" +"C++ cũng có [`std::move`](https://en.cppreference.com/w/cpp/utility/move), " +"được sử dụng để cho biết khi nào một giá trị có thể được di chuyển từ đó. " +"Nếu ví dụ là `s2 = std::move(s1)`, thì việc phân bổ heap sẽ không diễn ra. " +"Sau khi di chuyển, `s1` sẽ ở trạng thái hợp lệ nhưng không được chỉ định. " +"Không giống như Rust, lập trình viên được phép tiếp tục sử dụng `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." msgstr "" +"Không giống như Rust, `=` trong C++ có thể chạy mã tùy ý tùy theo loại đang " +"được sao chép hoặc di chuyển." #: src/memory-management/clone.md msgid "" "Sometimes you _want_ to make a copy of a value. The `Clone` trait " "accomplishes this." msgstr "" +"Đôi khi bạn _muốn_ tạo một bản sao của một giá trị. Đặc điểm `Clone` thực " +"hiện được điều này." #: 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!` or `Box::new`." msgstr "" +"Ý tưởng của `Clone` là giúp bạn dễ dàng phát hiện ra nơi đang diễn ra quá " +"trình phân bổ heap. Hãy tìm `.clone()` và một số khác như `vec!` hoặc " +"`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." msgstr "" +"Việc \"sao chép theo cách của bạn\" các vấn đề với trình kiểm tra khoản vay " +"là điều bình thường và quay lại sau để cố gắng tối ưu hóa những bản sao đó." #: src/memory-management/clone.md msgid "" -"`clone` generally performs a deep copy of the value, meaning that if you e." -"g. clone an array, all of the elements of the array are cloned as well." +"`clone` generally performs a deep copy of the value, meaning that if you " +"e.g. clone an array, all of the elements of the array are cloned as well." msgstr "" +"`clone` thường thực hiện một bản sao sâu của giá trị, nghĩa là nếu bạn ví " +"dụ: sao chép một mảng thì tất cả các phần tử của mảng cũng được sao chép." #: src/memory-management/clone.md msgid "" "The behavior for `clone` is user-defined, so it can perform custom cloning " "logic if needed." msgstr "" +"Hành vi của `clone` là do người dùng xác định, do đó, nó có thể thực hiện " +"logic nhân bản tùy chỉnh nếu cần." #: src/memory-management/copy-types.md msgid "" "While move semantics are the default, certain types are copied by default:" msgstr "" +"Trong khi ngữ nghĩa di chuyển là mặc định, một số loại nhất định được sao " +"chép theo mặc định:" #: src/memory-management/copy-types.md msgid "These types implement the `Copy` trait." -msgstr "" +msgstr "Những loại này triển khai đặc điểm `Sao chép`." #: src/memory-management/copy-types.md msgid "You can opt-in your own types to use copy semantics:" msgstr "" +"Bạn có thể chọn tham gia các loại của riêng mình để sử dụng ngữ nghĩa sao " +"chép:" #: src/memory-management/copy-types.md msgid "After the assignment, both `p1` and `p2` own their own data." -msgstr "" +msgstr "Sau khi gán, cả `p1` và `p2` đều sở hữu dữ liệu của riêng mình." #: src/memory-management/copy-types.md msgid "We can also use `p1.clone()` to explicitly copy the data." msgstr "" +"Chúng ta cũng có thể sử dụng `p1.clone()` để sao chép dữ liệu một cách rõ " +"ràng." #: src/memory-management/copy-types.md msgid "Copying and cloning are not the same thing:" -msgstr "" +msgstr "Sao chép và nhân bản không giống nhau:" #: src/memory-management/copy-types.md msgid "" "Copying refers to bitwise copies of memory regions and does not work on " "arbitrary objects." msgstr "" +"Sao chép đề cập đến các bản sao theo bit của vùng bộ nhớ và không hoạt động " +"trên các đối tượng tùy ý." #: src/memory-management/copy-types.md msgid "" "Copying does not allow for custom logic (unlike copy constructors in C++)." msgstr "" +"Sao chép không cho phép logic tùy chỉnh (không giống như các hàm tạo sao " +"chép trong C++)." #: src/memory-management/copy-types.md msgid "" "Cloning is a more general operation and also allows for custom behavior by " "implementing the `Clone` trait." msgstr "" +"Nhân bản là một hoạt động tổng quát hơn và cũng cho phép thực hiện hành vi " +"tùy chỉnh bằng cách triển khai đặc điểm `Clone`." #: src/memory-management/copy-types.md msgid "Copying does not work on types that implement the `Drop` trait." -msgstr "" +msgstr "Sao chép không hoạt động trên các loại triển khai đặc điểm `Drop`." #: src/memory-management/copy-types.md msgid "In the above example, try the following:" -msgstr "" +msgstr "Trong ví dụ trên, hãy thử làm như sau:" #: 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 "" +"Thêm trường `String` vào `struct Point`. Nó sẽ không biên dịch vì `String` " +"không phải là loại `Copy`." #: src/memory-management/copy-types.md msgid "" "Remove `Copy` from the `derive` attribute. The compiler error is now in the " "`println!` for `p1`." msgstr "" +"Xóa `Sao chép` khỏi thuộc tính `derive`. Lỗi compiler hiện nằm trong " +"`println!` cho `p1`." #: src/memory-management/copy-types.md msgid "Show that it works if you clone `p1` instead." -msgstr "" +msgstr "Chứng tỏ rằng nó hoạt động nếu bạn sao chép `p1`." #: src/memory-management/drop.md msgid "The `Drop` Trait" -msgstr "" +msgstr "Đặc điểm 'Thả'" #: src/memory-management/drop.md 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:" +"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 "" +"Các giá trị triển khai [`Drop`](https://doc.rust-" +"lang.org/std/ops/trait.Drop.html) có thể chỉ định mã để chạy khi chúng vượt " +"quá phạm vi:" #: src/memory-management/drop.md msgid "\"Dropping {}\"" -msgstr "" +msgstr "\"Thả {}\"" -#: src/memory-management/drop.md src/concurrency/sync-exercises/link-checker.md +#: src/memory-management/drop.md +#: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"a\"" -msgstr "" +msgstr "\"Một\"" #: src/memory-management/drop.md src/android/testing/googletest.md msgid "\"b\"" -msgstr "" +msgstr "\"b\"" #: src/memory-management/drop.md msgid "\"c\"" -msgstr "" +msgstr "\"c\"" #: src/memory-management/drop.md msgid "\"d\"" -msgstr "" +msgstr "\"d\"" #: src/memory-management/drop.md msgid "\"Exiting block B\"" -msgstr "" +msgstr "\"Ra khỏi khối B\"" #: src/memory-management/drop.md msgid "\"Exiting block A\"" -msgstr "" +msgstr "\"Ra khỏi khối A\"" #: src/memory-management/drop.md msgid "\"Exiting main\"" -msgstr "" +msgstr "\"Thoát chính\"" #: src/memory-management/drop.md msgid "Note that `std::mem::drop` is not the same as `std::ops::Drop::drop`." -msgstr "" +msgstr "Lưu ý rằng `std::mem::drop` không giống với `std::ops::Drop::drop`." #: src/memory-management/drop.md msgid "Values are automatically dropped when they go out of scope." -msgstr "" +msgstr "Các giá trị sẽ tự động bị loại bỏ khi chúng vượt quá phạm vi." #: src/memory-management/drop.md msgid "" -"When a value is dropped, if it implements `std::ops::Drop` then its `Drop::" -"drop` implementation will be called." +"When a value is dropped, if it implements `std::ops::Drop` then its " +"`Drop::drop` implementation will be called." msgstr "" +"Khi một giá trị bị loại bỏ, nếu nó triển khai `std::ops::Drop` thì việc " +"triển khai `Drop::drop` của nó sẽ được gọi." #: src/memory-management/drop.md msgid "" -"All its fields will then be dropped too, whether or not it implements `Drop`." +"All its fields will then be dropped too, whether or not it implements " +"`Drop`." msgstr "" +"Sau đó, tất cả các trường của nó cũng sẽ bị loại bỏ, cho dù nó có triển khai" +" `Drop` hay không." #: src/memory-management/drop.md msgid "" @@ -7705,26 +8484,34 @@ msgid "" "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` chỉ là một hàm trống nhận bất kỳ giá trị nào. Điều quan " +"trọng là nó có quyền sở hữu giá trị, vì vậy khi kết thúc phạm vi, nó sẽ bị " +"loại bỏ. Điều này làm cho việc loại bỏ các giá trị một cách rõ ràng sớm hơn " +"mức chúng có thể vượt quá phạm vi là một cách thuận tiện." #: src/memory-management/drop.md msgid "" -"This can be useful for objects that do some work on `drop`: releasing locks, " -"closing files, etc." +"This can be useful for objects that do some work on `drop`: releasing locks," +" closing files, etc." msgstr "" +"Điều này có thể hữu ích cho các đối tượng thực hiện một số công việc trên " +"`drop`: giải phóng khóa, đóng tệp, v.v." #: src/memory-management/drop.md msgid "Why doesn't `Drop::drop` take `self`?" -msgstr "" +msgstr "Tại sao `Drop::drop` không nhận `self`?" #: src/memory-management/drop.md msgid "" "Short-answer: If it did, `std::mem::drop` would be called at the end of the " "block, resulting in another call to `Drop::drop`, and a stack overflow!" msgstr "" +"Câu trả lời ngắn: Nếu đúng như vậy, `std::mem::drop` sẽ được gọi ở cuối " +"khối, dẫn đến một lệnh gọi khác tới `Drop::drop` và tràn ngăn xếp!" #: src/memory-management/drop.md msgid "Try replacing `drop(a)` with `a.drop()`." -msgstr "" +msgstr "Hãy thử thay thế `drop(a)` bằng `a.drop()`." #: src/memory-management/exercise.md msgid "" @@ -7732,192 +8519,217 @@ msgid "" "data. We will use the \"builder pattern\" to support building a new value " "piece-by-piece, using convenience functions." msgstr "" +"Trong ví dụ này, chúng tôi sẽ triển khai một kiểu dữ liệu phức tạp sở hữu " +"tất cả dữ liệu của nó. Chúng tôi sẽ sử dụng \"mẫu xây dựng\" để hỗ trợ xây " +"dựng từng phần giá trị mới bằng cách sử dụng các chức năng tiện lợi." #: src/memory-management/exercise.md msgid "Fill in the missing pieces." -msgstr "" +msgstr "Điền vào những phần còn thiếu." #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// A representation of a software package.\n" -msgstr "" +msgstr "/// Biểu diễn một gói phần mềm.\n" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "" "/// Return a representation of this package as a dependency, for use in\n" " /// building other packages.\n" msgstr "" +"/// Trả về một biểu diễn của gói này dưới dạng phần phụ thuộc, để sử dụng trong\n" +" /// xây dựng các gói khác.\n" #: src/memory-management/exercise.md msgid "\"1\"" -msgstr "" +msgstr "\"1\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "" "/// A builder for a Package. Use `build()` to create the `Package` itself.\n" -msgstr "" +msgstr "/// Trình xây dựng cho Gói. Sử dụng `build()` để tự tạo `Gói`.\n" #: src/memory-management/exercise.md msgid "\"2\"" -msgstr "" +msgstr "\"2\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the package version.\n" -msgstr "" +msgstr "/// Đặt phiên bản gói.\n" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the package authors.\n" -msgstr "" +msgstr "/// Đặt tác giả gói.\n" #: src/memory-management/exercise.md msgid "\"3\"" -msgstr "" +msgstr "\"3\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Add an additional dependency.\n" -msgstr "" +msgstr "/// Thêm một phụ thuộc bổ sung.\n" #: src/memory-management/exercise.md msgid "\"4\"" -msgstr "" +msgstr "\"4\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "/// Set the language. If not set, language defaults to None.\n" -msgstr "" +msgstr "/// Đặt ngôn ngữ. Nếu không được đặt, ngôn ngữ mặc định là Không có.\n" #: src/memory-management/exercise.md msgid "\"5\"" -msgstr "" +msgstr "\"5\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"base64\"" -msgstr "" +msgstr "\"cơ sở64\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"0.13\"" -msgstr "" +msgstr "\"0,13\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"base64: {base64:?}\"" -msgstr "" +msgstr "\"base64: {base64:?}\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"log\"" -msgstr "" +msgstr "\"nhật ký\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"0.4\"" -msgstr "" +msgstr "\"0,4\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"log: {log:?}\"" -msgstr "" +msgstr "\"log: {log:?}\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"serde\"" -msgstr "" +msgstr "\"serde\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"djmitche\"" -msgstr "" +msgstr "\"djmitche\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"4.0\"" -msgstr "" +msgstr "\"4.0\"" #: src/memory-management/exercise.md src/memory-management/solution.md msgid "\"serde: {serde:?}\"" -msgstr "" +msgstr "\"serde: {serde:?}\"" #: src/memory-management/solution.md msgid "\"0.1\"" -msgstr "" +msgstr "\"0,1\"" #: src/smart-pointers.md msgid "Box" -msgstr "" +msgstr "Hộp" #: src/smart-pointers.md msgid "Rc" -msgstr "" +msgstr "Rc" #: src/smart-pointers/box.md 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) là một con trỏ " +"sở hữu tới dữ liệu trên heap:" #: src/smart-pointers/box.md msgid "\"five: {}\"" -msgstr "" +msgstr "\"năm: {}\"" #: 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)." +"methods from `T` directly on a `Box`](https://doc.rust-" +"lang.org/std/ops/trait.Deref.html#more-on-deref-coercion)." msgstr "" +"`Box` triển khai `Deref`, nghĩa là bạn có thể [gọi các phương" +" thức từ `T` trực tiếp trên `Box`](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`:" msgstr "" +"Kiểu dữ liệu đệ quy hoặc kiểu dữ liệu có kích thước động cần sử dụng `Box`:" #: src/smart-pointers/box.md msgid "/// A non-empty list: first element and the rest of the list.\n" msgstr "" +"/// Danh sách không trống: phần tử đầu tiên và phần còn lại của danh sách.\n" #: src/smart-pointers/box.md msgid "/// An empty list.\n" -msgstr "" +msgstr "/// Một danh sách trống.\n" #: src/smart-pointers/box.md msgid "\"{list:?}\"" -msgstr "" +msgstr "\"{danh sách:?}\"" #: src/smart-pointers/box.md msgid "" "```bob\n" " Stack Heap\n" -".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - " -"- - - - -.\n" +".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - - - - - -.\n" ": : : :\n" -": " -"list : : :\n" -": +---------+----+----+ : : +---------+----+----+ +------+----" -"+----+ :\n" -": | Element | 1 | o--+----+-----+--->| Element | 2 | o--+--->| Nil | // " -"| // | :\n" -": +---------+----+----+ : : +---------+----+----+ +------+----" -"+----+ :\n" +": list : : :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----+----+ :\n" +": | Element | 1 | o--+----+-----+--->| Element | 2 | o--+--->| Nil | // | // | :\n" +": +---------+----+----+ : : +---------+----+----+ +------+----+----+ :\n" ": : : :\n" ": : : :\n" -"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - " -"- - - - -'\n" +"'- - - - - - - - - - - - - - ' '- - - - - - - - - - - - - - - - - - - - - - - - -'\n" "```" msgstr "" +"``` bob\n" +" đống đống\n" +".- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - - - - -.\n" +": : : :\n" +": danh sách : : :\n" +": +----------+----+----+ : : +----------+----+---+ +------+----+----+ :\n" +": | Yếu tố | 1 | o--+----+------+--->| Yếu tố | 2 | o--+--->| Không | // | // | :\n" +": +----------+----+----+ : : +----------+----+---+ +------+----+----+ :\n" +": : : :\n" +": : : :\n" +"'- - - - - - - - - - - - - - '- - - - - - - - - - - - - - - - - - - - - - - -'\n" +"```" #: src/smart-pointers/box.md msgid "" "`Box` is like `std::unique_ptr` in C++, except that it's guaranteed to be " "not null." msgstr "" +"`Box` giống như `std::unique_ptr` trong C++, ngoại trừ việc nó được đảm bảo " +"là không rỗng." #: src/smart-pointers/box.md msgid "A `Box` can be useful when you:" -msgstr "" +msgstr "`Box` có thể hữu ích khi bạn:" #: src/smart-pointers/box.md msgid "" "have a type whose size that can't be known at compile time, but the Rust " "compiler wants to know an exact size." msgstr "" +"có một loại có kích thước không thể biết được tại thời điểm biên dịch, nhưng" +" compiler Rust muốn biết kích thước chính xác." #: 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." +"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." msgstr "" +"muốn chuyển quyền sở hữu một lượng lớn dữ liệu. Để tránh sao chép lượng lớn " +"dữ liệu trên ngăn xếp, thay vào đó hãy lưu trữ dữ liệu trên heap trong `Box`" +" để chỉ con trỏ được di chuyển." #: src/smart-pointers/box.md msgid "" @@ -7925,12 +8737,17 @@ msgid "" "`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 "" +"Nếu `Box` không được sử dụng và chúng tôi đã cố nhúng `List` trực tiếp vào " +"`List`, compiler sẽ không thể tính kích thước cố định cho cấu trúc trong bộ " +"nhớ (`List` sẽ có kích thước vô hạn)." #: 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." msgstr "" +"`Box` giải quyết vấn đề này vì nó có cùng kích thước với một con trỏ thông " +"thường và chỉ trỏ vào phần tử tiếp theo của `Danh sách` trong vùng heap." #: src/smart-pointers/box.md msgid "" @@ -7939,10 +8756,14 @@ msgid "" "we have to use indirection, a `Box` or reference of some kind, instead of " "storing the value directly." msgstr "" +"Xóa `Box` trong định nghĩa Danh sách và hiển thị lỗi compiler. Chúng tôi " +"nhận được thông báo \"đệ quy không gián tiếp\", vì để đệ quy dữ liệu, chúng " +"tôi phải sử dụng phép đệ quy, một `Hộp` hoặc một loại tham chiếu nào đó, " +"thay vì lưu trữ giá trị trực tiếp." #: src/smart-pointers/box.md msgid "Niche Optimization" -msgstr "" +msgstr "Tối ưu hóa thích hợp" #: src/smart-pointers/box.md msgid "" @@ -7950,18 +8771,25 @@ msgid "" "This makes `Box` one of the types that allow the compiler to optimize " "storage of some enums." msgstr "" +"Mặc dù `Box` trông giống như `std::unique_ptr` trong C++, nhưng nó không thể" +" để trống/null. Điều này làm cho `Box` trở thành một trong những loại cho " +"phép compiler tối ưu hóa việc lưu trữ một số enum." #: src/smart-pointers/box.md msgid "" "For example, `Option>` has the same size, as just `Box`, because " "compiler uses NULL-value to discriminate variants instead of using explicit " -"tag ([\"Null Pointer Optimization\"](https://doc.rust-lang.org/std/option/" -"#representation)):" +"tag ([\"Null Pointer Optimization\"](https://doc.rust-" +"lang.org/std/option/#representation)):" msgstr "" +"Ví dụ: `Option>` có cùng kích thước, giống như `Box`, vì trình " +"biên dịch sử dụng giá trị NULL để phân biệt các biến thể thay vì sử dụng thẻ" +" rõ ràng ([\"Tối ưu hóa con trỏ Null\"](https://doc.rust-" +"lang.org/std/option/#reperformanceation)):" #: src/smart-pointers/box.md msgid "\"Just box\"" -msgstr "" +msgstr "\"Chỉ cần hộp\"" #: src/smart-pointers/box.md msgid "\"Optional box\"" @@ -7969,15 +8797,15 @@ msgstr "\"Optional box\"" #: src/smart-pointers/box.md msgid "\"Size of just_box: {}\"" -msgstr "" +msgstr "\"Kích thước của just_box: {}\"" #: src/smart-pointers/box.md msgid "\"Size of optional_box: {}\"" -msgstr "" +msgstr "\"Kích thước của hộp_tùy_chọn: {}\"" #: src/smart-pointers/box.md msgid "\"Size of none: {}\"" -msgstr "" +msgstr "\"Kích thước không có: {}\"" #: src/smart-pointers/rc.md msgid "" @@ -7985,37 +8813,49 @@ msgid "" "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) là một con trỏ dùng " +"chung được tính tham chiếu. Sử dụng điều này khi bạn cần tham khảo cùng một " +"dữ liệu từ nhiều nơi:" #: src/smart-pointers/rc.md msgid "\"a: {a}\"" -msgstr "" +msgstr "\"a: {a}\"" #: src/smart-pointers/rc.md msgid "\"b: {b}\"" -msgstr "" +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 "" +"Xem [`Arc`](../concurrency/shared_state/arc.md) và " +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) nếu bạn đang" +" ở trong bối cảnh đa luồng." #: 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 "" +"Bạn có thể _hạ cấp_ một con trỏ dùng chung thành một con trỏ " +"[`Weak`](https://doc.rust-lang.org/std/rc/struct.Weak.html) để tạo các chu " +"trình sẽ bị loại bỏ." #: src/smart-pointers/rc.md msgid "" "`Rc`'s count ensures that its contained value is valid for as long as there " "are references." msgstr "" +"Số lượng của `Rc` đảm bảo rằng giá trị được chứa của nó hợp lệ miễn là có " +"tham chiếu." #: src/smart-pointers/rc.md msgid "`Rc` in Rust is like `std::shared_ptr` in C++." -msgstr "" +msgstr "`Rc` trong Rust giống như `std::shared_ptr` trong C++." #: src/smart-pointers/rc.md msgid "" @@ -8023,136 +8863,163 @@ msgid "" "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` rẻ: nó tạo một con trỏ tới cùng một phân bổ và tăng số lượng " +"tham chiếu. Không tạo bản sao sâu và thường có thể bị bỏ qua khi tìm kiếm " +"các vấn đề về hiệu suất trong mã." #: src/smart-pointers/rc.md msgid "" -"`make_mut` actually clones the inner value if necessary (\"clone-on-write\") " -"and returns a mutable reference." +"`make_mut` actually clones the inner value if necessary (\"clone-on-write\")" +" and returns a mutable reference." msgstr "" +"`make_mut` thực sự sao chép giá trị bên trong nếu cần thiết (\"sao chép khi " +"ghi\") và trả về một tham chiếu có thể thay đổi." #: src/smart-pointers/rc.md msgid "Use `Rc::strong_count` to check the reference count." -msgstr "" +msgstr "Sử dụng `Rc::strong_count` để kiểm tra số lượng tham chiếu." #: 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`)." msgstr "" +"`Rc::downgrade` cung cấp cho bạn một đối tượng _được tính tham chiếu yếu_ để" +" tạo các chu trình sẽ được loại bỏ đúng cách (có thể kết hợp với `RefCell`)." #: src/smart-pointers/trait-objects.md msgid "" "Trait objects allow for values of different types, for instance in a " "collection:" msgstr "" +"Các đối tượng đặc điểm cho phép các giá trị thuộc các loại khác nhau, ví dụ " +"như trong một bộ sưu tập:" #: src/smart-pointers/trait-objects.md msgid "\"Miau!\"" -msgstr "" +msgstr "\"Miêu!\"" #: src/smart-pointers/trait-objects.md msgid "\"Hello, who are you? {}\"" -msgstr "" +msgstr "\"Xin chào, bạn là ai? {}\"" #: src/smart-pointers/trait-objects.md msgid "Memory layout after allocating `pets`:" -msgstr "" +msgstr "Bố cục bộ nhớ sau khi cấp phát `pets`:" #: src/smart-pointers/trait-objects.md msgid "" "```bob\n" " Stack Heap\n" -".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - " -"- -.\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - -.\n" ": : : :\n" -": \"pets: Vec\" : : \"data: Cat\" +----+----+----" -"+----+ :\n" -": +-----------+-------+ : : +-------+-------+ | F | i | d | " -"o | :\n" -": | ptr | o---+---+--. : | lives | 9 | +----+----+----" -"+----+ :\n" -": | len | 2 | : | : +-------+-------+ " -"^ :\n" -": | capacity | 2 | : | : ^ " -"| :\n" -": +-----------+-------+ : | : | " -"'-------. :\n" -": : | : | data:" -"\"Dog\"| :\n" -": : | : | +-------+--|-------" -"+ :\n" -"`- - - - - - - - - - - - - -' | : +---|-+-----+ | name | o, 4, 4 " -"| :\n" -" `--+-->| o o | o o-|----->| age | 5 " -"| :\n" -" : +-|---+-|---+ +-------+----------" -"+ :\n" -" : | " -"| :\n" -" `- - -| - - |- - - - - - - - - - - - - - - " -"- -'\n" +": \"pets: Vec\" : : \"data: Cat\" +----+----+----+----+ :\n" +": +-----------+-------+ : : +-------+-------+ | F | i | d | o | :\n" +": | ptr | o---+---+--. : | lives | 9 | +----+----+----+----+ :\n" +": | len | 2 | : | : +-------+-------+ ^ :\n" +": | capacity | 2 | : | : ^ | :\n" +": +-----------+-------+ : | : | '-------. :\n" +": : | : | data:\"Dog\"| :\n" +": : | : | +-------+--|-------+ :\n" +"`- - - - - - - - - - - - - -' | : +---|-+-----+ | name | o, 4, 4 | :\n" +" `--+-->| o o | o o-|----->| age | 5 | :\n" +" : +-|---+-|---+ +-------+----------+ :\n" +" : | | :\n" +" `- - -| - - |- - - - - - - - - - - - - - - - -'\n" " | |\n" -" | | " -"\"Program text\"\n" -" .- - -| - - |- - - - - - - - - - - - - - - " -"- -.\n" -" : | | " -"vtable :\n" -" : | | +----------------------" -"+ :\n" -" : | `----->| \"::" -"talk\" | :\n" -" : | +----------------------" -"+ :\n" -" : | " -"vtable :\n" -" : | +----------------------" -"+ :\n" -" : '----------->| \"::" -"talk\" | :\n" -" : +----------------------" -"+ :\n" +" | | \"Program text\"\n" +" .- - -| - - |- - - - - - - - - - - - - - - - -.\n" +" : | | vtable :\n" +" : | | +----------------------+ :\n" +" : | `----->| \"::talk\" | :\n" +" : | +----------------------+ :\n" +" : | vtable :\n" +" : | +----------------------+ :\n" +" : '----------->| \"::talk\" | :\n" +" : +----------------------+ :\n" " : :\n" -" '- - - - - - - - - - - - - - - - - - - - - " -"- -'\n" +" '- - - - - - - - - - - - - - - - - - - - - - -'\n" "```" msgstr "" +"``` bob\n" +" đống đống\n" +".- - - - - - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - -.\n" +": : : :\n" +": \"thú cưng: Vec\" : : \"data: Cat\" +----+----+----+----+ :\n" +": +----------+-------+ : : +-------+-------+ | F | tôi | d | o | :\n" +": | ptr | o---+---+--. : | cuộc sống | 9 | +----+----+----+----+ :\n" +": | len | 2 | : | : +-------+-------+ ^ :\n" +": | công suất | 2 | : | : ^ | :\n" +": +----------+-------+ : | : | '-------. :\n" +": : | : | dữ liệu:\"Con chó\"| :\n" +": : | : | +-------+--|-------+ :\n" +"`- - - - - - - - - - - - - -' | : +---|-+------+ | tên | o, 4, 4 | :\n" +" `--+-->| ồ | o o-|------->| tuổi | 5 | :\n" +" : +-|---+-|---+ +-------+----------+ :\n" +" : | | :\n" +" `- - -| - - |- - - - - - - - - - - - - - - -'\n" +" | |\n" +" | | \"Văn bản chương trình\"\n" +" .- - -| - - |- - - - - - - - - - - - - - - -.\n" +" : | | vtable :\n" +" : | | +----------------------+ :\n" +" : | `------->| \"::talk\" | :\n" +" : | +----------------------+ :\n" +" : | vtable :\n" +" : | +----------------------+ :\n" +" : '----------->| \"::talk\" | :\n" +" : +----------------------+ :\n" +" : :\n" +" '- - - - - - - - - - - - - - - - - - - - - -'\n" +"```" #: src/smart-pointers/trait-objects.md 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 "" +"Các loại thực hiện một đặc điểm nhất định có thể có kích cỡ khác nhau. Điều " +"này làm cho không thể có những thứ như `Vec` trong ví dụ trên." #: src/smart-pointers/trait-objects.md msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." msgstr "" +"`dyn Pet` là một cách để thông báo cho compiler về loại có kích thước động " +"triển khai `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_:" msgstr "" +"Trong ví dụ này, `pets` được phân bổ trên ngăn xếp và dữ liệu vectơ nằm trên" +" heap. Hai phần tử vectơ là _fat con trỏ_:" #: src/smart-pointers/trait-objects.md 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." +"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." msgstr "" +"Con trỏ béo là con trỏ có chiều rộng gấp đôi. Nó có hai thành phần: một con " +"trỏ tới đối tượng thực và một con trỏ tới [bảng phương thức " +"ảo](https://en.wikipedia.org/wiki/Virtual_method_table) (vtable) để triển " +"khai `Pet` của đối tượng cụ thể đó." #: 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 "" +"Dữ liệu cho `Dog` có tên Fido là trường `name` và `age`. `Cat` có trường " +"`lives`." #: src/smart-pointers/trait-objects.md msgid "Compare these outputs in the above example:" -msgstr "" +msgstr "So sánh các kết quả đầu ra trong ví dụ trên:" #: src/smart-pointers/exercise.md msgid "" @@ -8161,24 +9028,31 @@ msgid "" "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 "" +"Cây nhị phân là cấu trúc dữ liệu kiểu cây trong đó mỗi nút có hai nút con " +"(trái và phải). Chúng ta sẽ tạo một cây trong đó mỗi nút lưu trữ một giá " +"trị. Đối với một nút N cho trước, tất cả các nút trong cây con bên trái của " +"N sẽ chứa các giá trị nhỏ hơn và tất cả các nút trong cây con bên phải của N" +" sẽ chứa các giá trị lớn hơn." #: src/smart-pointers/exercise.md msgid "Implement the following types, so that the given tests pass." -msgstr "" +msgstr "Thực hiện các loại sau để vượt qua các bài kiểm tra đã cho." #: src/smart-pointers/exercise.md msgid "" "Extra Credit: implement an iterator over a binary tree that returns the " "values in order." msgstr "" +"Tín dụng bổ sung: triển khai trình vòng lặp trên cây nhị phân trả về các giá" +" trị theo thứ tự." #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A node in the binary tree.\n" -msgstr "" +msgstr "/// Một nút trên cây nhị phân.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "/// A possibly-empty subtree.\n" -msgstr "" +msgstr "/// Một cây con có thể trống.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "" @@ -8186,18 +9060,21 @@ msgid "" "///\n" "/// If the same value is added multiple times, it is only stored once.\n" msgstr "" +"/// Một container lưu trữ một tập hợp các giá trị, sử dụng cây nhị phân.\n" +"///\n" +"/// Nếu cùng một giá trị được thêm nhiều lần thì nó chỉ được lưu trữ một lần.\n" #: src/smart-pointers/exercise.md msgid "// Implement `new`, `insert`, `len`, and `has` for `Subtree`.\n" -msgstr "" +msgstr "// Triển khai `new`, `insert`, `len`, và `has` cho `Subtree`.\n" #: src/smart-pointers/exercise.md src/smart-pointers/solution.md msgid "// not a unique item\n" -msgstr "" +msgstr "// không phải là một mục duy nhất\n" #: src/smart-pointers/solution.md src/android/testing/googletest.md msgid "\"bar\"" -msgstr "" +msgstr "\"thanh\"" #: src/welcome-day-3-afternoon.md msgid "" @@ -8209,85 +9086,111 @@ msgstr "" #: src/borrowing/shared.md msgid "" -"As we saw before, instead of transferring ownership when calling a function, " -"you can let a function _borrow_ the value:" +"As we saw before, instead of transferring ownership when calling a function," +" you can let a function _borrow_ the value:" msgstr "" +"Như chúng ta đã thấy trước đây, thay vì chuyển quyền sở hữu khi gọi một hàm," +" bạn có thể để hàm _mượn_ giá trị:" #: src/borrowing/shared.md msgid "The `add` function _borrows_ two points and returns a new point." -msgstr "" +msgstr "Hàm `add` _mượn_ hai điểm và trả về một điểm mới." #: src/borrowing/shared.md msgid "The caller retains ownership of the inputs." -msgstr "" +msgstr "Người gọi vẫn giữ quyền sở hữu đầu vào." #: src/borrowing/shared.md msgid "" "This slide is a review of the material on references from day 1, expanding " "slightly to include function arguments and return values." msgstr "" +"Trang trình bày này ôn lại tài liệu về các tài liệu tham khảo từ ngày đầu " +"tiên, mở rộng một chút để bao gồm các đối số của hàm và các giá trị trả về." #: src/borrowing/shared.md msgid "Notes on stack returns and inlining:" -msgstr "" +msgstr "Lưu ý về trả về ngăn xếp và nội tuyến:" #: src/borrowing/shared.md msgid "" "Demonstrate that the return from `add` is cheap because the compiler can " "eliminate the copy operation, by inlining the call to add into main. Change " -"the above code to print stack addresses 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 " +"the above code to print stack addresses 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:" msgstr "" +"Chứng minh rằng kết quả trả về từ `add` là rẻ vì compiler có thể loại bỏ " +"thao tác sao chép, bằng cách nội tuyến lệnh gọi add vào main. Thay đổi mã ở " +"trên để in địa chỉ ngăn xếp và chạy mã trên [Playground](https://play.rust-" +"lang.org/?version=stable&mode=release&edition=2021&gist=0cb13be1c05d7e3446686ad9947c4671)" +" hoặc xem tập hợp trong [Godbolt](https://rust.godbolt.org/). Ở cấp độ tối " +"ưu hóa \"GỠ LỖI\", các địa chỉ sẽ thay đổi trong khi chúng vẫn giữ nguyên " +"khi thay đổi sang cài đặt \"ĐÁNH GIÁ\":" #: src/borrowing/shared.md msgid "" "The Rust compiler can do automatic inlining, that can be disabled on a " "function level with `#[inline(never)]`." msgstr "" +"compiler Rust có thể thực hiện nội tuyến tự động, tính năng này có thể bị vô" +" hiệu hóa ở cấp độ hàm bằng `#[inline(never)]`." #: src/borrowing/shared.md msgid "" "Once disabled, the printed address will change on all optimization levels. " "Looking at Godbolt or Playground, one can see that in this case, the return " -"of the value depends on the ABI, e.g. on amd64 the two i32 that is making up " -"the point will be returned in 2 registers (eax and edx)." +"of the value depends on the ABI, e.g. on amd64 the two i32 that is making up" +" the point will be returned in 2 registers (eax and edx)." msgstr "" +"Sau khi bị tắt, địa chỉ được in sẽ thay đổi ở tất cả các mức tối ưu hóa. " +"Nhìn vào Godbolt hoặc Playground, người ta có thể thấy rằng trong trường hợp" +" này, giá trị trả về phụ thuộc vào ABI, ví dụ: trên amd64, hai i32 tạo thành" +" điểm sẽ được trả về trong 2 thanh ghi (eax và edx)." #: src/borrowing/borrowck.md msgid "" "Rust's _borrow checker_ puts constraints on the ways you can borrow values. " "For a given value, at any time:" msgstr "" +"Trình kiểm tra _borrow_ của Rust đặt ra các ràng buộc về cách bạn có thể " +"mượn các giá trị. Đối với một giá trị nhất định, bất cứ lúc nào:" #: src/borrowing/borrowck.md msgid "You can have one or more shared references to the value, _or_" msgstr "" +"Bạn có thể có một hoặc nhiều tham chiếu được chia sẻ tới giá trị, _or_" #: src/borrowing/borrowck.md msgid "You can have exactly one exclusive reference to the value." -msgstr "" +msgstr "Bạn có thể có chính xác một tham chiếu độc quyền cho giá trị." #: src/borrowing/borrowck.md msgid "" "Note that the requirement is that conflicting references not _exist_ at the " "same point. It does not matter where the reference is dereferenced." msgstr "" +"Lưu ý rằng yêu cầu là các tham chiếu xung đột không tồn tại ở cùng một điểm." +" Việc tham chiếu bị hủy đăng ký ở đâu không quan trọng." #: src/borrowing/borrowck.md 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 "" +"Đoạn mã trên không biên dịch được vì `a` được mượn dưới dạng có thể thay đổi" +" (thông qua `c`) và đồng thời là không thể thay đổi (thông qua `b`)." #: src/borrowing/borrowck.md msgid "" "Move the `println!` statement for `b` before the scope that introduces `c` " "to make the code compile." msgstr "" +"Di chuyển câu lệnh `println!` cho `b` trước phạm vi giới thiệu `c` để biên " +"dịch mã." #: src/borrowing/borrowck.md msgid "" @@ -8295,6 +9198,9 @@ msgid "" "the new mutable borrow of `a` through `c`. This is a feature of the borrow " "checker called \"non-lexical lifetimes\"." msgstr "" +"Sau sự thay đổi đó, compiler nhận ra rằng `b` chỉ được sử dụng trước khi " +"mượn từ `a` đến `c` có thể thay đổi mới. Đây là một tính năng của công cụ " +"kiểm tra mượn được gọi là \"thời gian sống không từ vựng\"." #: src/borrowing/borrowck.md msgid "" @@ -8303,6 +9209,11 @@ msgid "" "optimize code. For example, a value behind a shared reference can be safely " "cached in a register for the lifetime of that reference." msgstr "" +"Ràng buộc tham chiếu độc quyền khá mạnh. Rust sử dụng nó để đảm bảo rằng các" +" cuộc đua dữ liệu không xảy ra. Rust cũng _dựa vào ràng buộc này để tối ưu " +"hóa mã. Ví dụ: một giá trị đằng sau một tham chiếu được chia sẻ có thể được " +"lưu vào bộ nhớ đệm một cách an toàn trong sổ đăng ký trong suốt thời gian " +"tồn tại của tham chiếu đó." #: src/borrowing/borrowck.md msgid "" @@ -8311,6 +9222,11 @@ msgid "" "time. But, there are some situations where it doesn't quite \"get it\" and " "this often results in \"fighting with the borrow checker.\"" msgstr "" +"Trình kiểm tra mượn được thiết kế để phù hợp với nhiều mẫu phổ biến, chẳng " +"hạn như lấy các tham chiếu độc quyền đến các trường khác nhau trong một cấu " +"trúc cùng một lúc. Tuy nhiên, có một số tình huống không hoàn toàn “hiểu " +"được” và điều này thường dẫn đến việc “đấu tranh với người kiểm tra khoản " +"vay”." #: src/borrowing/examples.md msgid "" @@ -8318,6 +9234,9 @@ msgid "" "consider the case of modifying a collection while there are references to " "its elements:" msgstr "" +"Để làm ví dụ cụ thể về cách các quy tắc mượn này ngăn ngừa lỗi bộ nhớ, hãy " +"xem xét trường hợp sửa đổi một bộ sưu tập trong khi có các tham chiếu đến " +"các phần tử của nó:" #: src/borrowing/examples.md msgid "\"{elem}\"" @@ -8325,7 +9244,7 @@ msgstr "\"{elem}\"" #: src/borrowing/examples.md msgid "Similarly, consider the case of iterator invalidation:" -msgstr "" +msgstr "Tương tự, hãy xem xét trường hợp vô hiệu của trình vòng lặp:" #: src/borrowing/examples.md msgid "" @@ -8333,28 +9252,38 @@ msgid "" "into it can potentially invalidate existing references to the collection's " "elements if the collection has to reallocate." msgstr "" +"Trong cả hai trường hợp này, việc sửa đổi bộ sưu tập bằng cách đẩy các phần " +"tử mới vào đó có thể làm mất hiệu lực các tham chiếu hiện có đến các phần tử" +" của bộ sưu tập nếu bộ sưu tập phải phân bổ lại." #: 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." +"only) reference. For example, a shared data structure might have an internal" +" cache, and wish to update that cache from read-only methods." msgstr "" +"Trong một số trường hợp, cần phải sửa đổi dữ liệu đằng sau tham chiếu được " +"chia sẻ (chỉ đọc). Ví dụ: cấu trúc dữ liệu dùng chung có thể có bộ đệm trong" +" và muốn cập nhật bộ đệm đó từ các phương thức chỉ đọc." #: 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, " +"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 "" +"Mẫu \"khả năng thay đổi nội bộ\" cho phép truy cập độc quyền (có thể thay " +"đổi) đằng sau một tham chiếu được chia sẻ. Thư viện tiêu chuẩn cung cấp một " +"số cách để thực hiện việc này, trong khi vẫn đảm bảo an toàn, thường bằng " +"cách thực hiện kiểm tra thời gian chạy." #: src/borrowing/interior-mutability.md msgid "`RefCell`" -msgstr "" +msgstr "`RefCell`" #: src/borrowing/interior-mutability.md msgid "// Note that `cell` is NOT declared as mutable.\n" -msgstr "" +msgstr "// Lưu ý rằng `cell` KHÔNG được khai báo là có thể thay đổi.\n" #: src/borrowing/interior-mutability.md msgid "" @@ -8362,21 +9291,28 @@ msgid "" " // let other = cell.borrow();\n" " // println!(\"{}\", *other);\n" msgstr "" +"// Điều này gây ra lỗi khi chạy.\n" +" // let other = cell.borrow();\n" +" // println!(\"{}\", *other);\n" #: src/borrowing/interior-mutability.md msgid "\"{cell:?}\"" -msgstr "" +msgstr "\"{tế bào:?}\"" #: src/borrowing/interior-mutability.md msgid "`Cell`" -msgstr "" +msgstr "`Ô`" #: src/borrowing/interior-mutability.md msgid "" "`Cell` wraps a value and allows getting or setting the value, even with a " -"shared reference to the `Cell`. However, it does not allow any references to " -"the value. Since there are no references, borrowing rules cannot be broken." +"shared reference to the `Cell`. However, it does not allow any references to" +" the value. Since there are no references, borrowing rules cannot be broken." msgstr "" +"`Ô` bao bọc một giá trị và cho phép nhận hoặc đặt giá trị, ngay cả với tham " +"chiếu chung đến `Ô`. Tuy nhiên, nó không cho phép bất kỳ tham chiếu nào đến " +"giá trị. Vì không có tài liệu tham khảo nên không thể vi phạm quy định vay " +"mượn." #: src/borrowing/interior-mutability.md msgid "" @@ -8384,6 +9320,9 @@ msgid "" "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 "" +"Điều chính cần rút ra từ slide này là Rust cung cấp các cách _safe_ để sửa " +"đổi dữ liệu đằng sau một tham chiếu được chia sẻ. Có nhiều cách khác nhau để" +" đảm bảo sự an toàn đó, và `RefCell` và `Cell` là hai trong số đó." #: src/borrowing/interior-mutability.md msgid "" @@ -8392,26 +9331,38 @@ msgid "" "case, all borrows are very short and never overlap, so the checks always " "succeed." msgstr "" +"`RefCell` thực thi các quy tắc vay mượn thông thường của Rust (nhiều tài " +"liệu tham khảo được chia sẻ hoặc một tài liệu tham khảo độc quyền duy nhất) " +"bằng kiểm tra thời gian chạy. Trong trường hợp này, tất cả các khoản vay đều" +" rất ngắn và không bao giờ trùng lặp nên việc kiểm tra luôn thành công." #: src/borrowing/interior-mutability.md msgid "" -"The extra block in the `RefCell` example is to end the borrow created by the " -"call to `borrow_mut` before we print the cell. Trying to print a borrowed " +"The extra block in the `RefCell` example is to end the borrow created by the" +" call to `borrow_mut` before we print the cell. Trying to print a borrowed " "`RefCell` just shows the message `\"{borrowed}\"`." msgstr "" +"Khối bổ sung trong ví dụ `RefCell` là để kết thúc khoản vay được tạo bởi " +"lệnh gọi tới `borrow_mut` trước khi chúng ta in ô. Cố gắng in một `RefCell` " +"đã mượn chỉ hiển thị thông báo `\"{borrowed}\"`." #: src/borrowing/interior-mutability.md msgid "" -"`Cell` is a simpler means to ensure safety: it has a `set` method that takes " -"`&self`. This needs no runtime check, but requires moving values, which can " -"have its own cost." +"`Cell` is a simpler means to ensure safety: it has a `set` method that takes" +" `&self`. This needs no runtime check, but requires moving values, which can" +" have its own cost." msgstr "" +"`Cell` là một phương tiện đơn giản hơn để đảm bảo an toàn: nó có phương thức" +" `set` nhận `&self`. Điều này không cần kiểm tra thời gian chạy, nhưng yêu " +"cầu các giá trị di chuyển, có thể có chi phí riêng." #: 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." msgstr "" +"Bạn đang triển khai hệ thống theo dõi sức khỏe. Là một phần trong đó, bạn " +"cần theo dõi số liệu thống kê sức khỏe của người dùng." #: src/borrowing/exercise.md msgid "" @@ -8419,34 +9370,43 @@ msgid "" "struct definition. Your goal is to implement the stubbed out method on the " "`User` `struct` defined in the `impl` block." msgstr "" +"Bạn sẽ bắt đầu với một hàm sơ khai trong khối `impl` cũng như định nghĩa cấu" +" trúc `Người dùng`. Mục tiêu của bạn là triển khai phương thức stubbed out " +"trên `User` `struct` được xác định trong khối `impl`." #: src/borrowing/exercise.md msgid "" -"Copy the code below to and fill in the missing " -"method:" +"Copy the code below to and fill in the missing" +" method:" msgstr "" +"Sao chép mã bên dưới vào và điền vào phương " +"thức còn thiếu:" #: src/borrowing/exercise.md msgid "" "\"Update a user's statistics based on measurements from a visit to the " "doctor\"" msgstr "" +"\"Cập nhật số liệu thống kê của người dùng dựa trên số đo từ lần khám bác " +"sĩ\"" #: src/borrowing/exercise.md src/borrowing/solution.md #: src/android/build-rules/library.md #: src/android/aidl/example-service/client.md msgid "\"Bob\"" -msgstr "" +msgstr "\"Bob\"" #: src/borrowing/exercise.md src/borrowing/solution.md msgid "\"I'm {} and my age is {}\"" -msgstr "" +msgstr "\"Tôi là {} và tuổi của tôi là {}\"" #: src/lifetimes/lifetime-annotations.md msgid "" -"A reference has a _lifetime_, which must not \"outlive\" the value it refers " -"to. This is verified by the borrow checker." +"A reference has a _lifetime_, which must not \"outlive\" the value it refers" +" to. This is verified by the borrow checker." msgstr "" +"Một tham chiếu có _lifetime_, giá trị này không được \"tồn tại lâu hơn\" giá" +" trị mà nó đề cập đến. Điều này được xác nhận bởi người kiểm tra khoản vay." #: src/lifetimes/lifetime-annotations.md msgid "" @@ -8455,6 +9415,10 @@ msgid "" "`'` and `'a` is a typical default name. Read `&'a Point` as \"a borrowed " "`Point` which is valid for at least the lifetime `a`\"." msgstr "" +"Tuổi thọ có thể được ẩn giấu - đây là những gì chúng ta đã thấy cho đến nay." +" Thời gian tồn tại cũng có thể rõ ràng: `&'a Point`, `&'document str`. Vòng " +"đời bắt đầu bằng `'` và `'a` là tên mặc định điển hình. Đọc `&'a Point` là " +"\"một `Điểm` mượn có giá trị ít nhất trong suốt thời gian tồn tại `a`\"." #: src/lifetimes/lifetime-annotations.md msgid "" @@ -8462,86 +9426,113 @@ msgid "" "yourself. Explicit lifetime annotations create constraints where there is " "ambiguity; the compiler verifies that there is a valid solution." msgstr "" +"Thời gian tồn tại luôn được compiler suy ra: bạn không thể tự mình chỉ định " +"thời gian tồn tại. Chú thích trọn đời rõ ràng tạo ra những hạn chế khi có sự" +" mơ hồ; compiler xác minh rằng có một giải pháp hợp lệ." #: src/lifetimes/lifetime-annotations.md msgid "" "Lifetimes become more complicated when considering passing values to and " "returning values from functions." msgstr "" +"Vòng đời trở nên phức tạp hơn khi xem xét việc truyền giá trị tới và trả về " +"giá trị từ hàm." #: src/lifetimes/lifetime-annotations.md msgid "// What is the lifetime of p3?\n" -msgstr "" +msgstr "// Tuổi thọ của p3 là bao nhiêu?\n" #: src/lifetimes/lifetime-annotations.md msgid "\"p3: {p3:?}\"" -msgstr "" +msgstr "\"p3: {p3:?}\"" #: src/lifetimes/lifetime-annotations.md msgid "" -"In this example, the compiler does not know what lifetime to infer for `p3`. " -"Looking inside the function body shows that it can only safely assume that " +"In this example, the compiler does not know what lifetime to infer for `p3`." +" Looking inside the function body shows that it can only safely assume that " "`p3`'s lifetime is the shorter of `p1` and `p2`. But just like types, Rust " "requires explicit annotations of lifetimes on function arguments and return " "values." msgstr "" +"Trong ví dụ này, compiler không biết thời gian tồn tại để suy ra cho `p3`. " +"Nhìn vào bên trong thân hàm cho thấy rằng nó chỉ có thể giả định một cách an" +" toàn rằng thời gian tồn tại của `p3` ngắn hơn `p1` và `p2`. Nhưng cũng " +"giống như các kiểu, Rust yêu cầu chú thích rõ ràng về thời gian tồn tại trên" +" các đối số của hàm và giá trị trả về." #: src/lifetimes/lifetime-annotations.md msgid "Add `'a` appropriately to `left_most`:" -msgstr "" +msgstr "Thêm `'a` một cách thích hợp vào `left_most`:" #: src/lifetimes/lifetime-annotations.md msgid "" -"This says, \"given p1 and p2 which both outlive `'a`, the return value lives " -"for at least `'a`." +"This says, \"given p1 and p2 which both outlive `'a`, the return value lives" +" for at least `'a`." msgstr "" +"Điều này cho biết, \"với p1 và p2 đều tồn tại lâu hơn `'a`, giá trị trả về " +"tồn tại ít nhất trong `'a`." #: src/lifetimes/lifetime-annotations.md msgid "" "In common cases, lifetimes can be elided, as described on the next slide." msgstr "" +"Trong các trường hợp thông thường, thời gian sống có thể được bỏ qua, như " +"được mô tả ở trang tiếp theo." #: src/lifetimes/lifetime-elision.md msgid "Lifetimes in Function Calls" -msgstr "" +msgstr "Thời gian tồn tại trong lệnh gọi hàm" #: src/lifetimes/lifetime-elision.md 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 " -"inference -- it is just a syntactic shorthand." +"rules](https://doc.rust-lang.org/nomicon/lifetime-elision.html). This is not" +" inference -- it is just a syntactic shorthand." msgstr "" +"Thời gian tồn tại của các đối số hàm và giá trị trả về phải được chỉ định " +"đầy đủ, nhưng Rust cho phép bỏ qua thời gian tồn tại trong hầu hết các " +"trường hợp bằng [một vài quy tắc đơn giản](https://doc.rust-" +"lang.org/nomicon/lifetime-elision.html). Đây không phải là suy luận - nó chỉ" +" là một cách viết tắt cú pháp." #: src/lifetimes/lifetime-elision.md msgid "Each argument which does not have a lifetime annotation is given one." msgstr "" +"Mỗi đối số không có chú thích trọn đời sẽ được cung cấp một chú thích." #: src/lifetimes/lifetime-elision.md msgid "" "If there is only one argument lifetime, it is given to all un-annotated " "return values." msgstr "" +"Nếu chỉ có một đối số tồn tại, nó sẽ được trao cho tất cả các giá trị trả về" +" không được chú thích." #: src/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." msgstr "" +"Nếu có nhiều thời gian tồn tại đối số, nhưng đối số đầu tiên là dành cho " +"`self`, thì thời gian tồn tại đó được cấp cho tất cả các giá trị trả về " +"không được chú thích." #: src/lifetimes/lifetime-elision.md msgid "In this example, `cab_distance` is trivially elided." -msgstr "" +msgstr "Trong ví dụ này, `cab_distance` được bỏ qua một cách tầm thường." #: src/lifetimes/lifetime-elision.md msgid "" "The `nearest` function provides another example of a function with multiple " "references in its arguments that requires explicit annotation." msgstr "" +"Hàm `gần nhất` cung cấp một ví dụ khác về hàm có nhiều tham chiếu trong các " +"đối số yêu cầu chú thích rõ ràng." #: src/lifetimes/lifetime-elision.md msgid "Try adjusting the signature to \"lie\" about the lifetimes returned:" -msgstr "" +msgstr "Hãy thử điều chỉnh chữ ký để \"nói dối\" về thời gian sống được trả về:" #: src/lifetimes/lifetime-elision.md msgid "" @@ -8549,6 +9540,10 @@ msgid "" "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 "" +"Điều này sẽ không được biên dịch, chứng tỏ rằng các chú thích đã được trình " +"biên dịch kiểm tra tính hợp lệ. Lưu ý rằng đây không phải là trường hợp của " +"con trỏ thô (không an toàn) và đây là nguồn lỗi phổ biến với Rust không an " +"toàn." #: src/lifetimes/lifetime-elision.md msgid "" @@ -8558,35 +9553,43 @@ msgid "" "help resolve ambiguity. Often, especially when prototyping, it's easier to " "just work with owned data by cloning values where necessary." msgstr "" +"Học sinh có thể hỏi khi nào nên sử dụng thời gian sống. Rust mượn _always_ " +"có cả cuộc đời. Trong hầu hết các trường hợp, việc loại bỏ và suy luận kiểu " +"có nghĩa là những điều này không cần phải được viết ra. Trong những trường " +"hợp phức tạp hơn, chú thích trọn đời có thể giúp giải quyết sự mơ hồ. Thông " +"thường, đặc biệt là khi tạo mẫu, việc làm việc với dữ liệu được sở hữu bằng " +"cách sao chép các giá trị khi cần thiết sẽ dễ dàng hơn." #: src/lifetimes/struct-lifetimes.md msgid "Lifetimes in Data Structures" -msgstr "" +msgstr "Tuổi thọ trong cấu trúc dữ liệu" #: src/lifetimes/struct-lifetimes.md msgid "" "If a data type stores borrowed data, it must be annotated with a lifetime:" msgstr "" +"Nếu một kiểu dữ liệu lưu trữ dữ liệu mượn thì nó phải được chú thích trọn " +"đời:" #: src/lifetimes/struct-lifetimes.md msgid "\"Bye {text}!\"" -msgstr "" +msgstr "\"Tạm biệt {văn bản}!\"" #: src/lifetimes/struct-lifetimes.md msgid "\"The quick brown fox jumps over the lazy dog.\"" -msgstr "" +msgstr "\"Con cáo nâu nhanh nhẹn nhảy qua con chó lười.\"" #: src/lifetimes/struct-lifetimes.md msgid "// erase(text);\n" -msgstr "" +msgstr "// xóa(văn bản);\n" #: src/lifetimes/struct-lifetimes.md msgid "\"{fox:?}\"" -msgstr "" +msgstr "\"{cáo:?}\"" #: src/lifetimes/struct-lifetimes.md msgid "\"{dog:?}\"" -msgstr "" +msgstr "\"{chó:?}\"" #: src/lifetimes/struct-lifetimes.md msgid "" @@ -8594,12 +9597,17 @@ msgid "" "underlying the contained `&str` lives at least as long as any instance of " "`Highlight` that uses that data." msgstr "" +"Trong ví dụ trên, chú thích trên `Highlight` bắt buộc rằng dữ liệu bên dưới " +"`&str` được chứa tồn tại ít nhất bằng bất kỳ phiên bản nào của `Highlight` " +"sử dụng dữ liệu đó." #: src/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." msgstr "" +"Nếu `văn bản` được sử dụng trước khi kết thúc vòng đời của `fox` (hoặc " +"`dog`), trình kiểm tra mượn sẽ đưa ra lỗi." #: src/lifetimes/struct-lifetimes.md msgid "" @@ -8607,26 +9615,39 @@ msgid "" "can be useful for creating lightweight views, but it generally makes them " "somewhat harder to use." msgstr "" +"Các loại có dữ liệu mượn buộc người dùng phải giữ dữ liệu gốc. Điều này có " +"thể hữu ích để tạo các chế độ xem nhẹ, nhưng nhìn chung nó khiến chúng khó " +"sử dụng hơn một chút." #: src/lifetimes/struct-lifetimes.md msgid "When possible, make data structures own their data directly." msgstr "" +"Khi có thể, hãy làm cho cấu trúc dữ liệu sở hữu trực tiếp dữ liệu của chúng." #: src/lifetimes/struct-lifetimes.md 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." +"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." msgstr "" +"Một số cấu trúc có nhiều tham chiếu bên trong có thể có nhiều chú thích trọn" +" đời. Điều này có thể cần thiết nếu có nhu cầu mô tả mối quan hệ trọn đời " +"giữa chính các tham chiếu, ngoài vòng đời của chính cấu trúc đó. Đó là những" +" trường hợp sử dụng rất tiên tiến." #: src/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." +"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." msgstr "" +"Trong bài tập này, bạn sẽ xây dựng một trình phân tích cú pháp cho [mã hóa " +"nhị phân protobuf](https://protobuf.dev/programming-guides/encoding/). Đừng " +"lo lắng, nó đơn giản hơn bạn tưởng! Điều này minh họa một mẫu phân tích cú " +"pháp phổ biến, truyền các lát dữ liệu. Bản thân dữ liệu cơ bản không bao giờ" +" được sao chép." #: src/lifetimes/exercise.md msgid "" @@ -8635,10 +9656,14 @@ msgid "" "file. In this exercise, we'll encode that information into `match` " "statements in functions that get called for each field." msgstr "" +"Việc phân tích đầy đủ thông báo protobuf yêu cầu biết loại trường, được lập " +"chỉ mục theo số trường của chúng. Điều đó thường được cung cấp trong tệp " +"`proto`. Trong bài tập này, chúng ta sẽ mã hóa thông tin đó thành các câu " +"lệnh `match` trong các hàm được gọi cho từng trường." #: src/lifetimes/exercise.md msgid "We'll use the following proto:" -msgstr "" +msgstr "Chúng tôi sẽ sử dụng proto sau:" #: src/lifetimes/exercise.md msgid "" @@ -8647,170 +9672,197 @@ msgid "" "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 "" +"Một tin nhắn nguyên mẫu được mã hóa dưới dạng một loạt các trường, lần lượt " +"từng trường. Mỗi cái được triển khai dưới dạng một \"thẻ\" theo sau là giá " +"trị. Thẻ chứa số trường (ví dụ: `2` cho trường `id` của thông báo `Person`) " +"và loại dây xác định cách xác định tải trọng từ luồng byte." #: src/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." +"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." msgstr "" +"Các số nguyên, bao gồm cả thẻ, được biểu diễn bằng mã hóa có độ dài thay đổi" +" được gọi là VARINT. May mắn thay, `parse_varint` được xác định cho bạn bên " +"dưới. Mã đã cho cũng xác định các lệnh gọi lại để xử lý các trường `Person` " +"và `PhoneNumber`, đồng thời phân tích thông báo thành một chuỗi lệnh gọi đến" +" các lệnh gọi lại đó." #: src/lifetimes/exercise.md msgid "" "What remains for you is to implement the `parse_field` function and the " "`ProtoMessage` trait for `Person` and `PhoneNumber`." msgstr "" +"Việc còn lại của bạn là triển khai hàm `parse_field` và đặc điểm " +"`ProtoMessage` cho `Person` và `PhoneNumber`." #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Invalid varint\"" -msgstr "" +msgstr "\"Biến thể không hợp lệ\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Invalid wire-type\"" -msgstr "" +msgstr "\"Loại dây không hợp lệ\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Unexpected EOF\"" -msgstr "" +msgstr "\"EOF không mong đợi\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Invalid length\"" -msgstr "" +msgstr "\"Độ dài không hợp lệ\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Unexpected wire-type)\"" -msgstr "" +msgstr "\"Loại dây không mong muốn)\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "\"Invalid string (not UTF-8)\"" -msgstr "" +msgstr "\"Chuỗi không hợp lệ (không phải UTF-8)\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// A wire type as seen on the wire.\n" -msgstr "" +msgstr "/// Một loại dây như nhìn thấy trên dây.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// The Varint WireType indicates the value is a single VARINT.\n" -msgstr "" +msgstr "/// Varint WireType cho biết giá trị là một VARINT đơn.\n" #: src/lifetimes/exercise.md src/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, -- không cần thiết cho bài tập này\n" +" /// Len WireType chỉ ra rằng giá trị là độ dài được biểu thị dưới dạng\n" +" /// VARINT theo sau chính xác là số byte đó.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "" "/// The I32 WireType indicates that the value is precisely 4 bytes in\n" " /// little-endian order containing a 32-bit signed integer.\n" msgstr "" +"/// WireType I32 chỉ ra rằng giá trị chính xác là 4 byte trong\n" +" /// thứ tự endian nhỏ chứa số nguyên có dấu 32 bit.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// A field's value, typed based on the wire type.\n" -msgstr "" +msgstr "/// Giá trị của một trường, được nhập dựa trên loại dây.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "//I64(i64), -- not needed for this exercise\n" -msgstr "" +msgstr "//I64(i64), -- không cần thiết cho bài tập này\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// A field, containing the field number and its value.\n" -msgstr "" +msgstr "/// Một trường, chứa số trường và giá trị của nó.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "//1 => WireType::I64, -- not needed for this exercise\n" -msgstr "" +msgstr "//1 => WireType::I64, -- không cần thiết cho bài tập này\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "" "/// Parse a VARINT, returning the parsed value and the remaining bytes.\n" msgstr "" +"/// Phân tích một VARINT, trả về giá trị được phân tích cú pháp và các byte " +"còn lại.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "" "// This is the last byte of the VARINT, so convert it to\n" " // a u64 and return it.\n" msgstr "" +"// Đây là byte cuối cùng của VARINT, nên hãy chuyển nó thành\n" +" // một u64 và trả lại nó.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "// More than 7 bytes is invalid.\n" -msgstr "" +msgstr "// Hơn 7 byte là không hợp lệ.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// Convert a tag into a field number and a WireType.\n" -msgstr "" +msgstr "/// Chuyển đổi thẻ thành số trường và WireType.\n" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "/// Parse a field, returning the remaining bytes\n" -msgstr "" +msgstr "/// Phân tích một trường, trả về các byte còn lại\n" #: src/lifetimes/exercise.md msgid "" "\"Based on the wire type, build a Field, consuming as many bytes as " "necessary.\"" -msgstr "" +msgstr "\"Dựa trên loại dây, xây dựng Trường, tiêu thụ bao nhiêu byte nếu cần.\"" #: src/lifetimes/exercise.md msgid "\"Return the field, and any un-consumed bytes.\"" -msgstr "" +msgstr "\"Trả về trường và mọi byte chưa được sử dụng.\"" #: src/lifetimes/exercise.md src/lifetimes/solution.md msgid "" -"/// Parse a message in the given data, calling `T::add_field` for each field " -"in\n" +"/// Parse a message in the given data, calling `T::add_field` for each field in\n" "/// the message.\n" "///\n" "/// The entire input is consumed.\n" msgstr "" +"/// Phân tích một thông báo trong dữ liệu đã cho, gọi `T::add_field` cho mỗi trường trong\n" +"/// tin nhắn.\n" +"///\n" +"/// Toàn bộ đầu vào được sử dụng.\n" #: src/lifetimes/exercise.md msgid "// TODO: Implement ProtoMessage for Person and PhoneNumber.\n" -msgstr "" +msgstr "// TODO: Triển khai ProtoMessage cho Person và PhoneNumber.\n" #: src/lifetimes/solution.md msgid "// Unwrap error because `value` is definitely 4 bytes long.\n" -msgstr "" +msgstr "// Lỗi Unwrap vì `value` chắc chắn dài 4 byte.\n" #: src/lifetimes/solution.md msgid "// skip everything else\n" -msgstr "" +msgstr "// bỏ qua mọi thứ khác\n" #: src/lifetimes/solution.md msgid "b\"hello\"" -msgstr "" +msgstr "b\"xin chào\"" #: src/welcome-day-4.md msgid "Welcome to Day 4" -msgstr "" +msgstr "Chào mừng đến với ngày thứ 4" #: src/welcome-day-4.md msgid "" -"Today we will cover topics relating to building large-scale software in Rust:" +"Today we will cover topics relating to building large-scale software in " +"Rust:" msgstr "" +"Hôm nay chúng tôi sẽ đề cập đến các chủ đề liên quan đến việc xây dựng phần " +"mềm quy mô lớn trong Rust:" #: src/welcome-day-4.md msgid "Iterators: a deep dive on the `Iterator` trait." -msgstr "" +msgstr "Iterators: tìm hiểu sâu về đặc điểm `Iterator`." #: src/welcome-day-4.md msgid "Modules and visibility." -msgstr "" +msgstr "Mô-đun và khả năng hiển thị." #: src/welcome-day-4.md msgid "Testing." -msgstr "" +msgstr "Đang thử nghiệm." #: src/welcome-day-4.md msgid "Error handling: panics, `Result`, and the try operator `?`." -msgstr "" +msgstr "Xử lý lỗi: hoảng loạn, `Kết quả` và toán tử thử `?`." #: src/welcome-day-4.md msgid "" "Unsafe Rust: the escape hatch when you can't express yourself in safe Rust." msgstr "" +"Rust không an toàn: lối thoát khi bạn không thể thể hiện bản thân trong Rust" +" an toàn." #: src/welcome-day-4.md msgid "" @@ -8826,15 +9878,15 @@ msgstr "Phần này sẽ kéo dài khoảng 45 phút, bao gồm:" #: src/iterators.md msgid "Iterator" -msgstr "" +msgstr "Trình vòng lặp" #: src/iterators.md msgid "IntoIterator" -msgstr "" +msgstr "IntoIterator" #: src/iterators.md src/iterators/fromiterator.md msgid "FromIterator" -msgstr "" +msgstr "FromIterator" #: src/iterators/iterator.md msgid "" @@ -8843,19 +9895,28 @@ msgid "" "method and provides lots of methods. Many standard library types implement " "`Iterator`, and you can implement it yourself, too:" msgstr "" +"Đặc điểm [`Iterator`](https://doc.rust-" +"lang.org/std/iter/trait.Iterator.html) hỗ trợ việc lặp lại các giá trị trong" +" một bộ sưu tập. Nó yêu cầu một phương thức `next` và cung cấp rất nhiều " +"phương thức. Nhiều loại thư viện tiêu chuẩn triển khai `Iterator` và bạn " +"cũng có thể tự triển khai nó:" #: src/iterators/iterator.md msgid "\"fib({i}): {n}\"" -msgstr "" +msgstr "\"fib({i}): {n}\"" #: src/iterators/iterator.md 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 " +"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 "" +"Đặc điểm `Iterator` thực hiện nhiều thao tác lập trình chức năng phổ biến " +"trên các bộ sưu tập (ví dụ: `map`, `filter`, `reduce`, v.v.). Đây là đặc " +"điểm mà bạn có thể tìm thấy tất cả tài liệu về chúng. Trong Rust, các hàm " +"này sẽ tạo ra mã hiệu quả như việc triển khai mệnh lệnh tương đương." #: src/iterators/iterator.md msgid "" @@ -8864,54 +9925,71 @@ msgid "" "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` là đặc điểm giúp cho các vòng lặp hoạt động. Nó được triển " +"khai bởi các loại bộ sưu tập chẳng hạn như `Vec` và các tham chiếu đến " +"chúng chẳng hạn như `&Vec` và `&[T]`. Phạm vi cũng thực hiện nó. Đây là " +"lý do tại sao bạn có thể lặp qua một vectơ với `for i in some_vec { .. }` " +"nhưng `some_vec.next()` không tồn tại." #: src/iterators/intoiterator.md 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 "" +"Đặc điểm `Iterator` cho bạn biết cách _iterate_ sau khi bạn đã tạo một " +"iterator. Đặc điểm liên quan [`IntoIterator`](https://doc.rust-" +"lang.org/std/iter/trait.IntoIterator.html) xác định cách tạo một trình vòng " +"lặp cho một loại. Nó được sử dụng tự động bởi vòng lặp `for`." #: src/iterators/intoiterator.md msgid "\"point = {x}, {y}\"" -msgstr "" +msgstr "\"điểm = {x}, {y}\"" #: src/iterators/intoiterator.md msgid "" "Click through to the docs for `IntoIterator`. Every implementation of " "`IntoIterator` must declare two types:" msgstr "" +"Nhấp qua tài liệu dành cho `IntoIterator`. Mỗi lần triển khai `IntoIterator`" +" phải khai báo hai loại:" #: src/iterators/intoiterator.md msgid "`Item`: the type to iterate over, such as `i8`," -msgstr "" +msgstr "`Item`: loại cần lặp lại, chẳng hạn như `i8`," #: src/iterators/intoiterator.md msgid "`IntoIter`: the `Iterator` type returned by the `into_iter` method." -msgstr "" +msgstr "`IntoIter`: kiểu `Iterator` được trả về bởi phương thức `into_iter`." #: src/iterators/intoiterator.md msgid "" "Note that `IntoIter` and `Item` are linked: the iterator must have the same " "`Item` type, which means that it returns `Option`" msgstr "" +"Lưu ý rằng `IntoIter` và `Item` được liên kết: iterator phải có cùng loại " +"`Item`, nghĩa là nó trả về `Option`" #: src/iterators/intoiterator.md msgid "The example iterates over all combinations of x and y coordinates." -msgstr "" +msgstr "Ví dụ lặp lại tất cả các kết hợp tọa độ x và y." #: src/iterators/intoiterator.md msgid "" "Try iterating over the grid twice in `main`. Why does this fail? Note that " "`IntoIterator::into_iter` takes ownership of `self`." msgstr "" +"Hãy thử lặp lại lưới hai lần trong `main`. Tại sao điều này thất bại? Lưu ý " +"rằng `IntoIterator::into_iter` có quyền sở hữu `self`." #: src/iterators/intoiterator.md msgid "" "Fix this issue by implementing `IntoIterator` for `&Grid` and storing a " "reference to the `Grid` in `GridIter`." msgstr "" +"Khắc phục sự cố này bằng cách triển khai `IntoIterator` cho `&Grid` và lưu " +"trữ tham chiếu đến `Grid` trong `GridIter`." #: src/iterators/intoiterator.md msgid "" @@ -8920,25 +9998,32 @@ msgid "" "elements from that vector. Use `for e in &some_vector` instead, to iterate " "over references to elements of `some_vector`." msgstr "" +"Vấn đề tương tự có thể xảy ra đối với các loại thư viện tiêu chuẩn: `for e " +"in some_vector` sẽ sở hữu `some_vector` và lặp lại các phần tử thuộc sở hữu " +"từ vectơ đó. Thay vào đó, hãy sử dụng `for e in &some_vector` để lặp lại các" +" tham chiếu đến các phần tử của `some_vector`." #: 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)." +"[`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)." msgstr "" +"[`FromIterator`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html)" +" cho phép bạn xây dựng một bộ sưu tập từ [`Iterator`](https://doc.rust-" +"lang.org/std/iter/trait.Iterator.html)." #: src/iterators/fromiterator.md msgid "\"prime_squares: {prime_squares:?}\"" -msgstr "" +msgstr "\"prime_squares: {prime_squares:?}\"" #: src/iterators/fromiterator.md msgid "`Iterator` implements" -msgstr "" +msgstr "`Iterator` thực hiện" #: src/iterators/fromiterator.md msgid "There are two ways to specify `B` for this method:" -msgstr "" +msgstr "Có hai cách để chỉ định `B` cho phương thức này:" #: src/iterators/fromiterator.md msgid "" @@ -8946,26 +10031,39 @@ msgid "" "shown. The `_` shorthand used here lets Rust infer the type of the `Vec` " "elements." msgstr "" +"Với \"turbofish\": `some_iterator.collect::()`, như được " +"hiển thị. Cách viết tắt `_` được sử dụng ở đây cho phép Rust suy ra loại " +"phần tử `Vec`." #: src/iterators/fromiterator.md msgid "" "With type inference: `let prime_squares: Vec<_> = some_iterator.collect()`. " "Rewrite the example to use this form." msgstr "" +"Với suy luận kiểu: `let prime_squares: Vec<_> = some_iterator.collect()`. " +"Viết lại ví dụ để sử dụng mẫu này." #: src/iterators/fromiterator.md msgid "" -"There are basic implementations of `FromIterator` for `Vec`, `HashMap`, etc. " -"There are also more specialized implementations which let you do cool things " -"like convert an `Iterator>` into a `Result, E>`." +"There are basic implementations of `FromIterator` for `Vec`, `HashMap`, etc." +" There are also more specialized implementations which let you do cool " +"things like convert an `Iterator>` into a " +"`Result, E>`." msgstr "" +"Có các cách triển khai cơ bản của `FromIterator` cho `Vec`, `HashMap`, v.v. " +"Ngoài ra còn có các cách triển khai chuyên biệt hơn cho phép bạn thực hiện " +"những điều thú vị như chuyển đổi `Iterator>` thành " +"`Result, E>`." #: src/iterators/exercise.md 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 "" +"Trong bài tập này, bạn sẽ cần tìm và sử dụng một số phương thức được cung " +"cấp trong đặc điểm [`Iterator`](https://doc.rust-" +"lang.org/std/iter/trait.Iterator.html) để thực hiện một phép tính phức tạp." #: src/iterators/exercise.md msgid "" @@ -8973,75 +10071,91 @@ msgid "" "pass. Use an iterator expression and `collect` the result to construct the " "return value." msgstr "" +"Sao chép mã sau vào và vượt qua bài kiểm tra. " +"Sử dụng biểu thức lặp và `thu thập` kết quả để xây dựng giá trị trả về." #: 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 "" +"/// Tính toán sự khác biệt giữa các phần tử của `values` offset by `offset`,\n" +"/// bao quanh từ cuối `values` đến đầu.\n" +"///\n" +"/// Phần tử `n` của kết quả là `values[(n+offset)%len] - value[n]`.\n" #: src/modules.md src/modules/paths.md msgid "use, super, self" -msgstr "" +msgstr "sử dụng, siêu, tự" #: src/modules/modules.md msgid "We have seen how `impl` blocks let us namespace functions to a type." msgstr "" +"Chúng ta đã thấy các khối `impl` cho phép chúng ta vận hành không gian tên " +"theo một kiểu như thế nào." #: src/modules/modules.md msgid "Similarly, `mod` lets us namespace types and functions:" msgstr "" +"Tương tự, `mod` cho phép chúng ta sử dụng các kiểu và hàm không gian tên:" #: src/modules/modules.md msgid "\"In the foo module\"" -msgstr "" +msgstr "\"Trong mô-đun foo\"" #: src/modules/modules.md msgid "\"In the bar module\"" -msgstr "" +msgstr "\"Trong mô-đun thanh\"" #: src/modules/modules.md msgid "" "Packages provide functionality and include a `Cargo.toml` file that " "describes how to build a bundle of 1+ crates." msgstr "" +"Các gói cung cấp chức năng và bao gồm tệp `Cargo.toml` mô tả cách tạo một " +"gói gồm hơn 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 là một cây mô-đun, trong đó crate nhị phân tạo ra tệp thực thi và " +"crate thư viện biên dịch thành thư viện." #: src/modules/modules.md msgid "Modules define organization, scope, and are the focus of this section." -msgstr "" +msgstr "Các mô-đun xác định tổ chức, phạm vi và là trọng tâm của phần này." #: src/modules/filesystem.md msgid "" "Omitting the module content will tell Rust to look for it in another file:" msgstr "" +"Việc bỏ qua nội dung mô-đun sẽ yêu cầu Rust tìm nó trong một tệp khác:" #: 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 "" +"Điều này cho biết rằng nội dung mô-đun `garden` được tìm thấy tại " +"`src/garden.rs`. Tương tự, bạn có thể tìm thấy mô-đun `garden::vegetables` " +"tại `src/garden/vegetables.rs`." #: src/modules/filesystem.md msgid "The `crate` root is in:" -msgstr "" +msgstr "Gốc `crate` nằm trong:" #: src/modules/filesystem.md msgid "`src/lib.rs` (for a library crate)" -msgstr "" +msgstr "`src/lib.rs` (đối với crate thư viện)" #: src/modules/filesystem.md msgid "`src/main.rs` (for a binary crate)" -msgstr "" +msgstr "`src/main.rs` (đối với crate nhị phân)" #: src/modules/filesystem.md msgid "" @@ -9049,180 +10163,221 @@ msgid "" "comments\". These document the item that contains them -- in this case, a " "module." msgstr "" +"Các mô-đun được xác định trong tệp cũng có thể được ghi lại bằng cách sử " +"dụng \"nhận xét tài liệu bên trong\". Những tài liệu này ghi lại mục chứa " +"chúng -- trong trường hợp này là một mô-đun." #: src/modules/filesystem.md msgid "" -"//! This module implements the garden, including a highly performant " -"germination\n" +"//! This module implements the garden, including a highly performant germination\n" "//! implementation.\n" msgstr "" +"//! Mô-đun này triển khai khu vườn, bao gồm cả quá trình nảy mầm hiệu suất cao\n" +"//! thực hiện.\n" #: src/modules/filesystem.md msgid "// Re-export types from this module.\n" -msgstr "" +msgstr "// Tái xuất các loại từ mô-đun này.\n" #: src/modules/filesystem.md msgid "/// Sow the given seed packets.\n" -msgstr "" +msgstr "/// Gieo các gói hạt giống đã cho.\n" #: src/modules/filesystem.md msgid "/// Harvest the produce in the garden that is ready.\n" -msgstr "" +msgstr "/// Thu hoạch sản phẩm đã sẵn sàng tại vườn.\n" #: src/modules/filesystem.md msgid "" -"Before Rust 2018, modules needed to be located at `module/mod.rs` instead of " -"`module.rs`, and this is still a working alternative for editions after 2018." +"Before Rust 2018, modules needed to be located at `module/mod.rs` instead of" +" `module.rs`, and this is still a working alternative for editions after " +"2018." msgstr "" +"Trước Rust 2018, các mô-đun cần được đặt tại `module/mod.rs` thay vì " +"`module.rs` và đây vẫn là một giải pháp thay thế hoạt động cho các phiên bản" +" sau năm 2018." #: 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 "" +"Lý do chính để giới thiệu `filename.rs` thay thế cho `filename/mod.rs` là vì" +" nhiều tệp có tên `mod.rs` có thể khó phân biệt trong IDE." #: src/modules/filesystem.md msgid "Deeper nesting can use folders, even if the main module is a file:" msgstr "" +"Việc lồng sâu hơn có thể sử dụng các thư mục, ngay cả khi mô-đun chính là " +"một tệp:" #: src/modules/filesystem.md msgid "" "The place rust will look for modules can be changed with a compiler " "directive:" msgstr "" +"Nơi Rust sẽ tìm kiếm các mô-đun có thể được thay đổi bằng lệnh của trình " +"biên dịch:" #: src/modules/filesystem.md msgid "\"some/path.rs\"" -msgstr "" +msgstr "\"một số/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." msgstr "" +"Điều này rất hữu ích, ví dụ: nếu bạn muốn đặt các bài kiểm tra cho một mô-" +"đun trong một tệp có tên `some_module_test.rs`, tương tự như quy ước trong " +"Go." #: src/modules/visibility.md msgid "Modules are a privacy boundary:" -msgstr "" +msgstr "Mô-đun là ranh giới riêng tư:" #: src/modules/visibility.md msgid "Module items are private by default (hides implementation details)." msgstr "" +"Các mục mô-đun được đặt ở chế độ riêng tư theo mặc định (ẩn chi tiết triển " +"khai)." #: src/modules/visibility.md msgid "Parent and sibling items are always visible." -msgstr "" +msgstr "Các mục cha mẹ và anh chị em luôn được nhìn thấy." #: 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`." msgstr "" +"Nói cách khác, nếu một mục hiển thị trong mô-đun `foo`, thì nó sẽ hiển thị " +"trong tất cả các mô-đun con của `foo`." #: src/modules/visibility.md msgid "\"outer::private\"" -msgstr "" +msgstr "\"bên ngoài::riêng tư\"" #: src/modules/visibility.md msgid "\"outer::public\"" -msgstr "" +msgstr "\"bên ngoài::công khai\"" #: src/modules/visibility.md msgid "\"outer::inner::private\"" -msgstr "" +msgstr "\"bên ngoài::bên trong::riêng tư\"" #: src/modules/visibility.md msgid "\"outer::inner::public\"" -msgstr "" +msgstr "\"bên ngoài::bên trong::công cộng\"" #: src/modules/visibility.md msgid "Use the `pub` keyword to make modules public." -msgstr "" +msgstr "Sử dụng từ khóa `pub` để công khai các mô-đun." #: 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 "" +"Ngoài ra, còn có các công cụ xác định `pub(...)` nâng cao để hạn chế phạm vi" +" hiển thị công khai." #: src/modules/visibility.md msgid "" "See the [Rust Reference](https://doc.rust-lang.org/reference/visibility-and-" "privacy.html#pubin-path-pubcrate-pubsuper-and-pubself)." msgstr "" +"Xem [Tham khảo Rust](https://doc.rust-lang.org/reference/visibility-and-" +"privacy.html#pubin-path-pubcrate-pubsuper-and-pubself)." #: src/modules/visibility.md msgid "Configuring `pub(crate)` visibility is a common pattern." -msgstr "" +msgstr "Định cấu hình khả năng hiển thị `pub(crate)` là một mẫu phổ biến." #: src/modules/visibility.md msgid "Less commonly, you can give visibility to a specific path." msgstr "" +"Ít phổ biến hơn, bạn có thể cung cấp khả năng hiển thị cho một đường dẫn cụ " +"thể." #: src/modules/visibility.md msgid "" "In any case, visibility must be granted to an ancestor module (and all of " "its descendants)." msgstr "" +"Trong mọi trường hợp, khả năng hiển thị phải được cấp cho mô-đun tổ tiên (và" +" tất cả các mô-đun con cháu của nó)." #: 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:" msgstr "" +"Một mô-đun có thể đưa các ký hiệu từ một mô-đun khác vào phạm vi bằng `use`." +" Thông thường, bạn sẽ thấy nội dung như thế này ở đầu mỗi mô-đun:" #: src/modules/paths.md msgid "Paths" -msgstr "" +msgstr "Đường dẫn" #: src/modules/paths.md msgid "Paths are resolved as follows:" -msgstr "" +msgstr "Đường dẫn được giải quyết như sau:" #: src/modules/paths.md msgid "As a relative path:" -msgstr "" +msgstr "Là một đường dẫn tương đối:" #: src/modules/paths.md msgid "`foo` or `self::foo` refers to `foo` in the current module," -msgstr "" +msgstr "`foo` hoặc `self::foo` đề cập đến `foo` trong mô-đun hiện tại," #: src/modules/paths.md msgid "`super::foo` refers to `foo` in the parent module." -msgstr "" +msgstr "`super::foo` đề cập đến `foo` trong mô-đun chính." #: src/modules/paths.md msgid "As an absolute path:" -msgstr "" +msgstr "Là một đường dẫn tuyệt đối:" #: src/modules/paths.md msgid "`crate::foo` refers to `foo` in the root of the current crate," -msgstr "" +msgstr "`crate::foo` đề cập đến `foo` trong thư mục gốc của crate hiện tại," #: src/modules/paths.md msgid "`bar::foo` refers to `foo` in the `bar` crate." -msgstr "" +msgstr "`bar::foo` đề cập đến `foo` trong crate `bar`." #: 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" msgstr "" +"Việc \"tái xuất\" các ký hiệu ở đường dẫn ngắn hơn là điều bình thường. Ví " +"dụ: `lib.rs` cấp cao nhất trong crate có thể có" #: src/modules/paths.md msgid "" "making `DiskStorage` and `NetworkStorage` available to other crates with a " "convenient, short path." msgstr "" +"cung cấp `DiskStorage` và `NetworkStorage` cho các crate khác bằng một đường" +" dẫn ngắn, thuận tiện." #: 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 " -"`read_to_string` method on a type implementing the `Read` trait, you need to " -"`use std::io::Read`." +"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 "" +"Trong hầu hết các trường hợp, chỉ những mục xuất hiện trong mô-đun mới cần " +"được ``sử dụng`. Tuy nhiên, một đặc điểm phải nằm trong phạm vi để gọi bất " +"kỳ phương thức nào trên đặc điểm đó, ngay cả khi kiểu triển khai đặc điểm đó" +" đã nằm trong phạm vi. Ví dụ: để sử dụng phương thức `read_to_string` trên " +"loại triển khai đặc điểm `Read`, bạn cần `use std::io::Read`." #: src/modules/paths.md msgid "" @@ -9230,6 +10385,9 @@ msgid "" "discouraged because it is not clear which items are imported, and those " "might change over time." msgstr "" +"Câu lệnh `use` có thể có ký tự đại diện: `use std::io::*`. Điều này không " +"được khuyến khích vì không rõ mặt hàng nào được nhập khẩu và những mặt hàng " +"đó có thể thay đổi theo thời gian." #: src/modules/exercise.md msgid "" @@ -9237,67 +10395,77 @@ msgid "" "This library defines a `Widget` trait and a few implementations of that " "trait, as well as a `main` function." msgstr "" +"Trong bài tập này, bạn sẽ tổ chức lại việc triển khai Thư viện GUI nhỏ. Thư " +"viện này xác định đặc điểm `Widget` và một vài cách triển khai đặc điểm đó, " +"cũng như hàm `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 "" +"Thông thường, nên đặt từng loại hoặc tập hợp các loại có liên quan chặt chẽ " +"vào mô-đun riêng của nó, vì vậy mỗi loại tiện ích sẽ có mô-đun riêng." #: src/modules/exercise.md msgid "Cargo Setup" -msgstr "" +msgstr "Cargo setup" #: src/modules/exercise.md msgid "" -"The Rust playground only supports one file, so you will need to make a Cargo " -"project on your local filesystem:" +"The Rust playground only supports one file, so you will need to make a Cargo" +" project on your local filesystem:" msgstr "" +"Sân chơi Rust chỉ hỗ trợ một tệp, vì vậy bạn sẽ cần tạo dự án Cargo trên hệ " +"thống tệp cục bộ của mình:" #: src/modules/exercise.md msgid "" -"Edit the resulting `src/main.rs` to add `mod` statements, and add additional " -"files in the `src` directory." +"Edit the resulting `src/main.rs` to add `mod` statements, and add additional" +" files in the `src` directory." msgstr "" +"Chỉnh sửa `src/main.rs` kết quả để thêm các câu lệnh `mod` và thêm các tệp " +"bổ sung trong thư mục `src`." #: src/modules/exercise.md msgid "Source" -msgstr "" +msgstr "Nguồn" #: src/modules/exercise.md msgid "Here's the single-module implementation of the GUI library:" -msgstr "" +msgstr "Đây là cách triển khai một mô-đun của thư viện GUI:" #: src/modules/exercise.md src/modules/solution.md msgid "/// Natural width of `self`.\n" -msgstr "" +msgstr "/// Chiều rộng tự nhiên của `self`.\n" #: src/modules/exercise.md src/modules/solution.md msgid "/// Draw the widget into a buffer.\n" -msgstr "" +msgstr "/// Vẽ widget vào bộ đệm.\n" #: src/modules/exercise.md src/modules/solution.md msgid "/// Draw the widget on standard output.\n" -msgstr "" +msgstr "/// Vẽ widget trên đầu ra tiêu chuẩn.\n" #: src/modules/exercise.md src/modules/solution.md msgid "\"{buffer}\"" -msgstr "" +msgstr "\"{bộ đệm}\"" #: src/modules/exercise.md msgid "// Add 4 paddings for borders\n" -msgstr "" +msgstr "// Thêm 4 phần đệm cho đường viền\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 "" +"// VIỆC CẦN LÀM: Thay đổi draw_into để trả về Kết quả<(), std::fmt::Error>. Sau đó sử dụng\n" +" // ?-operator ở đây thay vì .unwrap().\n" #: src/modules/exercise.md src/modules/solution.md msgid "\"+-{:-. Then use\n" " // the ?-operator here instead of .unwrap().\n" msgstr "" +"// TODO: sau khi tìm hiểu về cách xử lý lỗi, bạn có thể thay đổi\n" +" // draw_into để trả về Kết quả<(), std::fmt::Error>. Sau đó sử dụng\n" +" // toán tử ? ở đây thay vì .unwrap().\n" #: src/modules/solution.md msgid "// ---- src/main.rs ----\n" -msgstr "" +msgstr "// ---- src/main.rs ----\n" #: src/testing/unit-tests.md msgid "Unit Tests" -msgstr "" +msgstr "Kiểm tra đơn vị" #: src/testing/unit-tests.md msgid "Rust and Cargo come with a simple unit test framework:" -msgstr "" +msgstr "Rust và Cargo đi kèm với một khung kiểm thử đơn vị đơn giản:" #: src/testing/unit-tests.md msgid "Unit tests are supported throughout your code." -msgstr "" +msgstr "Kiểm thử đơn vị được hỗ trợ xuyên suốt mã của bạn." #: src/testing/unit-tests.md msgid "Integration tests are supported via the `tests/` directory." -msgstr "" +msgstr "Kiểm thử tích hợp được hỗ trợ thông qua thư mục `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` module, using `#[cfg(test)]` to conditionally compile them only when" +" building tests." msgstr "" +"Các bài kiểm tra được đánh dấu bằng `#[test]`. Kiểm thử đơn vị thường được " +"đặt trong mô-đun `kiểm tra` lồng nhau, sử dụng `#[cfg(test)]` để chỉ biên " +"dịch chúng theo điều kiện khi xây dựng kiểm thử." #: src/testing/unit-tests.md msgid "\"Hello World\"" -msgstr "" +msgstr "\"Xin chào thế giới\"" #: src/testing/unit-tests.md msgid "This lets you unit test private helpers." -msgstr "" +msgstr "Điều này cho phép bạn kiểm tra đơn vị người trợ giúp riêng." #: src/testing/unit-tests.md msgid "The `#[cfg(test)]` attribute is only active when you run `cargo test`." -msgstr "" +msgstr "Thuộc tính `#[cfg(test)]` chỉ hoạt động khi bạn chạy `cargo test`." #: src/testing/unit-tests.md msgid "Run the tests in the playground in order to show their results." -msgstr "" +msgstr "Chạy các bài kiểm tra trong sân chơi để hiển thị kết quả của họ." #: src/testing/other.md msgid "Integration Tests" -msgstr "" +msgstr "Kiểm tra tích hợp" #: src/testing/other.md msgid "If you want to test your library as a client, use an integration test." msgstr "" +"Nếu bạn muốn kiểm tra thư viện của mình với tư cách khách hàng, hãy sử dụng " +"thử nghiệm tích hợp." #: src/testing/other.md msgid "Create a `.rs` file under `tests/`:" -msgstr "" +msgstr "Tạo một tệp `.rs` trong `tests/`:" #: src/testing/other.md msgid "// tests/my_library.rs\n" -msgstr "" +msgstr "// test/my_library.rs\n" #: src/testing/other.md msgid "These tests only have access to the public API of your crate." msgstr "" +"Những thử nghiệm này chỉ có quyền truy cập vào API công khai của crate của " +"bạn." #: src/testing/other.md msgid "Documentation Tests" -msgstr "" +msgstr "Kiểm tra tài liệu" #: src/testing/other.md msgid "Rust has built-in support for documentation tests:" -msgstr "" +msgstr "Rust có hỗ trợ tích hợp cho việc kiểm tra tài liệu:" #: src/testing/other.md msgid "" @@ -9489,26 +10672,36 @@ msgid "" "/// assert_eq!(shorten_string(\"Hello World\", 20), \"Hello World\");\n" "/// ```\n" msgstr "" +"/// Rút ngắn chuỗi theo độ dài cho trước.\n" +"///\n" +"/// ```\n" +"/// # sử dụng sân chơi::shorten_string;\n" +"/// khẳng định_eq!(shorten_string(\"Xin chào thế giới\", 5), \"Xin chào\");\n" +"/// khẳng định_eq!(shorten_string(\"Xin chào thế giới\", 20), \"Xin chào thế giới\");\n" +"/// ```\n" #: src/testing/other.md msgid "Code blocks in `///` comments are automatically seen as Rust code." -msgstr "" +msgstr "Các khối mã trong nhận xét `///` được tự động xem là mã Rust." #: src/testing/other.md msgid "The code will be compiled and executed as part of `cargo test`." -msgstr "" +msgstr "Mã sẽ được biên dịch và thực thi như một phần của `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 "" +"Việc thêm `#` vào mã sẽ ẩn nó khỏi tài liệu nhưng vẫn sẽ biên dịch/chạy nó." #: src/testing/other.md msgid "" -"Test the above code on the [Rust Playground](https://play.rust-lang.org/?" -"version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." +"Test the above code on the [Rust Playground](https://play.rust-" +"lang.org/?version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." msgstr "" +"Kiểm tra mã trên trên [Rust Playground](https://play.rust-" +"lang.org/?version=stable&mode=debug&edition=2021&gist=3ce2ad13ea1302f6572cb15cd96becf0)." #: src/testing/lints.md msgid "" @@ -9516,10 +10709,14 @@ msgid "" "built-in lints. [Clippy](https://doc.rust-lang.org/clippy/) provides even " "more lints, organized into groups that can be enabled per-project." msgstr "" +"compiler Rust tạo ra các thông báo lỗi tuyệt vời cũng như các lint tích hợp " +"hữu ích. [Clippy](https://doc.rust-lang.org/clippy/) thậm chí còn cung cấp " +"nhiều lint hơn nữa, được sắp xếp thành các nhóm có thể được kích hoạt cho " +"mỗi dự án." #: src/testing/lints.md msgid "\"X probably fits in a u16, right? {}\"" -msgstr "" +msgstr "\"X có lẽ phù hợp với u16 phải không? {}\"" #: src/testing/lints.md msgid "" @@ -9527,6 +10724,9 @@ msgid "" "visible here, but those will not be shown once the code compiles. Switch to " "the Playground site to show those lints." msgstr "" +"Chạy mẫu mã và kiểm tra thông báo lỗi. Ở đây cũng có các đoạn mã được hiển " +"thị, nhưng chúng sẽ không được hiển thị sau khi biên dịch mã. Chuyển sang " +"trang Playground để hiển thị những gợi ý đó." #: src/testing/lints.md msgid "" @@ -9534,16 +10734,22 @@ msgid "" "clippy warnings. Clippy has extensive documentation of its lints, and adds " "new lints (including default-deny lints) all the time." msgstr "" +"Sau khi giải quyết các lỗi lint, hãy chạy `clippy` trên trang web sân chơi " +"để hiển thị các cảnh báo clippy. Clippy có tài liệu phong phú về các lint " +"của nó và luôn bổ sung thêm các lint mới (bao gồm cả các lint bị từ chối mặc" +" định)." #: src/testing/lints.md msgid "" "Note that errors or warnings with `help: ...` can be fixed with `cargo fix` " "or via your editor." msgstr "" +"Lưu ý rằng các lỗi hoặc cảnh báo với `trợ giúp: ...` có thể được sửa bằng " +"`sửa lỗi cargo` hoặc thông qua trình soạn thảo của bạn." #: src/testing/exercise.md msgid "Luhn Algorithm" -msgstr "" +msgstr "Thuật toán Luhn" #: src/testing/exercise.md msgid "" @@ -9551,30 +10757,39 @@ msgid "" "to validate credit card numbers. The algorithm takes a string as input and " "does the following to validate the credit card number:" msgstr "" +"[Thuật toán Luhn](https://en.wikipedia.org/wiki/Luhn_algorithm) được dùng để" +" xác thực số thẻ tín dụng. Thuật toán lấy một chuỗi làm đầu vào và thực hiện" +" các thao tác sau để xác thực số thẻ tín dụng:" #: src/testing/exercise.md msgid "Ignore all spaces. Reject number with fewer than two digits." -msgstr "" +msgstr "Bỏ qua tất cả các không gian. Từ chối số có ít hơn hai chữ số." #: src/testing/exercise.md 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`." +"`1234`, we double `3` and `1`. For the number `98765`, we double `6` and " +"`8`." msgstr "" +"Di chuyển từ **phải sang trái**, nhân đôi mỗi chữ số thứ hai: đối với số " +"`1234`, chúng ta nhân đôi `3` và `1`. Đối với số `98765`, chúng ta nhân đôi " +"`6` và `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 "" +"Sau khi nhân đôi một chữ số, tính tổng các chữ số nếu kết quả lớn hơn 9. Vì " +"vậy, nhân đôi `7` trở thành `14` trở thành `1 + 4 = 5`." #: src/testing/exercise.md msgid "Sum all the undoubled and doubled digits." -msgstr "" +msgstr "Tính tổng tất cả các chữ số không nhân đôi và nhân đôi." #: src/testing/exercise.md msgid "The credit card number is valid if the sum ends with `0`." -msgstr "" +msgstr "Số thẻ tín dụng hợp lệ nếu số tiền kết thúc bằng `0`." #: src/testing/exercise.md msgid "" @@ -9582,6 +10797,9 @@ msgid "" "along with two basic unit tests that confirm that most the algorithm is " "implemented correctly." msgstr "" +"Mã được cung cấp cung cấp cách triển khai thuật toán luhn có lỗi, cùng với " +"hai thử nghiệm đơn vị cơ bản xác nhận rằng hầu hết thuật toán được triển " +"khai chính xác." #: src/testing/exercise.md msgid "" @@ -9589,58 +10807,61 @@ msgid "" "tests to uncover bugs in the provided implementation, fixing any bugs you " "find." msgstr "" +"Sao chép mã bên dưới vào và viết các bài kiểm " +"tra bổ sung để phát hiện lỗi trong quá trình triển khai được cung cấp, khắc " +"phục mọi lỗi bạn tìm thấy." #: src/testing/exercise.md src/testing/solution.md msgid "\"4263 9826 4026 9299\"" -msgstr "" +msgstr "\"4263 9826 4026 9299\"" #: src/testing/exercise.md src/testing/solution.md msgid "\"4539 3195 0343 6467\"" -msgstr "" +msgstr "\"4539 3195 0343 6467\"" #: src/testing/exercise.md src/testing/solution.md msgid "\"7992 7398 713\"" -msgstr "" +msgstr "\"7992 7398 713\"" #: src/testing/exercise.md src/testing/solution.md msgid "\"4223 9826 4026 9299\"" -msgstr "" +msgstr "\"4223 9826 4026 9299\"" #: src/testing/exercise.md src/testing/solution.md msgid "\"4539 3195 0343 6476\"" -msgstr "" +msgstr "\"4539 3195 0343 6476\"" #: src/testing/exercise.md src/testing/solution.md msgid "\"8273 1232 7352 0569\"" -msgstr "" +msgstr "\"8273 1232 7352 0569\"" #: src/testing/solution.md msgid "// This is the buggy version that appears in the problem.\n" -msgstr "" +msgstr "// Đây là phiên bản có lỗi xuất hiện trong vấn đề.\n" #: src/testing/solution.md msgid "// This is the solution and passes all of the tests below.\n" -msgstr "" +msgstr "// Đây là giải pháp và vượt qua tất cả các bài kiểm tra bên dưới.\n" #: src/testing/solution.md msgid "\"1234 5678 1234 5670\"" -msgstr "" +msgstr "\"1234 5678 1234 5670\"" #: src/testing/solution.md msgid "\"Is {cc_number} a valid credit card number? {}\"" -msgstr "" +msgstr "\"{cc_number} có phải là số thẻ tín dụng hợp lệ không? {}\"" #: src/testing/solution.md msgid "\"yes\"" -msgstr "" +msgstr "\"Đúng\"" #: src/testing/solution.md msgid "\"no\"" -msgstr "" +msgstr "\"KHÔNG\"" #: src/testing/solution.md msgid "\"foo 0 0\"" -msgstr "" +msgstr "\"foo 0 0\"" #: src/testing/solution.md msgid "\" \"" @@ -9648,108 +10869,123 @@ msgstr "" #: src/testing/solution.md msgid "\" \"" -msgstr "" +msgstr "\" \"" #: src/testing/solution.md msgid "\" \"" -msgstr "" +msgstr "\" \"" #: src/testing/solution.md msgid "\"0\"" -msgstr "" +msgstr "\"0\"" #: src/testing/solution.md msgid "\" 0 0 \"" -msgstr "" +msgstr "\" 0 0 \"" #: src/error-handling.md msgid "Error Trait" -msgstr "" +msgstr "Đặc điểm lỗi" #: src/error-handling.md msgid "thiserror and anyhow" -msgstr "" +msgstr "lỗi này và dù sao đi nữa" #: src/error-handling.md src/error-handling/exercise.md msgid "Exercise: Rewriting with Result" -msgstr "" +msgstr "Bài tập: Viết lại kết quả" #: src/error-handling/panics.md msgid "Rust handles fatal errors with a \"panic\"." -msgstr "" +msgstr "Rust xử lý những lỗi chết người một cách “hoảng loạn”." #: src/error-handling/panics.md msgid "Rust will trigger a panic if a fatal error happens at runtime:" msgstr "" +"Rust sẽ gây hoảng loạn nếu xảy ra lỗi nghiêm trọng trong thời gian chạy:" #: src/error-handling/panics.md msgid "\"v[100]: {}\"" -msgstr "" +msgstr "\"v[100]: {}\"" #: src/error-handling/panics.md msgid "Panics are for unrecoverable and unexpected errors." -msgstr "" +msgstr "Sự hoảng loạn là do những lỗi không thể phục hồi và không mong muốn." #: src/error-handling/panics.md msgid "Panics are symptoms of bugs in the program." -msgstr "" +msgstr "Sự hoảng loạn là triệu chứng của lỗi trong chương trình." #: src/error-handling/panics.md msgid "Runtime failures like failed bounds checks can panic" msgstr "" +"Lỗi thời gian chạy như kiểm tra giới hạn không thành công có thể gây hoảng " +"loạn" #: src/error-handling/panics.md msgid "Assertions (such as `assert!`) panic on failure" msgstr "" +"Những lời khẳng định (chẳng hạn như `assert!`) hoảng sợ trước thất bại" #: src/error-handling/panics.md msgid "Purpose-specific panics can use the `panic!` macro." -msgstr "" +msgstr "Sự hoảng loạn có mục đích cụ thể có thể sử dụng macro `hoảng loạn!`." #: src/error-handling/panics.md msgid "" "A panic will \"unwind\" the stack, dropping values just as if the functions " "had returned." msgstr "" +"Sự hoảng loạn sẽ \"tháo gỡ\" ngăn xếp, làm mất các giá trị giống như thể các" +" hàm đã trả về." #: src/error-handling/panics.md msgid "" "Use non-panicking APIs (such as `Vec::get`) if crashing is not acceptable." msgstr "" +"Sử dụng các API không gây hoảng loạn (chẳng hạn như `Vec::get`) nếu không " +"thể chấp nhận được sự cố." #: src/error-handling/panics.md msgid "" "By default, a panic will cause the stack to unwind. The unwinding can be " "caught:" msgstr "" +"Theo mặc định, sự hoảng loạn sẽ khiến ngăn xếp bị giãn ra. Việc tháo gỡ có " +"thể bị bắt:" #: src/error-handling/panics.md msgid "\"No problem here!\"" -msgstr "" +msgstr "\"Không có vấn đề gì ở đây!\"" #: src/error-handling/panics.md msgid "\"{result:?}\"" -msgstr "" +msgstr "\"{kết quả:?}\"" #: src/error-handling/panics.md msgid "\"oh no!\"" -msgstr "" +msgstr "\"ồ không!\"" #: src/error-handling/panics.md msgid "" "Catching is unusual; do not attempt to implement exceptions with " "`catch_unwind`!" msgstr "" +"Bắt là bất thường; đừng cố triển khai các ngoại lệ bằng `catch_unwind`!" #: src/error-handling/panics.md msgid "" "This can be useful in servers which should keep running even if a single " "request crashes." msgstr "" +"Điều này có thể hữu ích trong các máy chủ sẽ tiếp tục chạy ngay cả khi một " +"yêu cầu gặp sự cố." #: src/error-handling/panics.md msgid "This does not work if `panic = 'abort'` is set in your `Cargo.toml`." msgstr "" +"Điều này không có tác dụng nếu `panic = 'abort'` được đặt trong `Cargo.toml`" +" của bạn." #: src/error-handling/try.md msgid "" @@ -9758,93 +10994,116 @@ msgid "" "The try-operator `?` is used to return errors to the caller. It lets you " "turn the common" msgstr "" +"Các lỗi thời gian chạy như bị từ chối kết nối hoặc không tìm thấy tệp được " +"xử lý bằng loại `Kết quả`, nhưng việc khớp loại này trong mọi cuộc gọi có " +"thể rất phức tạp. Toán tử thử `?` được sử dụng để trả về lỗi cho người gọi. " +"Nó cho phép bạn biến cái chung" #: src/error-handling/try.md msgid "into the much simpler" -msgstr "" +msgstr "vào đơn giản hơn nhiều" #: src/error-handling/try.md msgid "We can use this to simplify our error handling code:" msgstr "" +"Chúng ta có thể sử dụng điều này để đơn giản hóa mã xử lý lỗi của mình:" #: src/error-handling/try.md msgid "//fs::write(\"config.dat\", \"alice\").unwrap();\n" -msgstr "" +msgstr "//fs::write(\"config.dat\", \"alice\").unwrap();\n" #: src/error-handling/try.md src/error-handling/try-conversions.md #: src/error-handling/thiserror-and-anyhow.md msgid "\"config.dat\"" -msgstr "" +msgstr "\"config.dat\"" #: src/error-handling/try.md src/error-handling/try-conversions.md msgid "\"username or error: {username:?}\"" -msgstr "" +msgstr "\"tên người dùng hoặc lỗi: {tên người dùng:?}\"" #: src/error-handling/try.md msgid "Simplify the `read_username` function to use `?`." -msgstr "" +msgstr "Đơn giản hóa hàm `read_username` để sử dụng `?`." #: src/error-handling/try.md msgid "The `username` variable can be either `Ok(string)` or `Err(error)`." -msgstr "" +msgstr "Biến `tên người dùng` có thể là `Ok(string)` hoặc `Err(error)`." #: src/error-handling/try.md msgid "" -"Use the `fs::write` call to test out the different scenarios: no file, empty " -"file, file with username." +"Use the `fs::write` call to test out the different scenarios: no file, empty" +" file, file with username." msgstr "" +"Sử dụng lệnh gọi `fs::write` để kiểm tra các trường hợp khác nhau: không có " +"tệp, tệp trống, tệp có tên người dùng." #: 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." +"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." msgstr "" +"Lưu ý rằng `main` có thể trả về `Result<(), E>` miễn là nó triển khai " +"`std::process::Termination`. Trong thực tế, điều này có nghĩa là `E` thực " +"hiện `Gỡ lỗi`. Tệp thực thi sẽ in biến thể `Err` và trả về trạng thái thoát " +"khác 0 do lỗi." #: src/error-handling/try-conversions.md msgid "" "The effective expansion of `?` is a little more complicated than previously " "indicated:" msgstr "" +"Việc mở rộng hiệu quả của `?` phức tạp hơn một chút so với đã chỉ ra trước " +"đây:" #: src/error-handling/try-conversions.md msgid "works the same as" -msgstr "" +msgstr "hoạt động tương tự như" #: src/error-handling/try-conversions.md 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." +"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 "" +"Lệnh gọi `From::from` ở đây có nghĩa là chúng tôi cố gắng chuyển đổi loại " +"lỗi thành loại được hàm trả về. Điều này giúp dễ dàng gói gọn các lỗi thành " +"các lỗi cấp cao hơn." #: src/error-handling/try-conversions.md msgid "\"IO error: {e}\"" -msgstr "" +msgstr "\"Lỗi IO: {e}\"" #: src/error-handling/try-conversions.md msgid "\"Found no username in {path}\"" -msgstr "" +msgstr "\"Không tìm thấy tên người dùng trong {path}\"" #: src/error-handling/try-conversions.md msgid "//std::fs::write(\"config.dat\", \"\").unwrap();\n" -msgstr "" +msgstr "//std::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 " +"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 "" +"Toán tử `?` phải trả về một giá trị tương thích với kiểu trả về của hàm. Đối" +" với `Kết quả`, điều đó có nghĩa là các loại lỗi phải tương thích. Một hàm " +"trả về `Result` chỉ có thể sử dụng `?` trên giá trị thuộc " +"loại `Result` nếu `ErrorOuter` và `ErrorInner` cùng loại hoặc" +" nếu `ErrorOuter` thực hiện `From`." #: 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 "" +"Một giải pháp thay thế phổ biến cho việc triển khai `From` là " +"`Result::map_err`, đặc biệt khi quá trình chuyển đổi chỉ diễn ra ở một nơi." #: src/error-handling/try-conversions.md msgid "" @@ -9852,6 +11111,8 @@ msgid "" "`Option` can use the `?` operator on `Option` for arbitrary `T` and " "`U` types." msgstr "" +"Không có yêu cầu tương thích cho `Option`. Một hàm trả về `Option` có thể" +" sử dụng toán tử `?` trên `Option` cho các loại `T` và `U` tùy ý." #: src/error-handling/try-conversions.md msgid "" @@ -9859,122 +11120,150 @@ msgid "" "However, `Option::ok_or` converts `Option` to `Result` whereas `Result::ok` " "turns `Result` into `Option`." msgstr "" +"Hàm trả về `Result` không thể sử dụng `?` trên `Option` và ngược lại. Tuy " +"nhiên, `Option::ok_or` chuyển đổi `Option` thành `Result` trong khi " +"`Result::ok` biến `Result` thành `Option`." #: src/error-handling/error.md msgid "Dynamic Error Types" -msgstr "" +msgstr "Các loại lỗi động" #: src/error-handling/error.md 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." +"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 "" +"Đôi khi, chúng tôi muốn cho phép trả về bất kỳ loại lỗi nào mà không cần " +"viết enum của riêng mình bao gồm tất cả các khả năng khác nhau. Đặc điểm " +"`std::error::Error` giúp dễ dàng tạo một đối tượng đặc điểm có thể chứa bất " +"kỳ lỗi nào." #: src/error-handling/error.md msgid "\"count.dat\"" -msgstr "" +msgstr "\"đếm.dat\"" #: src/error-handling/error.md msgid "\"1i3\"" -msgstr "" +msgstr "\"1i3\"" #: src/error-handling/error.md msgid "\"Count: {count}\"" -msgstr "" +msgstr "\"Đếm: {đếm}\"" #: src/error-handling/error.md msgid "\"Error: {err}\"" -msgstr "" +msgstr "\"Lỗi: {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 "" +"Hàm `read_count` có thể trả về `std::io::Error` (từ các thao tác trên tệp) " +"hoặc `std::num::ParseIntError` (từ `String::parse`)." #: src/error-handling/error.md 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 " +"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 "" +"Lỗi quyền anh tiết kiệm mã nhưng từ bỏ khả năng xử lý rõ ràng các trường hợp" +" lỗi khác nhau trong chương trình. Vì vậy, nói chung không phải là một ý " +"tưởng hay khi sử dụng `Box` trong API công khai của thư viện, " +"nhưng nó có thể là một lựa chọn tốt trong một chương trình mà bạn chỉ muốn " +"hiển thị thông báo lỗi ở đâu đó." #: src/error-handling/error.md msgid "" "Make sure to implement the `std::error::Error` trait when defining a custom " "error type so it can be boxed. But if you need to support the `no_std` " "attribute, keep in mind that the `std::error::Error` trait is currently " -"compatible with `no_std` in [nightly](https://github.com/rust-lang/rust/" -"issues/103765) only." +"compatible with `no_std` in [nightly](https://github.com/rust-" +"lang/rust/issues/103765) only." msgstr "" +"Đảm bảo triển khai đặc điểm `std::error::Error` khi xác định loại lỗi tùy " +"chỉnh để nó có thể được đóng hộp. Tuy nhiên, nếu bạn cần hỗ trợ thuộc tính " +"`no_std`, hãy nhớ rằng đặc điểm `std::error::Error` hiện chỉ tương thích với" +" `no_std` trong [nightly](https://github.com/rust-lang/rust/issues/103765)." #: src/error-handling/thiserror-and-anyhow.md msgid "" -"The [`thiserror`](https://docs.rs/thiserror/) and [`anyhow`](https://docs.rs/" -"anyhow/) crates are widely used to simplify error handling." +"The [`thiserror`](https://docs.rs/thiserror/) and " +"[`anyhow`](https://docs.rs/anyhow/) crates are widely used to simplify error" +" handling." msgstr "" +"Các crate [`thiserror`](https://docs.rs/thiserror/) và " +"[`anyhow`](https://docs.rs/anyhow/) được sử dụng rộng rãi để đơn giản hóa " +"việc xử lý lỗi." #: src/error-handling/thiserror-and-anyhow.md msgid "" "`thiserror` is often used in libraries to create custom error types that " "implement `From`." msgstr "" +"`thiserror` thường được sử dụng trong các thư viện để tạo các loại lỗi tùy " +"chỉnh triển khai `From`." #: src/error-handling/thiserror-and-anyhow.md msgid "" "`anyhow` is often used by applications to help with error handling in " "functions, including adding contextual information to your errors." msgstr "" +"`dù sao đi nữa` thường được các ứng dụng sử dụng để trợ giúp xử lý lỗi trong" +" các hàm, bao gồm cả việc thêm thông tin ngữ cảnh vào lỗi của bạn." #: src/error-handling/thiserror-and-anyhow.md msgid "\"Found no username in {0}\"" -msgstr "" +msgstr "\"Không tìm thấy tên người dùng trong {0}\"" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Failed to open {path}\"" -msgstr "" +msgstr "\"Không mở được {đường dẫn}\"" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Failed to read\"" -msgstr "" +msgstr "\"Không đọc được\"" #: src/error-handling/thiserror-and-anyhow.md msgid "//fs::write(\"config.dat\", \"\").unwrap();\n" -msgstr "" +msgstr "//fs::write(\"config.dat\", \"\").unwrap();\n" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Username: {username}\"" -msgstr "" +msgstr "\"Tên người dùng: {tên người dùng}\"" #: src/error-handling/thiserror-and-anyhow.md msgid "\"Error: {err:?}\"" -msgstr "" +msgstr "\"Lỗi: {err:?}\"" #: src/error-handling/thiserror-and-anyhow.md msgid "`thiserror`" -msgstr "" +msgstr "`lỗi này`" #: src/error-handling/thiserror-and-anyhow.md 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 "" +"Macro dẫn xuất `Error` được cung cấp bởi `thiserror` và có nhiều thuộc tính " +"hữu ích để giúp xác định các loại lỗi một cách gọn gàng." #: src/error-handling/thiserror-and-anyhow.md msgid "The `std::error::Error` trait is derived automatically." -msgstr "" +msgstr "Đặc điểm `std::error::Error` được lấy tự động." #: src/error-handling/thiserror-and-anyhow.md msgid "The message from `#[error]` is used to derive the `Display` trait." -msgstr "" +msgstr "Thông báo từ `#[error]` được sử dụng để lấy đặc điểm `Display`." #: src/error-handling/thiserror-and-anyhow.md msgid "`anyhow`" -msgstr "" +msgstr "`dù sao`" #: src/error-handling/thiserror-and-anyhow.md msgid "" @@ -9982,15 +11271,22 @@ msgid "" "it's again generally not a good choice for the public API of a library, but " "is widely used in applications." msgstr "" +"`anyhow::Error` về cơ bản là một trình bao bọc xung quanh `Box`. " +"Vì vậy, nó thường không phải là một lựa chọn tốt cho API công khai của thư " +"viện nhưng lại được sử dụng rộng rãi trong các ứng dụng." #: src/error-handling/thiserror-and-anyhow.md msgid "`anyhow::Result` is a type alias for `Result`." msgstr "" +"`anyhow::Result` là bí danh loại cho `Result`." #: src/error-handling/thiserror-and-anyhow.md msgid "" -"Actual error type inside of it can be extracted for examination if necessary." +"Actual error type inside of it can be extracted for examination if " +"necessary." msgstr "" +"Loại lỗi thực tế bên trong nó có thể được trích xuất để kiểm tra nếu cần " +"thiết." #: src/error-handling/thiserror-and-anyhow.md msgid "" @@ -9998,6 +11294,9 @@ msgid "" "developers, as it provides similar usage patterns and ergonomics to `(T, " "error)` from Go." msgstr "" +"Chức năng được cung cấp bởi `anyhow::Result` có thể quen thuộc với các " +"nhà phát triển Go, vì nó cung cấp các kiểu sử dụng và công thái học tương tự" +" như `(T, error)` từ Go." #: src/error-handling/thiserror-and-anyhow.md msgid "" @@ -10005,45 +11304,57 @@ msgid "" "`Option` types. `use anyhow::Context` is necessary to enable `.context()` " "and `.with_context()` on those types." msgstr "" +"`dù sao đi nữa::Context` là một đặc điểm được triển khai cho các loại `Kết " +"quả` và `Tùy chọn` tiêu chuẩn. `dù sao cũng sử dụng::Context` là cần thiết " +"để kích hoạt `.context()` và `.with_context()` trên các loại đó." #: src/error-handling/exercise.md 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 " +"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`." msgstr "" +"Phần sau đây triển khai một trình phân tích cú pháp rất đơn giản cho ngôn " +"ngữ biểu thức. Tuy nhiên, nó xử lý lỗi bằng cách hoảng loạn. Thay vào đó, " +"hãy viết lại nó để sử dụng cách xử lý lỗi thành ngữ và truyền lỗi sang kết " +"quả trả về từ `main`. Vui lòng sử dụng `thiserror` và `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." +"`Iterator>` and handle that in the " +"parser." msgstr "" +"GỢI Ý: bắt đầu bằng cách sửa lỗi xử lý trong hàm `parse`. Khi nó hoạt động " +"bình thường, hãy cập nhật `Tokenizer` để triển khai " +"`Iterator>` và xử lý nó trong trình phân " +"tích cú pháp." #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// An arithmetic operator.\n" -msgstr "" +msgstr "/// Một toán tử số học.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// A token in the expression language.\n" -msgstr "" +msgstr "/// Một token trong ngôn ngữ biểu thức.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// An expression in the expression language.\n" -msgstr "" +msgstr "/// Một biểu thức trong ngôn ngữ biểu thức.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// A reference to a variable.\n" -msgstr "" +msgstr "/// Tham chiếu đến một biến.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// A literal number.\n" -msgstr "" +msgstr "/// Một số bằng chữ.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "/// A binary operation.\n" -msgstr "" +msgstr "/// Một phép toán nhị phân.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "'_'" @@ -10059,47 +11370,47 @@ msgstr "" #: src/error-handling/exercise.md msgid "\"Unexpected character {c}\"" -msgstr "" +msgstr "\"Ký tự không mong đợi {c}\"" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "\"Unexpected end of input\"" -msgstr "" +msgstr "\"Kết thúc đầu vào không mong đợi\"" #: src/error-handling/exercise.md msgid "\"Invalid 32-bit integer'\"" -msgstr "" +msgstr "\"Số nguyên 32 bit không hợp lệ'\"" #: src/error-handling/exercise.md msgid "\"Unexpected token {tok:?}\"" -msgstr "" +msgstr "\"Mã thông báo không mong đợi {tok:?}\"" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "// Look ahead to parse a binary operation if present.\n" -msgstr "" +msgstr "// Nhìn về phía trước để phân tích một phép toán nhị phân nếu có.\n" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "\"10+foo+20-30\"" -msgstr "" +msgstr "\"10+foo+20-30\"" #: src/error-handling/exercise.md src/error-handling/solution.md msgid "\"{expr:?}\"" -msgstr "" +msgstr "\"{expr:?}\"" #: src/error-handling/solution.md msgid "\"Unexpected character '{0}' in input\"" -msgstr "" +msgstr "\"Ký tự không mong đợi '{0}' trong đầu vào\"" #: src/error-handling/solution.md msgid "\"Tokenizer error: {0}\"" -msgstr "" +msgstr "\"Lỗi mã thông báo: {0}\"" #: src/error-handling/solution.md msgid "\"Unexpected token {0:?}\"" -msgstr "" +msgstr "\"Mã thông báo không mong đợi {0:?}\"" #: src/error-handling/solution.md msgid "\"Invalid number\"" -msgstr "" +msgstr "\"Số không hợp lệ\"" #: src/unsafe-rust.md msgid "This segment should take about 1 hour and 5 minutes. It contains:" @@ -10107,98 +11418,120 @@ msgstr "Phần này sẽ kéo dài khoảng 1 giờ và 5 phút, bao gồm:" #: src/unsafe-rust/unsafe.md msgid "The Rust language has two parts:" -msgstr "" +msgstr "Ngôn ngữ Rust có hai phần:" #: src/unsafe-rust/unsafe.md msgid "**Safe Rust:** memory safe, no undefined behavior possible." msgstr "" +"**Rust an toàn:** bộ nhớ an toàn, không thể có hành vi không xác định." #: src/unsafe-rust/unsafe.md msgid "" "**Unsafe Rust:** can trigger undefined behavior if preconditions are " "violated." msgstr "" +"**Rust không an toàn:** có thể kích hoạt hành vi không xác định nếu vi phạm " +"các điều kiện tiên quyết." #: src/unsafe-rust/unsafe.md msgid "" "We saw mostly safe Rust in this course, but it's important to know what " "Unsafe Rust is." msgstr "" +"Chúng ta đã thấy phần lớn Rust an toàn trong khóa học này, nhưng điều quan " +"trọng là phải biết Rust không an toàn là gì." #: src/unsafe-rust/unsafe.md 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 "" +"Mã không an toàn thường nhỏ và tách biệt, tính chính xác của nó phải được " +"ghi lại cẩn thận. Nó thường được bọc trong một lớp trừu tượng an toàn." #: src/unsafe-rust/unsafe.md msgid "Unsafe Rust gives you access to five new capabilities:" -msgstr "" +msgstr "Unsafe Rust cung cấp cho bạn quyền truy cập vào năm khả năng mới:" #: src/unsafe-rust/unsafe.md msgid "Dereference raw pointers." -msgstr "" +msgstr "Con trỏ thô Dereference." #: src/unsafe-rust/unsafe.md msgid "Access or modify mutable static variables." -msgstr "" +msgstr "Truy cập hoặc sửa đổi các biến tĩnh có thể thay đổi." #: src/unsafe-rust/unsafe.md msgid "Access `union` fields." -msgstr "" +msgstr "Truy cập các trường `union`." #: src/unsafe-rust/unsafe.md msgid "Call `unsafe` functions, including `extern` functions." -msgstr "" +msgstr "Gọi các hàm `không an toàn`, bao gồm cả các hàm `extern`." #: src/unsafe-rust/unsafe.md msgid "Implement `unsafe` traits." -msgstr "" +msgstr "Thực hiện các đặc điểm `không an toàn`." #: 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/)." +"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/)." msgstr "" +"Tiếp theo chúng tôi sẽ đề cập ngắn gọn về các khả năng không an toàn. Để " +"biết thông tin chi tiết đầy đủ, vui lòng xem [Chương 19.1 trong Rust " +"Book](https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html) và " +"[Rustonomicon](https://doc.rust-lang.org/nomicon/)." #: src/unsafe-rust/unsafe.md 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." +"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 "" +"Rust không an toàn không có nghĩa là mã không chính xác. Điều đó có nghĩa là" +" các nhà phát triển đã tắt một số tính năng an toàn của compiler và phải tự " +"viết mã chính xác. Điều đó có nghĩa là compiler không còn thực thi các quy " +"tắc an toàn bộ nhớ của Rust nữa." #: src/unsafe-rust/dereferencing.md msgid "Creating pointers is safe, but dereferencing them requires `unsafe`:" msgstr "" +"Tạo con trỏ là an toàn, nhưng việc hủy tham chiếu chúng yêu cầu `không an " +"toàn`:" #: src/unsafe-rust/dereferencing.md msgid "\"careful!\"" -msgstr "" +msgstr "\"cẩn thận!\"" #: src/unsafe-rust/dereferencing.md msgid "" "// SAFETY: r1 and r2 were obtained from references and so are guaranteed to\n" -" // be non-null and properly aligned, the objects underlying the " -"references\n" +" // be non-null and properly aligned, the objects underlying the references\n" " // from which they were obtained are live throughout the whole unsafe\n" " // block, and they are not accessed either through the references or\n" " // concurrently through any other pointers.\n" msgstr "" +"// AN TOÀN: r1 và r2 được lấy từ các tài liệu tham khảo và do đó được đảm bảo\n" +" // không có giá trị rỗng và được căn chỉnh chính xác, các đối tượng bên dưới các tham chiếu\n" +" // từ đó chúng được lấy đang tồn tại trong toàn bộ không an toàn\n" +" // chặn và chúng không được truy cập thông qua các tham chiếu hoặc\n" +" // đồng thời thông qua bất kỳ con trỏ nào khác.\n" #: src/unsafe-rust/dereferencing.md msgid "\"r1 is: {}\"" -msgstr "" +msgstr "\"r1 là: {}\"" #: src/unsafe-rust/dereferencing.md msgid "\"uhoh\"" -msgstr "" +msgstr "\"uho\"" #: src/unsafe-rust/dereferencing.md msgid "\"r2 is: {}\"" -msgstr "" +msgstr "\"r2 là: {}\"" #: src/unsafe-rust/dereferencing.md msgid "" @@ -10209,6 +11542,12 @@ msgid "" " println!(\"r3 is: {}\", *r3);\n" " */" msgstr "" +"// KHÔNG AN TOÀN. ĐỪNG LÀM ĐIỀU NÀY.\n" +" /*\n" +" hãy để r3: &String = không an toàn { &*r1 };\n" +" (các) giọt;\n" +" println!(\"r3 là: {}\", *r3);\n" +" */" #: src/unsafe-rust/dereferencing.md msgid "" @@ -10216,40 +11555,51 @@ msgid "" "a comment for each `unsafe` block explaining how the code inside it " "satisfies the safety requirements of the unsafe operations it is doing." msgstr "" +"Một cách thực hành tốt (và được yêu cầu bởi hướng dẫn về phong cách Android " +"Rust) là viết nhận xét cho mỗi khối `không an toàn` giải thích cách mã bên " +"trong nó đáp ứng các yêu cầu an toàn của các hoạt động không an toàn mà nó " +"đang thực hiện." #: src/unsafe-rust/dereferencing.md msgid "" "In the case of pointer dereferences, this means that the pointers must be " "[_valid_](https://doc.rust-lang.org/std/ptr/index.html#safety), i.e.:" msgstr "" +"Trong trường hợp hủy tham chiếu con trỏ, điều này có nghĩa là con trỏ phải " +"là [_valid_](https://doc.rust-lang.org/std/ptr/index.html#safety), tức là:" #: src/unsafe-rust/dereferencing.md msgid "The pointer must be non-null." -msgstr "" +msgstr "Con trỏ phải không rỗng." #: src/unsafe-rust/dereferencing.md msgid "" "The pointer must be _dereferenceable_ (within the bounds of a single " "allocated object)." msgstr "" +"Con trỏ phải là _dereferenceable_ (trong giới hạn của một đối tượng được " +"phân bổ)." #: src/unsafe-rust/dereferencing.md msgid "The object must not have been deallocated." -msgstr "" +msgstr "Đối tượng phải chưa được giải phóng." #: src/unsafe-rust/dereferencing.md msgid "There must not be concurrent accesses to the same location." -msgstr "" +msgstr "Không được có quyền truy cập đồng thời vào cùng một vị trí." #: 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." msgstr "" +"Nếu con trỏ được lấy bằng cách truyền tham chiếu thì đối tượng cơ bản phải " +"hoạt động và không được sử dụng tham chiếu nào để truy cập bộ nhớ." #: src/unsafe-rust/dereferencing.md msgid "In most cases the pointer must also be properly aligned." msgstr "" +"Trong hầu hết các trường hợp, con trỏ cũng phải được căn chỉnh chính xác." #: src/unsafe-rust/dereferencing.md msgid "" @@ -10257,33 +11607,39 @@ msgid "" "has the `'static` lifetime, so `r3` has type `&'static String`, and thus " "outlives `s`. Creating a reference from a pointer requires _great care_." msgstr "" +"Phần \"KHÔNG AN TOÀN\" đưa ra ví dụ về một loại lỗi UB phổ biến: `*r1` có " +"thời gian tồn tại `'static`, vì vậy `r3` có loại `&'static String`, và do đó" +" tồn tại lâu hơn `s`. Việc tạo một tham chiếu từ một con trỏ đòi hỏi sự _cẩn" +" thận_." #: src/unsafe-rust/mutable-static.md msgid "It is safe to read an immutable static variable:" -msgstr "" +msgstr "Việc đọc một biến tĩnh bất biến là an toàn:" #: src/unsafe-rust/mutable-static.md msgid "\"Hello, world!\"" -msgstr "" +msgstr "\"Xin chào thế giới!\"" #: src/unsafe-rust/mutable-static.md msgid "\"HELLO_WORLD: {HELLO_WORLD}\"" -msgstr "" +msgstr "\"HELLO_WORLD: {HELLO_WORLD}\"" #: src/unsafe-rust/mutable-static.md msgid "" "However, since data races can occur, it is unsafe to read and write mutable " "static variables:" msgstr "" +"Tuy nhiên, vì việc chạy đua dữ liệu có thể xảy ra nên việc đọc và ghi các " +"biến tĩnh có thể thay đổi là không an toàn:" #: src/unsafe-rust/mutable-static.md msgid "" "// SAFETY: There are no other threads which could be accessing `COUNTER`.\n" -msgstr "" +msgstr "// AN TOÀN: Không có chủ đề nào khác có thể truy cập `COUNTER`.\n" #: src/unsafe-rust/mutable-static.md msgid "\"COUNTER: {COUNTER}\"" -msgstr "" +msgstr "\"BỘ ĐẾM: {COUNTER}\"" #: src/unsafe-rust/mutable-static.md msgid "" @@ -10292,53 +11648,72 @@ msgid "" "`unsafe` and see how the compiler explains that it is undefined behavior to " "mutate a static from multiple threads." msgstr "" +"Chương trình ở đây an toàn vì nó là chương trình đơn luồng. Tuy nhiên, trình" +" biên dịch Rust rất bảo thủ và sẽ cho rằng điều tồi tệ nhất. Hãy thử loại bỏ" +" `không an toàn` và xem cách compiler giải thích rằng việc thay đổi một tĩnh" +" từ nhiều luồng là hành vi không xác định." #: 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." +"where it might make sense in low-level `no_std` code, such as implementing a" +" heap allocator or working with some C APIs." msgstr "" +"Sử dụng tĩnh có thể thay đổi nói chung là một ý tưởng tồi, nhưng có một số " +"trường hợp nó có thể hợp lý trong mã `no_std` cấp thấp, chẳng hạn như triển " +"khai bộ cấp phát heap hoặc làm việc với một số API C." #: src/unsafe-rust/unions.md -msgid "Unions are like enums, but you need to track the active field yourself:" +msgid "" +"Unions are like enums, but you need to track the active field yourself:" msgstr "" +"Các công đoàn giống như enum, nhưng bạn cần tự mình theo dõi trường hoạt " +"động:" #: src/unsafe-rust/unions.md msgid "\"int: {}\"" -msgstr "" +msgstr "\"int: {}\"" #: src/unsafe-rust/unions.md msgid "\"bool: {}\"" -msgstr "" +msgstr "\"bool: {}\"" #: src/unsafe-rust/unions.md msgid "// Undefined behavior!\n" -msgstr "" +msgstr "// Hành vi không xác định!\n" #: 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." msgstr "" +"Union rất hiếm khi cần thiết trong Rust vì bạn thường có thể sử dụng enum. " +"Đôi khi chúng cần thiết để tương tác với API thư viện C." #: 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." +"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." msgstr "" +"Nếu bạn chỉ muốn diễn giải lại byte thành một loại khác, bạn có thể muốn " +"[`std::mem::transmute`](https://doc.rust-" +"lang.org/stable/std/mem/fn.transmute.html) hoặc một trình bao bọc an toàn " +"chẳng hạn như crate [`zerocopy`](https://crates.io/crates/zerocopy)." #: src/unsafe-rust/unsafe-functions.md msgid "Calling Unsafe Functions" -msgstr "" +msgstr "Gọi các hàm không an toàn" #: 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:" msgstr "" +"Một hàm hoặc phương thức có thể được đánh dấu là `không an toàn` nếu nó có " +"các điều kiện tiên quyết bổ sung mà bạn phải duy trì để tránh hành vi không " +"xác định:" #: src/unsafe-rust/unsafe-functions.md src/unsafe-rust/exercise.md #: src/unsafe-rust/solution.md src/android/interoperability/with-c.md @@ -10348,7 +11723,7 @@ msgstr "" #: src/bare-metal/aps/better-uart/using.md src/bare-metal/aps/logging/using.md #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"C\"" -msgstr "" +msgstr "\"C\"" #: src/unsafe-rust/unsafe-functions.md msgid "\"🗻∈🌏\"" @@ -10359,24 +11734,28 @@ msgid "" "// SAFETY: The indices are in the correct order, within the bounds of the\n" " // string slice, and lie on UTF-8 sequence boundaries.\n" msgstr "" +"// AN TOÀN: Các chỉ số theo đúng thứ tự, trong giới hạn của\n" +" // cắt chuỗi và nằm trên ranh giới chuỗi UTF-8.\n" #: src/unsafe-rust/unsafe-functions.md msgid "\"emoji: {}\"" -msgstr "" +msgstr "\"biểu tượng cảm xúc: {}\"" #: src/unsafe-rust/unsafe-functions.md msgid "\"char count: {}\"" -msgstr "" +msgstr "\"số ký tự: {}\"" #: src/unsafe-rust/unsafe-functions.md msgid "" "// SAFETY: `abs` doesn't deal with pointers and doesn't have any safety\n" " // requirements.\n" msgstr "" +"// AN TOÀN: `abs` không xử lý con trỏ và không có bất kỳ sự an toàn nào\n" +" // yêu cầu.\n" #: src/unsafe-rust/unsafe-functions.md msgid "\"Absolute value of -3 according to C: {}\"" -msgstr "" +msgstr "\"Giá trị tuyệt đối của -3 theo C: {}\"" #: src/unsafe-rust/unsafe-functions.md msgid "" @@ -10385,16 +11764,22 @@ msgid "" " // println!(\"char count: {}\", count_chars(unsafe {\n" " // emojis.get_unchecked(0..3) }));\n" msgstr "" +"// Không đáp ứng yêu cầu mã hóa UTF-8 sẽ phá vỡ sự an toàn của bộ nhớ!\n" +" // println!(\"emoji: {}\", không an toàn { biểu tượng cảm xúc.get_unchecked(0..3) });\n" +" // println!(\"char count: {}\", count_chars(không an toàn {\n" +" // biểu tượng cảm xúc.get_unchecked(0..3) }));\n" #: src/unsafe-rust/unsafe-functions.md msgid "Writing Unsafe Functions" -msgstr "" +msgstr "Viết các hàm không an toàn" #: src/unsafe-rust/unsafe-functions.md msgid "" "You can mark your own functions as `unsafe` if they require particular " "conditions to avoid undefined behaviour." msgstr "" +"Bạn có thể đánh dấu các hàm của riêng mình là `không an toàn` nếu chúng yêu " +"cầu các điều kiện cụ thể để tránh hành vi không xác định." #: src/unsafe-rust/unsafe-functions.md msgid "" @@ -10404,60 +11789,84 @@ msgid "" "///\n" "/// The pointers must be valid and properly aligned.\n" msgstr "" +"/// Hoán đổi các giá trị được trỏ tới bởi các con trỏ đã cho.\n" +"///\n" +"/// # An toàn\n" +"///\n" +"/// Các con trỏ phải hợp lệ và được căn chỉnh chính xác.\n" #: src/unsafe-rust/unsafe-functions.md msgid "// SAFETY: ...\n" -msgstr "" +msgstr "// SỰ AN TOÀN: ...\n" #: src/unsafe-rust/unsafe-functions.md msgid "\"a = {}, b = {}\"" -msgstr "" +msgstr "\"a = {}, b = {}\"" #: src/unsafe-rust/unsafe-functions.md 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 " +"`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." msgstr "" +"`get_unchecked`, giống như hầu hết các hàm `_unchecked`, không an toàn vì nó" +" có thể tạo UB nếu phạm vi không chính xác. `abs` không chính xác vì một lý " +"do khác: đó là một hàm bên ngoài (FFI). Việc gọi các hàm bên ngoài thường " +"chỉ là vấn đề khi các hàm đó thực hiện mọi việc với con trỏ có thể vi phạm " +"mô hình bộ nhớ của Rust, nhưng nói chung, bất kỳ hàm C nào cũng có thể có " +"hành vi không xác định trong bất kỳ trường hợp tùy ý nào." #: 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\"` trong ví dụ này là ABI; [các ABI khác cũng có sẵn](https://doc.rust-" +"lang.org/reference/items/external-blocks.html)." #: src/unsafe-rust/unsafe-functions.md msgid "" "We wouldn't actually use pointers for a `swap` function - it can be done " "safely with references." msgstr "" +"Thực tế, chúng tôi sẽ không sử dụng con trỏ cho hàm `swap` - việc này có thể" +" được thực hiện một cách an toàn với các tham chiếu." #: src/unsafe-rust/unsafe-functions.md 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." +"`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 "" +"Lưu ý rằng mã không an toàn được cho phép trong một hàm không an toàn không " +"có khối `không an toàn`. Chúng tôi có thể cấm điều này bằng " +"`#[deny(unsafe_op_in_unsafe_fn)]`. Hãy thử thêm nó và xem điều gì sẽ xảy ra." +" Điều này có thể sẽ thay đổi trong phiên bản Rust trong tương lai." #: src/unsafe-rust/unsafe-traits.md msgid "Implementing Unsafe Traits" -msgstr "" +msgstr "Thực hiện các đặc điểm không an toàn" #: src/unsafe-rust/unsafe-traits.md msgid "" "Like with functions, you can mark a trait as `unsafe` if the implementation " "must guarantee particular conditions to avoid undefined behaviour." msgstr "" +"Giống như các hàm, bạn có thể đánh dấu một đặc điểm là `không an toàn` nếu " +"việc triển khai phải đảm bảo các điều kiện cụ thể để tránh hành vi không xác" +" định." #: src/unsafe-rust/unsafe-traits.md msgid "" "For example, the `zerocopy` crate has an unsafe trait that looks [something " "like this](https://docs.rs/zerocopy/latest/zerocopy/trait.AsBytes.html):" msgstr "" +"Ví dụ: crate `zerocopy` có một đặc điểm không an toàn trông [giống như thế " +"này](https://docs.rs/zerocopy/latest/zerocopy/trait.AsBytes.html):" #: src/unsafe-rust/unsafe-traits.md msgid "" @@ -10465,30 +11874,35 @@ msgid "" "/// # Safety\n" "/// The type must have a defined representation and no padding.\n" msgstr "" +"/// ...\n" +"/// # An toàn\n" +"/// Kiểu phải có cách biểu diễn xác định và không có phần đệm.\n" #: src/unsafe-rust/unsafe-traits.md msgid "// SAFETY: `u32` has a defined representation and no padding.\n" -msgstr "" +msgstr "// AN TOÀN: `u32` có biểu diễn được xác định và không có phần đệm.\n" #: src/unsafe-rust/unsafe-traits.md msgid "" -"There should be a `# Safety` section on the Rustdoc for the trait explaining " -"the requirements for the trait to be safely implemented." +"There should be a `# Safety` section on the Rustdoc for the trait explaining" +" the requirements for the trait to be safely implemented." msgstr "" +"Cần có phần `# An toàn` trên Rustdoc để biết đặc điểm giải thích các yêu cầu" +" để đặc điểm đó được triển khai một cách an toàn." #: src/unsafe-rust/unsafe-traits.md msgid "" "The actual safety section for `AsBytes` is rather longer and more " "complicated." -msgstr "" +msgstr "Phần an toàn thực sự của `AsBytes` dài hơn và phức tạp hơn." #: src/unsafe-rust/unsafe-traits.md msgid "The built-in `Send` and `Sync` traits are unsafe." -msgstr "" +msgstr "Các đặc điểm `Gửi` và `Đồng bộ hóa` tích hợp không an toàn." #: src/unsafe-rust/exercise.md msgid "Safe FFI Wrapper" -msgstr "" +msgstr "Gói FFI an toàn" #: src/unsafe-rust/exercise.md msgid "" @@ -10496,137 +11910,166 @@ 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 hỗ trợ rất tốt cho việc gọi các hàm thông qua giao diện hàm _forign_ " +"(FFI). Chúng tôi sẽ sử dụng điều này để xây dựng một trình bao bọc an toàn " +"cho các hàm `libc` mà bạn sẽ sử dụng từ C để đọc tên các tệp trong một thư " +"mục." #: src/unsafe-rust/exercise.md msgid "You will want to consult the manual pages:" -msgstr "" +msgstr "Bạn sẽ muốn tham khảo các trang hướng dẫn:" #: src/unsafe-rust/exercise.md msgid "[`opendir(3)`](https://man7.org/linux/man-pages/man3/opendir.3.html)" -msgstr "" +msgstr "[`opendir(3)`](https://man7.org/linux/man-pages/man3/opendir.3.html)" #: src/unsafe-rust/exercise.md msgid "[`readdir(3)`](https://man7.org/linux/man-pages/man3/readdir.3.html)" -msgstr "" +msgstr "[`readdir(3)`](https://man7.org/linux/man-pages/man3/readdir.3.html)" #: src/unsafe-rust/exercise.md msgid "[`closedir(3)`](https://man7.org/linux/man-pages/man3/closedir.3.html)" msgstr "" +"[`closedir(3)`](https://man7.org/linux/man-pages/man3/closedir.3.html)" #: src/unsafe-rust/exercise.md msgid "" -"You will also want to browse the [`std::ffi`](https://doc.rust-lang.org/std/" -"ffi/) module. There you find a number of string types which you need for the " -"exercise:" +"You will also want to browse the [`std::ffi`](https://doc.rust-" +"lang.org/std/ffi/) module. There you find a number of string types which you" +" need for the exercise:" msgstr "" +"Bạn cũng sẽ muốn duyệt qua mô-đun [`std::ffi`](https://doc.rust-" +"lang.org/std/ffi/). Ở đó bạn sẽ tìm thấy một số loại dây mà bạn cần cho bài " +"tập:" #: src/unsafe-rust/exercise.md msgid "Encoding" -msgstr "" +msgstr "Mã hóa" #: src/unsafe-rust/exercise.md msgid "Use" -msgstr "" +msgstr "Sử dụng" #: src/unsafe-rust/exercise.md msgid "" -"[`str`](https://doc.rust-lang.org/std/primitive.str.html) and [`String`]" -"(https://doc.rust-lang.org/std/string/struct.String.html)" +"[`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) và " +"[`String`](https://doc.rust-lang.org/std/string/struct.String.html)" #: src/unsafe-rust/exercise.md msgid "UTF-8" -msgstr "" +msgstr "UTF-8" #: src/unsafe-rust/exercise.md msgid "Text processing in Rust" -msgstr "" +msgstr "Xử lý văn bản trong Rust" #: src/unsafe-rust/exercise.md msgid "" -"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html) and [`CString`]" -"(https://doc.rust-lang.org/std/ffi/struct.CString.html)" +"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html) and " +"[`CString`](https://doc.rust-lang.org/std/ffi/struct.CString.html)" msgstr "" +"[`CStr`](https://doc.rust-lang.org/std/ffi/struct.CStr.html) và " +"[`CString`](https://doc.rust-lang.org/std/ffi/struct.CString.html)" #: src/unsafe-rust/exercise.md msgid "NUL-terminated" -msgstr "" +msgstr "NUL chấm dứt" #: src/unsafe-rust/exercise.md msgid "Communicating with C functions" -msgstr "" +msgstr "Giao tiếp với các hàm 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)" msgstr "" +"[`OsStr`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html) và " +"[`OsString`](https://doc.rust-lang.org/std/ffi/struct.OsString.html)" #: src/unsafe-rust/exercise.md msgid "OS-specific" -msgstr "" +msgstr "Dành riêng cho hệ điều hành" #: src/unsafe-rust/exercise.md msgid "Communicating with the OS" -msgstr "" +msgstr "Giao tiếp với hệ điều hành" #: src/unsafe-rust/exercise.md msgid "You will convert between all these types:" -msgstr "" +msgstr "Bạn sẽ chuyển đổi giữa tất cả các loại sau:" #: src/unsafe-rust/exercise.md msgid "" "`&str` to `CString`: you need to allocate space for a trailing `\\0` " "character," msgstr "" +"`&str` đến `CString`: bạn cần phân bổ khoảng trắng cho ký tự `\\0` ở cuối," #: src/unsafe-rust/exercise.md msgid "`CString` to `*const i8`: you need a pointer to call C functions," -msgstr "" +msgstr "`CString` tới `*const i8`: bạn cần một con trỏ để gọi các hàm C," #: src/unsafe-rust/exercise.md msgid "" -"`*const i8` to `&CStr`: you need something which can find the trailing `\\0` " -"character," +"`*const i8` to `&CStr`: you need something which can find the trailing `\\0`" +" character," msgstr "" +"`*const i8` thành `&CStr`: bạn cần thứ gì đó có thể tìm thấy ký tự `\\0` ở " +"cuối," #: src/unsafe-rust/exercise.md msgid "" "`&CStr` to `&[u8]`: a slice of bytes is the universal interface for \"some " "unknown data\"," msgstr "" +"`&CStr` đến `&[u8]`: một lát byte là giao diện chung cho \"một số dữ liệu " +"không xác định\"," #: src/unsafe-rust/exercise.md msgid "" -"`&[u8]` to `&OsStr`: `&OsStr` is a step towards `OsString`, use [`OsStrExt`]" -"(https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html) to create it," +"`&[u8]` to `&OsStr`: `&OsStr` is a step towards `OsString`, use " +"[`OsStrExt`](https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html) " +"to create it," msgstr "" +"`&[u8]` đến `&OsStr`: `&OsStr` là một bước hướng tới `OsString`, hãy sử dụng" +" [`OsStrExt`](https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html)" +" để tạo nó," #: src/unsafe-rust/exercise.md msgid "" -"`&OsStr` to `OsString`: you need to clone the data in `&OsStr` to be able to " -"return it and call `readdir` again." +"`&OsStr` to `OsString`: you need to clone the data in `&OsStr` to be able to" +" return it and call `readdir` again." msgstr "" +"`&OsStr` thành `OsString`: bạn cần sao chép dữ liệu trong `&OsStr` để có thể" +" trả về và gọi lại `readdir`." #: src/unsafe-rust/exercise.md 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) cũng có một chương rất" +" hữu ích về FFI." #: src/unsafe-rust/exercise.md msgid "" -"Copy the code below to and fill in the missing " -"functions and methods:" +"Copy the code below to and fill in the missing" +" functions and methods:" msgstr "" +"Sao chép mã bên dưới vào và điền vào các hàm " +"và phương thức còn thiếu:" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "\"macos\"" -msgstr "" +msgstr "\"macos\"" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "// Opaque type. See https://doc.rust-lang.org/nomicon/ffi.html.\n" -msgstr "" +msgstr "// Kiểu mờ đục. Xem https://doc.rust-lang.org/nomicon/ffi.html.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "" @@ -10634,43 +12077,51 @@ msgid "" " // off_t are resolved according to the definitions in\n" " // /usr/include/x86_64-linux-gnu/{sys/types.h, bits/typesizes.h}.\n" msgstr "" +"// Bố cục theo trang man Linux cho readdir(3), trong đó ino_t và\n" +" // off_t được giải quyết theo định nghĩa trong\n" +" // /usr/include/x86_64-linux-gnu/{sys/types.h, bit/typesizes.h}.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "// Layout according to the macOS man page for dir(5).\n" -msgstr "" +msgstr "// Bố cục theo trang man macOS cho dir(5).\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "\"x86_64\"" -msgstr "" +msgstr "\"x86_64\"" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "" "// 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" +" // \"Platforms that existed before these updates were available\" refers\n" +" // to macOS (as opposed to iOS / wearOS / etc.) on Intel and PowerPC.\n" msgstr "" +"// Xem https://github.com/rust-lang/libc/issues/414 và phần về\n" +" // _DARWIN_FEATURE_64_BIT_INODE trong trang man macOS cho stat(2).\n" +" //\n" +" // \"Các nền tảng đã tồn tại trước khi có những bản cập nhật này\" đề cập đến\n" +" // sang macOS (ngược lại với iOS / wearOS / v.v.) trên Intel và PowerPC.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "\"readdir$INODE64\"" -msgstr "" +msgstr "\"readdir$INODE64\"" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "" "// Call opendir and return a Ok value if that worked,\n" " // otherwise return Err with a message.\n" msgstr "" +"// Gọi opendir và trả về giá trị Ok nếu điều đó hiệu quả,\n" +" // nếu không thì trả về Err kèm theo một thông báo.\n" #: src/unsafe-rust/exercise.md msgid "// Keep calling readdir until we get a NULL pointer back.\n" -msgstr "" +msgstr "// Tiếp tục gọi readdir cho đến khi nhận được con trỏ NULL.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "// Call closedir as needed.\n" -msgstr "" +msgstr "// Gọi closeir nếu cần.\n" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md #: src/android/interoperability/with-c/rust.md @@ -10679,51 +12130,55 @@ msgstr "" #: src/unsafe-rust/exercise.md src/unsafe-rust/solution.md msgid "\"files: {:#?}\"" -msgstr "" +msgstr "\"tệp: {:#?}\"" #: src/unsafe-rust/solution.md msgid "\"Invalid path: {err}\"" -msgstr "" +msgstr "\"Đường dẫn không hợp lệ: {err}\"" #: src/unsafe-rust/solution.md msgid "// SAFETY: path.as_ptr() cannot be NULL.\n" -msgstr "" +msgstr "// AN TOÀN: path.as_ptr() không thể là NULL.\n" #: src/unsafe-rust/solution.md msgid "\"Could not open {:?}\"" -msgstr "" +msgstr "\"Không thể mở {:?}\"" #: src/unsafe-rust/solution.md msgid "" "// Keep calling readdir until we get a NULL pointer back.\n" " // SAFETY: self.dir is never NULL.\n" msgstr "" +"// Tiếp tục gọi readdir cho đến khi nhận được con trỏ NULL.\n" +" // AN TOÀN: self.dir không bao giờ là NULL.\n" #: src/unsafe-rust/solution.md msgid "// We have reached the end of the directory.\n" -msgstr "" +msgstr "// Chúng ta đã đến cuối thư mục.\n" #: src/unsafe-rust/solution.md msgid "" "// SAFETY: dirent is not NULL and dirent.d_name is NUL\n" " // terminated.\n" msgstr "" +"// AN TOÀN: dirent không phải là NULL và dirent.d_name là NUL\n" +" // chấm dứt.\n" #: src/unsafe-rust/solution.md msgid "// SAFETY: self.dir is not NULL.\n" -msgstr "" +msgstr "// AN TOÀN: self.dir không phải là NULL.\n" #: src/unsafe-rust/solution.md msgid "\"Could not close {:?}\"" -msgstr "" +msgstr "\"Không thể đóng {:?}\"" #: src/unsafe-rust/solution.md msgid "\"no-such-directory\"" -msgstr "" +msgstr "\"không có thư mục như vậy\"" #: src/unsafe-rust/solution.md msgid "\"Non UTF-8 character in path\"" -msgstr "" +msgstr "\"Ký tự không phải UTF-8 trong đường dẫn\"" #: src/unsafe-rust/solution.md msgid "\"..\"" @@ -10731,31 +12186,31 @@ msgstr "" #: src/unsafe-rust/solution.md msgid "\"foo.txt\"" -msgstr "" +msgstr "\"foo.txt\"" #: src/unsafe-rust/solution.md msgid "\"The Foo Diaries\\n\"" -msgstr "" +msgstr "\"Nhật ký ngốc nghếch\\n\"" #: src/unsafe-rust/solution.md msgid "\"bar.png\"" -msgstr "" +msgstr "\"bar.png\"" #: src/unsafe-rust/solution.md msgid "\"\\n\"" -msgstr "" +msgstr "\"\\n\"" #: src/unsafe-rust/solution.md msgid "\"crab.rs\"" -msgstr "" +msgstr "\"cua.rs\"" #: src/unsafe-rust/solution.md msgid "\"//! Crab\\n\"" -msgstr "" +msgstr "\"//! Cua\\n\"" #: src/android.md msgid "Welcome to Rust in Android" -msgstr "" +msgstr "Chào mừng đến với Rust trong Android" #: src/android.md msgid "" @@ -10763,6 +12218,9 @@ msgid "" "write new services, libraries, drivers or even firmware in Rust (or improve " "existing code as needed)." msgstr "" +"Rust được hỗ trợ cho phần mềm hệ thống trên Android. Điều này có nghĩa là " +"bạn có thể viết các dịch vụ, thư viện, trình điều khiển hoặc thậm chí chương" +" trình cơ sở mới trong Rust (hoặc cải thiện mã hiện có nếu cần)." #: src/android.md msgid "" @@ -10771,229 +12229,280 @@ msgid "" "to Rust. The fewer dependencies and \"exotic\" types the better. Something " "that parses some raw bytes would be ideal." msgstr "" +"Hôm nay chúng tôi sẽ cố gắng gọi cho Rust từ một trong những dự án của bạn. " +"Vì vậy, hãy cố gắng tìm một góc nhỏ trong cơ sở mã của bạn, nơi chúng tôi có" +" thể chuyển một số dòng mã sang Rust. Càng ít phụ thuộc và các loại \"kỳ " +"lạ\" thì càng tốt. Một cái gì đó phân tích cú pháp một số byte thô sẽ là lý " +"tưởng." #: 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 "" +"Diễn giả có thể đề cập đến bất kỳ điều nào sau đây do việc sử dụng Rust " +"trong Android ngày càng tăng:" #: src/android.md msgid "" -"Service example: [DNS over HTTP](https://security.googleblog.com/2022/07/dns-" -"over-http3-in-android.html)" +"Service example: [DNS over " +"HTTP](https://security.googleblog.com/2022/07/dns-over-http3-in-" +"android.html)" msgstr "" +"Ví dụ về dịch vụ: [DNS qua " +"HTTP](https://security.googleblog.com/2022/07/dns-over-http3-in-" +"android.html)" #: src/android.md msgid "" -"Libraries: [Rutabaga Virtual Graphics Interface](https://crosvm.dev/book/" -"appendix/rutabaga_gfx.html)" +"Libraries: [Rutabaga Virtual Graphics " +"Interface](https://crosvm.dev/book/appendix/rutabaga_gfx.html)" msgstr "" +"Thư viện: [Giao diện đồ họa ảo " +"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 "" +"Trình điều khiển hạt nhân: [Binder](https://lore.kernel.org/rust-for-" +"linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/)" #: src/android.md msgid "" -"Firmware: [pKVM firmware](https://security.googleblog.com/2023/10/bare-metal-" -"rust-in-android.html)" +"Firmware: [pKVM firmware](https://security.googleblog.com/2023/10/bare-" +"metal-rust-in-android.html)" msgstr "" +"Phần sụn: [phần mềm pKVM](https://security.googleblog.com/2023/10/bare-" +"metal-rust-in-android.html)" #: src/android/setup.md 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 "" +"Chúng tôi sẽ sử dụng Thiết bị ảo Android Cuttlefish để kiểm tra mã của mình." +" Đảm bảo bạn có quyền truy cập vào một tài khoản hoặc tạo một tài khoản mới " +"bằng:" #: src/android/setup.md msgid "" -"Please see the [Android Developer Codelab](https://source.android.com/docs/" -"setup/start) for details." +"Please see the [Android Developer " +"Codelab](https://source.android.com/docs/setup/start) for details." msgstr "" +"Vui lòng xem [Lớp học lập trình dành cho nhà phát triển " +"Android](https://source.android.com/docs/setup/start) để biết chi tiết." #: src/android/setup.md msgid "" "Cuttlefish is a reference Android device designed to work on generic Linux " "desktops. MacOS support is also planned." msgstr "" +"Mực nang là một thiết bị Android tham chiếu được thiết kế để hoạt động trên " +"các máy tính để bàn Linux thông thường. Hỗ trợ MacOS cũng được lên kế hoạch." #: 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." msgstr "" +"Hình ảnh hệ thống Cuttlefish duy trì độ trung thực cao cho các thiết bị thực" +" và là trình mô phỏng lý tưởng để chạy nhiều trường hợp sử dụng Rust." #: src/android/build-rules.md -msgid "The Android build system (Soong) supports Rust via a number of modules:" +msgid "" +"The Android build system (Soong) supports Rust via a number of modules:" msgstr "" +"Hệ thống xây dựng Android (Soong) hỗ trợ Rust thông qua một số mô-đun:" #: src/android/build-rules.md msgid "Module Type" -msgstr "" +msgstr "Loại mô-đun" #: src/android/build-rules.md msgid "Description" -msgstr "" +msgstr "Sự miêu tả" #: src/android/build-rules.md msgid "`rust_binary`" -msgstr "" +msgstr "`Rỉ_nhị phân`" #: src/android/build-rules.md msgid "Produces a Rust binary." -msgstr "" +msgstr "Tạo ra một tệp nhị phân Rust." #: src/android/build-rules.md msgid "`rust_library`" -msgstr "" +msgstr "`thư viện Rust`" #: src/android/build-rules.md -msgid "Produces a Rust library, and provides both `rlib` and `dylib` variants." -msgstr "" +msgid "" +"Produces a Rust library, and provides both `rlib` and `dylib` variants." +msgstr "Tạo thư viện Rust và cung cấp cả biến thể `rlib` và `dylib`." #: src/android/build-rules.md msgid "`rust_ffi`" -msgstr "" +msgstr "`Rỉ_ffi`" #: src/android/build-rules.md msgid "" "Produces a Rust C library usable by `cc` modules, and provides both static " "and shared variants." msgstr "" +"Tạo thư viện Rust C mà các mô-đun `cc` có thể sử dụng được và cung cấp cả " +"biến thể tĩnh và biến thể dùng chung." #: src/android/build-rules.md msgid "`rust_proc_macro`" -msgstr "" +msgstr "`rỉ_proc_macro`" #: src/android/build-rules.md msgid "" "Produces a `proc-macro` Rust library. These are analogous to compiler " "plugins." msgstr "" +"Tạo thư viện Rust `proc-macro`. Chúng tương tự như các plugin biên dịch." #: src/android/build-rules.md msgid "`rust_test`" -msgstr "" +msgstr "`Rỉ_kiểm tra`" #: src/android/build-rules.md msgid "Produces a Rust test binary that uses the standard Rust test harness." msgstr "" +"Tạo tệp nhị phân thử nghiệm Rust sử dụng khai thác thử nghiệm Rust tiêu " +"chuẩn." #: src/android/build-rules.md msgid "`rust_fuzz`" -msgstr "" +msgstr "`Rỉ_lông`" #: src/android/build-rules.md msgid "Produces a Rust fuzz binary leveraging `libfuzzer`." -msgstr "" +msgstr "Tạo ra một mã nhị phân Rust fuzz tận dụng `libfuzzer`." #: src/android/build-rules.md msgid "`rust_protobuf`" -msgstr "" +msgstr "`Rỉ_protobuf`" #: src/android/build-rules.md msgid "" "Generates source and produces a Rust library that provides an interface for " "a particular protobuf." msgstr "" +"Tạo nguồn và tạo thư viện Rust cung cấp giao diện cho một protobuf cụ thể." #: src/android/build-rules.md msgid "`rust_bindgen`" -msgstr "" +msgstr "`Rỉ_bindgen`" #: src/android/build-rules.md msgid "" "Generates source and produces a Rust library containing Rust bindings to C " "libraries." -msgstr "" +msgstr "Tạo nguồn và tạo thư viện Rust chứa các liên kết Rust với thư viện C." #: src/android/build-rules.md msgid "We will look at `rust_binary` and `rust_library` next." -msgstr "" +msgstr "Tiếp theo chúng ta sẽ xem xét `rust_binary` và `rust_library`." #: src/android/build-rules.md msgid "Additional items speaker may mention:" -msgstr "" +msgstr "Các mục bổ sung mà diễn giả có thể đề cập:" #: src/android/build-rules.md msgid "" -"Cargo is not optimized for multi-language repos, and also downloads packages " -"from the internet." +"Cargo is not optimized for multi-language repos, and also downloads packages" +" from the internet." msgstr "" +"Cargo không được tối ưu hóa cho các kho lưu trữ đa ngôn ngữ và cũng có thể " +"tải xuống các gói từ internet." #: 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." msgstr "" +"Để tuân thủ và đạt hiệu suất, Android phải có các crate trong cây. Nó cũng " +"phải tương tác với mã C/C++/Java. Soong lấp đầy khoảng trống đó." #: src/android/build-rules.md msgid "" "Soong has many similarities to Bazel, which is the open-source variant of " "Blaze (used in google3)." msgstr "" +"Soong có nhiều điểm tương đồng với Bazel, đây là biến thể nguồn mở của Blaze" +" (được sử dụng trong 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 "" +"Có kế hoạch chuyển đổi " +"[Android](https://source.android.com/docs/setup/build/bazel/introduction), " +"[ChromeOS](https://chromium.googlesource.com/chromiumos/bazel/) và " +"[Fuchsia](https://source.android.com/docs/setup/build/bazel/introduction) " +"sang Bazel." #: src/android/build-rules.md msgid "Learning Bazel-like build rules is useful for all Rust OS developers." msgstr "" +"Học các quy tắc xây dựng giống Bazel rất hữu ích cho tất cả các nhà phát " +"triển Rust OS." #: src/android/build-rules.md msgid "Fun fact: Data from Star Trek is a Soong-type Android." -msgstr "" +msgstr "Sự thật thú vị: Dữ liệu từ Star Trek là Android loại Soong." #: src/android/build-rules/binary.md msgid "Rust Binaries" -msgstr "" +msgstr "Mã nhị phân 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:" msgstr "" +"Chúng ta hãy bắt đầu với một ứng dụng đơn giản. Tại thư mục gốc của thanh " +"toán AOSP, hãy tạo các tệp sau:" #: src/android/build-rules/binary.md src/android/build-rules/library.md msgid "_hello_rust/Android.bp_:" -msgstr "" +msgstr "_hello_rust/Android.bp_:" #: src/android/build-rules/binary.md msgid "\"hello_rust\"" -msgstr "" +msgstr "\"xin chào_rust\"" #: src/android/build-rules/binary.md src/android/build-rules/library.md #: src/android/logging.md msgid "\"src/main.rs\"" -msgstr "" +msgstr "\"src/main.rs\"" #: src/android/build-rules/binary.md src/android/build-rules/library.md msgid "_hello_rust/src/main.rs_:" -msgstr "" +msgstr "_hello_rust/src/main.rs_:" #: src/android/build-rules/binary.md src/android/build-rules/library.md msgid "//! Rust demo.\n" -msgstr "" +msgstr "//! Bản demo Rust.\n" #: src/android/build-rules/binary.md src/android/build-rules/library.md msgid "/// Prints a greeting to standard output.\n" -msgstr "" +msgstr "/// In lời chào ra đầu ra tiêu chuẩn.\n" #: src/android/build-rules/binary.md src/exercises/chromium/build-rules.md msgid "\"Hello from Rust!\"" -msgstr "" +msgstr "\"Xin chào từ Rust!\"" #: src/android/build-rules/binary.md msgid "You can now build, push, and run the binary:" -msgstr "" +msgstr "Bây giờ bạn có thể xây dựng, đẩy và chạy tệp nhị phân:" #: src/android/build-rules/binary.md msgid "" @@ -11003,99 +12512,113 @@ msgid "" "adb shell /data/local/tmp/hello_rust\n" "```" msgstr "" +"```shell\n" +"xin chào_rust\n" +"adb đẩy \"$ANDROID_product_OUT/system/bin/hello_rust\" /data/local/tmp\n" +"adb shell /data/local/tmp/hello_rust\n" +"```" #: src/android/build-rules/library.md msgid "Rust Libraries" -msgstr "" +msgstr "Thư viện Rust" #: src/android/build-rules/library.md msgid "You use `rust_library` to create a new Rust library for Android." -msgstr "" +msgstr "Bạn sử dụng `rust_library` để tạo thư viện Rust mới cho Android." #: src/android/build-rules/library.md msgid "Here we declare a dependency on two libraries:" -msgstr "" +msgstr "Ở đây chúng tôi khai báo sự phụ thuộc vào hai thư viện:" #: src/android/build-rules/library.md msgid "`libgreeting`, which we define below," -msgstr "" +msgstr "`libgreeting`, mà chúng tôi định nghĩa bên dưới," #: src/android/build-rules/library.md msgid "" -"`libtextwrap`, which is a crate already vendored in [`external/rust/crates/`]" -"(https://cs.android.com/android/platform/superproject/+/master:external/rust/" -"crates/)." +"`libtextwrap`, which is a crate already vendored in " +"[`external/rust/crates/`](https://cs.android.com/android/platform/superproject/+/master:external/rust/crates/)." msgstr "" +"`libtextwrap`, là một crate đã được bán trong " +"[`external/rust/crates/`](https://cs.android.com/android/platform/superproject/+/master:external/rust/crates/)." #: src/android/build-rules/library.md msgid "\"hello_rust_with_dep\"" -msgstr "" +msgstr "\"xin chào_rust_with_dep\"" #: src/android/build-rules/library.md msgid "\"libgreetings\"" -msgstr "" +msgstr "\"lời chào\"" #: src/android/build-rules/library.md msgid "\"libtextwrap\"" -msgstr "" +msgstr "\"libtextwrap\"" #: src/android/build-rules/library.md msgid "// Need this to avoid dynamic link error.\n" -msgstr "" +msgstr "// Cần cái này để tránh lỗi link động.\n" #: src/android/build-rules/library.md msgid "\"greetings\"" -msgstr "" +msgstr "\"chào mừng\"" #: 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 "" +msgstr "\"src/lib.rs\"" #: src/android/build-rules/library.md msgid "_hello_rust/src/lib.rs_:" -msgstr "" +msgstr "_hello_rust/src/lib.rs_:" #: src/android/build-rules/library.md msgid "//! Greeting library.\n" -msgstr "" +msgstr "//! Thư viện chào mừng.\n" #: src/android/build-rules/library.md msgid "/// Greet `name`.\n" -msgstr "" +msgstr "/// Chào `name`.\n" #: src/android/build-rules/library.md msgid "\"Hello {name}, it is very nice to meet you!\"" -msgstr "" +msgstr "\"Xin chào {name}, rất vui được gặp bạn!\"" #: src/android/build-rules/library.md msgid "You build, push, and run the binary like before:" -msgstr "" +msgstr "Bạn xây dựng, đẩy và chạy nhị phân như trước:" #: src/android/build-rules/library.md msgid "" "```shell\n" "m hello_rust_with_dep\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep\" /data/local/tmp\n" "adb shell /data/local/tmp/hello_rust_with_dep\n" "```" msgstr "" +"```shell\n" +"xin chào_rust_with_dep\n" +"adb đẩy \"$ANDROID_product_OUT/system/bin/hello_rust_with_dep\" /data/local/tmp\n" +"adb shell /data/local/tmp/hello_rust_with_dep\n" +"```" #: src/android/aidl.md msgid "" -"The [Android Interface Definition Language (AIDL)](https://developer.android." -"com/guide/components/aidl) is supported in Rust:" +"The [Android Interface Definition Language " +"(AIDL)](https://developer.android.com/guide/components/aidl) is supported in" +" Rust:" msgstr "" +"[Ngôn ngữ định nghĩa giao diện Android " +"(AIDL)](https://developer.android.com/guide/comComponents/aidl) được hỗ trợ " +"trong Rust:" #: src/android/aidl.md msgid "Rust code can call existing AIDL servers," -msgstr "" +msgstr "Mã Rust có thể gọi các máy chủ AIDL hiện có," #: src/android/aidl.md msgid "You can create new AIDL servers in Rust." -msgstr "" +msgstr "Bạn có thể tạo máy chủ AIDL mới trong Rust." #: src/android/aidl/birthday-service.md msgid "" @@ -11103,194 +12626,215 @@ msgid "" "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 "" +"Để minh họa cách sử dụng Rust với Binder, chúng ta sẽ hướng dẫn quy trình " +"tạo giao diện Binder. Sau đó, chúng ta sẽ triển khai cả dịch vụ được mô tả " +"và viết mã máy khách để tương tác với dịch vụ đó." #: src/android/aidl/example-service/interface.md msgid "AIDL Interfaces" -msgstr "" +msgstr "Giao diện AIDL" #: src/android/aidl/example-service/interface.md msgid "You declare the API of your service using an AIDL interface:" -msgstr "" +msgstr "Bạn khai báo API của dịch vụ bằng giao diện AIDL:" #: src/android/aidl/example-service/interface.md #: src/android/aidl/example-service/service-bindings.md msgid "" "_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" msgstr "" +"_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:" #: src/android/aidl/example-service/interface.md #: src/android/aidl/example-service/service-bindings.md #: src/android/aidl/example-service/changing-definition.md msgid "/** Birthday service interface. */" -msgstr "" +msgstr "/** Giao diện phục vụ sinh nhật. */" #: src/android/aidl/example-service/interface.md #: src/android/aidl/example-service/service-bindings.md #: src/android/aidl/example-service/changing-definition.md msgid "/** Generate a Happy Birthday message. */" -msgstr "" +msgstr "/** Tạo tin nhắn Chúc mừng sinh nhật. */" #: src/android/aidl/example-service/interface.md msgid "_birthday_service/aidl/Android.bp_:" -msgstr "" +msgstr "_birthday_service/aidl/Android.bp_:" #: src/android/aidl/example-service/interface.md msgid "\"com.example.birthdayservice\"" -msgstr "" +msgstr "\"com.example.birthdayservice\"" #: src/android/aidl/example-service/interface.md msgid "\"com/example/birthdayservice/*.aidl\"" -msgstr "" +msgstr "\"com/example/birthdayservice/*.aidl\"" #: src/android/aidl/example-service/interface.md msgid "// Rust is not enabled by default\n" -msgstr "" +msgstr "// Rust không được bật theo mặc định\n" #: src/android/aidl/example-service/interface.md msgid "" -"Note that the directory structure under the `aidl/` directory needs to match " -"the package name used in the AIDL file, i.e. the package is `com.example." -"birthdayservice` and the file is at `aidl/com/example/IBirthdayService.aidl`." +"Note that the directory structure under the `aidl/` directory needs to match" +" the package name used in the AIDL file, i.e. the package is " +"`com.example.birthdayservice` and the file is at " +"`aidl/com/example/IBirthdayService.aidl`." msgstr "" +"Lưu ý rằng cấu trúc thư mục trong thư mục `aidl/` cần khớp với tên gói được " +"sử dụng trong tệp AIDL, tức là gói là `com.example.birthdayservice` và tệp " +"nằm ở `aidl/com/example/IBirthdayService.aidl`." #: src/android/aidl/example-service/service-bindings.md msgid "Generated Service API" -msgstr "" +msgstr "API dịch vụ đã tạo" #: src/android/aidl/example-service/service-bindings.md msgid "" -"Binder generates a trait corresponding to the interface definition. trait to " -"talk to the service." +"Binder generates a trait corresponding to the interface definition. trait to" +" talk to the service." msgstr "" +"Binder tạo ra một đặc điểm tương ứng với định nghĩa giao diện. đặc điểm để " +"nói chuyện với dịch vụ." #: src/android/aidl/example-service/service-bindings.md msgid "_Generated trait_:" -msgstr "" +msgstr "_Đặc điểm được tạo ra_:" #: 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." msgstr "" +"Dịch vụ của bạn sẽ cần triển khai đặc điểm này và khách hàng của bạn sẽ sử " +"dụng đặc điểm này để giao tiếp với dịch vụ." #: src/android/aidl/example-service/service-bindings.md msgid "" "The generated bindings can be found at `out/soong/.intermediates//`." msgstr "" +"Bạn có thể tìm thấy các liên kết được tạo tại " +"`out/soong/.intermediates//`." #: 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." msgstr "" +"Chỉ ra cách chữ ký hàm được tạo, cụ thể là kiểu đối số và kiểu trả về, tương" +" ứng với định nghĩa giao diện như thế nào." #: src/android/aidl/example-service/service-bindings.md msgid "" -"`String` for an argument results in a different Rust type than `String` as a " -"return type." +"`String` for an argument results in a different Rust type than `String` as a" +" return type." msgstr "" +"`Chuỗi` cho một đối số dẫn đến kiểu Rust khác với kiểu trả về là `Chuỗi`." #: src/android/aidl/example-service/service.md msgid "Service Implementation" -msgstr "" +msgstr "Triển khai dịch vụ" #: src/android/aidl/example-service/service.md msgid "We can now implement the AIDL service:" -msgstr "" +msgstr "Bây giờ chúng ta có thể triển khai dịch vụ AIDL:" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/changing-implementation.md msgid "_birthday_service/src/lib.rs_:" -msgstr "" +msgstr "_birthday_service/src/lib.rs_:" #: src/android/aidl/example-service/service.md msgid "/// The `IBirthdayService` implementation.\n" -msgstr "" +msgstr "/// Triển khai `IBirthdayService`.\n" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/changing-implementation.md #: src/android/aidl/types/file-descriptor.md msgid "\"Happy Birthday {name}, congratulations with the {years} years!\"" -msgstr "" +msgstr "\"Chúc mừng sinh nhật {name}, chúc mừng {years} năm!\"" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/server.md #: src/android/aidl/example-service/client.md msgid "_birthday_service/Android.bp_:" -msgstr "" +msgstr "_birthday_service/Android.bp_:" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/server.md msgid "\"libbirthdayservice\"" -msgstr "" +msgstr "\"dịch vụ sinh nhật\"" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/server.md #: src/android/aidl/example-service/client.md msgid "\"birthdayservice\"" -msgstr "" +msgstr "\"dịch vụ sinh nhật\"" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/server.md #: src/android/aidl/example-service/client.md msgid "\"com.example.birthdayservice-rust\"" -msgstr "" +msgstr "\"com.example.birthdayservice-rust\"" #: src/android/aidl/example-service/service.md #: src/android/aidl/example-service/server.md #: src/android/aidl/example-service/client.md msgid "\"libbinder_rs\"" -msgstr "" +msgstr "\"libinder_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." msgstr "" +"Chỉ ra đường dẫn đến đặc điểm `IBirthdayService` được tạo và giải thích lý " +"do tại sao mỗi phân đoạn lại cần thiết." #: src/android/aidl/example-service/service.md msgid "" "TODO: What does the `binder::Interface` trait do? Are there methods to " "override? Where source?" msgstr "" +"VIỆC CẦN LÀM: Đặc điểm `binder::Interface` làm gì? Có phương pháp nào để ghi" +" đè không? Nguồn đâu?" #: src/android/aidl/example-service/server.md msgid "AIDL Server" -msgstr "" +msgstr "Máy chủ AIDL" #: src/android/aidl/example-service/server.md msgid "Finally, we can create a server which exposes the service:" -msgstr "" +msgstr "Cuối cùng, chúng ta có thể tạo một máy chủ hiển thị dịch vụ:" #: src/android/aidl/example-service/server.md msgid "_birthday_service/src/server.rs_:" -msgstr "" +msgstr "_birthday_service/src/server.rs_:" #: src/android/aidl/example-service/server.md msgid "//! Birthday service.\n" -msgstr "" +msgstr "//! Dịch vụ sinh nhật.\n" #: src/android/aidl/example-service/server.md msgid "/// Entry point for birthday service.\n" -msgstr "" +msgstr "/// Điểm vào dịch vụ sinh nhật.\n" #: src/android/aidl/example-service/server.md msgid "\"Failed to register service\"" -msgstr "" +msgstr "\"Đăng ký dịch vụ không thành công\"" #: src/android/aidl/example-service/server.md msgid "\"birthday_server\"" -msgstr "" +msgstr "\"sinh nhật_server\"" #: src/android/aidl/example-service/server.md msgid "\"src/server.rs\"" -msgstr "" +msgstr "\"src/server.rs\"" #: src/android/aidl/example-service/server.md #: src/android/aidl/example-service/client.md msgid "// To avoid dynamic link error.\n" -msgstr "" +msgstr "// Để tránh lỗi liên kết động.\n" #: src/android/aidl/example-service/server.md msgid "" @@ -11300,117 +12844,147 @@ msgid "" "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 "" +"Quy trình triển khai dịch vụ do người dùng xác định (trong trường hợp này là" +" loại `BirthdayService`, triển khai `IBirthdayService`) và bắt đầu dưới dạng" +" dịch vụ Binder có nhiều bước và có thể phức tạp hơn so với những gì học " +"sinh đã quen nếu họ đã sử dụng Binder từ C++ hoặc ngôn ngữ khác. Giải thích " +"cho học sinh tại sao mỗi bước là cần thiết." #: src/android/aidl/example-service/server.md msgid "Create an instance of your service type (`BirthdayService`)." -msgstr "" +msgstr "Tạo một phiên bản của loại dịch vụ của bạn (`BirthdayService`)." #: src/android/aidl/example-service/server.md msgid "" "Wrap the service object in corresponding `Bn*` type (`BnBirthdayService` in " "this case). This type is generated by Binder and provides the common Binder " -"functionality that would be provided by the `BnBinder` base class in C++. We " -"don't have inheritance in Rust, so instead we use composition, putting our " +"functionality that would be provided by the `BnBinder` base class in C++. We" +" don't have inheritance in Rust, so instead we use composition, putting our " "`BirthdayService` within the generated `BnBinderService`." msgstr "" +"Bao bọc đối tượng dịch vụ theo loại `Bn*` tương ứng (`BnBirthdayService` " +"trong trường hợp này). Loại này được Binder tạo ra và cung cấp chức năng " +"Binder phổ biến sẽ được cung cấp bởi lớp cơ sở `BnBinder` trong C++. Chúng " +"tôi không có quyền kế thừa trong Rust, vì vậy thay vào đó chúng tôi sử dụng " +"tính kết hợp, đặt `BirthdayService` của mình bên trong `BnBinderService` " +"được tạo." #: 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)." msgstr "" +"Gọi `add_service`, đặt cho nó một mã định danh dịch vụ và đối tượng dịch vụ " +"của bạn (đối tượng `BnBirthdayService` trong ví dụ)." #: 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." msgstr "" +"Gọi `join_thread_pool` để thêm luồng hiện tại vào nhóm luồng của Binder và " +"bắt đầu lắng nghe các kết nối." #: src/android/aidl/example-service/deploy.md msgid "We can now build, push, and start the service:" -msgstr "" +msgstr "Bây giờ chúng ta có thể xây dựng, đẩy và bắt đầu dịch vụ:" #: src/android/aidl/example-service/deploy.md 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" +"sinh nhật_server\n" +"adb đẩy \"$ANDROID_product_OUT/system/bin/birthday_server\" /data/local/tmp\n" +"```shell\n" +"m birthday_server\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" +"```" #: src/android/aidl/example-service/deploy.md msgid "In another terminal, check that the service runs:" -msgstr "" +msgstr "Trong một terminal khác, hãy kiểm tra xem dịch vụ có chạy không:" #: src/android/aidl/example-service/deploy.md msgid "You can also call the service with `service call`:" -msgstr "" +msgstr "Bạn cũng có thể gọi dịch vụ bằng `service call`:" #: src/android/aidl/example-service/client.md msgid "AIDL Client" -msgstr "" +msgstr "Khách hàng AIDL" #: src/android/aidl/example-service/client.md msgid "Finally, we can create a Rust client for our new service." msgstr "" +"Cuối cùng, chúng ta có thể tạo ứng dụng khách Rust cho dịch vụ mới của mình." #: src/android/aidl/example-service/client.md #: src/android/aidl/example-service/changing-implementation.md msgid "_birthday_service/src/client.rs_:" -msgstr "" +msgstr "_birthday_service/src/client.rs_:" #: src/android/aidl/example-service/client.md msgid "/// Call the birthday service.\n" -msgstr "" +msgstr "/// Gọi dịch vụ sinh nhật.\n" -#: src/android/aidl/example-service/client.md src/android/aidl/types/objects.md -#: src/android/aidl/types/parcelables.md +#: 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 msgid "\"Failed to connect to BirthdayService\"" -msgstr "" +msgstr "\"Không thể kết nối với BirthdayService\"" #: src/android/aidl/example-service/client.md msgid "// Call the service.\n" -msgstr "" +msgstr "// Gọi dịch vụ.\n" #: src/android/aidl/example-service/client.md msgid "\"{msg}\"" -msgstr "" +msgstr "\"{tin nhắn}\"" #: src/android/aidl/example-service/client.md msgid "\"birthday_client\"" -msgstr "" +msgstr "\"sinh nhật_khách hàng\"" #: src/android/aidl/example-service/client.md msgid "\"src/client.rs\"" -msgstr "" +msgstr "\"src/client.rs\"" #: src/android/aidl/example-service/client.md msgid "Notice that the client does not depend on `libbirthdayservice`." -msgstr "" +msgstr "Lưu ý rằng client không phụ thuộc vào `libbirthdayservice`." #: src/android/aidl/example-service/client.md msgid "Build, push, and run the client on your device:" -msgstr "" +msgstr "Xây dựng, đẩy và chạy ứng dụng khách trên thiết bị của bạn:" #: src/android/aidl/example-service/client.md 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" +"sinh nhật_khách hàng\n" +"adb đẩy \"$ANDROID_product_OUT/system/bin/birthday_client\" /data/local/tmp\n" +"adb shell /data/local/tmp/birthday_client Charlie 60\n" +"```" #: src/android/aidl/example-service/client.md msgid "" "`Strong` is the trait object representing the service " "that the client has connected to." msgstr "" +"`Strong` là đối tượng đặc điểm đại diện cho dịch vụ mà" +" khách hàng đã kết nối." #: src/android/aidl/example-service/client.md msgid "" @@ -11418,6 +12992,10 @@ msgid "" "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 "" +"`Strong` là loại con trỏ thông minh tùy chỉnh cho Binder. Nó xử lý cả số " +"lượng tham chiếu trong quá trình cho đối tượng đặc điểm dịch vụ và số lượng " +"tham chiếu Binder toàn cầu để theo dõi số lượng quy trình có tham chiếu đến " +"đối tượng." #: src/android/aidl/example-service/client.md msgid "" @@ -11426,6 +13004,10 @@ msgid "" "interface, there is a single Rust trait generated that both client and " "server use." msgstr "" +"Lưu ý rằng đối tượng đặc điểm mà máy khách sử dụng để giao tiếp với dịch vụ " +"sử dụng chính xác đặc điểm mà máy chủ triển khai. Đối với một giao diện " +"Binder nhất định, có một đặc điểm Rust duy nhất được tạo ra mà cả máy khách " +"và máy chủ đều sử dụng." #: src/android/aidl/example-service/client.md msgid "" @@ -11433,16 +13015,23 @@ msgid "" "should ideally be defined in a common crate that both the client and server " "can depend on." msgstr "" +"Sử dụng cùng mã định danh dịch vụ được sử dụng khi đăng ký dịch vụ. Lý tưởng" +" nhất là điều này nên được xác định trong một crate chung mà cả máy khách và" +" máy chủ đều có thể phụ thuộc vào." #: 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:" msgstr "" +"Hãy để chúng tôi mở rộng API với nhiều chức năng hơn: chúng tôi muốn cho " +"phép khách hàng chỉ định danh sách các dòng cho thiệp sinh nhật:" #: src/android/aidl/example-service/changing-definition.md msgid "This results in an updated trait definition for `IBirthdayService`:" msgstr "" +"Điều này dẫn đến một định nghĩa đặc điểm được cập nhật cho " +"`IBirthdayService`:" #: src/android/aidl/example-service/changing-definition.md msgid "" @@ -11450,142 +13039,148 @@ msgid "" "`&[String]` in Rust, i.e. that idiomatic Rust types are used in the " "generated bindings wherever possible:" msgstr "" +"Lưu ý cách `String[]` trong định nghĩa AIDL được dịch là `&[String]` trong " +"Rust, tức là các kiểu Rust thành ngữ được sử dụng trong các liên kết được " +"tạo bất cứ khi nào có thể:" #: src/android/aidl/example-service/changing-definition.md msgid "`in` array arguments are translated to slices." -msgstr "" +msgstr "Các đối số mảng `in` được dịch thành các lát." #: src/android/aidl/example-service/changing-definition.md msgid "`out` and `inout` args are translated to `&mut Vec`." -msgstr "" +msgstr "Các đối số `out` và `inout` được dịch sang `&mut Vec`." #: src/android/aidl/example-service/changing-definition.md msgid "Return values are translated to returning a `Vec`." -msgstr "" +msgstr "Các giá trị trả về được chuyển thành trả về một `Vec`." #: src/android/aidl/example-service/changing-implementation.md msgid "Updating Client and Service" -msgstr "" +msgstr "Cập nhật khách hàng và dịch vụ" #: src/android/aidl/example-service/changing-implementation.md msgid "Update the client and server code to account for the new API." -msgstr "" +msgstr "Cập nhật mã máy khách và máy chủ để giải thích cho API mới." #: src/android/aidl/example-service/changing-implementation.md msgid "'\\n'" -msgstr "" +msgstr "'\\N'" #: src/android/aidl/example-service/changing-implementation.md msgid "\"Habby birfday to yuuuuu\"" -msgstr "" +msgstr "\"Chúc mừng sinh nhật yuuuuu\"" #: src/android/aidl/example-service/changing-implementation.md msgid "\"And also: many more\"" -msgstr "" +msgstr "\"Và còn có: nhiều hơn nữa\"" #: src/android/aidl/example-service/changing-implementation.md msgid "" "TODO: Move code snippets into project files where they'll actually be built?" msgstr "" +"VIỆC CẦN LÀM: Di chuyển đoạn mã vào tệp dự án nơi chúng thực sự sẽ được tạo?" #: src/android/aidl/types.md msgid "Working With AIDL Types" -msgstr "" +msgstr "Làm việc với các loại AIDL" #: src/android/aidl/types.md msgid "AIDL types translate into the appropriate idiomatic Rust type:" -msgstr "" +msgstr "Các loại AIDL chuyển sang loại Rust thành ngữ thích hợp:" #: src/android/aidl/types.md msgid "Primitive types map (mostly) to idiomatic Rust types." -msgstr "" +msgstr "Các loại nguyên thủy ánh xạ (hầu hết) thành các loại Rust thành ngữ." #: src/android/aidl/types.md msgid "Collection types like slices, `Vec`s and string types are supported." -msgstr "" +msgstr "Các loại bộ sưu tập như lát, `Vec` và loại chuỗi được hỗ trợ." #: src/android/aidl/types.md msgid "" "References to AIDL objects and file handles can be sent between clients and " "services." msgstr "" +"Các tham chiếu đến các đối tượng AIDL và các phần xử lý tệp có thể được gửi " +"giữa các máy khách và dịch vụ." #: src/android/aidl/types.md msgid "File handles and parcelables are fully supported." -msgstr "" +msgstr "Xử lý tập tin và phân chia được hỗ trợ đầy đủ." #: src/android/aidl/types/primitives.md msgid "Primitive types map (mostly) idiomatically:" -msgstr "" +msgstr "Bản đồ các loại nguyên thủy (chủ yếu) theo thành ngữ:" #: src/android/aidl/types/primitives.md msgid "AIDL Type" -msgstr "" +msgstr "Loại AIDL" #: src/android/aidl/types/primitives.md src/android/aidl/types/arrays.md #: src/android/interoperability/cpp/type-mapping.md msgid "Rust Type" -msgstr "" +msgstr "Loại Rust" #: src/android/aidl/types/primitives.md msgid "Note" -msgstr "" +msgstr "Ghi chú" #: src/android/aidl/types/primitives.md msgid "`boolean`" -msgstr "" +msgstr "`boolean`" #: src/android/aidl/types/primitives.md msgid "`byte`" -msgstr "" +msgstr "`byte`" #: src/android/aidl/types/primitives.md msgid "`i8`" -msgstr "" +msgstr "`i8`" #: src/android/aidl/types/primitives.md msgid "Note that bytes are signed." -msgstr "" +msgstr "Lưu ý rằng byte được ký." #: src/android/aidl/types/primitives.md msgid "`u16`" -msgstr "" +msgstr "`u16`" #: src/android/aidl/types/primitives.md msgid "Note the usage of `u16`, NOT `u32`." -msgstr "" +msgstr "Lưu ý cách sử dụng `u16`, KHÔNG phải `u32`." #: src/android/aidl/types/primitives.md msgid "`int`" -msgstr "" +msgstr "`int`" #: src/android/aidl/types/primitives.md msgid "`i32`" -msgstr "" +msgstr "`i32`" #: src/android/aidl/types/primitives.md msgid "`long`" -msgstr "" +msgstr "`dài`" #: src/android/aidl/types/primitives.md msgid "`i64`" -msgstr "" +msgstr "`i64`" #: src/android/aidl/types/primitives.md msgid "`float`" -msgstr "" +msgstr "`thả nổi`" #: src/android/aidl/types/primitives.md msgid "`f32`" -msgstr "" +msgstr "`f32`" #: src/android/aidl/types/primitives.md msgid "`double`" -msgstr "" +msgstr "`gấp đôi`" #: src/android/aidl/types/primitives.md msgid "`f64`" -msgstr "" +msgstr "`f64`" #: src/android/aidl/types/arrays.md msgid "" @@ -11593,35 +13188,37 @@ msgid "" "appropriate Rust array type depending on how they are used in the function " "signature:" msgstr "" +"Các kiểu mảng (`T[]`, `byte[]`, và `List`) được dịch sang kiểu mảng Rust " +"thích hợp tùy thuộc vào cách chúng được sử dụng trong chữ ký hàm:" #: src/android/aidl/types/arrays.md msgid "Position" -msgstr "" +msgstr "Chức vụ" #: src/android/aidl/types/arrays.md msgid "`in` argument" -msgstr "" +msgstr "đối số `in`" #: src/android/aidl/types/arrays.md msgid "`&[T]`" -msgstr "" +msgstr "`&[T]`" #: src/android/aidl/types/arrays.md msgid "`out`/`inout` argument" -msgstr "" +msgstr "đối số `out`/`inout`" #: src/android/aidl/types/arrays.md msgid "`&mut Vec`" -msgstr "" +msgstr "`&mut Vec`" #: src/android/aidl/types/arrays.md msgid "Return" -msgstr "" +msgstr "Trở lại" #: src/android/aidl/types/arrays.md #: src/android/interoperability/cpp/type-mapping.md msgid "`Vec`" -msgstr "" +msgstr "`Vec`" #: src/android/aidl/types/arrays.md msgid "" @@ -11630,123 +13227,139 @@ msgid "" "int\\[3\\]\\[4\\]). In the Java backend, fixed-size arrays are represented " "as array types." msgstr "" +"Trong Android 13 trở lên, mảng có kích thước cố định được hỗ trợ, tức là " +"`T[N]` trở thành `[T; N]`. Mảng có kích thước cố định có thể có nhiều chiều " +"(ví dụ: int\\[3\\]\\[4\\]). Trong chương trình phụ trợ Java, các mảng có " +"kích thước cố định được biểu diễn dưới dạng kiểu mảng." #: src/android/aidl/types/arrays.md msgid "Arrays in parcelable fields always get translated to `Vec`." -msgstr "" +msgstr "Mảng trong các trường có thể chia nhỏ luôn được dịch sang `Vec`." #: 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:" msgstr "" +"Các đối tượng AIDL có thể được gửi dưới dạng loại AIDL cụ thể hoặc dưới dạng" +" giao diện `IBinder` bị xóa loại:" #: src/android/aidl/types/objects.md msgid "" -"**birthday_service/aidl/com/example/birthdayservice/IBirthdayInfoProvider." -"aidl**:" +"**birthday_service/aidl/com/example/birthdayservice/IBirthdayInfoProvider.aidl**:" msgstr "" +"**birthday_service/aidl/com/example/birthdayservice/IBirthdayInfoProvider.aidl**:" #: src/android/aidl/types/objects.md src/android/aidl/types/parcelables.md #: src/android/aidl/types/file-descriptor.md msgid "" "**birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl**:" msgstr "" +"**birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl**:" #: src/android/aidl/types/objects.md msgid "/** The same thing, but using a binder object. */" -msgstr "" +msgstr "/** Tương tự, nhưng sử dụng đối tượng kết dính. */" #: src/android/aidl/types/objects.md msgid "/** The same thing, but using `IBinder`. */" -msgstr "" +msgstr "/** Tương tự, nhưng sử dụng `IBinder`. */" #: src/android/aidl/types/objects.md src/android/aidl/types/parcelables.md #: src/android/aidl/types/file-descriptor.md msgid "**birthday_service/src/client.rs**:" -msgstr "" +msgstr "**birth_service/src/client.rs**:" #: src/android/aidl/types/objects.md msgid "/// Rust struct implementing the `IBirthdayInfoProvider` interface.\n" -msgstr "" +msgstr "/// Rust struct triển khai giao diện `IBirthdayInfoProvider`.\n" #: src/android/aidl/types/objects.md msgid "// Create a binder object for the `IBirthdayInfoProvider` interface.\n" -msgstr "" +msgstr "// Tạo một đối tượng kết dính cho giao diện `IBirthdayInfoProvider`.\n" #: src/android/aidl/types/objects.md msgid "// Send the binder object to the service.\n" -msgstr "" +msgstr "// Gửi đối tượng liên kết tới dịch vụ.\n" #: src/android/aidl/types/objects.md msgid "" "// Perform the same operation but passing the provider as an `SpIBinder`.\n" msgstr "" +"// Thực hiện thao tác tương tự nhưng chuyển nhà cung cấp dưới dạng " +"`SpIBinder`.\n" #: src/android/aidl/types/objects.md msgid "" "Note the usage of `BnBirthdayInfoProvider`. This serves the same purpose as " "`BnBirthdayService` that we saw previously." msgstr "" +"Lưu ý cách sử dụng `BnBirthdayInfoProvider`. Điều này phục vụ cùng mục đích " +"như `BnBirthdayService` mà chúng ta đã thấy trước đây." #: src/android/aidl/types/parcelables.md msgid "Binder for Rust supports sending parcelables directly:" -msgstr "" +msgstr "Binder for Rust hỗ trợ gửi bưu kiện trực tiếp:" #: src/android/aidl/types/parcelables.md 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. */" -msgstr "" +msgstr "/** Điều tương tự, nhưng với một bưu kiện. */" #: src/android/aidl/types/file-descriptor.md msgid "" "Files can be sent between Binder clients/servers using the " "`ParcelFileDescriptor` type:" msgstr "" +"Các tập tin có thể được gửi giữa các máy khách/máy chủ Binder bằng cách sử " +"dụng loại `ParcelFileDescriptor`:" #: src/android/aidl/types/file-descriptor.md msgid "/** The same thing, but loads info from a file. */" -msgstr "" +msgstr "/** Tương tự, nhưng tải thông tin từ một tập tin. */" #: src/android/aidl/types/file-descriptor.md msgid "// Open a file and put the birthday info in it.\n" -msgstr "" +msgstr "// Mở một file và nhập thông tin ngày sinh vào đó.\n" #: src/android/aidl/types/file-descriptor.md msgid "\"/data/local/tmp/birthday.info\"" -msgstr "" +msgstr "\"/data/local/tmp/birthday.info\"" #: src/android/aidl/types/file-descriptor.md msgid "\"{name}\"" -msgstr "" +msgstr "\"{tên}\"" #: src/android/aidl/types/file-descriptor.md msgid "\"{years}\"" -msgstr "" +msgstr "\"{năm}\"" #: src/android/aidl/types/file-descriptor.md msgid "// Create a `ParcelFileDescriptor` from the file and send it.\n" -msgstr "" +msgstr "// Tạo một `ParcelFileDescriptor` từ file và gửi nó.\n" #: src/android/aidl/types/file-descriptor.md msgid "**birthday_service/src/lib.rs**:" -msgstr "" +msgstr "**birth_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 "" +"// Chuyển đổi bộ mô tả tập tin thành `File`. `ParcelFileDescriptor` kết thúc\n" +" // một `OwnedFd`, có thể được nhân bản và sau đó được sử dụng để tạo một `File`\n" +" // đối tượng.\n" #: src/android/aidl/types/file-descriptor.md msgid "\"Invalid file handle\"" -msgstr "" +msgstr "\"Xử lý tập tin không hợp lệ\"" #: src/android/aidl/types/file-descriptor.md msgid "" @@ -11754,78 +13367,86 @@ msgid "" "`File` (or any other type that wraps an `OwnedFd`), and can be used to " "create a new `File` handle on the other side." msgstr "" +"`ParcelFileDescriptor` bao bọc một `OwnedFd`, và do đó có thể được tạo từ " +"một `File` (hoặc bất kỳ loại nào khác bao bọc `OwnedFd`) và có thể được sử " +"dụng để tạo một bộ điều khiển `File` mới ở phía bên kia." #: src/android/aidl/types/file-descriptor.md msgid "" "Other types of file descriptors can be wrapped and sent, e.g. TCP, UDP, and " "UNIX sockets." msgstr "" +"Các loại mô tả tệp khác có thể được gói và gửi, ví dụ: Ổ cắm TCP, UDP và " +"UNIX." #: src/android/testing.md msgid "Testing in Android" -msgstr "" +msgstr "Thử nghiệm trong 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:" msgstr "" +"Dựa trên [Testing](../testing.md), bây giờ chúng ta sẽ xem xét cách hoạt " +"động của các bài kiểm tra đơn vị trong AOSP. Sử dụng mô-đun `rust_test` cho " +"các bài kiểm tra đơn vị của bạn:" #: src/android/testing.md msgid "_testing/Android.bp_:" -msgstr "" +msgstr "_testing/Android.bp_:" #: src/android/testing.md msgid "\"libleftpad\"" -msgstr "" +msgstr "\"libleftpad\"" #: src/android/testing.md msgid "\"leftpad\"" -msgstr "" +msgstr "\"leftpad\"" #: src/android/testing.md msgid "\"libleftpad_test\"" -msgstr "" +msgstr "\"libleftpad_test\"" #: src/android/testing.md msgid "\"leftpad_test\"" -msgstr "" +msgstr "\"leftpad_test\"" #: src/android/testing.md src/android/interoperability/with-c/bindgen.md msgid "\"general-tests\"" -msgstr "" +msgstr "\"general-tests\"" #: src/android/testing.md msgid "_testing/src/lib.rs_:" -msgstr "" +msgstr "_testing/src/lib.rs_:" #: src/android/testing.md msgid "//! Left-padding library.\n" -msgstr "" +msgstr "//! Thư viện đệm bên trái.\n" #: src/android/testing.md msgid "/// Left-pad `s` to `width`.\n" -msgstr "" +msgstr "/// Pad trái `s` tới `width`.\n" #: src/android/testing.md msgid "\"{s:>width$}\"" -msgstr "" +msgstr "\"{s:>width$}\"" #: src/android/testing.md msgid "\" foo\"" -msgstr "" +msgstr "\" foo\"" #: src/android/testing.md msgid "\"foobar\"" -msgstr "" +msgstr "\"foobar\"" #: src/android/testing.md msgid "You can now run the test with" -msgstr "" +msgstr "Bây giờ bạn có thể chạy thử nghiệm với" #: src/android/testing.md msgid "The output looks like this:" -msgstr "" +msgstr "Đầu ra trông như thế này:" #: src/android/testing.md msgid "" @@ -11833,53 +13454,73 @@ 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" "```" msgstr "" +"```văn bản\n" +"THÔNG TIN: Thời gian đã trôi qua: 2,666 giây, Đường dẫn quan trọng: 2,40 giây\n" +"THÔNG TIN: 3 quy trình: 2 nội bộ, 1 linux-sandbox.\n" +"THÔNG TIN: Quá trình xây dựng đã hoàn tất thành công, tổng cộng 3 hành động\n" +"//toàn diện-rust-android/testing:libleftpad_test_host ĐÃ ĐẠT sau 2,3 giây\n" +" ĐÃ ĐẠT libleftpad_test.tests::long_string (0,0 giây)\n" +" ĐÃ ĐẠT libleftpad_test.tests::short_string (0,0 giây)\n" +"Các trường hợp kiểm thử: kết thúc với 2 trường hợp đạt và 0 trường hợp thất bại trong số 2 trường hợp kiểm thử\n" +"```" #: src/android/testing.md msgid "" "Notice how you only mention the root of the library crate. Tests are found " "recursively in nested modules." msgstr "" +"Lưu ý cách bạn chỉ đề cập đến thư mục gốc của crate thư viện. Các thử nghiệm" +" được tìm thấy đệ quy trong các mô-đun lồng nhau." #: src/android/testing/googletest.md msgid "" -"The [GoogleTest](https://docs.rs/googletest/) crate allows for flexible test " -"assertions using _matchers_:" +"The [GoogleTest](https://docs.rs/googletest/) crate allows for flexible test" +" assertions using _matchers_:" msgstr "" +"Crate [GoogleTest](https://docs.rs/googletest/) cho phép xác nhận thử nghiệm" +" linh hoạt bằng cách sử dụng _matchers_:" #: src/android/testing/googletest.md msgid "\"baz\"" -msgstr "" +msgstr "\"baz\"" #: src/android/testing/googletest.md msgid "\"xyz\"" -msgstr "" +msgstr "\"xyz\"" #: src/android/testing/googletest.md msgid "" "If we change the last element to `\"!\"`, the test fails with a structured " "error message pin-pointing the error:" msgstr "" +"Nếu chúng tôi thay đổi phần tử cuối cùng thành `\"!\"`, quá trình kiểm tra " +"sẽ thất bại với thông báo lỗi có cấu trúc chỉ ra lỗi:" #: 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." +"example in a local environment. Use `cargo add googletest` to quickly add it" +" to an existing Cargo project." msgstr "" +"GoogleTest không phải là một phần của Rust Playground, vì vậy bạn cần chạy " +"ví dụ này trong môi trường cục bộ. Sử dụng `cargo add googletest` để nhanh " +"chóng thêm nó vào dự án Cargo hiện có." #: src/android/testing/googletest.md msgid "" "The `use googletest::prelude::*;` line imports a number of [commonly used " -"macros and types](https://docs.rs/googletest/latest/googletest/prelude/index." -"html)." +"macros and " +"types](https://docs.rs/googletest/latest/googletest/prelude/index.html)." msgstr "" +"Dòng `use googletest::prelude::*;` nhập một số [các loại và macro thường " +"được sử " +"dụng](https://docs.rs/googletest/latest/googletest/prelude/index.html)." #: src/android/testing/googletest.md msgid "" @@ -11890,12 +13531,20 @@ msgid "" "the library, with exercises to help you get comfortable with `googletest` " "macros, its matchers and its overall philosophy." msgstr "" +"Điều này chỉ làm trầy xước bề mặt, có rất nhiều công cụ so khớp được tích " +"hợp sẵn. Hãy cân nhắc xem qua chương đầu tiên của [\"Thử nghiệm nâng cao cho" +" các ứng dụng Rust\"](https://github.com/mainmatter/rust-advanced-testing-" +"workshop), một khóa học Rust tự hướng dẫn: nó cung cấp phần giới thiệu có " +"hướng dẫn về thư viện, kèm theo các bài tập giúp bạn làm quen với macro " +"`googletest`, các đối sánh và triết lý tổng thể của nó." #: src/android/testing/googletest.md msgid "" "A particularly nice feature is that mismatches in multi-line strings are " "shown as a diff:" msgstr "" +"Một tính năng đặc biệt thú vị là những điểm không khớp trong chuỗi nhiều " +"dòng được hiển thị dưới dạng khác biệt:" #: src/android/testing/googletest.md msgid "" @@ -11903,6 +13552,9 @@ msgid "" " Rust's strong typing guides the way,\\n\\\n" " Secure code you'll write.\"" msgstr "" +"\"Đã tìm thấy sự an toàn của bộ nhớ,\\n\\\n" +" Lối gõ mạnh mẽ của Rust sẽ dẫn đường,\\n\\\n" +" Mã an toàn bạn sẽ viết.\"" #: src/android/testing/googletest.md msgid "" @@ -11910,16 +13562,21 @@ msgid "" " Rust's silly humor guides the way,\\n\\\n" " Secure code you'll write.\"" msgstr "" +"\"Đã tìm thấy sự an toàn của bộ nhớ,\\n\\\n" +" Sự hài hước ngớ ngẩn của Rust dẫn đường,\\n\\\n" +" Mã an toàn bạn sẽ viết.\"" #: src/android/testing/googletest.md msgid "shows a color-coded diff (colors not shown here):" -msgstr "" +msgstr "hiển thị khác biệt được mã hóa màu (màu không được hiển thị ở đây):" #: src/android/testing/googletest.md msgid "" -"The crate is a Rust port of [GoogleTest for C++](https://google.github.io/" -"googletest/)." +"The crate is a Rust port of [GoogleTest for " +"C++](https://google.github.io/googletest/)." msgstr "" +"Crate là cổng Rust của [GoogleTest cho " +"C++](https://google.github.io/googletest/)." #: src/android/testing/mocking.md msgid "" @@ -11927,45 +13584,70 @@ msgid "" "You need to refactor your code to use traits, which you can then quickly " "mock:" msgstr "" +"Để chế giễu, [Mockall](https://docs.rs/mockall/) là một thư viện được sử " +"dụng rộng rãi. Bạn cần cấu trúc lại mã của mình để sử dụng các đặc điểm, sau" +" đó bạn có thể nhanh chóng mô phỏng:" #: 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." -msgstr "" +"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 "" +"Mockall là thư viện mô phỏng được đề xuất trong Android (AOSP). Có [thư viện" +" mô phỏng khác có sẵn trên Crates.io](https://crates.io/keywords/mock), đặc " +"biệt là trong lĩnh vực mô phỏng các dịch vụ HTTP. Các thư viện mô phỏng khác" +" hoạt động theo cách tương tự như Mockall, nghĩa là chúng giúp bạn dễ dàng " +"triển khai mô hình một đặc điểm nhất định." #: 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 " +"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." +"wrongly and return output different from what the real dependencies would " +"do." msgstr "" +"Lưu ý rằng chế độ mô phỏng hơi _gây tranh cãi_: chế độ mô phỏng cho phép bạn" +" tách biệt hoàn toàn một bài kiểm tra khỏi các phần phụ thuộc của nó. Kết " +"quả là việc thực hiện kiểm thử nhanh hơn và ổn định hơn. Mặt khác, các mô " +"hình có thể được cấu hình sai và trả về kết quả đầu ra khác với những gì các" +" phần phụ thuộc thực sự sẽ làm." #: 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 "" +"Nếu có thể, bạn nên sử dụng các phần phụ thuộc thực sự. Ví dụ: nhiều cơ sở " +"dữ liệu cho phép bạn định cấu hình phần phụ trợ trong bộ nhớ. Điều này có " +"nghĩa là bạn có được hành vi chính xác trong các thử nghiệm của mình, hơn " +"nữa chúng rất nhanh và sẽ tự động dọn dẹp sau đó." #: 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." +"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." msgstr "" +"Tương tự, nhiều khung web cho phép bạn khởi động một máy chủ đang xử lý liên" +" kết với một cổng ngẫu nhiên trên `localhost`. Luôn thích điều này hơn là " +"mock framework vì nó giúp bạn kiểm tra mã của mình trong môi trường thực." #: 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 " -"existing Cargo project." +"in a local environment. Use `cargo add mockall` to quickly add Mockall to an" +" existing Cargo project." msgstr "" +"Mockall không phải là một phần của Rust Playground, vì vậy bạn cần chạy ví " +"dụ này trong môi trường cục bộ. Sử dụng `cargo add mockall` để nhanh chóng " +"thêm Mockall vào dự án Cargo hiện có." #: src/android/testing/mocking.md msgid "" @@ -11973,6 +13655,9 @@ msgid "" "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 "" +"Mockall có nhiều chức năng hơn. Đặc biệt, bạn có thể thiết lập các kỳ vọng " +"phụ thuộc vào các đối số được truyền. Ở đây chúng tôi sử dụng điều này để " +"mock một con mèo đói 3 giờ sau lần cuối cùng nó được cho ăn:" #: src/android/testing/mocking.md msgid "" @@ -11980,363 +13665,402 @@ msgid "" "called to `n` --- the mock will automatically panic when dropped if this " "isn't satisfied." msgstr "" +"Bạn có thể sử dụng `.times(n)` để giới hạn số lần một phương thức mock có " +"thể được gọi thành `n` --- mock sẽ tự động panic khi bị drop nếu điều này " +"không được thỏa mãn." #: src/android/logging.md msgid "" "You should use the `log` crate to automatically log to `logcat` (on-device) " "or `stdout` (on-host):" msgstr "" +"Bạn nên sử dụng crate `log` để tự động đăng nhập vào `logcat` (trên thiết " +"bị) hoặc `stdout` (trên máy chủ):" #: src/android/logging.md msgid "_hello_rust_logs/Android.bp_:" -msgstr "" +msgstr "_hello_rust_logs/Android.bp_:" #: src/android/logging.md msgid "\"hello_rust_logs\"" -msgstr "" +msgstr "\"hello_rust_logs\"" #: src/android/logging.md msgid "\"liblog_rust\"" -msgstr "" +msgstr "\"liblog_rust\"" #: src/android/logging.md msgid "\"liblogger\"" -msgstr "" +msgstr "\"liblogger\"" #: src/android/logging.md msgid "_hello_rust_logs/src/main.rs_:" -msgstr "" +msgstr "_hello_rust_logs/src/main.rs_:" #: src/android/logging.md msgid "//! Rust logging demo.\n" -msgstr "" +msgstr "//! Bản demo Rust logging.\n" #: src/android/logging.md msgid "/// Logs a greeting.\n" -msgstr "" +msgstr "/// Ghi lại lời chào.\n" #: src/android/logging.md msgid "\"rust\"" -msgstr "" +msgstr "\"rust\"" #: src/android/logging.md msgid "\"Starting program.\"" -msgstr "" +msgstr "\"Chương trình bắt đầu.\"" #: src/android/logging.md msgid "\"Things are going fine.\"" -msgstr "" +msgstr "\"Mọi việc đang diễn ra tốt đẹp.\"" #: src/android/logging.md msgid "\"Something went wrong!\"" -msgstr "" +msgstr "\"Có gì đó không ổn!\"" #: src/android/logging.md src/android/interoperability/with-c/bindgen.md #: src/android/interoperability/with-c/rust.md msgid "Build, push, and run the binary on your device:" -msgstr "" +msgstr "Xây dựng, đẩy và chạy nhị phân trên thiết bị của bạn:" #: src/android/logging.md 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 shell /data/local/tmp/hello_rust_logs\n" +"```" #: src/android/logging.md msgid "The logs show up in `adb logcat`:" -msgstr "" +msgstr "Nhật ký hiển thị trong `adb logcat`:" #: src/android/interoperability.md msgid "" "Rust has excellent support for interoperability with other languages. This " "means that you can:" msgstr "" +"Rust có sự hỗ trợ tuyệt vời cho khả năng tương tác với các ngôn ngữ khác. " +"Điều này có nghĩa là bạn có thể:" #: src/android/interoperability.md msgid "Call Rust functions from other languages." -msgstr "" +msgstr "Gọi các hàm Rust từ các ngôn ngữ khác." #: src/android/interoperability.md msgid "Call functions written in other languages from Rust." -msgstr "" +msgstr "Các hàm gọi được viết bằng các ngôn ngữ khác từ Rust." #: src/android/interoperability.md msgid "" "When you call functions in a foreign language we say that you're using a " "_foreign function interface_, also known as FFI." msgstr "" +"Khi bạn gọi các hàm bằng một ngôn ngữ khác, chúng tôi sẽ nói rằng bạn đang " +"sử dụng _foreign function interface_, còn được gọi là FFI." #: src/android/interoperability/with-c.md msgid "Interoperability with C" -msgstr "" +msgstr "Khả năng tương tác với C" #: src/android/interoperability/with-c.md 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ó hỗ trợ đầy đủ cho việc liên kết các tệp đối tượng với quy ước gọi " +"hàm của C (C calling convention). Tương tự, bạn có thể xuất các hàm Rust và " +"gọi chúng từ C." #: src/android/interoperability/with-c.md msgid "You can do it by hand if you want:" -msgstr "" +msgstr "Bạn có thể làm điều đó bằng tay nếu bạn muốn:" #: src/android/interoperability/with-c.md msgid "// SAFETY: `abs` doesn't have any safety requirements.\n" -msgstr "" +msgstr "// AN TOÀN: `abs` không có bất kỳ yêu cầu an toàn nào.\n" #: src/android/interoperability/with-c.md msgid "\"{x}, {abs_x}\"" -msgstr "" +msgstr "\"{x}, {abs_x}\"" #: src/android/interoperability/with-c.md msgid "" -"We already saw this in the [Safe FFI Wrapper exercise](../../exercises/day-3/" -"safe-ffi-wrapper.md)." +"We already saw this in the [Safe FFI Wrapper " +"exercise](../../exercises/day-3/safe-ffi-wrapper.md)." msgstr "" +"Chúng ta đã thấy điều này trong [Bài tập về Safe FFI " +"Wrapper](../../exercises/day-3/safe-ffi-wrapper.md)." #: src/android/interoperability/with-c.md msgid "" "This assumes full knowledge of the target platform. Not recommended for " "production." msgstr "" +"Điều này giả định kiến ​​thức đầy đủ về nền tảng mục tiêu. Không được khuyến" +" khích cho môi trường production." #: src/android/interoperability/with-c.md msgid "We will look at better options next." -msgstr "" +msgstr "Chúng tôi sẽ xem xét các lựa chọn tốt hơn tiếp theo." #: src/android/interoperability/with-c/bindgen.md msgid "Using Bindgen" -msgstr "" +msgstr "Sử dụng 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." msgstr "" +"Công cụ [bindgen](https://rust-lang.github.io/rust-" +"bindgen/introduction.html) có thể tự động tạo các binding từ một tệp C " +"header." #: src/android/interoperability/with-c/bindgen.md msgid "First create a small C library:" -msgstr "" +msgstr "Đầu tiên tạo một thư viện C nhỏ:" #: src/android/interoperability/with-c/bindgen.md msgid "_interoperability/bindgen/libbirthday.h_:" -msgstr "" +msgstr "_interoperability/bindgen/libbirthday.h_:" #: src/android/interoperability/with-c/bindgen.md msgid "_interoperability/bindgen/libbirthday.c_:" -msgstr "" +msgstr "_interoperability/bindgen/libbirthday.c_:" #: src/android/interoperability/with-c/bindgen.md msgid "" -msgstr "" +msgstr "" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday.h\"" -msgstr "" +msgstr "\"libbirthday.h\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"+--------------\\n\"" -msgstr "" +msgstr "\"+--------------\\n\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"| Happy Birthday %s!\\n\"" -msgstr "" +msgstr "\"| Chúc mừng sinh nhật %s!\\n\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"| Congratulations with the %i years!\\n\"" -msgstr "" +msgstr "\"| Chúc mừng %i năm!\\n\"" #: src/android/interoperability/with-c/bindgen.md msgid "Add this to your `Android.bp` file:" -msgstr "" +msgstr "Thêm phần này vào tệp `Android.bp` của bạn:" #: src/android/interoperability/with-c/bindgen.md msgid "_interoperability/bindgen/Android.bp_:" -msgstr "" +msgstr "_interoperability/bindgen/Android.bp_:" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday\"" -msgstr "" +msgstr "\"libbirthday\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday.c\"" -msgstr "" +msgstr "\"libbirthday.c\"" #: src/android/interoperability/with-c/bindgen.md msgid "" "Create a wrapper header file for the library (not strictly needed in this " "example):" msgstr "" +"Tạo tệp tiêu đề trình bao bọc cho thư viện (không thực sự cần thiết trong ví" +" dụ này):" #: src/android/interoperability/with-c/bindgen.md msgid "_interoperability/bindgen/libbirthday_wrapper.h_:" -msgstr "" +msgstr "_interoperability/bindgen/libbirthday_wrapper.h_:" #: src/android/interoperability/with-c/bindgen.md msgid "You can now auto-generate the bindings:" -msgstr "" +msgstr "Bây giờ bạn có thể tự động tạo các ràng buộc:" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday_bindgen\"" -msgstr "" +msgstr "\"libbirthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"birthday_bindgen\"" -msgstr "" +msgstr "\"birthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday_wrapper.h\"" -msgstr "" +msgstr "\"libbirthday_wrapper.h\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"bindings\"" -msgstr "" +msgstr "\"bindings\"" #: src/android/interoperability/with-c/bindgen.md msgid "Finally, we can use the bindings in our Rust program:" msgstr "" +"Cuối cùng, chúng ta có thể sử dụng các ràng buộc trong chương trình Rust của" +" mình:" #: src/android/interoperability/with-c/bindgen.md msgid "\"print_birthday_card\"" -msgstr "" +msgstr "\"print_birthday_card\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"main.rs\"" -msgstr "" +msgstr "\"main.rs\"" #: src/android/interoperability/with-c/bindgen.md msgid "_interoperability/bindgen/main.rs_:" -msgstr "" +msgstr "_interoperability/bindgen/main.rs_:" #: src/android/interoperability/with-c/bindgen.md msgid "//! Bindgen demo.\n" -msgstr "" +msgstr "//! Bản trình diễn Bindgen.\n" #: src/android/interoperability/with-c/bindgen.md msgid "" "// SAFETY: The pointer we pass is valid because it came from a Rust\n" -" // reference, and the `name` it contains refers to `name` above which " -"also\n" -" // remains valid. `print_card` doesn't store either pointer to use " -"later\n" +" // reference, and the `name` it contains refers to `name` above which also\n" +" // remains valid. `print_card` doesn't store either pointer to use later\n" " // after it returns.\n" msgstr "" +"// AN TOÀN: Con trỏ chúng ta truyền vào là hợp lệ vì nó đến từ Rust\n" +" // tham chiếu, và `name` nó chứa tham chiếu đến `name` ở trên\n" +" // vẫn hợp lệ. `print_card` không lưu trữ con trỏ nào để sử dụng sau\n" +" // sau khi nó trả về.\n" #: src/android/interoperability/with-c/bindgen.md msgid "" "```shell\n" "m print_birthday_card\n" -"adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card\" /data/local/" -"tmp\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card\" /data/local/tmp\n" "adb shell /data/local/tmp/print_birthday_card\n" "```" msgstr "" +"```shell\n" +"m print_birthday_card\n" +"adb push \"$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card\" /data/local/tmp\n" +"adb shell /data/local/tmp/print_birthday_card\n" +"```" #: src/android/interoperability/with-c/bindgen.md msgid "Finally, we can run auto-generated tests to ensure the bindings work:" msgstr "" +"Cuối cùng, chúng ta có thể chạy các thử nghiệm được tạo tự động để đảm bảo " +"các binding hoạt động:" #: src/android/interoperability/with-c/bindgen.md msgid "\"libbirthday_bindgen_test\"" -msgstr "" +msgstr "\"libbirthday_bindgen_test\"" #: src/android/interoperability/with-c/bindgen.md msgid "\":libbirthday_bindgen\"" -msgstr "" +msgstr "\":libbirthday_bindgen\"" #: src/android/interoperability/with-c/bindgen.md msgid "\"none\"" -msgstr "" +msgstr "\"none\"" #: src/android/interoperability/with-c/bindgen.md msgid "// Generated file, skip linting\n" -msgstr "" +msgstr "// Tệp được tạo, bỏ qua linting\n" #: src/android/interoperability/with-c/rust.md msgid "Calling Rust" -msgstr "" +msgstr "Gọi Rust" #: src/android/interoperability/with-c/rust.md msgid "Exporting Rust functions and types to C is easy:" -msgstr "" +msgstr "Việc xuất các hàm và kiểu Rust sang C thật dễ dàng:" #: src/android/interoperability/with-c/rust.md msgid "_interoperability/rust/libanalyze/analyze.rs_" -msgstr "" +msgstr "_interoperability/rust/libanalyze/analyze.rs_" #: src/android/interoperability/with-c/rust.md msgid "//! Rust FFI demo.\n" -msgstr "" +msgstr "//! Bản demo Rust FFI.\n" #: src/android/interoperability/with-c/rust.md msgid "/// Analyze the numbers.\n" -msgstr "" +msgstr "/// Phân tích các con số.\n" #: src/android/interoperability/with-c/rust.md msgid "\"x ({x}) is smallest!\"" -msgstr "" +msgstr "\"x ({x}) là nhỏ nhất!\"" #: src/android/interoperability/with-c/rust.md msgid "\"y ({y}) is probably larger than x ({x})\"" -msgstr "" +msgstr "\"y ({y}) có thể lớn hơn x ({x})\"" #: src/android/interoperability/with-c/rust.md msgid "_interoperability/rust/libanalyze/analyze.h_" -msgstr "" +msgstr "_interoperability/rust/libanalyze/analyze.h_" #: src/android/interoperability/with-c/rust.md msgid "_interoperability/rust/libanalyze/Android.bp_" -msgstr "" +msgstr "_interoperability/rust/libanalyze/Android.bp_" #: src/android/interoperability/with-c/rust.md msgid "\"libanalyze_ffi\"" -msgstr "" +msgstr "\"libanalyze_ffi\"" #: src/android/interoperability/with-c/rust.md msgid "\"analyze_ffi\"" -msgstr "" +msgstr "\"analyze_ffi\"" #: src/android/interoperability/with-c/rust.md msgid "\"analyze.rs\"" -msgstr "" +msgstr "\"analyze.rs\"" #: src/android/interoperability/with-c/rust.md msgid "We can now call this from a C binary:" -msgstr "" +msgstr "Bây giờ chúng ta có thể gọi điều này từ nhị phân C:" #: src/android/interoperability/with-c/rust.md msgid "_interoperability/rust/analyze/main.c_" -msgstr "" +msgstr "_interoperability/rust/analyze/main.c_" #: src/android/interoperability/with-c/rust.md msgid "\"analyze.h\"" -msgstr "" +msgstr "\"phân tích.h\"" #: src/android/interoperability/with-c/rust.md msgid "_interoperability/rust/analyze/Android.bp_" -msgstr "" +msgstr "_interoperability/rust/analyze/Android.bp_" #: src/android/interoperability/with-c/rust.md msgid "\"analyze_numbers\"" -msgstr "" +msgstr "\"analyze_numbers\"" #: src/android/interoperability/with-c/rust.md msgid "\"main.c\"" -msgstr "" +msgstr "\"main.c\"" #: src/android/interoperability/with-c/rust.md 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 shell /data/local/tmp/analyze_numbers\n" "```" -msgstr "" #: src/android/interoperability/with-c/rust.md msgid "" @@ -12344,16 +14068,21 @@ msgid "" "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]` vô hiệu hóa tính năng xáo trộn tên thông thường của Rust, vì " +"vậy biểu tượng được xuất sẽ chỉ là tên của hàm. Bạn cũng có thể sử dụng " +"`#[export_name = \"some_name\"]` để chỉ định bất kỳ tên nào bạn muốn." #: src/android/interoperability/cpp.md msgid "" "The [CXX crate](https://cxx.rs/) makes it possible to do safe " "interoperability between Rust and C++." msgstr "" +"[CXX crate](https://cxx.rs/) giúp có thể thực hiện khả năng tương tác an " +"toàn giữa Rust và C++." #: src/android/interoperability/cpp.md msgid "The overall approach looks like this:" -msgstr "" +msgstr "Cách tiếp cận tổng thể trông như thế này:" #: src/android/interoperability/cpp/bridge.md msgid "" @@ -12361,19 +14090,22 @@ 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 dựa vào mô tả về chữ ký hàm sẽ được hiển thị từ ngôn ngữ này sang ngôn " +"ngữ khác. Bạn cung cấp mô tả này bằng cách sử dụng các khối bên ngoài trong " +"mô-đun Rust được chú thích bằng macro thuộc tính `#[cxx::bridge]`." #: src/android/interoperability/cpp/bridge.md msgid "\"org::blobstore\"" -msgstr "" +msgstr "\"org::blobstore\"" #: src/android/interoperability/cpp/bridge.md msgid "// Shared structs with fields visible to both languages.\n" -msgstr "" +msgstr "// Cấu trúc được chia sẻ với các trường hiển thị cho cả hai ngôn ngữ.\n" #: src/android/interoperability/cpp/bridge.md #: src/android/interoperability/cpp/generated-cpp.md msgid "// Rust types and signatures exposed to C++.\n" -msgstr "" +msgstr "// Các loại Rust và chữ ký tiếp xúc với C++.\n" #: src/android/interoperability/cpp/bridge.md #: src/android/interoperability/cpp/rust-bridge.md @@ -12383,28 +14115,28 @@ msgstr "" #: src/chromium/interoperability-with-cpp/error-handling-qr.md #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "\"Rust\"" -msgstr "" +msgstr "\"Rust\"" #: src/android/interoperability/cpp/bridge.md #: src/android/interoperability/cpp/cpp-bridge.md msgid "// C++ types and signatures exposed to Rust.\n" -msgstr "" +msgstr "// Các kiểu và chữ ký C++ được tiếp xúc với Rust.\n" #: src/android/interoperability/cpp/bridge.md #: src/android/interoperability/cpp/cpp-bridge.md #: src/android/interoperability/cpp/cpp-exception.md #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "\"C++\"" -msgstr "" +msgstr "\"C++\"" #: src/android/interoperability/cpp/bridge.md #: src/android/interoperability/cpp/cpp-bridge.md msgid "\"include/blobstore.h\"" -msgstr "" +msgstr "\"include/blobstore.h\"" #: src/android/interoperability/cpp/bridge.md msgid "The bridge is generally declared in an `ffi` module within your crate." -msgstr "" +msgstr "Bridge thường được khai báo trong mô-đun `ffi` trong crate của bạn." #: src/android/interoperability/cpp/bridge.md msgid "" @@ -12412,68 +14144,79 @@ msgid "" "Rust and C++ type/function definitions in order to expose those items to " "both languages." msgstr "" +"Từ các khai báo được thực hiện trong bridge module, CXX sẽ tạo ra các định " +"nghĩa kiểu/hàm Rust và C++ phù hợp để expose các mục đó cho cả hai ngôn ngữ." #: 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 "" +"Để xem mã Rust đã tạo, hãy sử dụng [cargo-" +"expand](https://github.com/dtolnay/cargo-expand) để xem macro proc mở rộng. " +"Đối với hầu hết các ví dụ, bạn sẽ sử dụng `cargo expand ::ffi` để chỉ mở " +"rộng mô-đun `ffi` (mặc dù điều này không áp dụng cho các dự án Android)." #: src/android/interoperability/cpp/bridge.md msgid "To view the generated C++ code, look in `target/cxxbridge`." -msgstr "" +msgstr "Để xem mã C++ đã tạo, hãy tìm trong `target/cxxbridge`." #: src/android/interoperability/cpp/rust-bridge.md msgid "Rust Bridge Declarations" -msgstr "" +msgstr "Khai báo Rust Bridge" #: src/android/interoperability/cpp/rust-bridge.md msgid "// Opaque type\n" -msgstr "" +msgstr "// Kiểu mờ\n" #: src/android/interoperability/cpp/rust-bridge.md msgid "// Method on `MyType`\n" -msgstr "" +msgstr "// Phương thức trên `MyType`\n" #: src/android/interoperability/cpp/rust-bridge.md msgid "// Free function\n" -msgstr "" +msgstr "// Hàm miễn phí\n" #: src/android/interoperability/cpp/rust-bridge.md msgid "" -"Items declared in the `extern \"Rust\"` reference items that are in scope in " -"the parent module." +"Items declared in the `extern \"Rust\"` reference items that are in scope in" +" the parent module." msgstr "" +"Các mục được khai báo trong các mục tham chiếu `bên ngoài \"Rust\"` nằm " +"trong phạm vi của mô-đun chính." #: 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, " +"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 "" +"Trình tạo mã CXX sử dụng (các) phần `bên ngoài \"Rust\"` của bạn để tạo ra " +"tệp tiêu đề C++ chứa các khai báo C++ tương ứng. Tiêu đề được tạo có cùng " +"đường dẫn với tệp nguồn Rust chứa cầu nối, ngoại trừ phần mở rộng tệp .rs.h." #: src/android/interoperability/cpp/generated-cpp.md msgid "Results in (roughly) the following C++:" -msgstr "" +msgstr "Kết quả trong (khoảng) C++ sau:" #: src/android/interoperability/cpp/cpp-bridge.md msgid "C++ Bridge Declarations" -msgstr "" +msgstr "Khai báo cầu C++" #: src/android/interoperability/cpp/cpp-bridge.md msgid "Results in (roughly) the following Rust:" -msgstr "" +msgstr "Kết quả trong (khoảng) Rust sau:" #: src/android/interoperability/cpp/cpp-bridge.md msgid "\"org$blobstore$cxxbridge1$new_blobstore_client\"" -msgstr "" +msgstr "\"org$blobstore$cxxbridge1$new_blobstore_client\"" #: src/android/interoperability/cpp/cpp-bridge.md msgid "\"org$blobstore$cxxbridge1$BlobstoreClient$put\"" -msgstr "" +msgstr "\"org$blobstore$cxxbridge1$BlobstoreClient$put\"" #: src/android/interoperability/cpp/cpp-bridge.md msgid "" @@ -12481,20 +14224,25 @@ msgid "" "in are accurate. CXX performs static assertions that the signatures exactly " "correspond with what is declared in C++." msgstr "" +"Lập trình viên không cần phải hứa rằng chữ ký họ gõ vào là chính xác. CXX " +"thực hiện các xác nhận tĩnh rằng các chữ ký tương ứng chính xác với những gì" +" được khai báo trong 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." msgstr "" +"Các khối `unsafe extern` cho phép bạn khai báo các hàm C++ an toàn để gọi từ" +" Rust." #: src/android/interoperability/cpp/shared-types.md msgid "// A=1, J=11, Q=12, K=13\n" -msgstr "" +msgstr "// A=1, J=11, Q=12, K=13\n" #: src/android/interoperability/cpp/shared-types.md msgid "Only C-like (unit) enums are supported." -msgstr "" +msgstr "Chỉ hỗ trợ các enum (đơn vị) giống C." #: src/android/interoperability/cpp/shared-types.md msgid "" @@ -12503,14 +14251,17 @@ msgid "" "derive `Hash` also generates an implementation of `std::hash` for the " "corresponding C++ type." msgstr "" +"Một số đặc điểm hạn chế được hỗ trợ cho `#[derive()]` trên các loại chia sẻ." +" Chức năng tương ứng cũng được tạo cho mã C++, ví dụ: nếu bạn lấy được " +"`Hash` thì cũng tạo ra một triển khai `std::hash` cho loại C++ tương ứng." #: src/android/interoperability/cpp/shared-enums.md msgid "Generated Rust:" -msgstr "" +msgstr "Tạo ra Rust:" #: src/android/interoperability/cpp/shared-enums.md msgid "Generated C++:" -msgstr "" +msgstr "Đã tạo C++:" #: src/android/interoperability/cpp/shared-enums.md msgid "" @@ -12519,20 +14270,24 @@ msgid "" "class to hold a value different from all of the listed variants, and our " "Rust representation needs to have the same behavior." msgstr "" +"Về phía Rust, mã được tạo cho các enum chia sẻ thực chất là một cấu trúc bao" +" bọc một giá trị số. Điều này là do nó không phải là UB trong C++ để một lớp" +" enum giữ một giá trị khác với tất cả các biến thể được liệt kê và cách biểu" +" diễn Rust của chúng ta cần phải có hành vi tương tự." #: src/android/interoperability/cpp/rust-result.md msgid "\"fallible1 requires depth > 0\"" -msgstr "" +msgstr "\"fallible1 yêu cầu độ sâu > 0\"" #: src/android/interoperability/cpp/rust-result.md msgid "\"Success!\"" -msgstr "" +msgstr "\"Thành công!\"" #: src/android/interoperability/cpp/rust-result.md msgid "" "Rust functions that return `Result` are translated to exceptions on the C++ " "side." -msgstr "" +msgstr "Các hàm Rust trả về `Result` được dịch sang các ngoại lệ ở phía C++." #: src/android/interoperability/cpp/rust-result.md msgid "" @@ -12540,348 +14295,404 @@ msgid "" "exposes a way to get the error message string. The error message will come " "from the error type's `Display` impl." msgstr "" +"Ngoại lệ được ném sẽ luôn thuộc loại `rust::Error`, chủ yếu đưa ra cách lấy " +"chuỗi thông báo lỗi. Thông báo lỗi sẽ đến từ ngụ ý `Display` của loại lỗi." #: src/android/interoperability/cpp/rust-result.md msgid "" "A panic unwinding from Rust to C++ will always cause the process to " "immediately terminate." msgstr "" +"Việc hoảng loạn khi chuyển từ Rust sang C++ sẽ luôn khiến quá trình kết thúc" +" instant." #: src/android/interoperability/cpp/cpp-exception.md msgid "\"example/include/example.h\"" -msgstr "" +msgstr "\"example/include/example.h\"" #: src/android/interoperability/cpp/cpp-exception.md msgid "\"Error: {}\"" -msgstr "" +msgstr "\"Lỗi: {}\"" #: 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." +"on the C++ side and return it as an `Err` value to the calling Rust " +"function." msgstr "" +"Các hàm C++ được khai báo để trả về một `Result` sẽ bắt bất kỳ ngoại lệ nào " +"được ném ra ở phía C++ và trả về nó dưới dạng giá trị `Err` cho hàm Rust " +"đang gọi." #: 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." +"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 "" +"Nếu một ngoại lệ được ném ra từ một hàm \"C++\" bên ngoài mà không được cầu " +"CXX khai báo để trả về `Kết quả`, thì chương trình sẽ gọi `std::terminate` " +"của C++. Hành vi này tương đương với cùng một ngoại lệ được đưa ra thông qua" +" hàm `noException` C++." #: src/android/interoperability/cpp/type-mapping.md msgid "C++ Type" -msgstr "" +msgstr "Loại C++" #: src/android/interoperability/cpp/type-mapping.md msgid "`rust::String`" -msgstr "" +msgstr "`rust::String`" #: src/android/interoperability/cpp/type-mapping.md msgid "`&str`" -msgstr "" +msgstr "`&str`" #: src/android/interoperability/cpp/type-mapping.md msgid "`rust::Str`" -msgstr "" +msgstr "`rust::Str`" #: src/android/interoperability/cpp/type-mapping.md msgid "`CxxString`" -msgstr "" +msgstr "`CxxString`" #: src/android/interoperability/cpp/type-mapping.md msgid "`std::string`" -msgstr "" +msgstr "`std::string`" #: src/android/interoperability/cpp/type-mapping.md msgid "`&[T]`/`&mut [T]`" -msgstr "" +msgstr "`&[T]`/`&mut [T]`" #: src/android/interoperability/cpp/type-mapping.md msgid "`rust::Slice`" -msgstr "" +msgstr "`rust::Slice`" #: src/android/interoperability/cpp/type-mapping.md msgid "`rust::Box`" -msgstr "" +msgstr "`rust::Box`" #: src/android/interoperability/cpp/type-mapping.md msgid "`UniquePtr`" -msgstr "" +msgstr "`UniquePtr`" #: src/android/interoperability/cpp/type-mapping.md msgid "`std::unique_ptr`" -msgstr "" +msgstr "`std::unique_ptr`" #: src/android/interoperability/cpp/type-mapping.md msgid "`rust::Vec`" -msgstr "" +msgstr "`rust::Vec`" #: src/android/interoperability/cpp/type-mapping.md msgid "`CxxVector`" -msgstr "" +msgstr "`CxxVector`" #: src/android/interoperability/cpp/type-mapping.md msgid "`std::vector`" -msgstr "" +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." msgstr "" +"Những kiểu này có thể được sử dụng trong các trường của cấu trúc được chia " +"sẻ cũng như các đối số và trả về của các hàm bên ngoài." #: 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 "" +"Lưu ý rằng `String` của Rust không ánh xạ trực tiếp tới `std::string`. Có " +"một vài lý do cho việc này:" #: src/android/interoperability/cpp/type-mapping.md msgid "" "`std::string` does not uphold the UTF-8 invariant that `String` requires." -msgstr "" +msgstr "`std::string` không duy trì bất biến UTF-8 mà `String` yêu cầu." #: 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." msgstr "" +"Hai loại này có bố cục khác nhau trong bộ nhớ và do đó không thể truyền trực" +" tiếp giữa các ngôn ngữ." #: src/android/interoperability/cpp/type-mapping.md 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` yêu cầu các move constructor không khớp với move semantics của" +" Rust, do đó, `std::string` không thể được truyền theo giá trị (pass by " +"value) cho Rust." #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-cpp-genrules.md #: src/android/interoperability/cpp/android-build-rust.md msgid "Building in Android" -msgstr "" +msgstr "Xây dựng trong Android" #: src/android/interoperability/cpp/android-build-cpp.md msgid "" "Create a `cc_library_static` to build the C++ library, including the CXX " "generated header and source file." msgstr "" +"Tạo một `cc_library_static` để xây dựng thư viện C++, bao gồm tệp nguồn và " +"tiêu đề được tạo bởi CXX." #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-build-rust.md msgid "\"libcxx_test_cpp\"" -msgstr "" +msgstr "\"libcxx_test_cpp\"" #: src/android/interoperability/cpp/android-build-cpp.md msgid "\"cxx_test.cpp\"" -msgstr "" +msgstr "\"cxx_test.cpp\"" #: src/android/interoperability/cpp/android-build-cpp.md msgid "\"cxx-bridge-header\"" -msgstr "" +msgstr "\"cxx-bridge-header\"" #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"libcxx_test_bridge_header\"" -msgstr "" +msgstr "\"libcxx_test_bridge_header\"" #: src/android/interoperability/cpp/android-build-cpp.md #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"libcxx_test_bridge_code\"" -msgstr "" +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 " +"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." msgstr "" +"Chỉ ra rằng `libcxx_test_bridge_header` và `libcxx_test_bridge_code` là các " +"phần phụ thuộc cho các C++ binding do CXX tạo ra. Chúng tôi sẽ trình bày " +"cách thiết lập những thứ này trên trang trình bày tiếp theo." #: 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." msgstr "" +"Lưu ý rằng bạn cũng cần phải phụ thuộc vào thư viện `cxx-bridge-header` để " +"lấy các định nghĩa CXX phổ biến." #: 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 "" +"Bạn có thể tìm thấy tài liệu đầy đủ về cách sử dụng CXX trong Android trong " +"[tài liệu " +"Android](https://source.android.com/docs/setup/build/rust/building-rust-" +"modules/android-rust-patterns#rust-cpp-interop-USE-cxx). Bạn có thể muốn " +"chia sẻ liên kết đó với cả lớp để học sinh biết họ có thể tìm lại những " +"hướng dẫn này ở đâu trong tương lai." #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "" -"Create two genrules: One to generate the CXX header, and one to generate the " -"CXX source file. These are then used as inputs to the `cc_library_static`." +"Create two genrules: One to generate the CXX header, and one to generate the" +" CXX source file. These are then used as inputs to the `cc_library_static`." msgstr "" +"Tạo hai genrule: Một để tạo CXX header và một để tạo tệp nguồn CXX. Sau đó, " +"chúng được sử dụng làm đầu vào cho `cc_library_static`." #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "" "// Generate a C++ header containing the C++ bindings\n" "// to the Rust exported functions in lib.rs.\n" msgstr "" +"// Tạo header C++ chứa các C++ binding\n" +"// tới các exported function của Rust trong lib.rs.\n" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"cxxbridge\"" -msgstr "" +msgstr "\"cxxbridge\"" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"$(location cxxbridge) $(in) --header > $(out)\"" -msgstr "" +msgstr "\"$(location cxxbridge) $(in) --header > $(out)\"" #: src/android/interoperability/cpp/android-cpp-genrules.md #: src/android/interoperability/cpp/android-build-rust.md msgid "\"lib.rs\"" -msgstr "" +msgstr "\"lib.rs\"" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"lib.rs.h\"" -msgstr "" +msgstr "\"lib.rs.h\"" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "// Generate the C++ code that Rust calls into.\n" -msgstr "" +msgstr "// Tạo mã C++ mà Rust gọi vào.\n" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"$(location cxxbridge) $(in) > $(out)\"" -msgstr "" +msgstr "\"$(location cxxbridge) $(in) > $(out)\"" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "\"lib.rs.cc\"" -msgstr "" +msgstr "\"lib.rs.cc\"" #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "" -"The `cxxbridge` tool is a standalone tool that generates the C++ side of the " -"bridge module. It is included in Android and available as a Soong tool." +"The `cxxbridge` tool is a standalone tool that generates the C++ side of the" +" bridge module. It is included in Android and available as a Soong tool." msgstr "" +"Công cụ `cxxbridge` là một công cụ độc lập tạo ra phía C++ của mô-đun cầu " +"nối. Nó được bao gồm trong Android và có sẵn dưới dạng công cụ Soong." #: src/android/interoperability/cpp/android-cpp-genrules.md msgid "" -"By convention, if your Rust source file is `lib.rs` your header file will be " -"named `lib.rs.h` and your source file will be named `lib.rs.cc`. This naming " -"convention isn't enforced, though." +"By convention, if your Rust source file is `lib.rs` your header file will be" +" named `lib.rs.h` and your source file will be named `lib.rs.cc`. This " +"naming convention isn't enforced, though." msgstr "" +"Theo quy ước, nếu tệp nguồn Rust của bạn là `lib.rs` thì tệp tiêu đề của bạn" +" sẽ được đặt tên là `lib.rs.h` và tệp nguồn của bạn sẽ được đặt tên là " +"`lib.rs.cc`. Tuy nhiên, quy ước đặt tên này không được thực thi." #: src/android/interoperability/cpp/android-build-rust.md msgid "" -"Create a `rust_binary` that depends on `libcxx` and your `cc_library_static`." +"Create a `rust_binary` that depends on `libcxx` and your " +"`cc_library_static`." msgstr "" +"Tạo một `rust_binary` phụ thuộc vào `libcxx` và `cc_library_static` của bạn." #: src/android/interoperability/cpp/android-build-rust.md msgid "\"cxx_test\"" -msgstr "" +msgstr "\"cxx_test\"" #: src/android/interoperability/cpp/android-build-rust.md msgid "\"libcxx\"" -msgstr "" +msgstr "\"libcxx\"" #: src/android/interoperability/java.md msgid "Interoperability with Java" -msgstr "" +msgstr "Khả năng tương tác với Java" #: src/android/interoperability/java.md msgid "" -"Java can load shared objects via [Java Native Interface (JNI)](https://en." -"wikipedia.org/wiki/Java_Native_Interface). The [`jni` crate](https://docs.rs/" -"jni/) allows you to create a compatible library." +"Java can load shared objects via [Java Native Interface " +"(JNI)](https://en.wikipedia.org/wiki/Java_Native_Interface). The [`jni` " +"crate](https://docs.rs/jni/) allows you to create a compatible library." msgstr "" +"Java có thể tải các shared object thông qua [Java Native Interface " +"(JNI)](https://en.wikipedia.org/wiki/Java_Native_Interface). Crate [`jni` " +"](https://docs.rs/jni/) cho phép bạn tạo một thư viện tương thích." #: src/android/interoperability/java.md msgid "First, we create a Rust function to export to Java:" -msgstr "" +msgstr "Đầu tiên, chúng ta tạo một hàm Rust để xuất sang Java:" #: src/android/interoperability/java.md msgid "_interoperability/java/src/lib.rs_:" -msgstr "" +msgstr "_interoperability/java/src/lib.rs_:" #: src/android/interoperability/java.md msgid "//! Rust <-> Java FFI demo.\n" -msgstr "" +msgstr "//! Rust <-> Bản trình diễn Java FFI.\n" #: src/android/interoperability/java.md msgid "/// HelloWorld::hello method implementation.\n" -msgstr "" +msgstr "/// HelloWorld::hello thực hiện phương thức này.\n" #: src/android/interoperability/java.md msgid "\"system\"" -msgstr "" +msgstr "\"system\"" #: src/android/interoperability/java.md msgid "\"Hello, {input}!\"" -msgstr "" +msgstr "\"Hello, {input}!\"" #: src/android/interoperability/java.md msgid "_interoperability/java/Android.bp_:" -msgstr "" +msgstr "_interoperability/java/Android.bp_:" #: src/android/interoperability/java.md msgid "\"libhello_jni\"" -msgstr "" +msgstr "\"libhello_jni\"" #: src/android/interoperability/java.md msgid "\"hello_jni\"" -msgstr "" +msgstr "\"hello_jni\"" #: src/android/interoperability/java.md msgid "\"libjni\"" -msgstr "" +msgstr "\"libjni\"" #: src/android/interoperability/java.md msgid "We then call this function from Java:" -msgstr "" +msgstr "Sau đó chúng tôi gọi hàm này từ Java:" #: src/android/interoperability/java.md msgid "_interoperability/java/HelloWorld.java_:" -msgstr "" +msgstr "_interoperability/java/HelloWorld.java_:" #: src/android/interoperability/java.md msgid "\"helloworld_jni\"" -msgstr "" +msgstr "\"helloworld_jni\"" #: src/android/interoperability/java.md msgid "\"HelloWorld.java\"" -msgstr "" +msgstr "\"HelloWorld.java\"" #: src/android/interoperability/java.md msgid "\"HelloWorld\"" -msgstr "" +msgstr "\"HelloWorld\"" #: src/android/interoperability/java.md msgid "Finally, you can build, sync, and run the binary:" -msgstr "" +msgstr "Cuối cùng, bạn có thể xây dựng, đồng bộ hóa và chạy tệp nhị phân:" #: 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:" msgstr "" +"Đây là bài tập nhóm: Chúng ta sẽ xem xét một trong những dự án mà bạn làm " +"việc cùng và cố gắng tích hợp một số Rust vào đó. Một số gợi ý:" #: src/exercises/android/morning.md msgid "Call your AIDL service with a client written in Rust." -msgstr "" +msgstr "Gọi dịch vụ AIDL của bạn với ứng dụng khách được viết bằng Rust." #: src/exercises/android/morning.md msgid "Move a function from your project to Rust and call it." -msgstr "" +msgstr "Di chuyển một chức năng từ dự án của bạn sang Rust và gọi nó." #: 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." +"in the class having a piece of code which you can turn in to Rust on the " +"fly." msgstr "" +"Không có giải pháp nào được cung cấp ở đây vì đây là giải pháp mở: nó phụ " +"thuộc vào việc ai đó trong lớp có một đoạn mã mà bạn có thể chuyển sang Rust" +" một cách nhanh chóng." #: src/chromium.md msgid "Welcome to Rust in Chromium" -msgstr "" +msgstr "Chào mừng bạn đến với Rust trong Chromium" #: 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." msgstr "" +"Rust được hỗ trợ cho các thư viện của bên thứ ba trong Chromium, với glue " +"code của bên thứ nhất để kết nối giữa Rust và code C++ Chromium hiện có." #: src/chromium.md msgid "" @@ -12890,6 +14701,10 @@ msgid "" "feel free to follow this recipe in your part of the codebase instead of the " "exact part we talk about." msgstr "" +"Hôm nay, chúng ta sẽ gọi Rust để làm một vài ví dụ đơn giản với chuỗi " +"(string). Nếu bạn có một phần code nơi bạn đang hiển thị chuỗi UTF8 cho " +"người dùng, vui lòng làm theo hướng dẫn này trong phần codebase của bạn thay" +" vì phần chính xác mà chúng ta đang nói đến." #: src/chromium/setup.md msgid "" @@ -12897,12 +14712,17 @@ msgid "" "flags is OK, so long as your code is relatively recent (commit position " "1223636 onwards, corresponding to November 2023):" msgstr "" +"Đảm bảo bạn có thể build và chạy Chromium. Bất kỳ nền tảng và bộ build flag " +"nào cũng được, miễn là code của bạn tương đối gần đây (commit position " +"1223636 trở đi, tương ứng với tháng 11 năm 2023):" #: src/chromium/setup.md msgid "" "(A component, debug build is recommended for quickest iteration time. This " "is the default!)" msgstr "" +"(Khuyến khích sử dụng component build và debug build để có thời gian " +"iteration nhanh nhất. Đây là cấu hình mặc định!)" #: src/chromium/setup.md msgid "" @@ -12910,138 +14730,192 @@ msgid "" "the-code/) if you aren't already at that point. Be warned: setting up to " "build Chromium takes time." msgstr "" +"Hãy xem [Cách xây dựng Chrome](https://www.chromium.org/developers/how-" +"tos/get-the-code/) nếu bạn chưa làm được điều đó. Được cảnh báo: việc thiết " +"lập để xây dựng Chromium cần có thời gian." #: src/chromium/setup.md msgid "It's also recommended that you have Visual Studio code installed." -msgstr "" +msgstr "Bạn cũng nên cài đặt Visual Studio Code." #: src/chromium/setup.md msgid "About the exercises" -msgstr "" +msgstr "Về bài tập" #: 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." +"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." msgstr "" +"Phần này của khóa học có một loạt các bài tập được xây dựng dựa trên nhau. " +"Chúng tôi sẽ thực hiện chúng rải rác trong suốt khóa học thay vì chỉ vào " +"cuối khóa học. Nếu bạn không có thời gian để hoàn thành một phần nào đó, " +"đừng lo lắng: bạn có thể bắt kịp ở phần tiếp theo." #: src/chromium/cargo.md msgid "" -"The Rust community typically uses `cargo` and libraries from [crates.io]" -"(https://crates.io/). Chromium is built using `gn` and `ninja` and a curated " -"set of dependencies." +"The Rust community typically uses `cargo` and libraries from " +"[crates.io](https://crates.io/). Chromium is built using `gn` and `ninja` " +"and a curated set of dependencies." msgstr "" +"Cộng đồng Rust thường sử dụng `cargo` và các thư viện từ " +"[crates.io](https://crates.io/). Chrome được xây dựng bằng cách sử dụng `gn`" +" và `ninja` cùng một tập hợp các phần phụ thuộc được tuyển chọn." #: src/chromium/cargo.md msgid "When writing code in Rust, your choices are:" -msgstr "" +msgstr "Khi viết mã bằng Rust, các lựa chọn của bạn là:" #: 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 "" +"Sử dụng `gn` và `ninja` với sự trợ giúp của các mẫu từ `//build/rust/*.gni` " +"(ví dụ: `rust_static_library` mà chúng ta sẽ gặp sau). Điều này sử dụng " +"toolchain và crate đã được kiểm tra của Chromium." #: 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)" +"crates](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust.md#Using-" +"cargo)" msgstr "" +"Hãy sử dụng `cargo` nhưng [hạn chế sử dụng toolchain và crate đã được kiểm " +"tra của " +"Chrome](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust.md#Using-" +"cargo)" #: src/chromium/cargo.md msgid "" "Use `cargo`, trusting a [toolchain](https://rustup.rs/) and/or [crates " "downloaded from the internet](https://crates.io/)" msgstr "" +"Sử dụng `cargo`, tin cậy vào [chuỗi công cụ](https://rustup.rs/) và/hoặc " +"[crate tải xuống từ internet](https://crates.io/)" #: src/chromium/cargo.md msgid "" -"From here on we'll be focusing on `gn` and `ninja`, because this is how Rust " -"code can be built into the Chromium browser. At the same time, Cargo is an " +"From here on we'll be focusing on `gn` and `ninja`, because this is how Rust" +" 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 "" +"Từ đây trở đi chúng ta sẽ tập trung vào `gn` và `ninja`, vì đây là cách mã " +"Rust có thể được tích hợp vào trình duyệt Chromium. Đồng thời, Cargo là một " +"phần quan trọng của hệ sinh thái Rust và bạn nên giữ nó trong hộp công cụ " +"của mình." #: src/chromium/cargo.md msgid "Mini exercise" -msgstr "" +msgstr "Bài tập nhỏ" #: src/chromium/cargo.md msgid "Split into small groups and:" -msgstr "" +msgstr "Chia thành các nhóm nhỏ và:" #: src/chromium/cargo.md msgid "" "Brainstorm scenarios where `cargo` may offer an advantage and assess the " "risk profile of these scenarios." msgstr "" +"Nghĩ ra các kịch bản trong đó `cargo` có thể mang lại lợi thế và đánh giá " +"mức độ rủi ro của các kịch bản này." #: src/chromium/cargo.md msgid "" -"Discuss which tools, libraries, and groups of people need to be trusted when " -"using `gn` and `ninja`, offline `cargo`, etc." +"Discuss which tools, libraries, and groups of people need to be trusted when" +" using `gn` and `ninja`, offline `cargo`, etc." msgstr "" +"Thảo luận về những công cụ, thư viện và nhóm người nào cần được tin cậy khi " +"sử dụng `gn` và `ninja`, `cargo` ngoại tuyến, v.v." #: 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 "" +"Yêu cầu học sinh tránh nhìn trộm ghi chú của diễn giả trước khi hoàn thành " +"bài tập. Giả sử mọi người tham gia khóa học đều ở cùng nhau, hãy yêu cầu họ " +"thảo luận theo nhóm nhỏ 3-4 người." #: src/chromium/cargo.md msgid "" "Notes/hints related to the first part of the exercise (\"scenarios where " "Cargo may offer an advantage\"):" msgstr "" +"Những lưu ý/gợi ý liên quan đến phần đầu tiên của bài tập (\"các tình huống " +"mà Cargo có thể mang lại lợi thế\"):" #: 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.)." +"(`clap` for command-line parsing, `serde` for serializing/deserializing " +"to/from various formats, `itertools` for working with iterators, etc.)." msgstr "" +"Thật tuyệt vời khi khi viết một công cụ hoặc tạo nguyên mẫu một phần của " +"Chromium, người ta có quyền truy cập vào hệ sinh thái phong phú của các thư " +"viện crates.io. Hầu hết mọi thứ đều có một crate và chúng thường khá dễ sử " +"dụng. (`clap` để phân tích cú pháp dòng lệnh, `serde` để tuần tự hóa/giải " +"tuần tự hóa sang/từ các định dạng khác nhau, `itertools` để làm việc với các" +" trình vòng lặp, v.v.)." #: 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` giúp bạn dễ dàng thử thư viện (chỉ cần thêm một dòng vào " +"`Cargo.toml` và bắt đầu viết mã)" #: src/chromium/cargo.md msgid "" "It may be worth comparing how CPAN helped make `perl` a popular choice. Or " "comparing with `python` + `pip`." msgstr "" +"Có thể đáng so sánh xem CPAN đã giúp làm cho `perl` trở thành một lựa chọn " +"phổ biến như thế nào. Hoặc so sánh với `python` + `pip`." #: src/chromium/cargo.md 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 " +"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)." msgstr "" +"Trải nghiệm phát triển được thực hiện thực sự tốt đẹp không chỉ nhờ các công" +" cụ cốt lõi của Rust (ví dụ: sử dụng `rustup` để chuyển sang phiên bản " +"`rustc` khác khi thử nghiệm một crate cần hoạt động nightly, ổn định hiện " +"tại và older stable) mà còn bởi hệ sinh thái gồm các công cụ của bên thứ ba " +"(ví dụ: Mozilla cung cấp `cargo vet` để hợp lý hóa và chia sẻ kiểm tra bảo " +"mật; crate `criterion` cung cấp một cách hợp lý để chạy các benchmark)." #: src/chromium/cargo.md msgid "" "`cargo` makes it easy to add a tool via `cargo install --locked cargo-vet`." msgstr "" +"`cargo` giúp bạn dễ dàng thêm một công cụ thông qua `cargo install --locked " +"Cargo-vet`." #: src/chromium/cargo.md msgid "It may be worth comparing with Chrome Extensions or VScode extensions." msgstr "" +"Có thể đáng so sánh với Tiện ích mở rộng của Chromium hoặc tiện ích mở rộng " +"VScode." #: src/chromium/cargo.md msgid "" "Broad, generic examples of projects where `cargo` may be the right choice:" msgstr "" +"Các ví dụ chung, khái quát về các dự án trong đó `cargo` có thể là lựa chọn " +"đúng đắn:" #: src/chromium/cargo.md msgid "" @@ -13051,34 +14925,47 @@ msgid "" "typesystem) and running faster (as a compiled, rather than interpreted " "language)." msgstr "" +"Có lẽ đáng ngạc nhiên là Rust ngày càng trở nên phổ biến trong ngành viết " +"các công cụ dòng lệnh. Độ rộng và tính tiện dụng của các thư viện có thể so " +"sánh với Python, đồng thời mạnh mẽ hơn (nhờ hệ thống type phong phú) và chạy" +" nhanh hơn (dưới dạng ngôn ngữ được biên dịch, thay vì ngôn ngữ thông dịch)." #: 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." +"used outside of Chromium (e.g. in Bazel or Android/Soong build environments)" +" should probably use Cargo." msgstr "" +"Việc tham gia vào hệ sinh thái Rust yêu cầu sử dụng các công cụ Rust tiêu " +"chuẩn như Cargo. Các thư viện muốn nhận được sự đóng góp từ bên ngoài và " +"muốn được sử dụng bên ngoài Chromium (ví dụ: trong môi trường build Bazel " +"hoặc Android/Soong) có thể nên sử dụng Cargo." #: src/chromium/cargo.md msgid "Examples of Chromium-related projects that are `cargo`\\-based:" -msgstr "" +msgstr "Ví dụ về các dự án liên quan đến Chromium dựa trên `cargo`\\:" #: src/chromium/cargo.md msgid "" "`serde_json_lenient` (experimented with in other parts of Google which " "resulted in PRs with performance improvements)" msgstr "" +"`serde_json_lenient` (đã được thử nghiệm trong các phần khác của Google và " +"mang lại kết quả PR cải thiện hiệu suất)" #: src/chromium/cargo.md msgid "Fontations libraries like `font-types`" -msgstr "" +msgstr "Thư viện phông chữ như `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." msgstr "" +"Công cụ `gnrt` (chúng ta sẽ gặp nó sau trong khóa học này) công cụ này phụ " +"thuộc vào `clap` để phân tích cú pháp dòng lệnh và `toml` cho các tệp cấu " +"hình." #: src/chromium/cargo.md msgid "" @@ -13086,76 +14973,105 @@ msgid "" "when building and bootstrapping Rust standard library when building Rust " "toolchain." msgstr "" +"Tuyên bố miễn trừ trách nhiệm: lý do duy nhất để sử dụng `cargo` là không có" +" sẵn `gn` khi xây dựng và khởi động thư viện chuẩn Rust khi xây dựng chuỗi " +"công cụ Rust." #: src/chromium/cargo.md msgid "" -"`run_gnrt.py` uses Chromium's copy of `cargo` and `rustc`. `gnrt` depends on " -"third-party libraries downloaded from the internet, but `run_gnrt.py` asks " +"`run_gnrt.py` uses Chromium's copy of `cargo` and `rustc`. `gnrt` depends on" +" 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` sử dụng copy của `cargo` và `rustc` của Chromium. `gnrt` phụ " +"thuộc vào thư viện của bên thứ ba được tải xuống từ internet, nhưng " +"`run_gnrt.py` yêu cầu `cargo` rằng chỉ nội dung `--locked` mới được phép " +"thông qua `Cargo.lock`.)" #: src/chromium/cargo.md msgid "" "Students may identify the following items as being implicitly or explicitly " "trusted:" msgstr "" +"Học sinh có thể xác định các mục sau đây được tin cậy một cách ngầm định " +"hoặc rõ ràng:" #: src/chromium/cargo.md msgid "" -"`rustc` (the Rust compiler) which in turn depends on the LLVM libraries, the " -"Clang compiler, the `rustc` sources (fetched from GitHub, reviewed by Rust " +"`rustc` (the Rust compiler) which in turn depends on the LLVM libraries, the" +" Clang compiler, the `rustc` sources (fetched from GitHub, reviewed by Rust " "compiler team), binary Rust compiler downloaded for bootstrapping" msgstr "" +"`rustc` (compiler Rust), do đó phụ thuộc vào thư viện LLVM, compiler " +"Clang, nguồn `rustc` (được tìm nạp từ GitHub, được nhóm biên dịch Rust xem " +"xét), compiler Rust nhị phân được tải xuống để khởi động" #: 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`)" +"umbrella of the https://github.com/rust-lang/ organization - same as " +"`rustc`)" msgstr "" +"`rustup` (có thể cần chỉ ra rằng `rustup` được phát triển dưới sự bảo trợ " +"của tổ chức https://github.com/rust-lang/ - giống như `rustc`)" #: src/chromium/cargo.md msgid "`cargo`, `rustfmt`, etc." -msgstr "" +msgstr "`cargo`, `rustfmt`, v.v." #: src/chromium/cargo.md msgid "" "Various internal infrastructure (bots that build `rustc`, system for " "distributing the prebuilt toolchain to Chromium engineers, etc.)" msgstr "" +"Cơ sở hạ tầng nội bộ khác nhau (các bot build `rustc`, hệ thống phân phối " +"toolchain dựng sẵn cho các kỹ sư Chromium, v.v.)" #: src/chromium/cargo.md msgid "Cargo tools like `cargo audit`, `cargo vet`, etc." -msgstr "" +msgstr "Các công cụ Cargo như `cargo audit`, `cargo vet`, v.v." #: src/chromium/cargo.md msgid "" "Rust libraries vendored into `//third_party/rust` (audited by " "security@chromium.org)" msgstr "" +"Thư viện Rust được vendor vào `//third_party/rust` (được kiểm tra bởi " +"security@chromium.org)" #: src/chromium/cargo.md -msgid "Other Rust libraries (some niche, some quite popular and commonly used)" +msgid "" +"Other Rust libraries (some niche, some quite popular and commonly used)" msgstr "" +"Các thư viện Rust khác (một số thích hợp, một số khá phổ biến và được sử " +"dụng phổ biến)" #: src/chromium/policy.md msgid "Chromium Rust policy" -msgstr "" +msgstr "Chính sách Rust của Chromium" #: 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)." +"approved by Chromium's [Area Tech " +"Leads](https://source.chromium.org/chromium/chromium/src/+/main:ATL_OWNERS)." msgstr "" +"Chromium chưa cho phép Rust của bên thứ nhất ngoại trừ một số trường hợp " +"hiếm hoi được [Area Tech Leads] của Chromium phê " +"duyệt(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 "" +"Chính sách của Chromium đối với thư viện bên thứ ba được nêu [tại " +"đây](https://chromium.googlesource.com/chromium/src/+/main/docs/adding_to_third_party.md#rust)" +" - Rust được phép sử dụng thư viện bên thứ ba trong nhiều trường hợp, bao " +"gồm cả việc liệu thư viện đó có phải là lựa chọn tốt nhất về hiệu suất hay " +"bảo mật hay không." #: src/chromium/policy.md msgid "" @@ -13163,59 +15079,71 @@ msgid "" "nearly all such libraries will require a small amount of first-party glue " "code." msgstr "" +"Rất ít thư viện Rust trực tiếp hiển thị API C/C++, vì vậy điều đó có nghĩa " +"là gần như tất cả các thư viện như vậy sẽ yêu cầu một lượng nhỏ glue code " +"của bên thứ nhất." #: src/chromium/policy.md msgid "" "```bob\n" "\"C++\" Rust\n" -".- - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - " -"-.\n" +".- - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - -.\n" ": : : :\n" -": Existing Chromium : : Chromium Rust Existing " -"Rust :\n" -": \"C++\" : : \"wrapper\" " -"crate :\n" -": +---------------+ : : +----------------+ +-------------" -"+ :\n" -": | | : : | | | " -"| :\n" -": | o-----+-+-----------+-+-> o-+----------+--> " -"| :\n" -": | | : Language : | | Crate | " -"| :\n" -": +---------------+ : boundary : +----------------+ API +-------------" -"+ :\n" +": Existing Chromium : : Chromium Rust Existing Rust :\n" +": \"C++\" : : \"wrapper\" crate :\n" +": +---------------+ : : +----------------+ +-------------+ :\n" +": | | : : | | | | :\n" +": | o-----+-+-----------+-+-> o-+----------+--> | :\n" +": | | : Language : | | Crate | | :\n" +": +---------------+ : boundary : +----------------+ API +-------------+ :\n" ": : : :\n" -"`- - - - - - - - - -' `- - - - - - - - - - - - - - - - - - - - - - " -"-'\n" +"`- - - - - - - - - -' `- - - - - - - - - - - - - - - - - - - - - - -'\n" "```" msgstr "" +"```bob\n" +"\"C++\" Rust\n" +".- - - - - - - - - -. .- - - - - - - - - - - - - - - - - - - - - - -.\n" +": : : :\n" +": Existing Chromium : : Chromium Rust Existing Rust :\n" +": \"C++\" : : \"wrapper\" crate :\n" +": +---------------+ : : +----------------+ +-------------+ :\n" +": | | : : | | | | :\n" +": | o-----+-+-----------+-+-> o-+----------+--> | :\n" +": | | : Language : | | Crate | | :\n" +": +---------------+ : boundary : +----------------+ API +-------------+ :\n" +": : : :\n" +"`- - - - - - - - - -' `- - - - - - - - - - - - - - - - - - - - - - -'\n" +"```" #: 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`." msgstr "" +"Glue code Rust của bên thứ nhất cho crate bên thứ ba cụ thể thường phải được" +" giữ trong `third_party/rust///wrapper`." #: src/chromium/policy.md msgid "Because of this, today's course will be heavily focused on:" -msgstr "" +msgstr "Vì vậy, khóa học hôm nay sẽ tập trung chủ yếu vào:" #: src/chromium/policy.md msgid "Bringing in third-party Rust libraries (\"crates\")" -msgstr "" +msgstr "Đưa vào thư viện Rust của bên thứ ba (\"crate\")" #: src/chromium/policy.md msgid "Writing glue code to be able to use those crates from Chromium C++." -msgstr "" +msgstr "Viết glue code để có thể sử dụng các crate đó từ Chromium C++." #: src/chromium/policy.md msgid "If this policy changes over time, the course will evolve to keep up." msgstr "" +"Nếu chính sách này thay đổi theo thời gian, khóa học sẽ phát triển để theo " +"kịp." #: src/chromium/build-rules.md msgid "Build rules" -msgstr "" +msgstr "Xây dựng quy tắc" #: src/chromium/build-rules.md msgid "" @@ -13223,15 +15151,20 @@ msgid "" "`ninja` for efficiency --- its static rules allow maximum parallelism. Rust " "is no exception." msgstr "" +"Mã Rust thường được build bằng cách sử dụng `cargo`. Chromium build bằng " +"`gn` và `ninja` để đạt hiệu quả --- các rule tĩnh của nó cho phép tính song " +"song tối đa. Rust cũng không ngoại lệ." #: src/chromium/build-rules.md msgid "Adding Rust code to Chromium" -msgstr "" +msgstr "Thêm mã Rust vào Chromium" #: src/chromium/build-rules.md msgid "" "In some existing Chromium `BUILD.gn` file, declare a `rust_static_library`:" msgstr "" +"Trong một số tệp `BUILD.gn` hiện có của Chromium, hãy khai báo " +"`rust_static_library`:" #: src/chromium/build-rules.md msgid "" @@ -13244,40 +15177,61 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"import(\"//build/rust/rust_static_library.gni\")\n" +"\n" +"rust_static_library(\"my_rust_lib\") {\n" +" crate_root = \"lib.rs\"\n" +" sources = [ \"lib.rs\" ]\n" +"}\n" +"```" #: 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." msgstr "" +"Bạn cũng có thể thêm `deps` vào các mục tiêu Rust khác. Sau này chúng tôi sẽ" +" sử dụng điều này để phụ thuộc vào mã của bên thứ ba." #: 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 " +"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 "" +"Bạn phải chỉ định _both_ gốc crate, _và_ danh sách đầy đủ các nguồn. " +"`crate_root` là tệp được cung cấp cho compiler Rust đại diện cho tệp gốc của" +" đơn vị biên dịch --- thường là `lib.rs`. `sources` là danh sách đầy đủ tất " +"cả các tệp nguồn mà `ninja` cần để xác định khi nào cần xây dựng lại." #: 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.)" msgstr "" +"(Không có thứ gọi là `source_set` của Rust, vì trong Rust, toàn bộ crate là " +"một đơn vị biên dịch. `static_library` là đơn vị nhỏ nhất.)" #: 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." +"[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 "" +"Học viên có thể thắc mắc tại sao chúng ta cần gn template thay vì sử dụng " +"[sự hỗ trợ tích hợp của gn cho các thư viện tĩnh " +"Rust](https://gn.googlesource.com/gn/+/main/docs/reference.md#func_static_library)." +" Câu trả lời là mẫu này cung cấp hỗ trợ cho CXX interop, các tính năng của " +"Rust và kiểm tra đơn vị, một số trong đó chúng tôi sẽ sử dụng sau." #: src/chromium/build-rules/unsafe.md msgid "Including `unsafe` Rust Code" -msgstr "" +msgstr "Bao gồm mã Rust `không an toàn`" #: src/chromium/build-rules/unsafe.md msgid "" @@ -13286,6 +15240,10 @@ msgid "" "the gn target. (Later in the course we'll see circumstances where this is " "necessary.)" msgstr "" +"Theo mặc định, mã Rust không an toàn bị cấm trong `rust_static_library` --- " +"nó sẽ không được biên dịch. Nếu bạn cần mã Rust không an toàn, hãy thêm " +"`allow_unsafe = true` vào mục tiêu gn. (Ở phần sau của khóa học, chúng ta sẽ" +" thấy những trường hợp cần thiết.)" #: src/chromium/build-rules/unsafe.md msgid "" @@ -13302,10 +15260,22 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"import(\"//build/rust/rust_static_library.gni\")\n" +"\n" +"rust_static_library(\"my_rust_lib\") {\n" +" crate_root = \"lib.rs\"\n" +" sources = [\n" +" \"lib.rs\",\n" +" \"hippopotamus.rs\"\n" +" ]\n" +" allow_unsafe = true\n" +"}\n" +"```" #: src/chromium/build-rules/depending.md msgid "Simply add the above target to the `deps` of some Chromium C++ target." -msgstr "" +msgstr "Chỉ cần thêm target trên vào `deps` của một số target Chromium C++." #: src/chromium/build-rules/depending.md msgid "" @@ -13323,75 +15293,112 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"nhập (\"//build/rust/rust_static_library.gni\")\n" +"\n" +"rust_static_library(\"my_rust_lib\") {\n" +" crate_root = \"lib.rs\"\n" +" sources = [ \"lib.rs\"]\n" +"}\n" +"\n" +"# hoặc source_set, static_library, v.v.\n" +"thành phần (\"trước_cpp\") {\n" +" deps = [ \":my_rust_lib\" ]\n" +"}\n" +"```" #: 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," msgstr "" +"Các loại được bỏ qua trong mã Rust, điều này làm cho một IDE tốt thậm chí " +"còn hữu ích hơn so với C++. Mã Visual Studio hoạt động tốt với Rust trong " +"Chromium. Để sử dụng nó," #: src/chromium/build-rules/vscode.md msgid "" "Ensure your VSCode has the `rust-analyzer` extension, not earlier forms of " "Rust support" msgstr "" +"Đảm bảo VSCode của bạn có tiện ích mở rộng `rust-analyzer`, không phải các " +"dạng hỗ trợ Rust trước đó" #: src/chromium/build-rules/vscode.md msgid "" "`gn gen out/Debug --export-rust-project` (or equivalent for your output " "directory)" msgstr "" +"`gn gen out/Debug --export-rust-project` (hoặc tương đương với thư mục đầu " +"ra của bạn)" #: src/chromium/build-rules/vscode.md msgid "`ln -s out/Debug/rust-project.json rust-project.json`" -msgstr "" +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." +"analyzer might be beneficial if the audience are naturally skeptical of " +"IDEs." msgstr "" +"Bản demo một số tính năng khám phá và chú thích mã của máy phân tích Rust có" +" thể hữu ích nếu khán giả nghi ngờ về IDE một cách tự nhiên." #: 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 "" +"Các bước sau đây có thể hữu ích với bản demo (nhưng thay vào đó, bạn có thể " +"sử dụng một phần Rust liên quan đến Chromium mà bạn quen thuộc nhất):" #: src/chromium/build-rules/vscode.md msgid "Open `components/qr_code_generator/qr_code_generator_ffi_glue.rs`" -msgstr "" +msgstr "Mở `thành phần/qr_code_generator/qr_code_generator_ffi_glue.rs`" #: src/chromium/build-rules/vscode.md msgid "" "Place the cursor over the `QrCode::new` call (around line 26) in " "\\`qr_code_generator_ffi_glue.rs" msgstr "" +"Đặt con trỏ lên lệnh gọi `QrCode::new` (khoảng dòng 26) trong " +"\\`qr_code_generator_ffi_glue.rs" #: src/chromium/build-rules/vscode.md msgid "" "Demo **show documentation** (typical bindings: vscode = ctrl k i; vim/CoC = " "K)." msgstr "" +"Demo **hiển thị tài liệu** (các ràng buộc điển hình: vscode = ctrl k i; " +"vim/CoC = K)." #: src/chromium/build-rules/vscode.md msgid "" "Demo **go to definition** (typical bindings: vscode = F12; vim/CoC = g d). " "(This will take you to `//third_party/rust/.../qr_code-.../src/lib.rs`.)" msgstr "" +"Bản trình diễn **đi tới định nghĩa** (các ràng buộc điển hình: vscode = F12;" +" vim/CoC = g d). (Thao tác này sẽ đưa bạn đến " +"`//third_party/rust/.../qr_code-.../src/lib.rs`.)" #: src/chromium/build-rules/vscode.md msgid "" -"Demo **outline** and navigate to the `QrCode::with_bits` method (around line " -"164; the outline is in the file explorer pane in vscode; typical vim/CoC " +"Demo **outline** and navigate to the `QrCode::with_bits` method (around line" +" 164; the outline is in the file explorer pane in vscode; typical vim/CoC " "bindings = space o)" msgstr "" +"Demo **outline** và điều hướng đến phương thức `QrCode::with_bits` (khoảng " +"dòng 164; đường viền nằm trong ngăn trình khám phá tệp trong vscode; các " +"ràng buộc vim/CoC điển hình = dấu cách o)" #: src/chromium/build-rules/vscode.md msgid "" "Demo **type annotations** (there are quote a few nice examples in the " "`QrCode::with_bits` method)" msgstr "" +"Demo **gõ chú thích** (có trích dẫn một vài ví dụ hay trong phương thức " +"`QrCode::with_bits`)" #: src/chromium/build-rules/vscode.md msgid "" @@ -13399,16 +15406,21 @@ msgid "" "need to be rerun after editing `BUILD.gn` files (which we will do a few " "times throughout the exercises in this session)." msgstr "" +"Có thể cần chỉ ra rằng `gn gen ... --export-rust-project` sẽ cần được chạy " +"lại sau khi chỉnh sửa các tệp `BUILD.gn` (điều mà chúng ta sẽ thực hiện một " +"vài lần trong suốt các bài tập trong phần này)." #: src/exercises/chromium/build-rules.md msgid "Build rules exercise" -msgstr "" +msgstr "Bài tập xây dựng quy tắc" #: src/exercises/chromium/build-rules.md msgid "" "In your Chromium build, add a new Rust target to `//ui/base/BUILD.gn` " "containing:" msgstr "" +"Trong bản dựng Chromium của bạn, hãy thêm mục tiêu Rust mới vào " +"`//ui/base/BUILD.gn` có chứa:" #: src/exercises/chromium/build-rules.md msgid "" @@ -13416,6 +15428,9 @@ msgid "" "by the Rust compiler, so you'll need to allow unsafe code in your `gn` " "target." msgstr "" +"**Quan trọng**: lưu ý rằng `no_mangle` ở đây được compiler Rust coi là một " +"loại không an toàn, vì vậy bạn sẽ cần cho phép mã không an toàn trong mục " +"tiêu `gn` của mình." #: src/exercises/chromium/build-rules.md msgid "" @@ -13423,57 +15438,78 @@ msgid "" "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 "" +"Thêm mục tiêu Rust mới này làm phần phụ thuộc của `//ui/base:base`. Khai báo" +" hàm này ở đầu `ui/base/resource/resource_bundle.cc` (sau này, chúng ta sẽ " +"xem cách tự động hóa chức năng này bằng các công cụ tạo liên kết):" #: 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 " +"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 "" +"Gọi hàm này từ đâu đó trong `ui/base/resource/resource_bundle.cc` - chúng " +"tôi đề xuất phần trên cùng của `ResourceBundle:: " +"MaybeMangleLocalizedString`. Xây dựng và chạy Chromium, đồng thời đảm bảo " +"rằng \"Xin chào từ Rust!\" được in rất nhiều lần." #: 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 "" +"Nếu bạn sử dụng VSCode, bây giờ hãy thiết lập Rust để hoạt động tốt trong " +"VSCode. Nó sẽ hữu ích trong các bài tập tiếp theo. Nếu thành công, bạn sẽ có" +" thể nhấp chuột phải vào \"Đi tới định nghĩa\" trên `println!`." #: src/exercises/chromium/build-rules.md #: src/exercises/chromium/interoperability-with-cpp.md msgid "Where to find help" -msgstr "" +msgstr "Tìm sự giúp đỡ ở đâu" #: 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 "" +"Các tùy chọn có sẵn cho [mẫu gn`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 "" +"Thông tin về [`#[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 "" +"Thông tin về [`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 "" +"Thông tin về nút chuyển [`--export-rust-" +"project`](https://gn.googlesource.com/gn/+/main/docs/reference.md#compilation-" +"database) của gn" #: src/exercises/chromium/build-rules.md msgid "" -"[How to install rust-analyzer in VSCode](https://code.visualstudio.com/docs/" -"languages/rust)" +"[How to install rust-analyzer in " +"VSCode](https://code.visualstudio.com/docs/languages/rust)" msgstr "" +"[Cách cài đặt bộ phân tích Rust trong " +"VSCode](https://code.visualstudio.com/docs/lacular/rust)" #: src/exercises/chromium/build-rules.md msgid "" @@ -13482,6 +15518,10 @@ msgid "" "call C ABI functions. Later in the course, we'll connect C++ directly to " "Rust." msgstr "" +"Ví dụ này không bình thường vì nó tập trung vào ngôn ngữ tương tác có mẫu số" +" chung thấp nhất, C. Cả C++ và Rust đều có thể khai báo và gọi các hàm C ABI" +" một cách tự nhiên. Ở phần sau của khóa học, chúng ta sẽ kết nối C++ trực " +"tiếp với Rust." #: src/exercises/chromium/build-rules.md msgid "" @@ -13489,38 +15529,53 @@ msgid "" "Rust to generate two functions with the same name, and Rust can no longer " "guarantee that the right one is called." msgstr "" +"Ở đây bắt buộc phải có `allow_unsafe = true` vì `#[no_mangle]` có thể cho " +"phép Rust tạo hai hàm có cùng tên và Rust không còn có thể đảm bảo rằng hàm " +"đúng được gọi." #: src/exercises/chromium/build-rules.md msgid "" "If you need a pure Rust executable, you can also do that using the " "`rust_executable` gn template." msgstr "" +"Nếu bạn cần một tệp thực thi Rust thuần túy, bạn cũng có thể làm điều đó " +"bằng cách sử dụng mẫu gn `rust_executable`." #: 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 "" +"Cộng đồng Rust thường tạo ra các bài kiểm tra đơn vị trong một mô-đun được " +"đặt trong cùng một tệp nguồn với mã đang được kiểm tra. Điều này đã được đề " +"cập [trước đó](../testing.md) trong khóa học và trông như thế này:" #: src/chromium/testing.md msgid "" -"In Chromium we place unit tests in a separate source file and we continue to " -"follow this practice for Rust --- this makes tests consistently discoverable " -"and helps to avoid rebuilding `.rs` files a second time (in the `test` " -"configuration)." +"In Chromium we place unit tests in a separate source file and we continue to" +" follow this practice for Rust --- this makes tests consistently " +"discoverable and helps to avoid rebuilding `.rs` files a second time (in the" +" `test` configuration)." msgstr "" +"Trong Chromium, chúng tôi đặt các bài kiểm tra đơn vị trong một tệp nguồn " +"riêng biệt và chúng tôi tiếp tục thực hiện theo phương pháp này cho Rust ---" +" điều này làm cho các bài kiểm tra có thể được phát hiện một cách nhất quán " +"và giúp tránh việc xây dựng lại các tệp `.rs` lần thứ hai (trong cấu hình " +"`test`)." #: src/chromium/testing.md msgid "" "This results in the following options for testing Rust code in Chromium:" -msgstr "" +msgstr "Điều này dẫn đến các tùy chọn sau để kiểm tra mã Rust trong Chromium:" #: src/chromium/testing.md msgid "" -"Native Rust tests (i.e. `#[test]`). Discouraged outside of `//third_party/" -"rust`." +"Native Rust tests (i.e. `#[test]`). Discouraged outside of " +"`//third_party/rust`." msgstr "" +"Các bài kiểm tra Rust gốc (tức là `#[test]`). Nản lòng bên ngoài " +"`//third_party/rust`." #: src/chromium/testing.md msgid "" @@ -13528,6 +15583,9 @@ msgid "" "when Rust code is just a thin FFI layer and the existing unit tests provide " "sufficient coverage for the feature." msgstr "" +"Các bài kiểm tra `gtest` được viết bằng C++ và thực thi Rust thông qua lệnh " +"gọi FFI. Đủ khi mã Rust chỉ là một lớp FFI mỏng và các thử nghiệm đơn vị " +"hiện có cung cấp đủ phạm vi bao phủ cho tính năng này." #: src/chromium/testing.md msgid "" @@ -13535,6 +15593,9 @@ msgid "" "public API (using `pub mod for_testing { ... }` if needed). This is the " "subject of the next few slides." msgstr "" +"Các thử nghiệm `gtest` được viết bằng Rust và sử dụng crate đang được thử " +"nghiệm thông qua API công khai của nó (sử dụng `pub mod for_testing { ... }`" +" nếu cần). Đây là chủ đề của một số slide tiếp theo." #: src/chromium/testing.md msgid "" @@ -13542,12 +15603,17 @@ msgid "" "exercised by Chromium bots. (Such testing is needed rarely --- only after " "adding or updating third-party crates.)" msgstr "" +"Đề cập rằng các thử nghiệm Rust gốc đối với các crate của bên thứ ba cuối " +"cùng sẽ được thực hiện bởi các bot Chromium. (Việc kiểm tra như vậy hiếm khi" +" cần thiết --- chỉ sau khi thêm hoặc cập nhật crate của bên thứ ba.)" #: src/chromium/testing.md msgid "" -"Some examples may help illustrate when C++ `gtest` vs Rust `gtest` should be " -"used:" +"Some examples may help illustrate when C++ `gtest` vs Rust `gtest` should be" +" used:" msgstr "" +"Một số ví dụ có thể giúp minh họa khi nào nên sử dụng C++ `gtest` so với " +"Rust `gtest`:" #: src/chromium/testing.md msgid "" @@ -13556,6 +15622,10 @@ msgid "" "both the C++ and the Rust implementation (parameterizing the tests so they " "enable or disable Rust using a `ScopedFeatureList`)." msgstr "" +"QR có rất ít chức năng trong lớp Rust của bên thứ nhất (nó chỉ là một lớp " +"keo FFI mỏng) và do đó sử dụng các thử nghiệm đơn vị C++ hiện có để thử " +"nghiệm cả cách triển khai C++ và Rust (tham số hóa các thử nghiệm để chúng " +"kích hoạt hoặc vô hiệu hóa Rust bằng cách sử dụng `ScopedFeatureList`)." #: src/chromium/testing.md msgid "" @@ -13564,34 +15634,49 @@ msgid "" "missing in the `png` crate - e.g. RGBA => BGRA, or gamma correction. Such " "functionality may benefit from separate tests authored in Rust." msgstr "" +"Tích hợp giả định/WIP PNG có thể cần triển khai triển khai các phép biến đổi" +" pixel an toàn cho bộ nhớ do `libpng` cung cấp nhưng bị thiếu trong crate " +"`png` - ví dụ: RGBA => BGRA hoặc hiệu chỉnh gamma. Chức năng như vậy có thể " +"được hưởng lợi từ các thử nghiệm riêng biệt được thực hiện trong Rust." #: src/chromium/testing/rust-gtest-interop.md msgid "" -"The [`rust_gtest_interop`](https://chromium.googlesource.com/chromium/src/+/" -"main/testing/rust_gtest_interop/README.md) library provides a way to:" +"The " +"[`rust_gtest_interop`](https://chromium.googlesource.com/chromium/src/+/main/testing/rust_gtest_interop/README.md)" +" library provides a way to:" msgstr "" +"Thư viện " +"[`rust_gtest_interop`](https://chromium.googlesource.com/chromium/src/+/main/testing/rust_gtest_interop/README.md)" +" cung cấp cách để:" #: src/chromium/testing/rust-gtest-interop.md msgid "" "Use a Rust function as a `gtest` testcase (using the `#[gtest(...)]` " "attribute)" msgstr "" +"Sử dụng hàm Rust làm testcase `gtest` (sử dụng thuộc tính `#[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)." msgstr "" +"Sử dụng `expect_eq!` và các macro tương tự (tương tự như `assert_eq!` nhưng " +"không hoảng loạn và không kết thúc thử nghiệm khi xác nhận không thành " +"công)." #: src/chromium/testing/rust-gtest-interop.md msgid "Example:" -msgstr "" +msgstr "Ví dụ:" #: 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:" msgstr "" +"Cách đơn giản nhất để xây dựng các bài kiểm tra Rust `gtest` là thêm chúng " +"vào tệp nhị phân kiểm tra hiện có đã chứa các bài kiểm tra được viết bằng " +"C++. Ví dụ:" #: src/chromium/testing/build-gn.md msgid "" @@ -13603,12 +15688,22 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"test(\"ui_base_unittests\") {\n" +" ...\n" +" nguồn += [ \"my_rust_lib_unittest.rs\" ]\n" +" deps += [ \":my_rust_lib\" ]\n" +"}\n" +"```" #: src/chromium/testing/build-gn.md msgid "" -"Authoring Rust tests in a separate `static_library` also works, but requires " -"manually declaring the dependency on the support libraries:" +"Authoring Rust tests in a separate `static_library` also works, but requires" +" manually declaring the dependency on the support libraries:" msgstr "" +"Việc tạo các bài kiểm tra Rust trong một `static_library` riêng biệt cũng " +"hoạt động, nhưng yêu cầu khai báo thủ công sự phụ thuộc vào các thư viện hỗ " +"trợ:" #: src/chromium/testing/build-gn.md msgid "" @@ -13630,6 +15725,23 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"rust_static_library(\"my_rust_lib_unittests\") {\n" +" chỉ kiểm tra = đúng\n" +" is_gtest_unittests = đúng\n" +" crate_root = \"my_rust_lib_unittest.rs\"\n" +" sources = [ \"my_rust_lib_unittest.rs\"]\n" +" dep = [\n" +" \":my_rust_lib\",\n" +" \"//kiểm tra/rust_gtest_interop\",\n" +" ]\n" +"}\n" +"\n" +"test(\"ui_base_unittests\") {\n" +" ...\n" +" deps += [ \":my_rust_lib_unittests\" ]\n" +"}\n" +"```" #: src/chromium/testing/chromium-import-macro.md msgid "" @@ -13640,43 +15752,56 @@ msgid "" "working with such an unwieldy name by using the `chromium::import!` macro " "from the automatically-imported `chromium` crate:" msgstr "" +"Sau khi thêm `:my_rust_lib` vào GN `deps`, chúng ta vẫn cần tìm hiểu cách " +"nhập và sử dụng `my_rust_lib` từ `my_rust_lib_unittest.rs`. Chúng tôi chưa " +"cung cấp `crate_name` rõ ràng cho `my_rust_lib` nên tên crate của nó được " +"tính toán dựa trên tên và đường dẫn mục tiêu đầy đủ. May mắn thay, chúng ta " +"có thể tránh làm việc với một cái tên khó sử dụng như vậy bằng cách sử dụng " +"macro `chromium::import!` từ crate `chromium` được nhập tự động:" #: src/chromium/testing/chromium-import-macro.md msgid "\"//ui/base:my_rust_lib\"" -msgstr "" +msgstr "\"//ui/base:my_rust_lib\"" #: src/chromium/testing/chromium-import-macro.md msgid "Under the covers the macro expands to something similar to:" -msgstr "" +msgstr "Dưới phần bìa, macro mở rộng thành một cái gì đó tương tự như:" #: 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:" -"third_party&ss=chromium%2Fchromium%2Fsrc) of the `chromium::import` macro." +"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 "" +"Bạn có thể tìm thêm thông tin trong [nhận xét tài " +"liệu](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)" +" của `Chromium::nhập` macro." #: src/chromium/testing/chromium-import-macro.md 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 " +"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." msgstr "" +"`rust_static_library` hỗ trợ chỉ định tên rõ ràng thông qua thuộc tính " +"`crate_name`, nhưng việc này không được khuyến khích. Và điều đó không được " +"khuyến khích vì tên crate phải là duy nhất trên toàn cầu. Crates.io đảm bảo " +"tính duy nhất của tên crate nên các mục tiêu GN `cargo_crate` (được tạo bởi " +"công cụ `gnrt` sẽ được đề cập trong phần sau) sử dụng tên crate ngắn." #: src/exercises/chromium/testing.md msgid "Testing exercise" -msgstr "" +msgstr "Bài tập kiểm tra" #: src/exercises/chromium/testing.md msgid "Time for another exercise!" -msgstr "" +msgstr "Thời gian cho một bài tập khác!" #: src/exercises/chromium/testing.md msgid "In your Chromium build:" -msgstr "" +msgstr "Trong bản dựng Chromium của bạn:" #: src/exercises/chromium/testing.md msgid "" @@ -13684,18 +15809,24 @@ msgid "" "two integers received as arguments, computing the nth Fibonacci number, " "summing integers in a slice, etc." msgstr "" +"Thêm một hàm có thể kiểm tra bên cạnh `hello_from_rust`. Một số gợi ý: cộng " +"hai số nguyên nhận được làm đối số, tính số Fibonacci thứ n, tính tổng các " +"số nguyên trong một lát cắt, v.v." #: src/exercises/chromium/testing.md -msgid "Add a separate `..._unittest.rs` file with a test for the new function." -msgstr "" +msgid "" +"Add a separate `..._unittest.rs` file with a test for the new function." +msgstr "Thêm một tệp `..._unittest.rs` riêng biệt để kiểm tra chức năng mới." #: src/exercises/chromium/testing.md msgid "Add the new tests to `BUILD.gn`." -msgstr "" +msgstr "Thêm các bài kiểm tra mới vào `BUILD.gn`." #: src/exercises/chromium/testing.md msgid "Build the tests, run them, and verify that the new test works." msgstr "" +"Xây dựng các thử nghiệm, chạy chúng và xác minh rằng thử nghiệm mới hoạt " +"động." #: src/chromium/interoperability-with-cpp.md msgid "" @@ -13703,6 +15834,8 @@ msgid "" "tools being developed all the time. At the moment, Chromium uses a tool " "called CXX." msgstr "" +"Cộng đồng Rust cung cấp nhiều tùy chọn cho C++/Rust interop, với các công cụ" +" mới luôn được phát triển. Hiện tại, Chromium sử dụng công cụ có tên CXX." #: src/chromium/interoperability-with-cpp.md msgid "" @@ -13710,19 +15843,27 @@ msgid "" "language (which looks a lot like Rust) and then CXX tools generate " "declarations for functions and types in both Rust and C++." msgstr "" +"Bạn mô tả toàn bộ ranh giới ngôn ngữ của mình bằng ngôn ngữ định nghĩa giao " +"diện (trông rất giống Rust) và sau đó các công cụ CXX tạo ra các khai báo " +"cho các hàm và kiểu trong cả Rust và 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 "" +"Xem [hướng dẫn CXX](https://cxx.rs/tutorial.html) để biết ví dụ đầy đủ về " +"cách sử dụng tính năng này." #: 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 " +"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:" msgstr "" +"Nói chuyện qua sơ đồ. Giải thích rằng đằng sau hậu trường, việc này cũng " +"diễn ra giống như những gì bạn đã làm trước đây. Chỉ ra rằng việc tự động " +"hóa quy trình có những lợi ích sau:" #: src/chromium/interoperability-with-cpp.md msgid "" @@ -13731,6 +15872,10 @@ msgid "" "definitions, but with out-of-sync manual bindings you'd get Undefined " "Behavior)" msgstr "" +"Công cụ này đảm bảo rằng các bên C++ và Rust khớp nhau (ví dụ: bạn gặp lỗi " +"biên dịch nếu `#[cxx::bridge]` không khớp với các định nghĩa C++ hoặc Rust " +"thực tế, nhưng với các ràng buộc thủ công không đồng bộ, bạn sẽ nhận được " +"Hành vi không xác định)" #: src/chromium/interoperability-with-cpp.md msgid "" @@ -13739,27 +15884,40 @@ msgid "" "methods; manual bindings would require authoring such top-level, free " "functions manually)" msgstr "" +"Công cụ này tự động tạo các thunk FFI (các chức năng nhỏ, tương thích với " +"C-ABI, miễn phí) cho các tính năng không phải C (ví dụ: cho phép các cuộc " +"gọi FFI vào các phương thức Rust hoặc C++; các ràng buộc thủ công sẽ yêu cầu" +" soạn thảo các chức năng miễn phí, cấp cao nhất theo cách thủ công)" #: src/chromium/interoperability-with-cpp.md msgid "The tool and the library can handle a set of core types - for example:" -msgstr "" +msgstr "Công cụ và thư viện có thể xử lý một tập hợp các loại lõi - ví dụ:" #: 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)" +"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]` có thể được vượt qua ranh giới FFI, mặc dù nó không đảm bảo bất kỳ " +"ABI hoặc bố cục bộ nhớ cụ thể nào. Với các ràng buộc thủ công `std::span`" +" / `&[T]` phải được hủy cấu trúc và xây dựng lại theo cách thủ công từ một " +"con trỏ và độ dài - điều này dễ xảy ra lỗi do mỗi ngôn ngữ biểu thị các lát " +"trống hơi khác nhau)" #: 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-" +"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." msgstr "" +"Các con trỏ thông minh như `std::unique_ptr`, `std::shared_ptr` " +"và/hoặc `Box` được hỗ trợ nguyên bản. Với các ràng buộc thủ công, người ta " +"sẽ phải chuyển các con trỏ thô tương thích với C-ABI, điều này sẽ làm tăng " +"rủi ro về tuổi thọ và an toàn bộ nhớ." #: src/chromium/interoperability-with-cpp.md msgid "" @@ -13768,24 +15926,30 @@ msgid "" "build a Rust string from non-UTF8 input and `rust::String::c_str` can NUL-" "terminate a string)." msgstr "" +"Các loại `rust::String` và `CxxString` hiểu và duy trì sự khác biệt trong " +"cách biểu diễn chuỗi giữa các ngôn ngữ (ví dụ: `rust::String::lossy` có thể " +"tạo chuỗi Rust từ đầu vào không phải UTF8 và `rust::String::c_str` có thể " +"NUL-chấm dứt một chuỗi)." #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" "CXX requires that the whole C++/Rust boundary is declared in `cxx::bridge` " "modules inside `.rs` source code." msgstr "" +"CXX yêu cầu toàn bộ ranh giới C++/Rust phải được khai báo trong các mô-đun " +"`cxx::bridge` bên trong mã nguồn `.rs`." #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "\"example/include/blobstore.h\"" -msgstr "" +msgstr "\"example/include/blobstore.h\"" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "// Definitions of Rust types and functions go here\n" -msgstr "" +msgstr "// Định nghĩa về các kiểu và chức năng của Rust ở đây\n" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "Point out:" -msgstr "" +msgstr "Chỉ ra:" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" @@ -13794,22 +15958,26 @@ msgid "" "bit more sophisticated - though this does still result in a `mod` called " "`ffi` in your code." msgstr "" +"Mặc dù nó trông giống như một `mod` của Rust thông thường, nhưng macro thủ " +"tục `#[cxx::bridge]` thực hiện những điều phức tạp với nó. Mã được tạo phức " +"tạp hơn một chút - mặc dù điều này vẫn dẫn đến một `mod` có tên là `ffi` " +"trong mã của bạn." #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "Native support for C++'s `std::unique_ptr` in Rust" -msgstr "" +msgstr "Hỗ trợ riêng cho `std::unique_ptr` của C++ trong Rust" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "Native support for Rust slices in C++" -msgstr "" +msgstr "Hỗ trợ riêng cho các lát Rust trong C++" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "Calls from C++ to Rust, and Rust types (in the top part)" -msgstr "" +msgstr "Các cuộc gọi từ C++ đến các loại Rust và Rust (ở phần trên cùng)" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "Calls from Rust to C++, and C++ types (in the bottom part)" -msgstr "" +msgstr "Các cuộc gọi từ Rust đến C++ và các loại C++ (ở phần dưới cùng)" #: src/chromium/interoperability-with-cpp/example-bindings.md msgid "" @@ -13818,124 +15986,157 @@ msgid "" "simply `#include`d in the generated C++ code for the benefit of C++ " "compilers." msgstr "" +"**Quan niệm sai lầm phổ biến**: Có vẻ như tiêu đề C++ đang được Rust phân " +"tích cú pháp, nhưng điều này gây hiểu lầm. Tiêu đề này không bao giờ được " +"Rust diễn giải mà chỉ đơn giản là `#include`d trong mã C++ được tạo ra vì " +"lợi ích của compiler C++." #: 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 "" +"Cho đến nay, trang hữu ích nhất khi sử dụng CXX là [loại tham " +"chiếu](https://cxx.rs/binds.html)." #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "CXX fundamentally suits cases where:" -msgstr "" +msgstr "CXX về cơ bản phù hợp với các trường hợp:" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "Your Rust-C++ interface is sufficiently simple that you can declare all of " "it." -msgstr "" +msgstr "Giao diện Rust-C++ của bạn đủ đơn giản để bạn có thể khai báo tất cả." #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "You're using only the types natively supported by CXX already, for example " "`std::unique_ptr`, `std::string`, `&[u8]` etc." msgstr "" +"Bạn hiện chỉ sử dụng các loại được CXX hỗ trợ nguyên bản, ví dụ: " +"`std::unique_ptr`, `std::string`, `&[u8]`, v.v." #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "It has many limitations --- for example lack of support for Rust's `Option` " "type." msgstr "" +"Nó có nhiều hạn chế --- ví dụ như thiếu hỗ trợ cho loại `Option` của Rust." #: 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." +"draft the CXX bindings for the language boundary to see if it appears simple" +" enough." msgstr "" +"Những hạn chế này hạn chế chúng tôi chỉ sử dụng Rust trong Chromium cho các " +"\"nút lá\" được cách ly tốt thay vì cho khả năng tương tác Rust-C++ tùy ý. " +"Khi xem xét trường hợp sử dụng cho Rust trong Chromium, điểm khởi đầu tốt là" +" soạn thảo các ràng buộc CXX cho ranh giới ngôn ngữ để xem liệu nó có đủ đơn" +" giản hay không." #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "You should also discuss some of the other sticky points with CXX, for " "example:" -msgstr "" +msgstr "Bạn cũng nên thảo luận về một số điểm vướng mắc khác với CXX, ví dụ:" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "" "Its error handling is based around C++ exceptions (given on the next slide)" msgstr "" +"Việc xử lý lỗi của nó dựa trên các ngoại lệ của C++ (được đưa ra ở trang " +"tiếp theo)" #: src/chromium/interoperability-with-cpp/limitations-of-cxx.md msgid "Function pointers are awkward to use." -msgstr "" +msgstr "Con trỏ hàm khó sử dụng." #: 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 "" +"[Hỗ trợ cho `Result`](https://cxx.rs/bind/result.html) của CXX dựa trên" +" các ngoại lệ C++, vì vậy chúng tôi không thể sử dụng điều đó trong " +"Chromium. Các lựa chọn thay thế:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "The `T` part of `Result` can be:" -msgstr "" +msgstr "Phần `T` của `Result` có thể là:" #: 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:" msgstr "" +"Được trả về thông qua các tham số đầu ra (ví dụ: thông qua `&mut T`). Điều " +"này yêu cầu `T` có thể được chuyển qua ranh giới FFI - ví dụ `T` phải là:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "A primitive type (like `u32` or `usize`)" -msgstr "" +msgstr "Kiểu nguyên thủy (như `u32` hoặc `usize`)" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" -"A type natively supported by `cxx` (like `UniquePtr`) that has a suitable " -"default value to use in a failure case (_unlike_ `Box`)." +"A type natively supported by `cxx` (like `UniquePtr`) that has a suitable" +" default value to use in a failure case (_unlike_ `Box`)." msgstr "" +"Một loại được hỗ trợ nguyên bản bởi `cxx` (như `UniquePtr`) có giá trị " +"mặc định phù hợp để sử dụng trong trường hợp lỗi (_unlike_ `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`." +"when `T` is a Rust type, which cannot be passed across the FFI boundary, and" +" cannot be stored in `UniquePtr`." msgstr "" +"Được giữ lại ở phía Rust và được hiển thị thông qua tài liệu tham khảo. Điều" +" này có thể cần thiết khi `T` là loại Rust, không thể vượt qua ranh giới FFI" +" và không thể được lưu trữ trong `UniquePtr`." #: src/chromium/interoperability-with-cpp/error-handling.md msgid "The `E` part of `Result` can be:" -msgstr "" +msgstr "Phần `E` của `Result` có thể là:" #: src/chromium/interoperability-with-cpp/error-handling.md msgid "" "Returned as a boolean (e.g. `true` representing success, and `false` " "representing failure)" msgstr "" +"Được trả về dưới dạng boolean (ví dụ: `true` đại diện cho thành công và " +"`false` đại diện cho thất bại)" #: 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." msgstr "" +"Về mặt lý thuyết, việc lưu giữ các chi tiết lỗi là có thể, nhưng cho đến nay" +" vẫn chưa cần thiết trong thực tế." #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "CXX Error Handling: QR Example" -msgstr "" +msgstr "Xử lý lỗi CXX: Ví dụ về QR" #: 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:" +"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:" msgstr "" +"Trình tạo mã QR là [một ví " +"dụ](https://source.chromium.org/chromium/chromium/src/+/main:comComponents/qr_code_generator/qr_code_generator_ffi_glue.rs;l=13-18;drc=7bf1b75b910ca430501b9c6a74c1d18a0223ecca)," +" trong đó boolean được dùng để truyền đạt sự thành công so với thất bại và " +"khi kết quả thành công có thể được chuyển qua ranh giới FFI:" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "\"qr_code_generator\"" -msgstr "" +msgstr "\"qr_code_generator\"" #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" @@ -13944,14 +16145,21 @@ msgid "" "admittedly it is a bit redundant - this is the square root of the size of " "the vector)." msgstr "" +"Học sinh có thể tò mò về ngữ nghĩa của đầu ra `out_qr_size`. Đây không phải " +"là kích thước của vectơ mà là kích thước của mã QR (và phải thừa nhận rằng " +"nó hơi dư thừa - đây là căn bậc hai của kích thước của vectơ)." #: 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)." +"points to uninitialized memory results in Undefined Behavior (unlike in C++," +" when only the act of dereferencing such memory results in UB)." msgstr "" +"Có thể đáng để chỉ ra tầm quan trọng của việc khởi tạo `out_qr_size` trước " +"khi gọi hàm Rust. Việc tạo tham chiếu Rust trỏ đến bộ nhớ chưa được khởi tạo" +" dẫn đến Hành vi không xác định (không giống như trong C++, khi chỉ hành " +"động hủy tham chiếu bộ nhớ đó dẫn đến UB)." #: src/chromium/interoperability-with-cpp/error-handling-qr.md msgid "" @@ -13959,42 +16167,54 @@ msgid "" "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 "" +"Nếu học sinh hỏi về `Pin`, hãy giải thích tại sao CXX cần nó để tham chiếu " +"đến dữ liệu C++ có thể thay đổi: câu trả lời là dữ liệu C++ không thể di " +"chuyển xung quanh như dữ liệu Rust, vì nó có thể chứa các con trỏ tự tham " +"chiếu." #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "CXX Error Handling: PNG Example" -msgstr "" +msgstr "Xử lý lỗi CXX: Ví dụ 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 "" +"Nguyên mẫu của bộ giải mã PNG minh họa những gì có thể được thực hiện khi " +"kết quả thành công không thể vượt qua ranh giới FFI:" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "\"gfx::rust_bindings\"" -msgstr "" +msgstr "\"gfx::rust_binds\"" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "" "/// This returns an FFI-friendly equivalent of `Result,\n" " /// ()>`.\n" msgstr "" +"/// Điều này trả về một giá trị tương đương thân thiện với FFI của `Result,\n" +" /// ()>`.\n" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "/// C++ bindings for the `crate::png::ResultOfPngReader` type.\n" -msgstr "" +msgstr "/// Liên kết C++ cho loại `crate::png::ResultOfPngReader`.\n" #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "/// C++ bindings for the `crate::png::PngReader` type.\n" -msgstr "" +msgstr "/// Liên kết C++ cho loại `crate::png::PngReader`.\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." +"can't have an `out_parameter: &mut PngReader`, because CXX doesn't allow C++" +" to store Rust objects by value." msgstr "" +"`PngReader` và `ResultOfPngReader` là các loại Rust --- các đối tượng thuộc " +"loại này không thể vượt qua ranh giới FFI mà không có sự chỉ dẫn của " +"`Box`. Chúng tôi không thể có `out_parameter: &mut PNGReader`, vì CXX " +"không cho phép C++ lưu trữ các đối tượng Rust theo giá trị." #: src/chromium/interoperability-with-cpp/error-handling-png.md msgid "" @@ -14005,10 +16225,16 @@ msgid "" "appropriate methods of `Result` (e.g. into `is_err`, `unwrap`, and/or " "`as_mut`)." msgstr "" +"Ví dụ này minh họa rằng mặc dù CXX không hỗ trợ các mẫu chung và mẫu tùy ý, " +"chúng tôi vẫn có thể chuyển chúng qua ranh giới FFI bằng cách chuyên biệt " +"hóa/đơn hình hóa chúng thành một loại không chung chung theo cách thủ công. " +"Trong ví dụ, `ResultOfPngReader` là loại không chung chung chuyển tiếp thành" +" các phương thức thích hợp của `Result` (ví dụ: vào `is_err`, `unwrap`" +" và/hoặc `as_mut`)." #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "Using cxx in Chromium" -msgstr "" +msgstr "Sử dụng cxx trong Chromium" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" @@ -14016,6 +16242,9 @@ msgid "" "node where we want to use Rust. You'd typically have one for each " "`rust_static_library`. Just add" msgstr "" +"Trong Chromium, chúng tôi xác định một mod` #[cxx::bridge] độc lập cho mỗi " +"nút lá mà chúng tôi muốn sử dụng Rust. Thông thường, bạn sẽ có một cái cho " +"mỗi `rust_static_library`. Chỉ cần thêm" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" @@ -14025,59 +16254,82 @@ msgid "" "allow_unsafe = true\n" "```" msgstr "" +"```gn\n" +"cxx_binds = [ \"my_rust_file.rs\" ]\n" +" # danh sách các file chứa #[cxx::bridge], không phải tất cả các file nguồn\n" +"allow_unsafe = đúng\n" +"```" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "" "to your existing `rust_static_library` target alongside `crate_root` and " "`sources`." msgstr "" +"vào mục tiêu `rust_static_library` hiện có của bạn cùng với `crate_root` và " +"`sources`." #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "C++ headers will be generated at a sensible location, so you can just" msgstr "" +"Các tiêu đề C++ sẽ được tạo ở một vị trí hợp lý, vì vậy bạn có thể chỉ cần" #: src/chromium/interoperability-with-cpp/using-cxx-in-chromium.md msgid "\"ui/base/my_rust_file.rs.h\"" -msgstr "" +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 "" +"Bạn sẽ tìm thấy một số hàm tiện ích trong `//base` để chuyển đổi sang/từ " +"loại Chromium C++ sang loại CXX Rust --- ví dụ: " +"[`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`?" msgstr "" +"Học sinh có thể hỏi --- tại sao chúng ta vẫn cần `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 "" +"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 "" +"Câu trả lời rộng rãi là không có mã C/C++ nào là \"an toàn\" theo tiêu chuẩn" +" Rust thông thường. Việc gọi qua lại C/C++ từ Rust có thể thực hiện những " +"tác vụ tùy ý đối với bộ nhớ và làm ảnh hưởng đến sự an toàn của bố cục dữ " +"liệu của chính Rust. Sự hiện diện của _too many_ `unsafe` từ khóa trong " +"tương tác C/C++ có thể gây tổn hại đến tỷ lệ tín hiệu trên nhiễu của một từ " +"khóa như vậy và [gây tranh cãi](https://steveklabnik.com/writing/the-cxx-" +"debate), nhưng nghiêm túc mà nói, việc đưa bất kỳ mã nước ngoài nào vào tệp " +"nhị phân Rust có thể gây ra hành vi không mong muốn theo quan điểm của 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 " +"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." msgstr "" +"Câu trả lời hẹp nằm trong sơ đồ ở đầu [trang này](../interoperability-with-" +"cpp.md) --- đằng sau hậu trường, CXX tạo ra các hàm Rust `unsafe` và `extern" +" \"C\"` giống như chúng ta đã làm thủ công trong phần trước." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Exercise: Interoperability with C++" -msgstr "" +msgstr "Bài tập: Khả năng tương tác với C++" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Part one" -msgstr "" +msgstr "Phần một" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -14085,107 +16337,131 @@ msgid "" "specifies a single function, to be called from C++, called " "`hello_from_rust`, taking no parameters and returning no value." msgstr "" +"Trong tệp Rust mà bạn đã tạo trước đó, hãy thêm `#[cxx::bridge]` chỉ định " +"một hàm duy nhất, được gọi từ C++, được gọi là `hello_from_rust`, không lấy " +"tham số và không trả về giá trị." #: 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." +"Modify your previous `hello_from_rust` function to remove `extern \"C\"` and" +" `#[no_mangle]`. This is now just a standard Rust function." msgstr "" +"Sửa đổi hàm `hello_from_rust` trước đó của bạn để xóa `C\"` bên ngoài và " +"`#[no_mangle]`. Đây bây giờ chỉ là một chức năng Rust tiêu chuẩn." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Modify your `gn` target to build these bindings." -msgstr "" +msgstr "Sửa đổi mục tiêu `gn` của bạn để xây dựng các liên kết này." #: 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." msgstr "" +"Trong mã C++ của bạn, hãy xóa phần khai báo chuyển tiếp của " +"`hello_from_rust`. Thay vào đó, hãy bao gồm tệp tiêu đề được tạo." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Build and run!" -msgstr "" +msgstr "Xây dựng và chạy!" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Part two" -msgstr "" +msgstr "Phần hai" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" "It's a good idea to play with CXX a little. It helps you think about how " "flexible Rust in Chromium actually is." msgstr "" +"Chơi với CXX một chút là một ý kiến ​​hay. Nó giúp bạn suy nghĩ về mức độ " +"linh hoạt thực sự của Rust trong Chromium." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Some things to try:" -msgstr "" +msgstr "Một số điều cần thử:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "Call back into C++ from Rust. You will need:" -msgstr "" +msgstr "Gọi lại C++ từ Rust. Bạn sẽ cần:" #: src/exercises/chromium/interoperability-with-cpp.md 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 "" +"Một tệp tiêu đề bổ sung mà bạn có thể `bao gồm!` từ `cxx::bridge` của mình. " +"Bạn sẽ cần khai báo hàm C++ của mình trong tệp tiêu đề mới đó." #: src/exercises/chromium/interoperability-with-cpp.md msgid "" "An `unsafe` block to call such a function, or alternatively specify the " -"`unsafe` keyword in your `#[cxx::bridge]` [as described here](https://cxx.rs/" -"extern-c++.html#functions-and-member-functions)." +"`unsafe` keyword in your `#[cxx::bridge]` [as described " +"here](https://cxx.rs/extern-c++.html#functions-and-member-functions)." msgstr "" +"Một khối `unsafe` để gọi một hàm như vậy hoặc chỉ định từ khóa `unsafe` " +"trong `#[cxx::bridge]` [như được mô tả ở " +"đây](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\"`" +"You may also need to `#include " +"\"third_party/rust/cxx/v1/crate/include/cxx.h\"`" msgstr "" +"Bạn cũng có thể cần `#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." -msgstr "" +msgstr "Truyền chuỗi C++ từ C++ vào Rust." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Pass a reference to a C++ object into Rust." -msgstr "" +msgstr "Truyền tham chiếu đến đối tượng C++ vào Rust." #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"Intentionally get the Rust function signatures mismatched from the `#[cxx::" -"bridge]`, and get used to the errors you see." +"Intentionally get the Rust function signatures mismatched from the " +"`#[cxx::bridge]`, and get used to the errors you see." msgstr "" +"Cố tình lấy các chữ ký hàm Rust không khớp với `#[cxx::bridge]` và làm quen " +"với các lỗi bạn thấy." #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"Intentionally get the C++ function signatures mismatched from the `#[cxx::" -"bridge]`, and get used to the errors you see." +"Intentionally get the C++ function signatures mismatched from the " +"`#[cxx::bridge]`, and get used to the errors you see." msgstr "" +"Cố ý lấy các chữ ký hàm C++ không khớp với `#[cxx::bridge]` và làm quen với " +"các lỗi bạn thấy." #: 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." msgstr "" +"Chuyển một `std::unique_ptr` thuộc loại nào đó từ C++ vào Rust, để Rust có " +"thể sở hữu một số đối tượng 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 "" +"Tạo một đối tượng Rust và chuyển nó vào C++, để C++ sở hữu nó. (Gợi ý: bạn " +"cần có `Box`)." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Declare some methods on a C++ type. Call them from Rust." -msgstr "" +msgstr "Khai báo một số phương thức trên kiểu C++. Gọi cho họ từ Rust." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Declare some methods on a Rust type. Call them from C++." -msgstr "" +msgstr "Khai báo một số phương thức trên kiểu Rust. Gọi chúng từ C++." #: src/exercises/chromium/interoperability-with-cpp.md msgid "Part three" -msgstr "" +msgstr "Phần ba" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -14193,20 +16469,25 @@ msgid "" "couple of use-cases for Rust in Chromium where the interface would be " "sufficiently simple. Sketch how you might define that interface." msgstr "" +"Bây giờ bạn đã hiểu những điểm mạnh và hạn chế của CXX interop, hãy nghĩ đến" +" một số trường hợp sử dụng cho Rust trong Chromium trong đó giao diện sẽ đủ " +"đơn giản. Phác thảo cách bạn có thể xác định giao diện đó." #: src/exercises/chromium/interoperability-with-cpp.md msgid "The [`cxx` binding reference](https://cxx.rs/bindings.html)" -msgstr "" +msgstr "[Tham chiếu liên kết [`cxx`](https://cxx.rs/binds.html)" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" -"The [`rust_static_library` gn template](https://source.chromium.org/chromium/" -"chromium/src/+/main:build/rust/rust_static_library.gni;l=16)" +"The [`rust_static_library` gn " +"template](https://source.chromium.org/chromium/chromium/src/+/main:build/rust/rust_static_library.gni;l=16)" msgstr "" +"Mẫu [`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:" -msgstr "" +msgstr "Một số câu hỏi bạn có thể gặp phải:" #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -14214,6 +16495,9 @@ msgid "" "and Y are both function types. This is because your C++ function doesn't " "quite match the declaration in your `cxx::bridge`." msgstr "" +"Tôi gặp sự cố khi khởi tạo biến loại X với loại Y, trong đó X và Y đều là " +"loại hàm. Điều này là do hàm C++ của bạn không hoàn toàn khớp với khai báo " +"trong `cxx::bridge` của bạn." #: src/exercises/chromium/interoperability-with-cpp.md msgid "" @@ -14222,101 +16506,115 @@ msgid "" "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 "" +"Tôi dường như có thể tự do chuyển đổi các tham chiếu C++ thành các tham " +"chiếu Rust. Điều đó có nguy hiểm không UB? Đối với các loại _opaque_ của CXX" +" thì không, vì chúng có kích thước bằng 0. Đối với các loại tầm thường CXX " +"thì có, _có thể_ gây ra UB, mặc dù thiết kế của CXX khiến việc tạo ra một ví" +" dụ như vậy khá khó khăn." #: src/chromium/adding-third-party-crates.md msgid "" -"Rust libraries are called \"crates\" and are found at [crates.io](https://" -"crates.io). It's _very easy_ for Rust crates to depend upon one another. So " -"they do!" +"Rust libraries are called \"crates\" and are found at " +"[crates.io](https://crates.io). It's _very easy_ for Rust crates to depend " +"upon one another. So they do!" msgstr "" +"Thư viện Rust được gọi là \"crates\" và có tại " +"[crates.io](https://crates.io). _Rất dễ dàng để các crate Rust phụ thuộc vào" +" nhau. Vì vậy, họ làm!" #: src/chromium/adding-third-party-crates.md msgid "Property" -msgstr "" +msgstr "Tài sản" #: src/chromium/adding-third-party-crates.md msgid "C++ library" -msgstr "" +msgstr "thư viện C++" #: src/chromium/adding-third-party-crates.md msgid "Rust crate" -msgstr "" +msgstr "Crate Rust" #: src/chromium/adding-third-party-crates.md msgid "Build system" -msgstr "" +msgstr "Xây dựng hệ thống" #: src/chromium/adding-third-party-crates.md msgid "Lots" -msgstr "" +msgstr "Rất nhiều" #: src/chromium/adding-third-party-crates.md msgid "Consistent: `Cargo.toml`" -msgstr "" +msgstr "Nhất quán: `Cargo.toml`" #: src/chromium/adding-third-party-crates.md msgid "Typical library size" -msgstr "" +msgstr "Kích thước thư viện điển hình" #: src/chromium/adding-third-party-crates.md msgid "Large-ish" -msgstr "" +msgstr "Lớn-ish" #: src/chromium/adding-third-party-crates.md msgid "Small" -msgstr "" +msgstr "Bé nhỏ" #: src/chromium/adding-third-party-crates.md msgid "Transitive dependencies" -msgstr "" +msgstr "Sự phụ thuộc bắc cầu" #: src/chromium/adding-third-party-crates.md msgid "Few" -msgstr "" +msgstr "Một vài" #: src/chromium/adding-third-party-crates.md msgid "For a Chromium engineer, this has pros and cons:" -msgstr "" +msgstr "Đối với kỹ sư Chromium, điều này có những ưu và nhược điểm:" #: src/chromium/adding-third-party-crates.md msgid "" -"All crates use a common build system so we can automate their inclusion into " -"Chromium..." +"All crates use a common build system so we can automate their inclusion into" +" Chromium..." msgstr "" +"Tất cả các crate đều sử dụng một hệ thống xây dựng chung để chúng tôi có thể" +" tự động hóa việc đưa chúng vào Chromium..." #: src/chromium/adding-third-party-crates.md msgid "" "... but, crates typically have transitive dependencies, so you will likely " "have to bring in multiple libraries." msgstr "" +"... nhưng, các crate thường có sự phụ thuộc bắc cầu, vì vậy bạn có thể sẽ " +"phải đưa vào nhiều thư viện." #: src/chromium/adding-third-party-crates.md msgid "We'll discuss:" -msgstr "" +msgstr "Chúng ta sẽ thảo luận:" #: src/chromium/adding-third-party-crates.md msgid "How to put a crate in the Chromium source code tree" -msgstr "" +msgstr "Cách đặt crate vào cây mã nguồn Chromium" #: src/chromium/adding-third-party-crates.md msgid "How to make `gn` build rules for it" -msgstr "" +msgstr "Làm thế nào để tạo quy tắc xây dựng `gn` cho nó" #: src/chromium/adding-third-party-crates.md msgid "How to audit its source code for sufficient safety." -msgstr "" +msgstr "Làm thế nào để kiểm tra mã nguồn của nó để đảm bảo đủ an toàn." #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "Configuring the `Cargo.toml` file to add crates" -msgstr "" +msgstr "Định cấu hình tệp `Cargo.toml` để thêm 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):" +"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 có một tập hợp các phần phụ thuộc crate trực tiếp được quản lý tập " +"trung. Những hoạt động này được quản lý thông qua một " +"[`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 "" @@ -14328,6 +16626,13 @@ msgid "" "# lots more...\n" "```" msgstr "" +"``` toml\n" +"[phụ thuộc]\n" +"bitflags = \"1\"\n" +"cfg-if = \"1\"\n" +"cxx = \"1\"\n" +"# còn nhiều nữa...\n" +"```" #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md msgid "" @@ -14336,121 +16641,158 @@ msgid "" "dependencies.html) --- most commonly, you'll want to specify the `features` " "that you wish to enable in the crate." msgstr "" +"Giống như bất kỳ `Cargo.toml` nào khác, bạn có thể chỉ định [thêm chi tiết " +"về các phần phụ thuộc](https://doc.rust-lang.org/cargo/reference/specifying-" +"dependency.html) --- thông thường nhất là bạn sẽ muốn chỉ định `tính năng` " +"mà bạn muốn bật trong crate." #: src/chromium/adding-third-party-crates/configuring-cargo-toml.md 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." +"information in an additional file, `gnrt_config.toml`, which we'll meet " +"next." msgstr "" +"Khi thêm crate vào Chromium, bạn thường cần cung cấp một số thông tin bổ " +"sung trong tệp bổ sung, `gnrt_config.toml`, chúng ta sẽ gặp tệp này ở phần " +"tiếp theo." #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md msgid "" -"Alongside `Cargo.toml` is [`gnrt_config.toml`](https://source.chromium.org/" -"chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/gnrt_config." -"toml). This contains Chromium-specific extensions to crate handling." +"Alongside `Cargo.toml` is " +"[`gnrt_config.toml`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/gnrt_config.toml)." +" This contains Chromium-specific extensions to crate handling." msgstr "" +"Cùng với `Cargo.toml` là " +"[`gnrt_config.toml`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/gnrt_config.toml)." +" Phần này chứa các tiện ích mở rộng dành riêng cho Chromium để xử lý crate." #: 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 "" +"Nếu bạn thêm một crate mới, bạn nên chỉ định ít nhất `nhóm`. Đây là một " +"trong:" #: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md #: src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "For instance," -msgstr "" +msgstr "Ví dụ," #: 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." msgstr "" +"Tùy thuộc vào cách bố trí mã nguồn crate, bạn cũng có thể cần sử dụng tệp " +"này để chỉ định nơi có thể tìm thấy (các) tệp `LICENSE` của nó." #: 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." msgstr "" +"Sau này, chúng ta sẽ thấy một số thứ khác mà bạn cần phải định cấu hình " +"trong tệp này để giải quyết vấn đề." #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "" -"A tool called `gnrt` knows how to download crates and how to generate `BUILD." -"gn` rules." +"A tool called `gnrt` knows how to download crates and how to generate " +"`BUILD.gn` rules." msgstr "" +"Một công cụ có tên `gnrt` biết cách tải xuống các crate và cách tạo quy tắc " +"`BUILD.gn`." #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "To start, download the crate you want like this:" -msgstr "" +msgstr "Để bắt đầu, hãy tải xuống crate bạn muốn như thế này:" #: 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." +"`crates.io`. See [the earlier section](../cargo.md) discussing this security" +" decision." msgstr "" +"Mặc dù công cụ `gnrt` là một phần của mã nguồn Chromium, nhưng bằng cách " +"chạy lệnh này, bạn sẽ tải xuống và chạy các phần phụ thuộc của nó từ " +"`crates.io`. Xem [phần trước](../cargo.md) thảo luận về quyết định bảo mật " +"này." #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "This `vendor` command may download:" -msgstr "" +msgstr "Lệnh `nhà cung cấp` này có thể tải xuống:" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "Your crate" -msgstr "" +msgstr "Crate của bạn" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "Direct and transitive dependencies" -msgstr "" +msgstr "Sự phụ thuộc trực tiếp và bắc cầu" #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "" -"New versions of other crates, as required by `cargo` to resolve the complete " -"set of crates required by Chromium." +"New versions of other crates, as required by `cargo` to resolve the complete" +" set of crates required by Chromium." msgstr "" +"Phiên bản mới của các crate khác, theo yêu cầu của `cargo` để giải quyết bộ " +"crate hoàn chỉnh theo yêu cầu của Chromium." #: src/chromium/adding-third-party-crates/downloading-crates.md msgid "" -"Chromium maintains patches for some crates, kept in `//third_party/rust/" -"chromium_crates_io/patches`. These will be reapplied automatically, but if " -"patching fails you may need to take manual action." +"Chromium maintains patches for some crates, kept in " +"`//third_party/rust/chromium_crates_io/patches`. These will be reapplied " +"automatically, but if patching fails you may need to take manual action." msgstr "" +"Chromium duy trì các bản vá cho một số crate, được lưu giữ trong " +"`//third_party/rust/chromium_crates_io/patches`. Chúng sẽ được áp dụng lại " +"tự động, nhưng nếu việc vá lỗi không thành công, bạn có thể cần phải thực " +"hiện thao tác thủ công." #: 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:" msgstr "" +"Sau khi bạn đã tải xuống crate, hãy tạo các tệp `BUILD.gn` như thế này:" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "Now run `git status`. You should find:" -msgstr "" +msgstr "Bây giờ hãy chạy `git status`. Bạn nên tìm:" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" -"At least one new crate source code in `third_party/rust/chromium_crates_io/" -"vendor`" +"At least one new crate source code in " +"`third_party/rust/chromium_crates_io/vendor`" msgstr "" +"Ít nhất một mã nguồn crate mới trong " +"`third_party/rust/chromium_crates_io/vendor`" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" -"At least one new `BUILD.gn` in `third_party/rust//v`" +"At least one new `BUILD.gn` in `third_party/rust//v`" msgstr "" +"Ít nhất một `BUILD.gn` mới trong `third_party/rust//v`" #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "An appropriate `README.chromium`" -msgstr "" +msgstr "Một `README.chromium` thích hợp" #: 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 "" +"\"Phiên bản học kỳ chính\" là [số phiên bản \"semver\" của " +"Rust](https://doc.rust-lang.org/cargo/reference/semver.html)." #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" "Take a close look, especially at the things generated in `third_party/rust`." msgstr "" +"Hãy xem xét kỹ, đặc biệt là những thứ được tạo ra trong `third_party/rust`." #: src/chromium/adding-third-party-crates/generating-gn-build-rules.md msgid "" @@ -14458,6 +16800,9 @@ msgid "" "it's to allow multiple incompatible versions of a crate, which is " "discouraged but sometimes necessary in the Cargo ecosystem." msgstr "" +"Nói một chút về semver --- và cụ thể là cách trong Chromium cho phép nhiều " +"phiên bản crate không tương thích, điều này không được khuyến khích nhưng " +"đôi khi cần thiết trong hệ sinh thái Cargo." #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "" @@ -14466,84 +16811,100 @@ msgid "" "design of `gn` and `ninja` which aim for static, deterministic, build rules " "to maximize parallelism and repeatability of builds." msgstr "" +"Nếu quá trình xây dựng của bạn không thành công, có thể là do `build.rs`: " +"các chương trình thực hiện những việc tùy ý tại thời điểm xây dựng. Về cơ " +"bản, điều này trái ngược với thiết kế của `gn` và` ninja` vốn nhắm đến các " +"quy tắc xây dựng tĩnh, xác định, nhằm tối đa hóa tính song song và khả năng " +"lặp lại của các bản dựng." #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "" "Some `build.rs` actions are automatically supported; others require action:" msgstr "" +"Một số hành động `build.rs` được hỗ trợ tự động; những người khác yêu cầu " +"hành động:" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "build script effect" -msgstr "" +msgstr "xây dựng hiệu ứng kịch bản" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Supported by our gn templates" -msgstr "" +msgstr "Được hỗ trợ bởi các mẫu gn của chúng tôi" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Work required by you" -msgstr "" +msgstr "Công việc do bạn yêu cầu" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Checking rustc version to configure features on and off" -msgstr "" +msgstr "Kiểm tra phiên bản Rustc để cấu hình bật và tắt tính năng" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Yes" -msgstr "" +msgstr "Đúng" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "None" -msgstr "" +msgstr "Không có" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Checking platform or CPU to configure features on and off" -msgstr "" +msgstr "Kiểm tra nền tảng hoặc CPU để bật và tắt cấu hình các tính năng" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Generating code" -msgstr "" +msgstr "Đang tạo mã" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Yes - specify in `gnrt_config.toml`" -msgstr "" +msgstr "Có - chỉ định trong `gnrt_config.toml`" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Building C/C++" -msgstr "" +msgstr "Xây dựng C/C++" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "No" -msgstr "" +msgstr "KHÔNG" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Patch around it" -msgstr "" +msgstr "Vá xung quanh nó" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "Arbitrary other actions" -msgstr "" +msgstr "Các hành động tùy tiện khác" #: src/chromium/adding-third-party-crates/resolving-problems.md msgid "" -"Fortunately, most crates don't contain a build script, and fortunately, most " -"build scripts only do the top two actions." +"Fortunately, most crates don't contain a build script, and fortunately, most" +" build scripts only do the top two actions." msgstr "" +"May mắn thay, hầu hết các crate không chứa tập lệnh xây dựng và may mắn " +"thay, hầu hết các tập lệnh xây dựng chỉ thực hiện hai hành động hàng đầu." #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" "If `ninja` complains about missing files, check the `build.rs` to see if it " "writes source code files." msgstr "" +"Nếu `ninja` phàn nàn về việc thiếu tệp, hãy kiểm tra `build.rs` để xem liệu " +"nó có ghi tệp mã nguồn hay không." #: 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 " +"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 "" +"Nếu vậy, hãy sửa đổi [`gnrt_config.toml`](../configuring-gnrt-config-" +"toml.md) để thêm `build-script-outputs` vào crate. Nếu đây là phần phụ thuộc" +" bắc cầu, tức là phần phụ thuộc mà mã Chromium không nên phụ thuộc trực tiếp" +" vào, thì hãy thêm `allow-first-party-usage=false`. Có một số ví dụ đã có " +"trong tập tin đó:" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" @@ -14553,6 +16914,11 @@ msgid "" "build-script-outputs = [\"tables.rs\"]\n" "```" msgstr "" +"``` toml\n" +"[crate.unicode-linebreak]\n" +"cho phép sử dụng bên thứ nhất = sai\n" +"build-script-outputs = [\"tables.rs\"]\n" +"```" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.md msgid "" @@ -14560,36 +16926,52 @@ msgid "" "`BUILD.gn` files to inform ninja that this particular output file is input " "to subsequent build steps." msgstr "" +"Bây giờ hãy chạy lại [`gnrt.py -- gen`](../generating-gn-build-rules.md) để " +"tạo lại các tệp `BUILD.gn` nhằm thông báo cho ninja rằng tệp đầu ra cụ thể " +"này là đầu vào cho các bước xây dựng tiếp theo." #: 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." -msgstr "" +"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 "" +"Một số crate sử dụng crate [`cc`](https://crates.io/crates/cc) để xây dựng " +"và liên kết các thư viện C/C++. Các crate khác phân tích cú pháp C/C++ bằng " +"cách sử dụng [`bindgen`](https://crates.io/crates/bindgen) trong tập lệnh " +"xây dựng của chúng. Không thể hỗ trợ những hành động này trong ngữ cảnh " +"Chromium --- hệ thống xây dựng gn, ninja và LLVM của chúng tôi rất cụ thể " +"trong việc thể hiện mối quan hệ giữa các hành động xây dựng." #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "So, your options are:" -msgstr "" +msgstr "Vì vậy, các lựa chọn của bạn là:" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "Avoid these crates" -msgstr "" +msgstr "Tránh xa những cái crate này" #: src/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.md msgid "Apply a patch to the crate." -msgstr "" +msgstr "Dán một miếng vá vào 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 "" +"Các bản vá phải được lưu giữ trong " +"`third_party/rust/chromium_crates_io/patches/` - ví dụ: xem [các bản " +"vá đối với crate " +"`cxx`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/patches/cxx/)" +" - và sẽ được `gnrt` tự động áp dụng mỗi khi nâng cấp crate." #: src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "" @@ -14597,20 +16979,27 @@ msgid "" "on a crate is simple. Find your `rust_static_library` target, and add a " "`dep` on the `:lib` target within your crate." msgstr "" +"Khi bạn đã thêm crate của bên thứ ba và tạo quy tắc xây dựng, việc tùy thuộc" +" vào crate rất đơn giản. Tìm mục tiêu `rust_static_library` của bạn và thêm " +"`dep` vào mục tiêu `:lib` trong crate của bạn." #: src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "Specifically," -msgstr "" +msgstr "Cụ thể," #: src/chromium/adding-third-party-crates/depending-on-a-crate.md 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" +"\"//bên thứ ba/Rust\" | tên crate | \"/v\" | phiên bản học kỳ lớn | \":lib\"\n" +" +-------------+ +----------------------+\n" +"```" #: src/chromium/adding-third-party-crates/depending-on-a-crate.md msgid "" @@ -14622,62 +17011,91 @@ msgid "" "}\n" "```" msgstr "" +"```gn\n" +"rust_static_library(\"my_rust_lib\") {\n" +" crate_root = \"lib.rs\"\n" +" sources = [ \"lib.rs\"]\n" +" deps = [ \"//third_party/rust/example_rust_crate/v1:lib\" ]\n" +"}\n" +"```" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "Auditing Third Party Crates" -msgstr "" +msgstr "Kiểm tra crate của bên thứ ba" #: src/chromium/adding-third-party-crates/reviews-and-audits.md 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?" -msgstr "" +"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?" +msgstr "" +"Việc thêm thư viện mới phải tuân theo [chính " +"sách](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/rust.md#Third_party-" +"review) tiêu chuẩn của Chromium, nhưng tất nhiên cũng phải trải qua quá " +"trình đánh giá về bảo mật. Vì bạn có thể đưa vào không chỉ một crate đơn lẻ " +"mà còn cả các phần phụ thuộc bắc cầu, nên có thể có rất nhiều mã cần xem " +"xét. Mặt khác, mã Rust an toàn có thể hạn chế các tác dụng phụ tiêu cực. Bạn" +" nên xem xét nó như thế nào?" #: 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 "" +"Theo thời gian, Chromium hướng đến việc chuyển sang một quy trình dựa trên " +"[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:" msgstr "" +"Trong khi đó, đối với mỗi lần bổ sung crate mới, chúng tôi sẽ kiểm tra những" +" điều sau:" #: 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?" +"macros, work out what they're for. Are they compatible with the way Chromium" +" is normally built?" msgstr "" +"Hiểu lý do tại sao mỗi crate được sử dụng. Mối quan hệ giữa các crate là gì?" +" Nếu hệ thống xây dựng cho mỗi crate chứa `build.rs` hoặc macro thủ tục, hãy" +" tìm hiểu xem chúng dùng để làm gì. Chúng có tương thích với cách xây dựng " +"Chromium thông thường không?" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "Check each crate seems to be reasonably well maintained" -msgstr "" +msgstr "Kiểm tra từng crate có vẻ được bảo trì tốt" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" -"Use `cd third-party/rust/chromium_crates_io; cargo audit` to check for known " -"vulnerabilities (first you'll need to `cargo install cargo-audit`, which " -"ironically involves downloading lots of dependencies from the internet[2](../" -"cargo.md))" +"Use `cd third-party/rust/chromium_crates_io; cargo audit` to check for known" +" vulnerabilities (first you'll need to `cargo install cargo-audit`, which " +"ironically involves downloading lots of dependencies from the " +"internet[2](../cargo.md))" msgstr "" +"Sử dụng `cd third_party/rust/chromium_crates_io; cargo audit` để kiểm tra " +"các lỗ hổng đã biết (trước tiên, bạn sẽ cần phải `cargo install cargo-" +"audit`, trớ trêu thay lại liên quan đến việc tải xuống nhiều phần phụ thuộc " +"từ internet[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 "" +"Đảm bảo mọi mã `không an toàn` đều đủ tốt cho [Quy tắc số " +"2](https://chromium.googlesource.com/chromium/src/+/main/docs/security/rule-" +"of-2.md#unsafe-code-in-safe-lingutions)" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "Check for any use of `fs` or `net` APIs" -msgstr "" +msgstr "Kiểm tra mọi hoạt động sử dụng API `fs` hoặc `net`" #: src/chromium/adding-third-party-crates/reviews-and-audits.md msgid "" @@ -14685,46 +17103,59 @@ msgid "" "that might have been maliciously inserted. (You can't realistically aim for " "100% perfection here: there's often just too much code.)" msgstr "" +"Đọc tất cả mã ở mức độ vừa đủ để tìm bất kỳ mã nào không đúng vị trí có thể " +"đã được chèn vào với mục đích xấu. (Trên thực tế, bạn không thể hướng tới sự" +" hoàn hảo 100% ở đây: thường có quá nhiều mã.)" #: 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 "" +"Đây chỉ là những hướng dẫn --- làm việc với những người đánh giá từ " +"`security@chromium.org` để tìm ra cách phù hợp để trở nên tin tưởng hơn vào " +"crate." #: src/chromium/adding-third-party-crates/checking-in.md msgid "Checking Crates into Chromium Source Code" -msgstr "" +msgstr "Kiểm tra crate vào mã nguồn Chromium" #: src/chromium/adding-third-party-crates/checking-in.md msgid "`git status` should reveal:" -msgstr "" +msgstr "`trạng thái git` sẽ tiết lộ:" #: src/chromium/adding-third-party-crates/checking-in.md msgid "Crate code in `//third_party/rust/chromium_crates_io`" -msgstr "" +msgstr "Mã crate trong `//third_party/rust/chromium_crates_io`" #: src/chromium/adding-third-party-crates/checking-in.md msgid "" -"Metadata (`BUILD.gn` and `README.chromium`) in `//third_party/rust//" -"`" +"Metadata (`BUILD.gn` and `README.chromium`) in " +"`//third_party/rust//`" msgstr "" +"Siêu dữ liệu (`BUILD.gn` và `README.chromium`) trong " +"`//third_party/rust//`" #: src/chromium/adding-third-party-crates/checking-in.md msgid "Please also add an `OWNERS` file in the latter location." -msgstr "" +msgstr "Ngoài ra, vui lòng thêm tệp `CHỦ SỞ HỮU` ở vị trí sau." #: 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 "" +"Bạn nên đưa tất cả những thứ này cùng với các thay đổi `Cargo.toml` và " +"`gnrt_config.toml` vào kho lưu trữ Chromium." #: 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 "" +"**Quan trọng**: bạn cần sử dụng `git add -f` vì nếu không, các tệp " +"`.gitignore` có thể dẫn đến một số tệp bị bỏ qua." #: src/chromium/adding-third-party-crates/checking-in.md msgid "" @@ -14733,96 +17164,125 @@ msgid "" "branches, and many projects still use non-inclusive terminology there. So " "you may need to run:" msgstr "" +"Khi làm như vậy, bạn có thể nhận thấy quá trình kiểm tra gửi trước không " +"thành công do ngôn ngữ không bao gồm. Điều này là do dữ liệu của Rust có xu " +"hướng bao gồm tên của các nhánh git và nhiều dự án vẫn sử dụng thuật ngữ " +"không bao gồm ở đó. Vì vậy, bạn có thể cần phải chạy:" #: 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." -msgstr "" +"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 "" +"Với tư cách là CHỦ SỞ HỮU của bất kỳ phần phụ thuộc Chromium nào của bên thứ" +" ba, bạn [phải luôn cập nhật mọi bản sửa lỗi bảo " +"mật](https://chromium.googlesource.com/chromium/src/+/main/docs/adding_to_third_party.md#add-" +"owners). Chúng tôi hy vọng rằng chúng tôi sẽ sớm tự động hóa việc này cho " +"các crate Rust, nhưng hiện tại, trách nhiệm của bạn vẫn là giống như bất kỳ " +"sự phụ thuộc nào khác của bên thứ ba." #: 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 "" +"Thêm [uwuify](https://crates.io/crates/uwuify) vào Chrome, tắt [tính năng " +"mặc định](https://doc.rust-lang.org/cargo/reference/features.html#the-" +"default-feature của hòm). Giả sử rằng crate sẽ được sử dụng để vận chuyển " +"Chromium nhưng sẽ không được dùng để xử lý thông tin đầu vào không đáng tin " +"cậy." #: 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 "" +"(Trong bài tập tiếp theo, chúng ta sẽ sử dụng uwuify từ Chromium, nhưng bạn " +"có thể bỏ qua và thực hiện ngay bây giờ nếu muốn. Hoặc, bạn có thể tạo một " +"[`rust_executable` " +"target](https://source.chromium.org/chromium/chromium/src/+/main:build/rust/rust_executable.gni)" +" sử dụng `uwuify`)." #: src/exercises/chromium/third-party.md msgid "Students will need to download lots of transitive dependencies." -msgstr "" +msgstr "Học sinh sẽ cần tải xuống rất nhiều phụ thuộc bắc cầu." #: src/exercises/chromium/third-party.md msgid "The total crates needed are:" -msgstr "" +msgstr "Tổng số crate cần thiết là:" #: src/exercises/chromium/third-party.md msgid "`instant`," -msgstr "" +msgstr "`instant`," #: src/exercises/chromium/third-party.md msgid "`lock_api`," -msgstr "" +msgstr "`lock_api`," #: src/exercises/chromium/third-party.md msgid "`parking_lot`," -msgstr "" +msgstr "`parking_lot`," #: src/exercises/chromium/third-party.md msgid "`parking_lot_core`," -msgstr "" +msgstr "`bãi_đỗ_lõi`," #: src/exercises/chromium/third-party.md msgid "`redox_syscall`," -msgstr "" +msgstr "`redox_syscall`," #: src/exercises/chromium/third-party.md msgid "`scopeguard`," -msgstr "" +msgstr "`scopeguard`," #: src/exercises/chromium/third-party.md msgid "`smallvec`, and" -msgstr "" +msgstr "`smallvec`, và" #: src/exercises/chromium/third-party.md msgid "`uwuify`." -msgstr "" +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." msgstr "" +"Nếu học sinh tải nhiều hơn thế, có lẽ họ đã quên tắt các tính năng mặc định." #: src/exercises/chromium/third-party.md msgid "" -"Thanks to [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) for this crate!" +"Thanks to [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) for this " +"crate!" msgstr "" +"Cảm ơn [Daniel Liu](https://github.com/Daniel-Liu-c0deb0t) vì chiếc crate " +"này!" #: src/exercises/chromium/bringing-it-together.md msgid "Bringing It Together --- Exercise" -msgstr "" +msgstr "Mang nó lại với nhau --- Tập thể dục" #: src/exercises/chromium/bringing-it-together.md msgid "" -"In this exercise, you're going to add a whole new Chromium feature, bringing " -"together everything you already learned." +"In this exercise, you're going to add a whole new Chromium feature, bringing" +" together everything you already learned." msgstr "" +"Trong bài tập này, bạn sẽ thêm một tính năng hoàn toàn mới của Chromium, tập" +" hợp mọi thứ bạn đã học được." #: src/exercises/chromium/bringing-it-together.md msgid "The Brief from Product Management" -msgstr "" +msgstr "Tóm tắt từ quản lý sản phẩm" #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14830,12 +17290,15 @@ msgid "" "It's important that we get Chromium for Pixies delivered to them as soon as " "possible." msgstr "" +"Một cộng đồng tiên nữ đã được phát hiện sống trong một khu rừng nhiệt đới xa" +" xôi. Điều quan trọng là chúng tôi phải cung cấp Chromium dành cho Pixies " +"cho họ càng sớm càng tốt." #: src/exercises/chromium/bringing-it-together.md msgid "" "The requirement is to translate all Chromium's UI strings into Pixie " "language." -msgstr "" +msgstr "Yêu cầu là dịch toàn bộ chuỗi UI của Chromium sang ngôn ngữ Pixie." #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14843,22 +17306,29 @@ msgid "" "language is very close to English, and it turns out there's a Rust crate " "which does the translation." msgstr "" +"Không có thời gian để chờ đợi những bản dịch thích hợp, nhưng may mắn thay, " +"ngôn ngữ pixie rất gần với tiếng Anh, và hóa ra có một cái crate Rust đảm " +"nhiệm việc dịch thuật." #: src/exercises/chromium/bringing-it-together.md msgid "" -"In fact, you already [imported that crate in the previous exercise](https://" -"crates.io/crates/uwuify)." +"In fact, you already [imported that crate in the previous " +"exercise](https://crates.io/crates/uwuify)." msgstr "" +"Trên thực tế, bạn đã [nhập crate đó trong bài tập " +"trước](https://crates.io/crates/uwuify)." #: src/exercises/chromium/bringing-it-together.md msgid "" "(Obviously, real translations of Chrome require incredible care and " "diligence. Don't ship this!)" msgstr "" +"(Rõ ràng, các bản dịch thực sự của Chromium đòi hỏi sự cẩn thận và siêng " +"năng đáng kinh ngạc. Đừng vận chuyển thứ này!)" #: src/exercises/chromium/bringing-it-together.md msgid "Steps" -msgstr "" +msgstr "bước" #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14866,12 +17336,18 @@ msgid "" "strings before display. In this special build of Chromium, it should always " "do this irrespective of the setting of `mangle_localized_strings_`." msgstr "" +"Sửa đổi `ResourceBundle:: MaybeMangleLocalizedString` để nó loại bỏ tất cả " +"các chuỗi trước khi hiển thị. Trong bản dựng đặc biệt này của Chromium, bản " +"dựng này phải luôn thực hiện việc này bất kể cài đặt của " +"`manle_localized_strings_`." #: src/exercises/chromium/bringing-it-together.md msgid "" -"If you've done everything right across all these exercises, congratulations, " -"you should have created Chrome for pixies!" +"If you've done everything right across all these exercises, congratulations," +" you should have created Chrome for pixies!" msgstr "" +"Nếu bạn đã thực hiện đúng tất cả các bài tập này thì xin chúc mừng, lẽ ra " +"bạn đã tạo Chromium dành cho pixies!" #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14879,15 +17355,23 @@ msgid "" "and will probably decide that it's better to do the conversion on the C++ " "side using `base::UTF16ToUTF8` and back again." msgstr "" +"UTF16 so với UTF8. Học sinh nên biết rằng chuỗi Rust luôn là UTF8 và có thể " +"sẽ quyết định rằng tốt hơn nên thực hiện chuyển đổi ở phía C++ bằng cách sử " +"dụng `base::UTF16ToUTF8` và ngược lại." #: 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)." +"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)." msgstr "" +"Nếu sinh viên quyết định thực hiện chuyển đổi ở phía Rust, họ sẽ cần xem xét" +" [`String::from_utf16`](https://doc.rust-" +"lang.org/std/string/struct.String.html#method.from_utf16), xem xét việc xử " +"lý lỗi và xem xét [các loại được hỗ trợ CXX nào có thể chuyển nhiều " +"u16](https://cxx.rs/bind/slice.html)." #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14899,6 +17383,14 @@ msgid "" "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 "" +"Học sinh có thể thiết kế ranh giới C++/Rust theo nhiều cách khác nhau, ví " +"dụ: lấy và trả về chuỗi theo giá trị hoặc lấy tham chiếu có thể thay đổi cho" +" chuỗi. Nếu sử dụng tham chiếu có thể thay đổi, CXX có thể sẽ thông báo cho " +"học viên rằng họ cần sử dụng [`Pin`](https://doc.rust-lang.org/std/pin/). " +"Bạn có thể cần giải thích `Pin` làm gì, sau đó giải thích lý do tại sao CXX " +"cần nó để tham chiếu có thể thay đổi đến dữ liệu C++: câu trả lời là dữ liệu" +" C++ không thể di chuyển xung quanh như dữ liệu Rust, vì nó có thể chứa các " +"con trỏ tự tham chiếu." #: src/exercises/chromium/bringing-it-together.md msgid "" @@ -14906,22 +17398,28 @@ msgid "" "need to depend on a `rust_static_library` target. The student probably " "already did this." msgstr "" +"Mục tiêu C++ chứa `ResourceBundle:: MaybeMangleLocalizedString` sẽ cần phụ " +"thuộc vào mục tiêu `rust_static_library`. Học sinh có lẽ đã làm điều này." #: src/exercises/chromium/bringing-it-together.md msgid "" -"The `rust_static_library` target will need to depend on `//third_party/rust/" -"uwuify/v0_2:lib`." +"The `rust_static_library` target will need to depend on " +"`//third_party/rust/uwuify/v0_2:lib`." msgstr "" +"Mục tiêu `rust_static_library` sẽ cần phụ thuộc vào " +"`//third_party/rust/uwuify/v0_2:lib`." #: src/exercises/chromium/solutions.md msgid "" -"Solutions to the Chromium exercises can be found in [this series of CLs]" -"(https://chromium-review.googlesource.com/c/chromium/src/+/5096560)." +"Solutions to the Chromium exercises can be found in [this series of " +"CLs](https://chromium-review.googlesource.com/c/chromium/src/+/5096560)." msgstr "" +"Bạn có thể tìm thấy lời giải cho các bài tập về Chromium trong [loạt CL " +"này](https://chromium-review.googlesource.com/c/chromium/src/+/5096560)." #: src/bare-metal.md msgid "Welcome to Bare Metal Rust" -msgstr "" +msgstr "Chào mừng đến với Bare Metal Rust" #: src/bare-metal.md msgid "" @@ -14930,202 +17428,230 @@ msgid "" "Comprehensive Rust course), and ideally also have some experience with bare-" "metal programming in some other language such as C." msgstr "" +"Đây là khóa học độc lập kéo dài một ngày về Rust kim loại trần, nhắm đến " +"những người đã quen thuộc với những điều cơ bản về Rust (có lẽ sau khi hoàn " +"thành khóa học Rust toàn diện) và lý tưởng nhất là cũng có một số kinh " +"nghiệm về lập trình kim loại trần bằng một số ngôn ngữ khác chẳng hạn như 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 "" +"Hôm nay chúng ta sẽ nói về Rust 'kim loại trần': chạy mã Rust mà không cần " +"hệ điều hành bên dưới. Điều này sẽ được chia thành nhiều phần:" #: src/bare-metal.md msgid "What is `no_std` Rust?" -msgstr "" +msgstr "`no_std` Rust là gì?" #: src/bare-metal.md msgid "Writing firmware for microcontrollers." -msgstr "" +msgstr "Viết firmware cho vi điều khiển." #: src/bare-metal.md msgid "Writing bootloader / kernel code for application processors." -msgstr "" +msgstr "Viết mã bootloader/kernel cho bộ xử lý ứng dụng." #: src/bare-metal.md msgid "Some useful crates for bare-metal Rust development." -msgstr "" +msgstr "Một số crate hữu ích để phát triển Rust kim loại trần." #: src/bare-metal.md 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." +"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." msgstr "" +"Đối với phần vi điều khiển của khóa học, chúng tôi sẽ sử dụng [BBC " +"micro:bit](https://microbit.org/) v2 làm ví dụ. Đó là [board phát " +"triển](https://tech.microbit.org/hardware/) dựa trên bộ vi điều khiển Nordic" +" nRF51822 với một số đèn LED và nút, gia tốc kế và la bàn được kết nối I2C " +"cũng như trình gỡ lỗi SWD tích hợp." #: src/bare-metal.md msgid "" "To get started, install some tools we'll need later. On gLinux or Debian:" msgstr "" +"Để bắt đầu, hãy cài đặt một số công cụ chúng ta sẽ cần sau này. Trên gLinux " +"hoặc Debian:" #: src/bare-metal.md msgid "" "And give users in the `plugdev` group access to the micro:bit programmer:" msgstr "" +"Và cấp cho người dùng trong nhóm `plugdev` quyền truy cập vào trình lập " +"trình micro:bit:" #: src/bare-metal.md src/bare-metal/microcontrollers/debugging.md msgid "On MacOS:" -msgstr "" +msgstr "Trên MacOS:" #: src/bare-metal/no_std.md msgid "`core`" -msgstr "" +msgstr "`lõi`" #: src/bare-metal/no_std.md msgid "`std`" -msgstr "" +msgstr "`std`" #: src/bare-metal/no_std.md msgid "Slices, `&str`, `CStr`" -msgstr "" +msgstr "Lát, `&str`, `CStr`" #: src/bare-metal/no_std.md msgid "`NonZeroU8`..." -msgstr "" +msgstr "`NonZeroU8`..." #: src/bare-metal/no_std.md msgid "`Option`, `Result`" -msgstr "" +msgstr "`Tùy chọn`, `Kết quả`" #: src/bare-metal/no_std.md msgid "`Display`, `Debug`, `write!`..." -msgstr "" +msgstr "`Hiển thị`, `Gỡ lỗi`, `viết!`..." #: src/bare-metal/no_std.md msgid "`panic!`, `assert_eq!`..." -msgstr "" +msgstr "`hoảng loạn!`, `assert_eq!`..." #: src/bare-metal/no_std.md msgid "`NonNull` and all the usual pointer-related functions" -msgstr "" +msgstr "`NonNull` và tất cả các hàm liên quan đến con trỏ thông thường" #: src/bare-metal/no_std.md msgid "`Future` and `async`/`await`" -msgstr "" +msgstr "`Tương lai` và `async`/`await`" #: src/bare-metal/no_std.md msgid "`fence`, `AtomicBool`, `AtomicPtr`, `AtomicU32`..." -msgstr "" +msgstr "`hàng rào`, `AtomicBool`, `AtomicPtr`, `AtomicU32`..." #: src/bare-metal/no_std.md msgid "`Duration`" -msgstr "" +msgstr "`Thời lượng`" #: src/bare-metal/no_std.md msgid "`Box`, `Cow`, `Arc`, `Rc`" -msgstr "" +msgstr "`Hộp`, `Bò`, `Arc`, `Rc`" #: src/bare-metal/no_std.md msgid "`Vec`, `BinaryHeap`, `BtreeMap`, `LinkedList`, `VecDeque`" -msgstr "" +msgstr "`Vec`, `BinaryHeap`, `BtreeMap`, `LinkedList`, `VecDeque`" #: src/bare-metal/no_std.md msgid "`String`, `CString`, `format!`" -msgstr "" +msgstr "`Chuỗi`, `CString`, `định dạng!`" #: src/bare-metal/no_std.md msgid "`Error`" -msgstr "" +msgstr "`Lỗi`" #: src/bare-metal/no_std.md msgid "`Mutex`, `Condvar`, `Barrier`, `Once`, `RwLock`, `mpsc`" -msgstr "" +msgstr "`Mutex`, `Condvar`, `Rào cản`, `Một lần`, `RwLock`, `mpsc`" #: src/bare-metal/no_std.md msgid "`File` and the rest of `fs`" -msgstr "" +msgstr "`File` và phần còn lại của `fs`" #: src/bare-metal/no_std.md msgid "`println!`, `Read`, `Write`, `Stdin`, `Stdout` and the rest of `io`" msgstr "" +"`println!`, `Read`, `Write`, `Stdin`, `Stdout` và phần còn lại của `io`" #: src/bare-metal/no_std.md msgid "`Path`, `OsString`" -msgstr "" +msgstr "`Đường dẫn`, `OsString`" #: src/bare-metal/no_std.md msgid "`net`" -msgstr "" +msgstr "`net`" #: src/bare-metal/no_std.md msgid "`Command`, `Child`, `ExitCode`" -msgstr "" +msgstr "`Lệnh`, `Con`, `Mã Thoát`" #: src/bare-metal/no_std.md msgid "`spawn`, `sleep` and the rest of `thread`" -msgstr "" +msgstr "`spawn`, `sleep` và phần còn lại của `thread`" #: src/bare-metal/no_std.md msgid "`SystemTime`, `Instant`" -msgstr "" +msgstr "`Thời gian hệ thống`, `Tức thì`" #: src/bare-metal/no_std.md msgid "`HashMap` depends on RNG." -msgstr "" +msgstr "`HashMap` phụ thuộc vào RNG." #: src/bare-metal/no_std.md msgid "`std` re-exports the contents of both `core` and `alloc`." -msgstr "" +msgstr "`std` tái xuất nội dung của cả `core` và `alloc`." #: src/bare-metal/minimal.md msgid "A minimal `no_std` program" -msgstr "" +msgstr "Một chương trình `no_std` tối thiểu" #: src/bare-metal/minimal.md msgid "This will compile to an empty binary." -msgstr "" +msgstr "Điều này sẽ biên dịch thành một nhị phân trống." #: src/bare-metal/minimal.md msgid "`std` provides a panic handler; without it we must provide our own." msgstr "" +"`std` cung cấp một trình xử lý hoảng loạn; không có nó, chúng tôi phải tự " +"cung cấp." #: src/bare-metal/minimal.md msgid "It can also be provided by another crate, such as `panic-halt`." msgstr "" +"Nó cũng có thể được cung cấp bởi một crate khác, chẳng hạn như `panic-stop`." #: src/bare-metal/minimal.md msgid "" -"Depending on the target, you may need to compile with `panic = \"abort\"` to " -"avoid an error about `eh_personality`." +"Depending on the target, you may need to compile with `panic = \"abort\"` to" +" avoid an error about `eh_personality`." msgstr "" +"Tùy thuộc vào mục tiêu, bạn có thể cần phải biên dịch bằng `panic = " +"\"abort\"` để tránh lỗi về `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." +"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 "" +"Lưu ý rằng không có `chính` hoặc bất kỳ điểm vào nào khác; tùy bạn xác định " +"điểm vào của riêng mình. Điều này thường sẽ liên quan đến một tập lệnh liên " +"kết và một số mã lắp ráp để thiết lập mọi thứ sẵn sàng cho mã Rust chạy." #: 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 "" +"Để sử dụng `alloc`, bạn phải triển khai [bộ cấp phát toàn cục " +"(đống)](https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html)." #: src/bare-metal/alloc.md msgid "// SAFETY: `HEAP` is only used here and `entry` is only called once.\n" msgstr "" +"// AN TOÀN: `HEAP` chỉ được sử dụng ở đây và `entry` chỉ được gọi một lần.\n" #: src/bare-metal/alloc.md msgid "// Give the allocator some memory to allocate.\n" -msgstr "" +msgstr "// Cung cấp cho bộ cấp phát một số bộ nhớ để phân bổ.\n" #: src/bare-metal/alloc.md msgid "// Now we can do things that require heap allocation.\n" -msgstr "" +msgstr "// Bây giờ chúng ta có thể làm những việc yêu cầu phân bổ heap.\n" #: src/bare-metal/alloc.md msgid "\"A string\"" -msgstr "" +msgstr "\"Một sợi dây\"" #: src/bare-metal/alloc.md msgid "" @@ -15133,123 +17659,156 @@ msgid "" "system allocator. Other crates are available, or you can write your own or " "hook into your existing allocator." msgstr "" +"`buddy_system_allocator` là crate của bên thứ ba triển khai công cụ phân bổ " +"hệ thống bạn bè cơ bản. Các crate khác có sẵn hoặc bạn có thể tự viết hoặc " +"nối vào bộ cấp phát hiện có của mình." #: 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." msgstr "" +"Tham số const của `LockedHeap` là thứ tự tối đa của bộ cấp phát; tức là " +"trong trường hợp này, nó có thể phân bổ các vùng có kích thước lên tới " +"2\\*\\*32 byte." #: src/bare-metal/alloc.md msgid "" "If any crate in your dependency tree depends on `alloc` then you must have " -"exactly one global allocator defined in your binary. Usually this is done in " -"the top-level binary crate." +"exactly one global allocator defined in your binary. Usually this is done in" +" the top-level binary crate." msgstr "" +"Nếu bất kỳ crate nào trong cây phụ thuộc của bạn phụ thuộc vào `alloc` thì " +"bạn phải có chính xác một bộ cấp phát toàn cục được xác định trong tệp nhị " +"phân của mình. Thông thường việc này được thực hiện trong crate nhị phân cấp" +" cao nhất." #: 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 "" +"`crate bên ngoài hoảng loạn_halt vì _` là cần thiết để đảm bảo rằng crate " +"`panic_halt` được liên kết để chúng tôi có được trình xử lý hoảng loạn của " +"nó." #: src/bare-metal/alloc.md -msgid "This example will build but not run, as it doesn't have an entry point." -msgstr "" +msgid "" +"This example will build but not run, as it doesn't have an entry point." +msgstr "Ví dụ này sẽ được xây dựng nhưng không chạy vì nó không có điểm vào." #: src/bare-metal/microcontrollers.md msgid "" "The `cortex_m_rt` crate provides (among other things) a reset handler for " "Cortex M microcontrollers." msgstr "" +"Crate `cortex_m_rt` cung cấp (trong số những thứ khác) trình xử lý thiết lập" +" lại cho bộ vi điều khiển Cortex M." #: src/bare-metal/microcontrollers.md msgid "" "Next we'll look at how to access peripherals, with increasing levels of " "abstraction." msgstr "" +"Tiếp theo chúng ta sẽ xem xét cách truy cập các thiết bị ngoại vi với mức độ" +" trừu tượng ngày càng tăng." #: 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 "" +"Macro `cortex_m_rt::entry` yêu cầu hàm phải có loại `fn() -> !`, vì việc " +"quay lại trình xử lý đặt lại không có ý nghĩa gì." #: src/bare-metal/microcontrollers.md msgid "Run the example with `cargo embed --bin minimal`" -msgstr "" +msgstr "Chạy ví dụ với `cargo embed --bin tối thiểu`" #: src/bare-metal/microcontrollers/mmio.md msgid "" "Most microcontrollers access peripherals via memory-mapped IO. Let's try " "turning on an LED on our micro:bit:" msgstr "" +"Hầu hết các bộ vi điều khiển truy cập các thiết bị ngoại vi thông qua IO " +"được ánh xạ bộ nhớ. Hãy thử bật đèn LED trên micro:bit của chúng tôi:" #: src/bare-metal/microcontrollers/mmio.md msgid "/// GPIO port 0 peripheral address\n" -msgstr "" +msgstr "/// Địa chỉ ngoại vi cổng GPIO 0\n" #: src/bare-metal/microcontrollers/mmio.md msgid "// GPIO peripheral offsets\n" -msgstr "" +msgstr "// offset ngoại vi GPIO\n" #: src/bare-metal/microcontrollers/mmio.md msgid "// PIN_CNF fields\n" -msgstr "" +msgstr "// trường PIN_CNF\n" #: 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 "" +msgstr "// Định cấu hình chân GPIO 0 21 và 28 làm đầu ra kéo đẩy.\n" #: src/bare-metal/microcontrollers/mmio.md msgid "" "// SAFETY: The pointers are to valid peripheral control registers, and no\n" " // aliases exist.\n" msgstr "" +"// AN TOÀN: Các con trỏ tới các thanh ghi điều khiển ngoại vi hợp lệ và không\n" +" // bí danh tồn tại.\n" #: 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 "" +msgstr "// Đặt chân 28 ở mức thấp và chân 21 ở mức cao để bật đèn LED.\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 chân 21 được kết nối với cột đầu tiên của ma trận LED và chân 28 với " +"hàng đầu tiên." #: 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:" -msgstr "" +msgstr "Chạy ví dụ với:" #: src/bare-metal/microcontrollers/pacs.md msgid "Peripheral Access Crates" -msgstr "" +msgstr "Crate truy cập ngoại vi" #: src/bare-metal/microcontrollers/pacs.md msgid "" "[`svd2rust`](https://crates.io/crates/svd2rust) generates mostly-safe Rust " -"wrappers for memory-mapped peripherals from [CMSIS-SVD](https://www.keil.com/" -"pack/doc/CMSIS/SVD/html/index.html) files." +"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) tạo ra các trình bao bọc " +"Rust gần như an toàn cho các thiết bị ngoại vi được ánh xạ bộ nhớ từ các tệp" +" [CMSIS-SVD](https://www.keil.com/pack/doc/CMSIS/SVD/html/index.html)." #: 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." msgstr "" +"Tệp SVD (Mô tả chế độ xem hệ thống) là các tệp XML thường được cung cấp bởi " +"các nhà cung cấp silicon mô tả bản đồ bộ nhớ của thiết bị." #: src/bare-metal/microcontrollers/pacs.md msgid "" "They are organised by peripheral, register, field and value, with names, " "descriptions, addresses and so on." msgstr "" +"Chúng được sắp xếp theo ngoại vi, thanh ghi, trường và giá trị, cùng với " +"tên, mô tả, địa chỉ, v.v." #: src/bare-metal/microcontrollers/pacs.md msgid "" @@ -15257,93 +17816,117 @@ msgid "" "which patch the mistakes, add missing details, and publish the generated " "crates." msgstr "" +"Các tệp SVD thường có lỗi và không đầy đủ, vì vậy có nhiều dự án khác nhau " +"vá lỗi, bổ sung các chi tiết còn thiếu và xuất bản các crate được tạo." #: src/bare-metal/microcontrollers/pacs.md msgid "`cortex-m-rt` provides the vector table, among other things." -msgstr "" +msgstr "`cortex-m-rt` cung cấp bảng vectơ, cùng với những thứ khác." #: 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." msgstr "" +"Nếu bạn `cargo install Cargo-binutils` thì bạn có thể chạy `cargo objdump " +"--bin pac -- -d --no-show-raw-insn` để xem kết quả nhị phân." #: src/bare-metal/microcontrollers/hals.md msgid "HAL crates" -msgstr "" +msgstr "crate HAL" #: src/bare-metal/microcontrollers/hals.md msgid "" "[HAL crates](https://github.com/rust-embedded/awesome-embedded-rust#hal-" "implementation-crates) for many microcontrollers provide wrappers around " -"various peripherals. These generally implement traits from [`embedded-hal`]" -"(https://crates.io/crates/embedded-hal)." +"various peripherals. These generally implement traits from [`embedded-" +"hal`](https://crates.io/crates/embedded-hal)." msgstr "" +"[Hộp HAL](https://github.com/rust-embedded/awesome-embedded-rust#hal-" +"implementation-crates) dành cho nhiều bộ vi điều khiển cung cấp các lớp bọc " +"xung quanh nhiều thiết bị ngoại vi khác nhau. Chúng thường triển khai các " +"đặc điểm từ [`embedded-hal`](https://crates.io/crates/embedded-hal)." #: src/bare-metal/microcontrollers/hals.md msgid "// Create HAL wrapper for GPIO port 0.\n" -msgstr "" +msgstr "// Tạo trình bao bọc HAL cho cổng GPIO 0.\n" #: src/bare-metal/microcontrollers/hals.md msgid "" -"`set_low` and `set_high` are methods on the `embedded_hal` `OutputPin` trait." +"`set_low` and `set_high` are methods on the `embedded_hal` `OutputPin` " +"trait." msgstr "" +"`set_low` và `set_high` là các phương thức trên trait `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." msgstr "" +"Crate HAL tồn tại cho nhiều thiết bị Cortex-M và RISC-V, bao gồm nhiều bộ vi" +" điều khiển STM32, GD32, nRF, NXP, MSP430, AVR và PIC." #: src/bare-metal/microcontrollers/board-support.md msgid "Board support crates" -msgstr "" +msgstr "Crate hỗ trợ bảng" #: src/bare-metal/microcontrollers/board-support.md msgid "" "Board support crates provide a further level of wrapping for a specific " "board for convenience." msgstr "" +"Crate hỗ trợ ván cung cấp mức độ bọc cao hơn cho một tấm ván cụ thể để thuận" +" tiện hơn." #: 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." msgstr "" +"Trong trường hợp này, crate hỗ trợ bảng chỉ cung cấp nhiều tên hữu ích hơn " +"và khởi tạo một chút." #: src/bare-metal/microcontrollers/board-support.md msgid "" "The crate may also include drivers for some on-board devices outside of the " "microcontroller itself." msgstr "" +"Crate cũng có thể bao gồm trình điều khiển cho một số thiết bị tích hợp bên " +"ngoài bộ vi điều khiển." #: src/bare-metal/microcontrollers/board-support.md msgid "`microbit-v2` includes a simple driver for the LED matrix." -msgstr "" +msgstr "`microbit-v2` bao gồm một trình điều khiển đơn giản cho ma trận LED." #: src/bare-metal/microcontrollers/type-state.md msgid "The type state pattern" -msgstr "" +msgstr "Mẫu trạng thái loại" #: src/bare-metal/microcontrollers/type-state.md msgid "// let gpio0_01_again = gpio0.p0_01; // Error, moved.\n" -msgstr "" +msgstr "// hãy để gpio0_01_again = gpio0.p0_01; // Lỗi, đã di chuyển.\n" #: src/bare-metal/microcontrollers/type-state.md msgid "// pin_input.is_high(); // Error, moved.\n" -msgstr "" +msgstr "// pin_input.is_high(); // Lỗi, đã di chuyển.\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." msgstr "" +"Ghim không triển khai `Sao chép` hoặc `Bản sao`, vì vậy chỉ có thể tồn tại " +"một phiên bản của mỗi ghim. Khi một mã pin được di chuyển ra khỏi cấu trúc " +"cổng thì không ai khác có thể lấy nó." #: 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." msgstr "" +"Việc thay đổi cấu hình của mã pin sẽ tiêu tốn phiên bản mã pin cũ, do đó bạn" +" không thể tiếp tục sử dụng phiên bản cũ sau đó." #: src/bare-metal/microcontrollers/type-state.md msgid "" @@ -15353,53 +17936,70 @@ msgid "" "way without properly configuring it first. Illegal state transitions are " "caught at compile time." msgstr "" +"Loại giá trị cho biết trạng thái của nó: ví dụ: trong trường hợp này là " +"trạng thái cấu hình của chân GPIO. Điều này mã hóa máy trạng thái vào hệ " +"thống loại và đảm bảo rằng bạn không cố gắng sử dụng mã pin theo một cách " +"nhất định mà không định cấu hình mã pin đúng cách trước. Chuyển đổi trạng " +"thái bất hợp pháp bị bắt tại thời điểm biên dịch." #: 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." msgstr "" +"Bạn có thể gọi `is_high` trên chân đầu vào và `set_high` trên chân đầu ra, " +"nhưng không được ngược lại." #: src/bare-metal/microcontrollers/type-state.md msgid "Many HAL crates follow this pattern." -msgstr "" +msgstr "Nhiều crate HAL theo mô hình này." #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"The [`embedded-hal`](https://crates.io/crates/embedded-hal) crate provides a " -"number of traits covering common microcontroller peripherals:" +"The [`embedded-hal`](https://crates.io/crates/embedded-hal) crate provides a" +" number of traits covering common microcontroller peripherals:" msgstr "" +"Crate [`embedded-hal`](https://crates.io/crates/embedded-hal) cung cấp một " +"số đặc điểm bao gồm các thiết bị ngoại vi phổ biến của bộ vi điều khiển:" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "GPIO" -msgstr "" +msgstr "GPIO" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "PWM" -msgstr "" +msgstr "xung điện" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "Delay timers" -msgstr "" +msgstr "Bộ hẹn giờ trễ" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "I2C and SPI buses and devices" -msgstr "" +msgstr "Xe buýt và thiết bị I2C và SPI" #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" "Similar traits for byte streams (e.g. UARTs), CAN buses and RNGs and broken " "out into [`embedded-io`](https://crates.io/crates/embedded-io), [`embedded-" -"can`](https://crates.io/crates/embedded-can) and [`rand_core`](https://" -"crates.io/crates/rand_core) respectively." +"can`](https://crates.io/crates/embedded-can) and " +"[`rand_core`](https://crates.io/crates/rand_core) respectively." msgstr "" +"Các đặc điểm tương tự đối với luồng byte (ví dụ: UART), bus CAN và RNG và " +"được chia thành [`embedded-io`](https://crates.io/crates/embedded-io), " +"[`embedded-can`](https://crates.io/crates/embedded-can) và " +"[`rand_core`](https://crates.io/crates/rand_core) tương ứng." #: 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 device instance." +"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 device instance." msgstr "" +"Sau đó, các crate khác triển khai [trình điều " +"khiển](https://github.com/rust-embedded/awesome-embedded-rust#driver-crates)" +" về các đặc điểm này, ví dụ: trình điều khiển gia tốc kế có thể cần phiên " +"bản thiết bị I2C hoặc SPI." #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" @@ -15407,51 +18007,68 @@ msgid "" "them, as initialisation and configuration is usually highly platform-" "specific." msgstr "" +"Các đặc điểm bao gồm việc sử dụng các thiết bị ngoại vi nhưng không khởi tạo" +" hoặc định cấu hình chúng, vì việc khởi tạo và cấu hình thường mang tính đặc" +" thù cao cho nền tảng." #: 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." msgstr "" +"Có các triển khai cho nhiều bộ vi điều khiển, cũng như các nền tảng khác như" +" Linux trên Raspberry Pi." #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" -"[`embedded-hal-async`](https://crates.io/crates/embedded-hal-async) provides " -"async versions of the traits." +"[`embedded-hal-async`](https://crates.io/crates/embedded-hal-async) provides" +" async versions of the traits." msgstr "" +"[`embedded-hal-async`](https://crates.io/crates/embedded-hal-async) cung cấp" +" các phiên bản không đồng bộ của các đặc điểm." #: src/bare-metal/microcontrollers/embedded-hal.md msgid "" "[`embedded-hal-nb`](https://crates.io/crates/embedded-hal-nb) provides " -"another approach to non-blocking I/O, based on the [`nb`](https://crates.io/" -"crates/nb) crate." +"another approach to non-blocking I/O, based on the " +"[`nb`](https://crates.io/crates/nb) crate." msgstr "" +"[`embedded-hal-nb`](https://crates.io/crates/embedded-hal-nb) cung cấp một " +"cách tiếp cận khác cho I/O không chặn, dựa trên crate " +"[`nb`](https://crates.io/crates/nb)." #: 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." msgstr "" +"[probe-rs](https://probe.rs/) là bộ công cụ tiện dụng để gỡ lỗi nhúng, giống" +" như OpenOCD nhưng được tích hợp tốt hơn." #: src/bare-metal/microcontrollers/probe-rs.md msgid "" "SWD (Serial Wire Debug) and JTAG via CMSIS-DAP, ST-Link and J-Link probes" msgstr "" +"SWD (Gỡ lỗi dây nối tiếp) và JTAG thông qua đầu dò CMSIS-DAP, ST-Link và " +"J-Link" #: src/bare-metal/microcontrollers/probe-rs.md msgid "GDB stub and Microsoft DAP (Debug Adapter Protocol) server" -msgstr "" +msgstr "Sơ khai GDB và máy chủ Microsoft DAP (Giao thức bộ điều hợp gỡ lỗi)" #: src/bare-metal/microcontrollers/probe-rs.md msgid "Cargo integration" -msgstr "" +msgstr "Cargo integration" #: 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." +"(Real Time Transfers) output and connect GDB. It's configured by an " +"`Embed.toml` file in your project directory." msgstr "" +"`cargo-embed` là một cargo sub-command để xây dựng và flash các tệp nhị " +"phân, ghi nhật ký đầu ra RTT (Chuyển thời gian thực) và kết nối GDB. Nó được" +" định cấu hình bởi tệp `Embed.toml` trong thư mục dự án của bạn." #: src/bare-metal/microcontrollers/probe-rs.md msgid "" @@ -15460,24 +18077,34 @@ msgid "" "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) là " +"giao thức tiêu chuẩn của Arm qua USB để trình gỡ lỗi trong mạch truy cập vào" +" Cổng truy cập gỡ lỗi CoreSight của nhiều bộ xử lý Arm Cortex khác nhau. Đó " +"là chức năng mà trình gỡ lỗi tích hợp trên micro:bit của BBC sử dụng." #: 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." msgstr "" +"ST-Link là dòng sản phẩm gỡ lỗi nội mạch của ST Microelectronics, J-Link là " +"dòng sản phẩm của 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." msgstr "" +"Cổng truy cập gỡ lỗi thường là giao diện JTAG 5 chân hoặc Gỡ lỗi dây nối " +"tiếp 2 chân." #: 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." msgstr "" +"thăm dò-rs là một thư viện mà bạn có thể tích hợp vào các công cụ của riêng " +"mình nếu muốn." #: src/bare-metal/microcontrollers/probe-rs.md msgid "" @@ -15485,276 +18112,330 @@ msgid "" "adapter-protocol/) lets VSCode and other IDEs debug code running on any " "supported microcontroller." msgstr "" +"[Giao thức bộ điều hợp gỡ lỗi của " +"Microsoft](https://microsoft.github.io/debug-adapter-protocol/) cho phép " +"VSCode và các IDE khác chạy mã gỡ lỗi trên mọi bộ vi điều khiển được hỗ trợ." #: src/bare-metal/microcontrollers/probe-rs.md msgid "cargo-embed is a binary built using the probe-rs library." msgstr "" +"Cargo-embed là một tệp nhị phân được xây dựng bằng thư viện thăm dò-rs." #: src/bare-metal/microcontrollers/probe-rs.md msgid "" "RTT (Real Time Transfers) is a mechanism to transfer data between the debug " "host and the target through a number of ringbuffers." msgstr "" +"RTT (Truyền thời gian thực) là một cơ chế truyền dữ liệu giữa máy chủ gỡ lỗi" +" và mục tiêu thông qua một số bộ đệm chuông." #: src/bare-metal/microcontrollers/debugging.md msgid "_Embed.toml_:" -msgstr "" +msgstr "_Nhúng.toml_:" #: src/bare-metal/microcontrollers/debugging.md msgid "In one terminal under `src/bare-metal/microcontrollers/examples/`:" msgstr "" +"Trong một thiết bị đầu cuối trong `src/bare-" +"metal/microcontrollers/examples/`:" #: src/bare-metal/microcontrollers/debugging.md msgid "In another terminal in the same directory:" -msgstr "" +msgstr "Trong một thiết bị đầu cuối khác trong cùng thư mục:" #: src/bare-metal/microcontrollers/debugging.md msgid "On gLinux or Debian:" -msgstr "" +msgstr "Trên gLinux hoặc Debian:" #: src/bare-metal/microcontrollers/debugging.md msgid "In GDB, try running:" -msgstr "" +msgstr "Trong GDB, hãy thử chạy:" #: src/bare-metal/microcontrollers/other-projects.md #: src/bare-metal/aps/other-projects.md msgid "Other projects" -msgstr "" +msgstr "Các dự án khác" #: src/bare-metal/microcontrollers/other-projects.md msgid "[RTIC](https://rtic.rs/)" -msgstr "" +msgstr "[RTIC](https://rtic.rs/)" #: src/bare-metal/microcontrollers/other-projects.md msgid "\"Real-Time Interrupt-driven Concurrency\"" -msgstr "" +msgstr "\"Đồng thời theo hướng ngắt thời gian thực\"" #: src/bare-metal/microcontrollers/other-projects.md msgid "" "Shared resource management, message passing, task scheduling, timer queue" msgstr "" +"Quản lý tài nguyên được chia sẻ, truyền tin nhắn, lập lịch tác vụ, xếp hàng " +"hẹn giờ" #: src/bare-metal/microcontrollers/other-projects.md msgid "[Embassy](https://embassy.dev/)" -msgstr "" +msgstr "[Đại sứ quán](https://embassy.dev/)" #: src/bare-metal/microcontrollers/other-projects.md msgid "`async` executors with priorities, timers, networking, USB" msgstr "" +"Trình thực thi `async` với mức độ ưu tiên, bộ hẹn giờ, kết nối mạng, USB" #: src/bare-metal/microcontrollers/other-projects.md msgid "[TockOS](https://www.tockos.org/documentation/getting-started)" -msgstr "" +msgstr "[TockOS](https://www.tockos.org/documentation/getting-started)" #: src/bare-metal/microcontrollers/other-projects.md msgid "" "Security-focused RTOS with preemptive scheduling and Memory Protection Unit " "support" msgstr "" +"RTOS tập trung vào bảo mật với tính năng lập lịch ưu tiên và hỗ trợ Đơn vị " +"bảo vệ bộ nhớ" #: src/bare-metal/microcontrollers/other-projects.md msgid "[Hubris](https://hubris.oxide.computer/)" -msgstr "" +msgstr "[Hubris](https://hubris.oxide.computer/)" #: src/bare-metal/microcontrollers/other-projects.md msgid "" "Microkernel RTOS from Oxide Computer Company with memory protection, " "unprivileged drivers, IPC" msgstr "" +"Microkernel RTOS của Oxide Computer Company với tính năng bảo vệ bộ nhớ, " +"trình điều khiển không có đặc quyền, IPC" #: src/bare-metal/microcontrollers/other-projects.md msgid "[Bindings for FreeRTOS](https://github.com/lobaro/FreeRTOS-rust)" msgstr "" +"[Ràng buộc dành cho 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 "" +"Một số nền tảng có triển khai `std`, ví dụ: [esp-idf](https://esp-" +"rs.github.io/book/overview/USE-the-standard-library.html)." #: src/bare-metal/microcontrollers/other-projects.md msgid "RTIC can be considered either an RTOS or a concurrency framework." -msgstr "" +msgstr "RTIC có thể được coi là RTOS hoặc khung đồng thời." #: src/bare-metal/microcontrollers/other-projects.md msgid "It doesn't include any HALs." -msgstr "" +msgstr "Nó không bao gồm bất kỳ HAL nào." #: 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 "" +"Nó sử dụng Cortex-M NVIC (Bộ điều khiển ngắt ảo lồng nhau) để lập lịch thay " +"vì hạt nhân thích hợp." #: src/bare-metal/microcontrollers/other-projects.md msgid "Cortex-M only." -msgstr "" +msgstr "Chỉ có Cortex-M." #: src/bare-metal/microcontrollers/other-projects.md msgid "" "Google uses TockOS on the Haven microcontroller for Titan security keys." msgstr "" +"Google sử dụng TockOS trên bộ vi điều khiển Haven cho khóa bảo mật Titan." #: src/bare-metal/microcontrollers/other-projects.md msgid "" "FreeRTOS is mostly written in C, but there are Rust bindings for writing " "applications." msgstr "" +"FreeRTOS chủ yếu được viết bằng C, nhưng có các ràng buộc Rust để viết ứng " +"dụng." #: src/exercises/bare-metal/morning.md msgid "" "We will read the direction from an I2C compass, and log the readings to a " "serial port." -msgstr "" +msgstr "Chúng tôi sẽ đọc hướng từ la bàn I2C và ghi số đọc vào cổng nối tiếp." #: src/exercises/bare-metal/morning.md msgid "" "After looking at the exercises, you can look at the [solutions](solutions-" "morning.md) provided." msgstr "" +"Sau khi xem các bài tập, bạn có thể xem [giải pháp](solutions-morning.md) " +"được cung cấp." #: src/exercises/bare-metal/compass.md msgid "" "We will read the direction from an I2C compass, and log the readings to a " -"serial port. If you have time, try displaying it on the LEDs somehow too, or " -"use the buttons somehow." +"serial port. If you have time, try displaying it on the LEDs somehow too, or" +" use the buttons somehow." msgstr "" +"Chúng tôi sẽ đọc hướng từ la bàn I2C và ghi số đọc vào cổng nối tiếp. Nếu " +"bạn có thời gian, hãy thử hiển thị nó trên đèn LED bằng cách nào đó hoặc sử " +"dụng các nút bằng cách nào đó." #: src/exercises/bare-metal/compass.md msgid "Hints:" -msgstr "" +msgstr "Gợi ý:" #: 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 "" +"Kiểm tra tài liệu về các crate " +"[`lsm303agr`](https://docs.rs/lsm303agr/latest/lsm303agr/) và " +"[`microbit-v2`](https://docs.rs/microbit-v2/latest/microbit/), cũng như " +"[micro:bit hardware](https://tech.microbit.org/hardware/)." #: src/exercises/bare-metal/compass.md msgid "" -"The LSM303AGR Inertial Measurement Unit is connected to the internal I2C bus." -msgstr "" +"The LSM303AGR Inertial Measurement Unit is connected to the internal I2C " +"bus." +msgstr "Bộ đo quán tính LSM303AGR được kết nối với bus I2C bên trong." #: src/exercises/bare-metal/compass.md msgid "" "TWI is another name for I2C, so the I2C master peripheral is called TWIM." msgstr "" +"TWI là tên gọi khác của I2C nên thiết bị ngoại vi chính I2C được gọi là " +"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 "" +"Trình điều khiển LSM303AGR cần thứ gì đó triển khai đặc điểm " +"`embedded_hal::blocking::i2c::WriteRead`. Cấu trúc " +"[`microbit::hal::Twim`](https://docs.rs/microbit-v2/latest/microbit/hal/struct.Twim.html)" +" thực hiện điều này." #: src/exercises/bare-metal/compass.md msgid "" -"You have a [`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/" -"struct.Board.html) struct with fields for the various pins and peripherals." +"You have a " +"[`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/struct.Board.html)" +" struct with fields for the various pins and peripherals." msgstr "" +"Bạn có cấu trúc " +"[`microbit::Board`](https://docs.rs/microbit-v2/latest/microbit/struct.Board.html)" +" với các trường dành cho các chân cắm và thiết bị ngoại vi khác nhau." #: 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 "" +"Bạn cũng có thể xem [bảng dữ liệu " +"nRF52833](https://infocenter.nordicsemi.com/pdf/nRF52833_PS_v1.5.pdf) nếu " +"muốn, nhưng nó không cần thiết cho bài tập này." #: src/exercises/bare-metal/compass.md msgid "" -"Download the [exercise template](../../comprehensive-rust-exercises.zip) and " -"look in the `compass` directory for the following files." +"Download the [exercise template](../../comprehensive-rust-exercises.zip) and" +" look in the `compass` directory for the following files." msgstr "" +"Tải xuống [mẫu bài tập](../../comprehensive-rust-exercises.zip) và tìm trong" +" thư mục `compass` để tìm các tệp sau." #: src/exercises/bare-metal/compass.md src/exercises/bare-metal/rtc.md msgid "_src/main.rs_:" -msgstr "" +msgstr "_src/main.rs_:" #: src/exercises/bare-metal/compass.md src/exercises/bare-metal/rtc.md msgid "_Cargo.toml_ (you shouldn't need to change this):" -msgstr "" +msgstr "_Cargo.toml_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/compass.md msgid "_Embed.toml_ (you shouldn't need to change this):" -msgstr "" +msgstr "_Embed.toml_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/compass.md src/exercises/bare-metal/rtc.md msgid "_.cargo/config.toml_ (you shouldn't need to change this):" -msgstr "" +msgstr "_.cargo/config.toml_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/compass.md msgid "See the serial output on Linux with:" -msgstr "" +msgstr "Xem đầu ra nối tiếp trên Linux với:" #: src/exercises/bare-metal/compass.md msgid "" "Or on Mac OS something like (the device name may be slightly different):" -msgstr "" +msgstr "Hoặc trên Mac OS giống như (tên thiết bị có thể hơi khác):" #: src/exercises/bare-metal/compass.md msgid "Use Ctrl+A Ctrl+Q to quit picocom." -msgstr "" +msgstr "Sử dụng Ctrl+A Ctrl+Q để thoát picocom." #: src/exercises/bare-metal/solutions-morning.md msgid "Bare Metal Rust Morning Exercise" -msgstr "" +msgstr "Bài tập buổi sáng bằng kim loại trần" #: src/exercises/bare-metal/solutions-morning.md msgid "([back to exercise](compass.md))" -msgstr "" +msgstr "([quay lại bài tập](compass.md))" #: src/exercises/bare-metal/solutions-morning.md msgid "// Configure serial port.\n" -msgstr "" +msgstr "// Cấu hình cổng nối tiếp.\n" #: src/exercises/bare-metal/solutions-morning.md msgid "// Use the system timer as a delay provider.\n" -msgstr "" +msgstr "// Sử dụng bộ đếm thời gian của hệ thống làm nhà cung cấp độ trễ.\n" #: src/exercises/bare-metal/solutions-morning.md msgid "// Set up the I2C controller and Inertial Measurement Unit.\n" -msgstr "" +msgstr "// Thiết lập bộ điều khiển I2C và Đơn vị đo lường quán tính.\n" #: src/exercises/bare-metal/solutions-morning.md msgid "\"Setting up IMU...\"" -msgstr "" +msgstr "\"Đang thiết lập IMU...\"" #: src/exercises/bare-metal/solutions-morning.md msgid "// Set up display and timer.\n" -msgstr "" +msgstr "// Thiết lập hiển thị và hẹn giờ.\n" #: src/exercises/bare-metal/solutions-morning.md msgid "\"Ready.\"" -msgstr "" +msgstr "\"Sẵn sàng.\"" #: src/exercises/bare-metal/solutions-morning.md msgid "// Read compass data and log it to the serial port.\n" -msgstr "" +msgstr "// Đọc dữ liệu la bàn và ghi nó vào cổng nối tiếp.\n" #: src/exercises/bare-metal/solutions-morning.md msgid "\"{},{},{}\\t{},{},{}\"" -msgstr "" +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 "" +"// Nếu nhấn nút A, chuyển sang chế độ tiếp theo và nhấp nháy nhanh tất cả các đèn LED\n" +" // trên.\n" #: src/bare-metal/aps.md msgid "Application processors" -msgstr "" +msgstr "Bộ xử lý ứng dụng" #: src/bare-metal/aps.md msgid "" -"So far we've talked about microcontrollers, such as the Arm Cortex-M series. " -"Now let's try writing something for Cortex-A. For simplicity we'll just work " -"with QEMU's aarch64 ['virt'](https://qemu-project.gitlab.io/qemu/system/arm/" -"virt.html) board." +"So far we've talked about microcontrollers, such as the Arm Cortex-M series." +" Now let's try writing something for Cortex-A. For simplicity we'll just " +"work with QEMU's aarch64 ['virt'](https://qemu-" +"project.gitlab.io/qemu/system/arm/virt.html) board." msgstr "" +"Cho đến nay chúng ta đã nói về các bộ vi điều khiển, chẳng hạn như dòng Arm " +"Cortex-M. Bây giờ hãy thử viết một cái gì đó cho Cortex-A. Để đơn giản, " +"chúng tôi sẽ chỉ làm việc với bảng aarch64 ['virt'](https://qemu-" +"project.gitlab.io/qemu/system/arm/virt.html) của QEMU." #: src/bare-metal/aps.md msgid "" @@ -15762,6 +18443,9 @@ msgid "" "privilege (exception levels on Arm CPUs, rings on x86), while application " "processors do." msgstr "" +"Nói rộng ra, bộ vi điều khiển không có MMU hoặc nhiều cấp độ đặc quyền (cấp " +"độ ngoại lệ trên CPU Arm, đổ chuông trên x86), trong khi bộ xử lý ứng dụng " +"thì có." #: src/bare-metal/aps.md msgid "" @@ -15769,11 +18453,16 @@ msgid "" "architecture. The 'virt' board doesn't correspond to any particular real " "hardware, but is designed purely for virtual machines." msgstr "" +"QEMU hỗ trợ mô phỏng nhiều loại máy hoặc mô hình bo mạch khác nhau cho từng " +"kiến ​​trúc. Bo mạch 'virt' không tương ứng với bất kỳ phần cứng thực cụ thể" +" nào mà được thiết kế hoàn toàn dành cho máy ảo." #: src/bare-metal/aps/entry-point.md msgid "" "Before we can start running Rust code, we need to do some initialisation." msgstr "" +"Trước khi có thể bắt đầu chạy mã Rust, chúng ta cần thực hiện một số khởi " +"tạo." #: src/bare-metal/aps/entry-point.md msgid "" @@ -15782,8 +18471,7 @@ 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" @@ -15802,8 +18490,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" @@ -15813,8 +18500,7 @@ msgid "" " isb\n" "\n" " /*\n" -" * Configure sctlr_el1 to enable MMU and cache and don't proceed until " -"this\n" +" * Configure sctlr_el1 to enable MMU and cache and don't proceed until this\n" " * has completed.\n" " */\n" " msr sctlr_el1, x30\n" @@ -15850,52 +18536,142 @@ msgid "" " b 2b\n" "```" msgstr "" +"`` vũ khí\n" +".section .init.entry, \"ax\"\n" +"mục nhập .global\n" +"mục nhập:\n" +" /*\n" +" * Tải và áp dụng cấu hình quản lý bộ nhớ, sẵn sàng kích hoạt MMU và\n" +" * bộ nhớ đệm.\n" +" */\n" +" adrp x30, idmap\n" +" msr ttbr0_el1, x30\n" +"\n" +" mov_i x30, .Lmairval\n" +" msr mai_el1, x30\n" +"\n" +" mov_i x30, .Ltcrval\n" +" /* Sao chép dải PA được hỗ trợ vào TCR_EL1.IPS. */\n" +" bà x29, id_aa64mmr0_el1\n" +" bfi x30, x29, #32, #4\n" +"\n" +" msr tcr_el1, x30\n" +"\n" +" mov_i x30, .Lsctlrval\n" +"\n" +" /*\n" +" * Đảm bảo mọi thứ trước thời điểm này đã hoàn thành, sau đó vô hiệu hóa mọi thứ\n" +" * các mục TLB cục bộ có khả năng cũ trước khi chúng bắt đầu được sử dụng.\n" +" */\n" +" isb\n" +" tlbi vmalle1\n" +" ic là gì\n" +" dsb nsh\n" +" isb\n" +"\n" +" /*\n" +" * Định cấu hình sctlr_el1 để bật MMU và bộ đệm và không tiếp tục cho đến khi thực hiện việc này\n" +" * đã hoàn thành.\n" +" */\n" +" msr sctlr_el1, x30\n" +" isb\n" +"\n" +" /* Tắt tính năng truy cập dấu phẩy động trong EL1. */\n" +" bà x30, cpacr_el1\n" +" hoặc x30, x30, #(0x3 << 20)\n" +" msr cpacr_el1, x30\n" +" isb\n" +"\n" +" /* Loại bỏ phần bss. */\n" +" adr_l x29, bss_begin\n" +" adr_l x30, bss_end\n" +"0: cmp x29, x30\n" +" b.hs 1f\n" +" stp xzr, xzr, [x29], #16\n" +" b 0b\n" +"\n" +"1: /* Chuẩn bị ngăn xếp. */\n" +" adr_l x30, boot_stack_end\n" +" di chuyển sp, x30\n" +"\n" +" /* Thiết lập vectơ ngoại lệ. */\n" +" adr x30, vector_table_el1\n" +" msr vbar_el1, x30\n" +"\n" +" /* Gọi vào mã Rust. */\n" +" bl chính\n" +"\n" +" /* Vòng lặp mãi mãi chờ ngắt. */\n" +"2: wfi\n" +" b 2b\n" +"```" #: src/bare-metal/aps/entry-point.md 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 "" +"Điều này cũng giống như đối với C: khởi tạo trạng thái bộ xử lý, đưa BSS về " +"0 và thiết lập con trỏ ngăn xếp." #: 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 " +"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 (ký hiệu bắt đầu khối, vì lý do lịch sử) là một phần của tệp đối tượng " +"chứa các biến được phân bổ tĩnh được khởi tạo bằng 0. Chúng được bỏ qua khỏi" +" hình ảnh để tránh lãng phí không gian cho các số 0. compiler giả định rằng " +"trình tải sẽ xử lý việc đưa chúng về 0." #: 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." msgstr "" +"BSS có thể đã về 0, tùy thuộc vào cách khởi tạo bộ nhớ và hình ảnh được tải," +" nhưng chúng tôi về 0 để chắc chắn." #: 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 "" +"Chúng ta cần kích hoạt MMU và bộ đệm trước khi đọc hoặc ghi bất kỳ bộ nhớ " +"nào. Nếu chúng ta không:" #: 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 "" +"Truy cập không được căn chỉnh sẽ bị lỗi. Chúng tôi xây dựng mã Rust cho mục " +"tiêu `aarch64-unknown-none` đặt `+strict-align` để ngăn compiler tạo ra các " +"truy cập không được căn chỉnh, vì vậy trong trường hợp này sẽ ổn, nhưng nói " +"chung thì điều này không nhất thiết phải như vậy." #: src/bare-metal/aps/entry-point.md msgid "" "If it were running in a VM, this can lead to cache coherency issues. The " -"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.)" -msgstr "" +"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.)" +msgstr "" +"Nếu nó đang chạy trong VM, điều này có thể dẫn đến các vấn đề về tính nhất " +"quán của bộ đệm. Vấn đề là VM đang truy cập trực tiếp vào bộ nhớ khi bộ đệm " +"bị tắt, trong khi máy chủ có các bí danh có thể lưu trong bộ nhớ đệm cho " +"cùng một bộ nhớ. Ngay cả khi máy chủ không truy cập bộ nhớ một cách rõ ràng," +" các truy cập suy đoán có thể dẫn đến việc lấp đầy bộ đệm và sau đó các thay" +" đổi từ cái này hoặc cái kia sẽ bị mất khi bộ đệm được xóa hoặc VM kích hoạt" +" bộ đệm. (Bộ nhớ đệm được khóa theo địa chỉ vật lý, không phải VA hoặc IPA.)" #: src/bare-metal/aps/entry-point.md msgid "" @@ -15904,12 +18680,18 @@ msgid "" "for DRAM, and another 1 GiB higher up for more devices. This matches the " "memory layout that QEMU uses." msgstr "" +"Để đơn giản, chúng tôi chỉ sử dụng một bảng phân trang được mã hóa cứng (xem" +" `idmap.S`) để nhận dạng bản đồ 1 GiB đầu tiên của không gian địa chỉ cho " +"các thiết bị, 1 GiB tiếp theo cho DRAM và 1 GiB khác cao hơn cho nhiều thiết" +" bị hơn. Điều này phù hợp với bố cục bộ nhớ mà QEMU sử dụng." #: src/bare-metal/aps/entry-point.md msgid "" -"We also set up the exception vector (`vbar_el1`), which we'll see more about " -"later." +"We also set up the exception vector (`vbar_el1`), which we'll see more about" +" later." msgstr "" +"Chúng tôi cũng thiết lập vectơ ngoại lệ (`vbar_el1`), chúng tôi sẽ tìm hiểu " +"thêm về nó sau." #: src/bare-metal/aps/entry-point.md msgid "" @@ -15917,10 +18699,13 @@ msgid "" "(EL1). If you need to run at a different exception level you'll need to " "modify `entry.S` accordingly." msgstr "" +"Tất cả các ví dụ chiều nay đều giả định rằng chúng ta sẽ chạy ở cấp độ ngoại" +" lệ 1 (EL1). Nếu bạn cần chạy ở một mức ngoại lệ khác, bạn sẽ cần sửa đổi " +"`entry.S` cho phù hợp." #: src/bare-metal/aps/inline-assembly.md msgid "Inline assembly" -msgstr "" +msgstr "Lắp ráp nội tuyến" #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -15928,54 +18713,63 @@ msgid "" "Rust code. For example, to make an HVC (hypervisor call) to tell the " "firmware to power off the system:" msgstr "" +"Đôi khi chúng ta cần sử dụng hợp ngữ để làm những việc mà mã Rust không thể " +"thực hiện được. Ví dụ: để thực hiện một HVC (cuộc gọi hypervisor) để yêu cầu" +" chương trình cơ sở tắt nguồn hệ thống:" #: src/bare-metal/aps/inline-assembly.md msgid "" "// SAFETY: this only uses the declared registers and doesn't do anything\n" " // with memory.\n" msgstr "" +"// AN TOÀN: cái này chỉ sử dụng các thanh ghi đã khai báo và không làm gì cả\n" +" // với bộ nhớ.\n" #: src/bare-metal/aps/inline-assembly.md msgid "\"hvc #0\"" -msgstr "" +msgstr "\"hvc #0\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w0\"" -msgstr "" +msgstr "\"w0\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w1\"" -msgstr "" +msgstr "\"w1\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w2\"" -msgstr "" +msgstr "\"w2\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w3\"" -msgstr "" +msgstr "\"w3\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w4\"" -msgstr "" +msgstr "\"w4\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w5\"" -msgstr "" +msgstr "\"w5\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w6\"" -msgstr "" +msgstr "\"w6\"" #: src/bare-metal/aps/inline-assembly.md msgid "\"w7\"" -msgstr "" +msgstr "\"w7\"" #: src/bare-metal/aps/inline-assembly.md msgid "" -"(If you actually want to do this, use the [`smccc`](https://crates.io/crates/" -"smccc) crate which has wrappers for all these functions.)" +"(If you actually want to do this, use the " +"[`smccc`](https://crates.io/crates/smccc) crate which has wrappers for all " +"these functions.)" msgstr "" +"(Nếu bạn thực sự muốn làm điều này, hãy sử dụng crate " +"[`smccc`](https://crates.io/crates/smccc) có trình bao bọc cho tất cả các " +"chức năng này.)" #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -15983,6 +18777,10 @@ msgid "" "functions to manage system and CPU power states, among other things. It is " "implemented by EL3 firmware and hypervisors on many systems." msgstr "" +"PSCI là Giao diện điều phối trạng thái nguồn điện của Arm, một bộ chức năng " +"tiêu chuẩn để quản lý trạng thái nguồn của hệ thống và CPU, cùng nhiều chức " +"năng khác. Nó được triển khai bởi phần mềm EL3 và bộ ảo hóa trên nhiều hệ " +"thống." #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -15991,12 +18789,17 @@ msgid "" "`inout` rather than `in` because the call could potentially clobber the " "contents of the registers." msgstr "" +"Cú pháp `0 => _` có nghĩa là khởi tạo thanh ghi về 0 trước khi chạy mã hợp " +"ngữ nội tuyến và bỏ qua nội dung của nó sau đó. Chúng ta cần sử dụng `inout`" +" thay vì `in` vì lệnh gọi có thể ghi đè nội dung của các thanh ghi." #: 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`." msgstr "" +"Hàm `main` này cần phải là `#[no_mangle]` và `extern \"C\"` vì nó được gọi " +"từ điểm nhập của chúng ta trong `entry.S`." #: src/bare-metal/aps/inline-assembly.md msgid "" @@ -16007,36 +18810,49 @@ 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` là các giá trị của các thanh ghi `x0`–`x3`, thường được bộ nạp " +"khởi động sử dụng để truyền những thứ như con trỏ tới cây thiết bị. Theo quy" +" ước gọi aarch64 tiêu chuẩn (là quy ước mà `extern \"C\"` chỉ định sử dụng)," +" các thanh ghi `x0`–`x7` được sử dụng cho 8 đối số đầu tiên được truyền cho " +"một hàm, vì vậy `entry.S` không cần thực hiện bất kỳ điều gì đặc biệt ngoại " +"trừ việc đảm bảo rằng nó không thay đổi các thanh ghi này." #: src/bare-metal/aps/inline-assembly.md msgid "" -"Run the example in QEMU with `make qemu_psci` under `src/bare-metal/aps/" -"examples`." +"Run the example in QEMU with `make qemu_psci` under `src/bare-" +"metal/aps/examples`." msgstr "" +"Chạy ví dụ trong QEMU với `make qemu_psci` trong `src/bare-" +"metal/aps/examples`." #: src/bare-metal/aps/mmio.md msgid "Volatile memory access for MMIO" -msgstr "" +msgstr "Truy cập bộ nhớ khả biến cho MMIO" #: src/bare-metal/aps/mmio.md msgid "Use `pointer::read_volatile` and `pointer::write_volatile`." -msgstr "" +msgstr "Sử dụng `con trỏ::read_volatile` và `pointer::write_volatile`." #: src/bare-metal/aps/mmio.md msgid "Never hold a reference." -msgstr "" +msgstr "Không bao giờ giữ một tài liệu tham khảo." #: src/bare-metal/aps/mmio.md msgid "" "`addr_of!` lets you get fields of structs without creating an intermediate " "reference." msgstr "" +"`addr_of!` cho phép bạn lấy các trường cấu trúc mà không cần tạo tham chiếu " +"trung gian." #: 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." msgstr "" +"Truy cập không ổn định: các thao tác đọc hoặc ghi có thể có tác dụng phụ, vì" +" vậy hãy ngăn compiler hoặc phần cứng sắp xếp lại, sao chép hoặc loại bỏ " +"chúng." #: src/bare-metal/aps/mmio.md msgid "" @@ -16044,33 +18860,45 @@ msgid "" "compiler may assume that the value read is the same as the value just " "written, and not bother actually reading memory." msgstr "" +"Thông thường nếu bạn viết và sau đó đọc, ví dụ: thông qua một tham chiếu có " +"thể thay đổi, compiler có thể giả định rằng giá trị được đọc giống với giá " +"trị vừa được ghi và không bận tâm đến việc đọc bộ nhớ thực sự." #: src/bare-metal/aps/mmio.md msgid "" -"Some existing crates for volatile access to hardware do hold references, but " -"this is unsound. Whenever a reference exist, the compiler may choose to " +"Some existing crates for volatile access to hardware do hold references, but" +" this is unsound. Whenever a reference exist, the compiler may choose to " "dereference it." msgstr "" +"Một số crate hiện có để truy cập dễ dàng vào phần cứng có chứa các tài liệu " +"tham khảo, nhưng điều này không có cơ sở. Bất cứ khi nào một tham chiếu tồn " +"tại, compiler có thể chọn hủy đăng ký nó." #: src/bare-metal/aps/mmio.md msgid "" "Use the `addr_of!` macro to get struct field pointers from a pointer to the " "struct." msgstr "" +"Sử dụng macro `addr_of!` để lấy các con trỏ trường cấu trúc từ một con trỏ " +"tới cấu trúc." #: src/bare-metal/aps/uart.md msgid "Let's write a UART driver" -msgstr "" +msgstr "Hãy viết trình điều khiển 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 "" +"Máy 'virt' QEMU có " +"[PL011](https://developer.arm.com/documentation/ddi0183/g) UART, vì vậy hãy " +"viết trình điều khiển cho điều đó." #: src/bare-metal/aps/uart.md msgid "/// Minimal driver for a PL011 UART.\n" -msgstr "" +msgstr "/// Trình điều khiển tối thiểu cho PL011 UART.\n" #: src/bare-metal/aps/uart.md src/bare-metal/aps/better-uart/driver.md msgid "" @@ -16079,34 +18907,42 @@ msgid "" " ///\n" " /// # Safety\n" " ///\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" +" /// 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" msgstr "" +"/// Xây dựng một phiên bản mới của trình điều khiển UART cho thiết bị PL011 tại\n" +" /// địa chỉ cơ sở đã cho.\n" +" ///\n" +" /// # An toàn\n" +" ///\n" +" /// Địa chỉ cơ sở đã cho phải trỏ đến 8 thanh ghi điều khiển MMIO của một\n" +" /// Thiết bị PL011, phải được ánh xạ vào không gian địa chỉ của tiến trình\n" +" /// làm bộ nhớ thiết bị và không có bí danh nào khác.\n" #: src/bare-metal/aps/uart.md src/bare-metal/aps/better-uart/driver.md msgid "/// Writes a single byte to the UART.\n" -msgstr "" +msgstr "/// Ghi một byte đơn vào UART.\n" #: src/bare-metal/aps/uart.md src/bare-metal/aps/better-uart/driver.md msgid "// Wait until there is room in the TX buffer.\n" -msgstr "" +msgstr "// Đợi cho đến khi còn chỗ trống trong bộ đệm TX.\n" #: src/bare-metal/aps/uart.md msgid "" "// SAFETY: We know that the base address points to the control\n" " // registers of a PL011 device which is appropriately mapped.\n" msgstr "" +"// AN TOÀN: Chúng ta biết rằng địa chỉ cơ sở trỏ đến điều khiển\n" +" // các thanh ghi của thiết bị PL011 được ánh xạ thích hợp.\n" #: src/bare-metal/aps/uart.md src/bare-metal/aps/better-uart/driver.md msgid "// Write to the TX buffer.\n" -msgstr "" +msgstr "// Ghi vào bộ đệm TX.\n" #: src/bare-metal/aps/uart.md src/bare-metal/aps/better-uart/driver.md msgid "// Wait until the UART is no longer busy.\n" -msgstr "" +msgstr "// Đợi cho đến khi UART không còn bận nữa.\n" #: src/bare-metal/aps/uart.md msgid "" @@ -16117,266 +18953,297 @@ msgid "" "it is always safe to call `write_byte` later because we can assume the " "necessary preconditions." msgstr "" +"Lưu ý rằng `Uart::new` không an toàn trong khi các phương thức khác vẫn an " +"toàn. Điều này là do miễn là lệnh gọi `Uart::new` đảm bảo rằng các yêu cầu " +"an toàn của nó được đáp ứng (tức là chỉ có một phiên bản trình điều khiển " +"cho một UART nhất định và không có gì khác đặt bí danh cho không gian địa " +"chỉ của nó), thì việc gọi `write_byte` sau này luôn an toàn vì chúng ta có " +"thể thừa nhận các điều kiện tiên quyết cần thiết." #: 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" +"`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 "" +"Chúng ta có thể làm theo cách khác (làm cho `new` an toàn nhưng `write_byte`" +" không an toàn), nhưng cách đó sẽ kém thuận tiện hơn nhiều vì mọi nơi gọi " +"`write_byte` sẽ cần phải đưa ra lý do về sự an toàn" #: 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." +"the burden of proof for soundness from a large number of places to a smaller" +" number of places." msgstr "" +"Đây là một mẫu phổ biến để viết các trình bao bọc an toàn của mã không an " +"toàn: chuyển gánh nặng chứng minh tính đúng đắn từ một số lượng lớn các địa " +"điểm đến một số lượng nhỏ các địa điểm." #: src/bare-metal/aps/uart/traits.md msgid "More traits" -msgstr "" +msgstr "Nhiều đặc điểm hơn" #: src/bare-metal/aps/uart/traits.md msgid "" "We derived the `Debug` trait. It would be useful to implement a few more " "traits too." msgstr "" +"Chúng tôi đã rút ra đặc điểm `Gỡ lỗi`. Sẽ rất hữu ích nếu triển khai thêm " +"một vài đặc điểm nữa." #: src/bare-metal/aps/uart/traits.md msgid "" "// SAFETY: `Uart` just contains a pointer to device memory, which can be\n" "// accessed from any context.\n" msgstr "" +"// AN TOÀN: `Uart` chỉ chứa một con trỏ tới bộ nhớ thiết bị, có thể\n" +"// truy cập từ bất kỳ ngữ cảnh nào.\n" #: src/bare-metal/aps/uart/traits.md msgid "" -"Implementing `Write` lets us use the `write!` and `writeln!` macros with our " -"`Uart` type." +"Implementing `Write` lets us use the `write!` and `writeln!` macros with our" +" `Uart` type." msgstr "" +"Việc triển khai `Write` cho phép chúng tôi sử dụng macro `write!` và " +"`writeln!` với loại `Uart` của chúng tôi." #: src/bare-metal/aps/uart/traits.md msgid "" -"Run the example in QEMU with `make qemu_minimal` under `src/bare-metal/aps/" -"examples`." +"Run the example in QEMU with `make qemu_minimal` under `src/bare-" +"metal/aps/examples`." msgstr "" +"Chạy ví dụ trong QEMU với `make qemu_minimal` trong `src/bare-" +"metal/aps/examples`." #: src/bare-metal/aps/better-uart.md msgid "A better UART driver" -msgstr "" +msgstr "Trình điều khiển UART tốt hơn" #: src/bare-metal/aps/better-uart.md 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." +"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." msgstr "" +"PL011 thực sự có [nhiều thanh ghi " +"hơn](https://developer.arm.com/documentation/ddi0183/g/programmers-" +"model/summary-of-registers) và việc thêm các offset để xây dựng con trỏ truy" +" cập chúng sẽ dễ bị lỗi và khó đọc. Ngoài ra, một số trong số chúng là các " +"trường bit rất hữu ích để truy cập theo cách có cấu trúc." #: src/bare-metal/aps/better-uart.md msgid "Offset" -msgstr "" +msgstr "Bù lại" #: src/bare-metal/aps/better-uart.md msgid "Register name" -msgstr "" +msgstr "Tên đăng ký" #: src/bare-metal/aps/better-uart.md msgid "Width" -msgstr "" +msgstr "Chiều rộng" #: src/bare-metal/aps/better-uart.md msgid "0x00" -msgstr "" +msgstr "0x00" #: src/bare-metal/aps/better-uart.md msgid "DR" -msgstr "" +msgstr "DR" #: src/bare-metal/aps/better-uart.md msgid "12" -msgstr "" +msgstr "12" #: src/bare-metal/aps/better-uart.md msgid "0x04" -msgstr "" +msgstr "0x04" #: src/bare-metal/aps/better-uart.md msgid "RSR" -msgstr "" +msgstr "RSR" #: src/bare-metal/aps/better-uart.md msgid "0x18" -msgstr "" +msgstr "0x18" #: src/bare-metal/aps/better-uart.md msgid "FR" -msgstr "" +msgstr "Pháp" #: src/bare-metal/aps/better-uart.md msgid "9" -msgstr "" +msgstr "9" #: src/bare-metal/aps/better-uart.md msgid "0x20" -msgstr "" +msgstr "0x20" #: src/bare-metal/aps/better-uart.md msgid "ILPR" -msgstr "" +msgstr "ILPR" #: src/bare-metal/aps/better-uart.md msgid "0x24" -msgstr "" +msgstr "0x24" #: src/bare-metal/aps/better-uart.md msgid "IBRD" -msgstr "" +msgstr "IBRD" #: src/bare-metal/aps/better-uart.md msgid "16" -msgstr "" +msgstr "16" #: src/bare-metal/aps/better-uart.md msgid "0x28" -msgstr "" +msgstr "0x28" #: src/bare-metal/aps/better-uart.md msgid "FBRD" -msgstr "" +msgstr "FBRD" #: src/bare-metal/aps/better-uart.md msgid "0x2c" -msgstr "" +msgstr "0x2c" #: src/bare-metal/aps/better-uart.md msgid "LCR_H" -msgstr "" +msgstr "LCR_H" #: src/bare-metal/aps/better-uart.md msgid "0x30" -msgstr "" +msgstr "0x30" #: src/bare-metal/aps/better-uart.md msgid "CR" -msgstr "" +msgstr "CR" #: src/bare-metal/aps/better-uart.md msgid "0x34" -msgstr "" +msgstr "0x34" #: src/bare-metal/aps/better-uart.md msgid "IFLS" -msgstr "" +msgstr "IFLS" #: src/bare-metal/aps/better-uart.md msgid "0x38" -msgstr "" +msgstr "0x38" #: src/bare-metal/aps/better-uart.md msgid "IMSC" -msgstr "" +msgstr "IMSC" #: src/bare-metal/aps/better-uart.md msgid "11" -msgstr "" +msgstr "11" #: src/bare-metal/aps/better-uart.md msgid "0x3c" -msgstr "" +msgstr "0x3c" #: src/bare-metal/aps/better-uart.md msgid "RIS" -msgstr "" +msgstr "RIS" #: src/bare-metal/aps/better-uart.md msgid "0x40" -msgstr "" +msgstr "0x40" #: src/bare-metal/aps/better-uart.md msgid "MIS" -msgstr "" +msgstr "MIS" #: src/bare-metal/aps/better-uart.md msgid "0x44" -msgstr "" +msgstr "0x44" #: src/bare-metal/aps/better-uart.md msgid "ICR" -msgstr "" +msgstr "ICR" #: src/bare-metal/aps/better-uart.md msgid "0x48" -msgstr "" +msgstr "0x48" #: src/bare-metal/aps/better-uart.md msgid "DMACR" -msgstr "" +msgstr "DMACR" #: src/bare-metal/aps/better-uart.md msgid "There are also some ID registers which have been omitted for brevity." -msgstr "" +msgstr "Ngoài ra còn có một số thanh ghi ID đã được lược bỏ để cho ngắn gọn." #: src/bare-metal/aps/better-uart/bitflags.md msgid "" "The [`bitflags`](https://crates.io/crates/bitflags) crate is useful for " "working with bitflags." msgstr "" +"Crate [`bitflags`](https://crates.io/crates/bitflags) rất hữu ích khi làm " +"việc với bitflags." #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Flags from the UART flag register.\n" -msgstr "" +msgstr "/// Cờ từ thanh ghi cờ UART.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Clear to send.\n" -msgstr "" +msgstr "/// Xóa để gửi.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Data set ready.\n" -msgstr "" +msgstr "/// Tập dữ liệu đã sẵn sàng.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Data carrier detect.\n" -msgstr "" +msgstr "/// Phát hiện sóng mang dữ liệu.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// UART busy transmitting data.\n" -msgstr "" +msgstr "/// UART bận truyền dữ liệu.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Receive FIFO is empty.\n" -msgstr "" +msgstr "/// Nhận FIFO trống.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Transmit FIFO is full.\n" -msgstr "" +msgstr "/// Truyền FIFO đã đầy.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Receive FIFO is full.\n" -msgstr "" +msgstr "/// Nhận FIFO đã đầy.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Transmit FIFO is empty.\n" -msgstr "" +msgstr "/// Truyền FIFO trống.\n" #: src/bare-metal/aps/better-uart/bitflags.md msgid "/// Ring indicator.\n" -msgstr "" +msgstr "/// Chỉ báo vòng.\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." msgstr "" +"Macro `bitflags!` tạo ra một kiểu mới giống như `Flags(u16)`, cùng với một " +"loạt cách triển khai phương thức để nhận và đặt cờ." #: src/bare-metal/aps/better-uart/registers.md msgid "Multiple registers" -msgstr "" +msgstr "Nhiều thanh ghi" #: src/bare-metal/aps/better-uart/registers.md msgid "" "We can use a struct to represent the memory layout of the UART's registers." msgstr "" +"Chúng ta có thể sử dụng cấu trúc để biểu diễn bố cục bộ nhớ của các thanh " +"ghi UART." #: src/bare-metal/aps/better-uart/registers.md msgid "" @@ -16386,57 +19253,76 @@ msgid "" "predictable layout, as default Rust representation allows the compiler to " "(among other things) reorder fields however it sees fit." msgstr "" +"[`#[repr(C)]`](https://doc.rust-lang.org/reference/type-layout.html#the-c-" +"reprofessionalation) yêu cầu compiler sắp xếp các trường cấu trúc theo thứ " +"tự, tuân theo các quy tắc tương tự như C. Điều này là cần thiết để cấu trúc " +"của chúng ta có bố cục có thể dự đoán được, vì cách biểu diễn Rust mặc định " +"cho phép compiler (trong số những thứ khác) sắp xếp lại các trường theo cách" +" nó thấy phù hợp." #: src/bare-metal/aps/better-uart/driver.md msgid "Now let's use the new `Registers` struct in our driver." msgstr "" +"Bây giờ hãy sử dụng cấu trúc `Registers` mới trong trình điều khiển của " +"chúng tôi." #: src/bare-metal/aps/better-uart/driver.md msgid "/// Driver for a PL011 UART.\n" -msgstr "" +msgstr "/// Trình điều khiển cho PL011 UART.\n" #: src/bare-metal/aps/better-uart/driver.md msgid "" "// SAFETY: We know that self.registers points to the control registers\n" " // of a PL011 device which is appropriately mapped.\n" msgstr "" +"// AN TOÀN: Chúng ta biết rằng self.registers trỏ đến các thanh ghi điều khiển\n" +" // của thiết bị PL011 được ánh xạ thích hợp.\n" #: src/bare-metal/aps/better-uart/driver.md msgid "" "/// Reads and returns a pending byte, or `None` if nothing has been\n" " /// received.\n" msgstr "" +"/// Đọc và trả về một byte đang chờ xử lý hoặc `None` nếu không có gì\n" +" /// đã nhận được.\n" #: src/bare-metal/aps/better-uart/driver.md msgid "" "// SAFETY: We know that self.registers points to the control\n" " // registers of a PL011 device which is appropriately mapped.\n" msgstr "" +"// AN TOÀN: Chúng ta biết rằng self.registers trỏ đến điều khiển\n" +" // các thanh ghi của thiết bị PL011 được ánh xạ thích hợp.\n" #: src/bare-metal/aps/better-uart/driver.md msgid "// TODO: Check for error conditions in bits 8-11.\n" -msgstr "" +msgstr "// VIỆC CẦN LÀM: Kiểm tra điều kiện lỗi ở bit 8-11.\n" #: src/bare-metal/aps/better-uart/driver.md msgid "" "Note the use of `addr_of!` / `addr_of_mut!` to get pointers to individual " "fields without creating an intermediate reference, which would be unsound." msgstr "" +"Lưu ý việc sử dụng `addr_of!` / `addr_of_mut!` để nhận con trỏ tới các " +"trường riêng lẻ mà không tạo tham chiếu trung gian, điều này sẽ không có cơ " +"sở." #: src/bare-metal/aps/better-uart/using.md src/bare-metal/aps/logging/using.md msgid "Using it" -msgstr "" +msgstr "Sử dụng nó" #: src/bare-metal/aps/better-uart/using.md msgid "" -"Let's write a small program using our driver to write to the serial console, " -"and echo incoming bytes." +"Let's write a small program using our driver to write to the serial console," +" and echo incoming bytes." msgstr "" +"Hãy viết một chương trình nhỏ bằng trình điều khiển của chúng tôi để ghi vào" +" bảng điều khiển nối tiếp và lặp lại các byte đến." #: src/bare-metal/aps/better-uart/using.md src/bare-metal/aps/logging/using.md #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Base address of the primary PL011 UART.\n" -msgstr "" +msgstr "/// Địa chỉ cơ sở của PL011 UART chính.\n" #: src/bare-metal/aps/better-uart/using.md src/bare-metal/aps/logging/using.md #: src/exercises/bare-metal/solutions-afternoon.md @@ -16444,27 +19330,29 @@ msgid "" "// SAFETY: `PL011_BASE_ADDRESS` is the base address of a PL011 device, and\n" " // nothing else accesses that address range.\n" msgstr "" +"// AN TOÀN: `PL011_BASE_ADDRESS` là địa chỉ cơ sở của thiết bị PL011 và\n" +" // không có gì khác truy cập vào dải địa chỉ đó.\n" #: src/bare-metal/aps/better-uart/using.md src/bare-metal/aps/logging/using.md msgid "\"main({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})\"" -msgstr "" +msgstr "\"chính({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})\"" #: src/bare-metal/aps/better-uart/using.md msgid "b'\\r'" -msgstr "" +msgstr "b'\\r'" #: src/bare-metal/aps/better-uart/using.md #: src/concurrency/async-pitfalls/cancellation.md msgid "b'\\n'" -msgstr "" +msgstr "b'\\n'" #: src/bare-metal/aps/better-uart/using.md msgid "b'q'" -msgstr "" +msgstr "b'q'" #: src/bare-metal/aps/better-uart/using.md msgid "\"Bye!\"" -msgstr "" +msgstr "\"Tạm biệt!\"" #: src/bare-metal/aps/better-uart/using.md msgid "" @@ -16472,18 +19360,26 @@ msgid "" "function is called from our entry point code in `entry.S`. See the speaker " "notes there for details." msgstr "" +"Như trong ví dụ [inline Assembly](../inline-assembly.md), hàm `main` này " +"được gọi từ mã điểm nhập của chúng tôi trong `entry.S`. Xem ghi chú của diễn" +" giả ở đó để biết chi tiết." #: src/bare-metal/aps/better-uart/using.md msgid "" -"Run the example in QEMU with `make qemu` under `src/bare-metal/aps/examples`." +"Run the example in QEMU with `make qemu` under `src/bare-" +"metal/aps/examples`." msgstr "" +"Chạy ví dụ trong QEMU với `make qemu` trong `src/bare-metal/aps/examples`." #: 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 "" +"Sẽ thật tuyệt nếu có thể sử dụng macro ghi nhật ký từ crate " +"[`log`](https://crates.io/crates/log). Chúng ta có thể làm điều này bằng " +"cách triển khai đặc điểm `Log`." #: src/bare-metal/aps/logging.md msgid "\"[{}] {}\"" @@ -16491,115 +19387,147 @@ msgstr "" #: src/bare-metal/aps/logging.md msgid "/// Initialises UART logger.\n" -msgstr "" +msgstr "/// Khởi tạo trình ghi nhật ký UART.\n" #: src/bare-metal/aps/logging.md msgid "" "The unwrap in `log` is safe because we initialise `LOGGER` before calling " "`set_logger`." msgstr "" +"Việc mở gói trong `log` là an toàn vì chúng tôi khởi tạo `LOGGER` trước khi " +"gọi `set_logger`." #: src/bare-metal/aps/logging/using.md msgid "We need to initialise the logger before we use it." -msgstr "" +msgstr "Chúng ta cần khởi tạo logger trước khi sử dụng nó." #: src/bare-metal/aps/logging/using.md #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"{info}\"" -msgstr "" +msgstr "\"{thông tin}\"" #: src/bare-metal/aps/logging/using.md msgid "Note that our panic handler can now log details of panics." msgstr "" +"Lưu ý rằng trình xử lý hoảng loạn của chúng tôi hiện có thể ghi lại thông " +"tin chi tiết về hoảng loạn." #: src/bare-metal/aps/logging/using.md msgid "" -"Run the example in QEMU with `make qemu_logger` under `src/bare-metal/aps/" -"examples`." +"Run the example in QEMU with `make qemu_logger` under `src/bare-" +"metal/aps/examples`." msgstr "" +"Chạy ví dụ trong QEMU với `make qemu_logger` trong `src/bare-" +"metal/aps/examples`." #: 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 " -"calling into Rust code:" +"We implement this in assembly to save volatile registers to the stack before" +" calling into Rust code:" msgstr "" +"AArch64 xác định bảng vectơ ngoại lệ với 16 mục nhập, cho 4 loại ngoại lệ " +"(đồng bộ, IRQ, FIQ, SError) từ 4 trạng thái (EL hiện tại với SP0, EL hiện " +"tại với SPx, EL thấp hơn sử dụng AArch64, EL thấp hơn sử dụng AArch32). " +"Chúng tôi triển khai điều này trong tập hợp để lưu các thanh ghi dễ bay hơi " +"vào ngăn xếp trước khi gọi vào mã Rust:" #: src/bare-metal/aps/exceptions.md msgid "EL is exception level; all our examples this afternoon run in EL1." msgstr "" +"EL là cấp độ ngoại lệ; tất cả các ví dụ của chúng tôi chiều nay đều chạy " +"trong 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." msgstr "" +"Để đơn giản, chúng tôi không phân biệt giữa SP0 và SPx đối với các ngoại lệ " +"EL hiện tại hoặc giữa AArch32 và AArch64 đối với các ngoại lệ EL thấp hơn." #: 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." msgstr "" +"Trong ví dụ này, chúng tôi chỉ ghi lại ngoại lệ và tắt nguồn vì chúng tôi " +"không mong đợi bất kỳ trường hợp nào trong số đó thực sự xảy ra." #: 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." -msgstr "" +"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 "" +"Chúng ta có thể nghĩ về các trình xử lý ngoại lệ và bối cảnh thực thi chính " +"của chúng ta ít nhiều giống như các luồng khác nhau. [`Send` và " +"`Sync`](../../concurrency/send-sync.md) sẽ kiểm soát những gì chúng ta có " +"thể chia sẻ giữa chúng, giống như với các chuỗi. Ví dụ: nếu chúng ta muốn " +"chia sẻ một số giá trị giữa các trình xử lý ngoại lệ và phần còn lại của " +"chương trình và đó là `Gửi` chứ không phải `Đồng bộ hóa`, thì chúng ta sẽ " +"cần bọc nó trong một cái gì đó giống như `Mutex` và đặt nó vào tĩnh." #: src/bare-metal/aps/other-projects.md msgid "[oreboot](https://github.com/oreboot/oreboot)" -msgstr "" +msgstr "[oreboot](https://github.com/oreboot/oreboot)" #: src/bare-metal/aps/other-projects.md msgid "\"coreboot without the C\"" -msgstr "" +msgstr "\"coreboot không có C\"" #: src/bare-metal/aps/other-projects.md msgid "Supports x86, aarch64 and RISC-V." -msgstr "" +msgstr "Hỗ trợ x86, aarch64 và RISC-V." #: src/bare-metal/aps/other-projects.md msgid "Relies on LinuxBoot rather than having many drivers itself." -msgstr "" +msgstr "Dựa vào LinuxBoot thay vì có nhiều trình điều khiển." #: src/bare-metal/aps/other-projects.md msgid "" "[Rust RaspberryPi OS tutorial](https://github.com/rust-embedded/rust-" "raspberrypi-OS-tutorials)" msgstr "" +"[Hướng dẫn về hệ điều hành Rust RaspberryPi](https://github.com/rust-" +"embedded/rust-raspberrypi-OS-tutorials)" #: src/bare-metal/aps/other-projects.md msgid "" "Initialisation, UART driver, simple bootloader, JTAG, exception levels, " "exception handling, page tables" msgstr "" +"Khởi tạo, trình điều khiển UART, bộ nạp khởi động đơn giản, JTAG, mức độ " +"ngoại lệ, xử lý ngoại lệ, bảng trang" #: src/bare-metal/aps/other-projects.md msgid "" "Some dodginess around cache maintenance and initialisation in Rust, not " "necessarily a good example to copy for production code." msgstr "" +"Một số điều khó hiểu xung quanh việc khởi tạo và bảo trì bộ đệm trong Rust, " +"không nhất thiết phải là một ví dụ điển hình để sao chép cho mã sản xuất." #: src/bare-metal/aps/other-projects.md msgid "[`cargo-call-stack`](https://crates.io/crates/cargo-call-stack)" -msgstr "" +msgstr "[`cargo-call-stack`](https://crates.io/crates/cargo-call-stack)" #: src/bare-metal/aps/other-projects.md msgid "Static analysis to determine maximum stack usage." -msgstr "" +msgstr "Phân tích tĩnh để xác định mức sử dụng ngăn xếp tối đa." #: src/bare-metal/aps/other-projects.md 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 "" +"Hướng dẫn về RaspberryPi OS chạy mã Rust trước khi bật MMU và bộ đệm. Điều " +"này sẽ đọc và ghi bộ nhớ (ví dụ: ngăn xếp). Tuy nhiên:" #: src/bare-metal/aps/other-projects.md msgid "" @@ -16608,27 +19536,41 @@ msgid "" "generating unaligned accesses so it should be alright, but this is not " "necessarily the case in general." msgstr "" +"Nếu không có MMU và bộ đệm, các truy cập không được căn chỉnh sẽ bị lỗi. Nó " +"được xây dựng với `aarch64-unknown-none` đặt `+strict-align` để ngăn trình " +"biên dịch tạo ra các truy cập không được căn chỉnh nên sẽ ổn, nhưng điều này" +" nói chung không nhất thiết phải như vậy." #: src/bare-metal/aps/other-projects.md msgid "" "If it were running in a VM, this can lead to cache coherency issues. The " -"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. Again this is " +"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. Again this is " "alright in this particular case (running directly on the hardware with no " "hypervisor), but isn't a good pattern in general." msgstr "" +"Nếu nó đang chạy trong VM, điều này có thể dẫn đến các vấn đề về tính nhất " +"quán của bộ đệm. Vấn đề là VM đang truy cập trực tiếp vào bộ nhớ khi bộ đệm " +"bị tắt, trong khi máy chủ có các bí danh có thể lưu trong bộ nhớ đệm cho " +"cùng một bộ nhớ. Ngay cả khi máy chủ không truy cập bộ nhớ một cách rõ ràng," +" các truy cập suy đoán có thể dẫn đến việc lấp đầy bộ đệm và sau đó các thay" +" đổi từ cái này hay cái kia sẽ bị mất. Một lần nữa, điều này ổn trong trường" +" hợp cụ thể này (chạy trực tiếp trên phần cứng không có bộ ảo hóa), nhưng " +"nói chung không phải là một mẫu tốt." #: src/bare-metal/useful-crates.md msgid "Useful crates" -msgstr "" +msgstr "Crate hữu ích" #: src/bare-metal/useful-crates.md msgid "" "We'll go over a few crates which solve some common problems in bare-metal " "programming." msgstr "" +"Chúng ta sẽ điểm qua một số crate có thể giải quyết một số vấn đề thường gặp" +" trong lập trình kim loại trần." #: src/bare-metal/useful-crates/zerocopy.md msgid "" @@ -16636,19 +19578,28 @@ msgid "" "traits and macros for safely converting between byte sequences and other " "types." msgstr "" +"Crate [`zerocopy`](https://docs.rs/zerocopy/) (từ Fuchsia) cung cấp các đặc " +"điểm và macro để chuyển đổi an toàn giữa các chuỗi byte và các loại khác." #: 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 " +"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." msgstr "" +"Điều này không phù hợp với MMIO (vì nó không sử dụng khả năng đọc và ghi " +"không ổn định), nhưng có thể hữu ích khi làm việc với các cấu trúc được chia" +" sẻ với phần cứng, ví dụ: bởi DMA hoặc được gửi qua một số giao diện bên " +"ngoài." #: 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." msgstr "" +"`FromBytes` có thể được triển khai cho các loại mà bất kỳ mẫu byte nào đều " +"hợp lệ và do đó có thể được chuyển đổi một cách an toàn từ một chuỗi byte " +"không đáng tin cậy." #: src/bare-metal/useful-crates/zerocopy.md msgid "" @@ -16656,18 +19607,25 @@ msgid "" "`RequestType` doesn't use all possible u32 values as discriminants, so not " "all byte patterns are valid." msgstr "" +"Việc cố gắng lấy `FromBytes` cho các loại này sẽ không thành công vì " +"`RequestType` không sử dụng tất cả các giá trị u32 có thể có làm phân biệt " +"đối xử, vì vậy không phải tất cả các mẫu byte đều hợp lệ." #: src/bare-metal/useful-crates/zerocopy.md msgid "" "`zerocopy::byteorder` has types for byte-order aware numeric primitives." msgstr "" +"`zerocopy::byteorder` có các kiểu dành cho các số nguyên thủy nhận biết thứ " +"tự byte." #: 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 "" +"Chạy ví dụ với `cargo run` trong `src/bare-metal/useful-crates/zerocopy-" +"example/`. (Nó sẽ không chạy trong Playground vì phụ thuộc vào crate.)" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "" @@ -16675,60 +19633,79 @@ msgid "" "you create page tables according to the AArch64 Virtual Memory System " "Architecture." msgstr "" +"Crate [`aarch64-paging`](https://crates.io/crates/aarch64-paging) cho phép " +"bạn tạo các bảng trang theo Kiến trúc hệ thống bộ nhớ ảo AArch64." #: src/bare-metal/useful-crates/aarch64-paging.md msgid "// Create a new page table with identity mapping.\n" -msgstr "" +msgstr "// Tạo một bảng trang mới với ánh xạ nhận dạng.\n" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "// Map a 2 MiB region of memory as read-only.\n" -msgstr "" +msgstr "// Ánh xạ vùng bộ nhớ 2 MiB ở dạng chỉ đọc.\n" #: src/bare-metal/useful-crates/aarch64-paging.md msgid "// Set `TTBR0_EL1` to activate the page table.\n" -msgstr "" +msgstr "// Đặt `TTBR0_EL1` để kích hoạt bảng trang.\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." msgstr "" +"Hiện tại, nó chỉ hỗ trợ EL1, nhưng việc hỗ trợ cho các cấp độ ngoại lệ khác " +"sẽ dễ dàng được thêm vào." #: 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 "" +"Điều này được sử dụng trong Android cho [Phần mềm máy ảo được bảo " +"vệ](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 "" +"Không có cách nào dễ dàng để chạy ví dụ này vì nó cần chạy trên phần cứng " +"thực hoặc theo 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/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:" +"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:" msgstr "" +"[`buddy_system_allocator`](https://crates.io/crates/buddy_system_allocator) " +"là crate của bên thứ ba triển khai buddy_system_allocator cơ bản. Bạn có thể" +" sử dụng nó cho cả " +"[`LockedHeap`](https://docs.rs/buddy_system_allocator/0.9.0/buddy_system_allocator/struct.LockedHeap.html)" +" triển khai [`GlobalAlloc`](https://doc.rust-" +"lang.org/core/alloc/trait.GlobalAlloc.html) để bạn có thể sử dụng crate " +"`alloc` tiêu chuẩn (như chúng ta đã thấy [trước](../alloc.md)), hoặc để phân" +" bổ không gian địa chỉ khác. Ví dụ: chúng tôi có thể muốn phân bổ không gian" +" MMIO cho PCI BAR:" #: src/bare-metal/useful-crates/buddy_system_allocator.md msgid "PCI BARs always have alignment equal to their size." -msgstr "" +msgstr "Thanh PCI luôn có sự căn chỉnh bằng với kích thước của chúng." #: 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 "" +"Chạy ví dụ với `cargo run` trong `src/bare-metal/useful-crates/allocator-" +"example/`. (Nó sẽ không chạy trong Playground vì phụ thuộc vào crate.)" #: src/bare-metal/useful-crates/tinyvec.md msgid "" @@ -16738,40 +19715,56 @@ msgid "" "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 "" +"Đôi khi bạn muốn thứ gì đó có thể thay đổi kích thước như `Vec`, nhưng không" +" cần phân bổ vùng heap. [`tinyvec`](https://crates.io/crates/tinyvec) cung " +"cấp điều này: một vectơ được hỗ trợ bởi một mảng hoặc lát cắt, có thể được " +"phân bổ tĩnh hoặc trên ngăn xếp, giúp theo dõi số lượng phần tử được sử dụng" +" và sẽ gây hoảng loạn nếu bạn cố gắng sử dụng nhiều hơn số lượng được phân " +"bổ." #: src/bare-metal/useful-crates/tinyvec.md msgid "" "`tinyvec` requires that the element type implement `Default` for " "initialisation." -msgstr "" +msgstr "`tinyvec` yêu cầu loại phần tử triển khai `Mặc định` để khởi tạo." #: src/bare-metal/useful-crates/tinyvec.md msgid "" -"The Rust Playground includes `tinyvec`, so this example will run fine inline." +"The Rust Playground includes `tinyvec`, so this example will run fine " +"inline." msgstr "" +"Rust Playground bao gồm `tinyvec`, vì vậy ví dụ này sẽ chạy nội tuyến tốt." #: src/bare-metal/useful-crates/spin.md msgid "" -"`std::sync::Mutex` and the other synchronisation primitives from `std::sync` " -"are not available in `core` or `alloc`. How can we manage synchronisation or " -"interior mutability, such as for sharing state between different CPUs?" +"`std::sync::Mutex` and the other synchronisation primitives from `std::sync`" +" are not available in `core` or `alloc`. How can we manage synchronisation " +"or interior mutability, such as for sharing state between different CPUs?" msgstr "" +"`std::sync::Mutex` và các nguyên hàm đồng bộ hóa khác từ `std::sync` không " +"có sẵn trong `core` hoặc `alloc`. Làm cách nào chúng tôi có thể quản lý việc" +" đồng bộ hóa hoặc khả năng thay đổi nội bộ, chẳng hạn như chia sẻ trạng thái" +" giữa các CPU khác nhau?" #: 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 "" +"Crate [`spin`](https://crates.io/crates/spin) cung cấp các sản phẩm tương " +"đương dựa trên spinlock của nhiều loại nguyên thủy này." #: src/bare-metal/useful-crates/spin.md msgid "Be careful to avoid deadlock if you take locks in interrupt handlers." -msgstr "" +msgstr "Hãy cẩn thận để tránh bế tắc nếu bạn khóa các trình xử lý ngắt." #: src/bare-metal/useful-crates/spin.md msgid "" -"`spin` also has a ticket lock mutex implementation; equivalents of `RwLock`, " -"`Barrier` and `Once` from `std::sync`; and `Lazy` for lazy initialisation." +"`spin` also has a ticket lock mutex implementation; equivalents of `RwLock`," +" `Barrier` and `Once` from `std::sync`; and `Lazy` for lazy initialisation." msgstr "" +"`spin` cũng có triển khai mutex khóa vé; tương đương với `RwLock`, `Barrier`" +" và `Once` từ `std::sync`; và `Lazy` để khởi tạo lười biếng." #: src/bare-metal/useful-crates/spin.md msgid "" @@ -16779,11 +19772,15 @@ msgid "" "useful types for late initialisation with a slightly different approach to " "`spin::once::Once`." msgstr "" +"Crate [`once_cell`](https://crates.io/crates/once_cell) cũng có một số loại " +"hữu ích để khởi tạo muộn với cách tiếp cận hơi khác so với " +"`spin::once::Once`." #: src/bare-metal/useful-crates/spin.md msgid "" "The Rust Playground includes `spin`, so this example will run fine inline." msgstr "" +"Rust Playground bao gồm `spin`, vì vậy ví dụ này sẽ chạy nội tuyến tốt." #: src/bare-metal/android.md msgid "" @@ -16792,158 +19789,198 @@ msgid "" "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 "" +"Để xây dựng một hệ nhị phân Rust thuần túy trong AOSP, bạn cần sử dụng quy " +"tắc `rust_ffi_static` Soong để xây dựng mã Rust, sau đó là `cc_binary` với " +"tập lệnh liên kết để tự tạo nhị phân và sau đó là `raw_binary` để chuyển đổi" +" ELF thành nhị phân thô sẵn sàng chạy." #: src/bare-metal/android/vmbase.md msgid "vmbase" -msgstr "" +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." +"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." msgstr "" +"Đối với các máy ảo chạy bằng crosvm trên aarch64, thư viện " +"[vmbase](https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/master/vmbase/)" +" cung cấp tập lệnh liên kết và các giá trị mặc định hữu ích cho quy tắc xây " +"dựng, cùng với điểm vào, ghi nhật ký bảng điều khiển UART, v.v." #: src/bare-metal/android/vmbase.md msgid "" "The `main!` macro marks your main function, to be called from the `vmbase` " "entry point." msgstr "" +"Macro `main!` đánh dấu chức năng chính của bạn, được gọi từ điểm vào " +"`vmbase`." #: src/bare-metal/android/vmbase.md msgid "" "The `vmbase` entry point handles console initialisation, and issues a " "PSCI_SYSTEM_OFF to shutdown the VM if your main function returns." msgstr "" +"Điểm vào `vmbase` xử lý việc khởi tạo bảng điều khiển và đưa ra " +"PSCI_SYSTEM_OFF để tắt VM nếu chức năng chính của bạn quay trở lại." #: src/exercises/bare-metal/afternoon.md msgid "We will write a driver for the PL031 real-time clock device." msgstr "" +"Chúng tôi sẽ viết trình điều khiển cho thiết bị đồng hồ thời gian thực " +"PL031." #: src/exercises/bare-metal/afternoon.md msgid "" "After looking at the exercises, you can look at the [solutions](solutions-" "afternoon.md) provided." msgstr "" +"Sau khi xem các bài tập, bạn có thể xem [giải pháp](solutions-afternoon.md) " +"được cung cấp." #: src/exercises/bare-metal/rtc.md #: src/exercises/bare-metal/solutions-afternoon.md msgid "RTC driver" -msgstr "" +msgstr "trình điều khiển 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." +"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." msgstr "" +"Máy QEMU aarch64 có đồng hồ thời gian thực " +"[PL031](https://developer.arm.com/documentation/ddi0224/c) ở mức 0x9010000. " +"Đối với bài tập này, bạn nên viết một trình điều khiển cho nó." #: 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 "" +"Sử dụng nó để in thời gian hiện tại lên bảng điều khiển nối tiếp. Bạn có thể" +" sử dụng crate [`chrono`](https://crates.io/crates/chrono) để định dạng " +"ngày/giờ." #: 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 "" +"Sử dụng thanh ghi khớp và trạng thái ngắt thô để bận-đợi đến một thời điểm " +"nhất định, ví dụ: 3 giây trong tương lai. (Gọi " +"[`core::hint::spin_loop`](https://doc.rust-" +"lang.org/core/hint/fn.spin_loop.html) bên trong vòng lặp.)" #: 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." +"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 "" +"_Tiện ích mở rộng nếu có thời gian:_ Kích hoạt và xử lý ngắt do trận đấu RTC" +" tạo ra. Bạn có thể sử dụng trình điều khiển được cung cấp trong hộp [`arm-" +"gic`](https://docs.rs/arm-gic/) để định cấu hình Bộ điều khiển ngắt chung " +"của Arm." #: src/exercises/bare-metal/rtc.md msgid "Use the RTC interrupt, which is wired to the GIC as `IntId::spi(2)`." -msgstr "" +msgstr "Sử dụng ngắt RTC, được kết nối với GIC dưới dạng `IntId::spi(2)`." #: src/exercises/bare-metal/rtc.md 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." +"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 "" +"Sau khi kích hoạt ngắt, bạn có thể đặt lõi ở chế độ ngủ thông qua " +"`arm_gic::wfi()`, điều này sẽ khiến lõi ở chế độ ngủ cho đến khi nhận được " +"ngắt." #: 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." +"Download the [exercise template](../../comprehensive-rust-exercises.zip) and" +" look in the `rtc` directory for the following files." msgstr "" +"Tải xuống [mẫu bài tập](../../comprehensive-rust-exercises.zip) và tìm trong" +" thư mục `rtc` để tìm các tệp sau." #: src/exercises/bare-metal/rtc.md msgid "" -"_src/exceptions.rs_ (you should only need to change this for the 3rd part of " -"the exercise):" +"_src/exceptions.rs_ (you should only need to change this for the 3rd part of" +" the exercise):" msgstr "" +"_src/Exceptions.rs_ (bạn chỉ cần thay đổi điều này cho phần thứ 3 của bài " +"tập):" #: src/exercises/bare-metal/rtc.md msgid "_src/logger.rs_ (you shouldn't need to change this):" -msgstr "" +msgstr "_src/logger.rs_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_src/pl011.rs_ (you shouldn't need to change this):" -msgstr "" +msgstr "_src/pl011.rs_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_build.rs_ (you shouldn't need to change this):" -msgstr "" +msgstr "_build.rs_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_entry.S_ (you shouldn't need to change this):" -msgstr "" +msgstr "_entry.S_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_exceptions.S_ (you shouldn't need to change this):" -msgstr "" +msgstr "_Exceptions.S_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_idmap.S_ (you shouldn't need to change this):" -msgstr "" +msgstr "_idmap.S_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_image.ld_ (you shouldn't need to change this):" -msgstr "" +msgstr "_image.ld_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "_Makefile_ (you shouldn't need to change this):" -msgstr "" +msgstr "_Makefile_ (bạn không cần thay đổi điều này):" #: src/exercises/bare-metal/rtc.md msgid "Run the code in QEMU with `make qemu`." -msgstr "" +msgstr "Chạy mã trong QEMU bằng `make qemu`." #: src/exercises/bare-metal/solutions-afternoon.md msgid "Bare Metal Rust Afternoon" -msgstr "" +msgstr "Buổi chiều Rust kim loại trần" #: src/exercises/bare-metal/solutions-afternoon.md msgid "([back to exercise](rtc.md))" -msgstr "" +msgstr "([quay lại bài tập](rtc.md))" #: src/exercises/bare-metal/solutions-afternoon.md msgid "_main.rs_:" -msgstr "" +msgstr "_main.rs_:" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Base addresses of the GICv3.\n" -msgstr "" +msgstr "/// Địa chỉ cơ sở của GICv3.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Base address of the PL031 RTC.\n" -msgstr "" +msgstr "/// Địa chỉ cơ sở của PL031 RTC.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// The IRQ used by the PL031 RTC.\n" -msgstr "" +msgstr "/// IRQ được PL031 RTC sử dụng.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"main({:#x}, {:#x}, {:#x}, {:#x})\"" -msgstr "" +msgstr "\"chính({:#x}, {:#x}, {:#x}, {:#x})\"" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" @@ -16951,76 +19988,81 @@ msgid "" " // addresses of a GICv3 distributor and redistributor respectively, and\n" " // nothing else accesses those address ranges.\n" msgstr "" +"// AN TOÀN: `GICD_BASE_ADDRESS` và `GICR_BASE_ADDRESS` là cơ sở\n" +" // địa chỉ của nhà phân phối và nhà phân phối lại GICv3 tương ứng và\n" +" // không có gì khác truy cập vào các dải địa chỉ đó.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" "// SAFETY: `PL031_BASE_ADDRESS` is the base address of a PL031 device, and\n" " // nothing else accesses that address range.\n" msgstr "" +"// AN TOÀN: `PL031_BASE_ADDRESS` là địa chỉ cơ sở của thiết bị PL031 và\n" +" // không có gì khác truy cập vào dải địa chỉ đó.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"RTC: {time}\"" -msgstr "" +msgstr "\"RTC: {thời gian}\"" #: src/exercises/bare-metal/solutions-afternoon.md msgid "// Wait for 3 seconds, without interrupts.\n" -msgstr "" +msgstr "// Đợi 3 giây, không ngắt.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"Waiting for {}\"" -msgstr "" +msgstr "\"Đang chờ {}\"" #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"matched={}, interrupt_pending={}\"" -msgstr "" +msgstr "\"khớp={}, ngắt_pending={}\"" #: src/exercises/bare-metal/solutions-afternoon.md msgid "\"Finished waiting\"" -msgstr "" +msgstr "\"Chờ xong rồi\"" #: src/exercises/bare-metal/solutions-afternoon.md msgid "// Wait another 3 seconds for an interrupt.\n" -msgstr "" +msgstr "// Đợi thêm 3 giây nữa để ngắt.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "_pl031.rs_:" -msgstr "" +msgstr "_pl031.rs_:" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Data register\n" -msgstr "" +msgstr "/// Thanh ghi dữ liệu\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Match register\n" -msgstr "" +msgstr "/// Thanh ghi so khớp\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Load register\n" -msgstr "" +msgstr "/// Nạp thanh ghi\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Control register\n" -msgstr "" +msgstr "/// Thanh ghi điều khiển\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Interrupt Mask Set or Clear register\n" -msgstr "" +msgstr "/// Đặt mặt nạ ngắt hoặc xóa thanh ghi\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Raw Interrupt Status\n" -msgstr "" +msgstr "/// Trạng thái ngắt thô\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Masked Interrupt Status\n" -msgstr "" +msgstr "/// Trạng thái ngắt bị che giấu\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Interrupt Clear Register\n" -msgstr "" +msgstr "/// Ngắt Xóa thanh ghi\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Driver for a PL031 real-time clock.\n" -msgstr "" +msgstr "/// Driver cho đồng hồ thời gian thực PL031.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" @@ -17029,35 +20071,46 @@ msgid "" " ///\n" " /// # Safety\n" " ///\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" +" /// 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" msgstr "" +"/// Xây dựng một phiên bản mới của trình điều khiển RTC cho thiết bị PL031 tại\n" +" /// địa chỉ cơ sở đã cho.\n" +" ///\n" +" /// # An toàn\n" +" ///\n" +" /// Địa chỉ cơ sở đã cho phải trỏ tới các thanh ghi điều khiển MMIO của một\n" +" /// Thiết bị PL031, phải được ánh xạ vào không gian địa chỉ của tiến trình\n" +" /// làm bộ nhớ thiết bị và không có bí danh nào khác.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Reads the current RTC value.\n" -msgstr "" +msgstr "/// Đọc giá trị RTC hiện tại.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" "// SAFETY: We know that self.registers points to the control registers\n" " // of a PL031 device which is appropriately mapped.\n" msgstr "" +"// AN TOÀN: Chúng ta biết rằng self.registers trỏ đến các thanh ghi điều khiển\n" +" // của thiết bị PL031 được ánh xạ thích hợp.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" "/// Writes a match value. When the RTC value matches this then an interrupt\n" " /// will be generated (if it is enabled).\n" msgstr "" +"/// Viết một giá trị khớp. Khi giá trị RTC khớp với giá trị này thì sẽ có ngắt\n" +" /// sẽ được tạo (nếu nó được bật).\n" #: 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 "" +"/// Trả về xem thanh ghi khớp có khớp với giá trị RTC hay không\n" +" /// ngắt được kích hoạt.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" @@ -17066,42 +20119,57 @@ msgid "" " /// This should be true if and only if `matched` returns true and the\n" " /// interrupt is masked.\n" msgstr "" +"/// Trả về xem hiện tại có một ngắt đang chờ xử lý hay không.\n" +" ///\n" +" /// Điều này đúng khi và chỉ khi `matched` trả về true và\n" +" /// ngắt bị che dấu.\n" #: src/exercises/bare-metal/solutions-afternoon.md 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 "" +"/// Đặt hoặc xóa mặt nạ ngắt.\n" +" ///\n" +" /// Khi mặt nạ đúng thì ngắt được kích hoạt; khi nó sai\n" +" /// ngắt bị vô hiệu hóa.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "/// Clears a pending interrupt, if any.\n" -msgstr "" +msgstr "/// Xóa một ngắt đang chờ xử lý, nếu có.\n" #: src/exercises/bare-metal/solutions-afternoon.md msgid "" "// SAFETY: `Rtc` just contains a pointer to device memory, which can be\n" "// accessed from any context.\n" msgstr "" +"// AN TOÀN: `Rtc` chỉ chứa một con trỏ tới bộ nhớ thiết bị, có thể\n" +"// truy cập từ bất kỳ ngữ cảnh nào.\n" #: src/concurrency/welcome.md msgid "Welcome to Concurrency in Rust" -msgstr "" +msgstr "Chào mừng bạn đến với Đồng thời trong Rust" #: src/concurrency/welcome.md msgid "" "Rust has full support for concurrency using OS threads with mutexes and " "channels." msgstr "" +"Rust có hỗ trợ đầy đủ cho hoạt động đồng thời bằng cách sử dụng các luồng hệ" +" điều hành với các mutex và kênh." #: src/concurrency/welcome.md msgid "" -"The Rust type system plays an important role in making many concurrency bugs " -"compile time bugs. This is often referred to as _fearless concurrency_ since " -"you can rely on the compiler to ensure correctness at runtime." +"The Rust type system plays an important role in making many concurrency bugs" +" compile time bugs. This is often referred to as _fearless concurrency_ " +"since you can rely on the compiler to ensure correctness at runtime." msgstr "" +"Hệ thống kiểu Rust đóng một vai trò quan trọng trong việc tạo ra nhiều lỗi " +"đồng thời biên dịch lỗi thời gian. Điều này thường được gọi là _sự đồng thời" +" không sợ hãi_ vì bạn có thể dựa vào compiler để đảm bảo tính chính xác khi " +"chạy." #: src/concurrency/welcome.md src/concurrency/welcome-async.md msgid "" @@ -17115,18 +20183,26 @@ msgstr "" msgid "" "Rust lets us access OS concurrency toolkit: threads, sync. primitives, etc." msgstr "" +"Rust cho phép chúng ta truy cập bộ công cụ đồng thời của hệ điều hành: " +"luồng, đồng bộ hóa. nguyên thủy, v.v." #: src/concurrency/welcome.md msgid "" -"The type system gives us safety for concurrency without any special features." +"The type system gives us safety for concurrency without any special " +"features." msgstr "" +"Hệ thống kiểu mang lại cho chúng ta sự an toàn khi chạy đồng thời mà không " +"có bất kỳ tính năng đặc biệt nào." #: src/concurrency/welcome.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 "" +"Các công cụ tương tự giúp truy cập \"đồng thời\" trong một luồng duy nhất " +"(ví dụ: hàm được gọi có thể thay đổi một đối số hoặc lưu tham chiếu đến nó " +"để đọc sau) giúp chúng ta tránh khỏi các vấn đề đa luồng." #: src/concurrency/threads.md src/concurrency/shared-state.md #: src/concurrency/async.md @@ -17135,173 +20211,210 @@ msgstr "Phần này sẽ kéo dài khoảng 30 phút, bao gồm:" #: src/concurrency/threads/plain.md msgid "Rust threads work similarly to threads in other languages:" -msgstr "" +msgstr "Luồng Rust hoạt động tương tự như luồng trong các ngôn ngữ khác:" #: src/concurrency/threads/plain.md msgid "\"Count in thread: {i}!\"" -msgstr "" +msgstr "\"Đếm trong chuỗi: {i}!\"" #: src/concurrency/threads/plain.md msgid "\"Main thread: {i}\"" -msgstr "" +msgstr "\"Chủ đề chính: {i}\"" #: src/concurrency/threads/plain.md -msgid "Threads are all daemon threads, the main thread does not wait for them." -msgstr "" +msgid "" +"Threads are all daemon threads, the main thread does not wait for them." +msgstr "Các luồng đều là các luồng daemon, luồng chính không đợi chúng." #: src/concurrency/threads/plain.md msgid "Thread panics are independent of each other." -msgstr "" +msgstr "Sự hoảng loạn của chủ đề là độc lập với nhau." #: src/concurrency/threads/plain.md msgid "Panics can carry a payload, which can be unpacked with `downcast_ref`." msgstr "" +"Sự hoảng loạn có thể mang theo một tải trọng, có thể được giải nén bằng " +"`downcast_ref`." #: src/concurrency/threads/plain.md msgid "Rust thread APIs look not too different from e.g. C++ ones." -msgstr "" +msgstr "API luồng Rust trông không quá khác biệt so với ví dụ: C++." #: src/concurrency/threads/plain.md msgid "Run the example." -msgstr "" +msgstr "Chạy ví dụ." #: src/concurrency/threads/plain.md msgid "" "5ms timing is loose enough that main and spawned threads stay mostly in " "lockstep." msgstr "" +"Thời gian 5ms đủ lỏng để các luồng chính và luồng sinh ra chủ yếu ở trạng " +"thái khóa." #: src/concurrency/threads/plain.md msgid "Notice that the program ends before the spawned thread reaches 10!" -msgstr "" +msgstr "Lưu ý rằng chương trình kết thúc trước khi chuỗi được sinh ra đạt 10!" #: src/concurrency/threads/plain.md msgid "" "This is because main ends the program and spawned threads do not make it " "persist." msgstr "" +"Điều này là do chương trình chính kết thúc chương trình và các luồng được " +"sinh ra không khiến chương trình tồn tại lâu dài." #: src/concurrency/threads/plain.md msgid "Compare to pthreads/C++ std::thread/boost::thread if desired." -msgstr "" +msgstr "So sánh với pthreads/C++ std::thread/boost::thread nếu muốn." #: src/concurrency/threads/plain.md msgid "How do we wait around for the spawned thread to complete?" -msgstr "" +msgstr "Làm thế nào để chúng ta chờ đợi chuỗi được sinh ra hoàn tất?" #: src/concurrency/threads/plain.md msgid "" "[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html) " "returns a `JoinHandle`. Look at the docs." msgstr "" +"[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html) trả về" +" `JoinHandle`. Nhìn vào các tài liệu." #: src/concurrency/threads/plain.md msgid "" -"`JoinHandle` has a [`.join()`](https://doc.rust-lang.org/std/thread/struct." -"JoinHandle.html#method.join) method that blocks." +"`JoinHandle` has a [`.join()`](https://doc.rust-" +"lang.org/std/thread/struct.JoinHandle.html#method.join) method that blocks." msgstr "" +"`JoinHandle` có phương thức [`.join()`](https://doc.rust-" +"lang.org/std/thread/struct.JoinHandle.html#method.join) chặn." #: src/concurrency/threads/plain.md 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." msgstr "" +"Sử dụng `let Handle = thread::spawn(...)` và sau đó là `handle.join()` để " +"đợi chuỗi kết thúc và chương trình sẽ đếm đến 10." #: src/concurrency/threads/plain.md msgid "Now what if we want to return a value?" -msgstr "" +msgstr "Bây giờ nếu chúng ta muốn trả về một giá trị thì sao?" #: src/concurrency/threads/plain.md msgid "Look at docs again:" -msgstr "" +msgstr "Nhìn lại tài liệu:" #: src/concurrency/threads/plain.md msgid "" "[`thread::spawn`](https://doc.rust-lang.org/std/thread/fn.spawn.html)'s " "closure returns `T`" msgstr "" +"Việc đóng của [`thread::spawn`](https://doc.rust-" +"lang.org/std/thread/fn.spawn.html) trả về `T`" #: src/concurrency/threads/plain.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 "" +"`JoinHandle` [`.join()`](https://doc.rust-" +"lang.org/std/thread/struct.JoinHandle.html#method.join) trả về " +"`thread::Result`" #: src/concurrency/threads/plain.md msgid "" "Use the `Result` return value from `handle.join()` to get access to the " "returned value." msgstr "" +"Sử dụng giá trị trả về `Result` từ `handle.join()` để có quyền truy cập vào " +"giá trị được trả về." #: src/concurrency/threads/plain.md msgid "Ok, what about the other case?" -msgstr "" +msgstr "Được rồi, còn trường hợp kia thì sao?" #: src/concurrency/threads/plain.md msgid "Trigger a panic in the thread. Note that this doesn't panic `main`." msgstr "" +"Gây ra sự hoảng loạn trong chủ đề. Lưu ý rằng điều này không làm `main` " +"hoảng sợ." #: src/concurrency/threads/plain.md 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 "" +"Truy cập vào tải trọng hoảng loạn. Đây là thời điểm thích hợp để nói về " +"[`Any`](https://doc.rust-lang.org/std/any/index.html)." #: src/concurrency/threads/plain.md msgid "Now we can return values from threads! What about taking inputs?" msgstr "" +"Bây giờ chúng ta có thể trả về giá trị từ các luồng! Còn việc lấy đầu vào " +"thì sao?" #: src/concurrency/threads/plain.md msgid "Capture something by reference in the thread closure." -msgstr "" +msgstr "Chụp nội dung nào đó bằng cách tham chiếu trong quá trình đóng chuỗi." #: src/concurrency/threads/plain.md msgid "An error message indicates we must move it." -msgstr "" +msgstr "Một thông báo lỗi cho biết chúng ta phải di chuyển nó." #: src/concurrency/threads/plain.md msgid "Move it in, see we can compute and then return a derived value." msgstr "" +"Di chuyển nó vào, xem chúng ta có thể tính toán và sau đó trả về giá trị dẫn" +" xuất." #: src/concurrency/threads/plain.md msgid "If we want to borrow?" -msgstr "" +msgstr "Nếu chúng tôi muốn vay?" #: src/concurrency/threads/plain.md msgid "" "Main kills child threads when it returns, but another function would just " "return and leave them running." msgstr "" +"Chính sẽ giết các luồng con khi nó quay trở lại, nhưng một hàm khác sẽ quay " +"lại và để chúng chạy." #: src/concurrency/threads/plain.md msgid "That would be stack use-after-return, which violates memory safety!" -msgstr "" +msgstr "Đó sẽ là ngăn xếp sử dụng sau khi trả về, vi phạm an toàn bộ nhớ!" #: src/concurrency/threads/plain.md msgid "How do we avoid this? see next slide." -msgstr "" +msgstr "Làm thế nào để chúng ta tránh được điều này? xem slide tiếp theo." #: src/concurrency/threads/scoped.md msgid "Normal threads cannot borrow from their environment:" -msgstr "" +msgstr "Các luồng thông thường không thể mượn từ môi trường của chúng:" #: src/concurrency/threads/scoped.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 "" +"Tuy nhiên, bạn có thể sử dụng [chuỗi có phạm vi](https://doc.rust-" +"lang.org/std/thread/fn.scope.html) cho việc này:" #: src/concurrency/threads/scoped.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." +"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 "" +"Lý do là vì khi hàm `thread::scope` hoàn thành, tất cả các luồng được đảm " +"bảo sẽ được nối, vì vậy chúng có thể trả về dữ liệu đã mượn." #: src/concurrency/threads/scoped.md msgid "" "Normal Rust borrowing rules apply: you can either borrow mutably by one " "thread, or immutably by any number of threads." msgstr "" +"Áp dụng các quy tắc vay Rust thông thường: bạn có thể mượn thay đổi theo một" +" luồng hoặc bất biến theo bất kỳ số lượng luồng nào." #: src/concurrency/channels.md src/concurrency/async-control-flow.md msgid "This segment should take about 20 minutes. It contains:" @@ -17312,93 +20425,115 @@ 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." msgstr "" +"Các kênh Rust có hai phần: `Sender` và `Receiver`. Hai phần được kết " +"nối qua kênh nhưng bạn chỉ nhìn thấy điểm cuối." #: src/concurrency/channels/senders-receivers.md msgid "\"Received: {:?}\"" -msgstr "" +msgstr "\"Đã nhận: {:?}\"" #: src/concurrency/channels/senders-receivers.md msgid "" -"`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender` " -"implement `Clone` (so you can make multiple producers) but `Receiver` does " +"`mpsc` stands for Multi-Producer, Single-Consumer. `Sender` and `SyncSender`" +" implement `Clone` (so you can make multiple producers) but `Receiver` does " "not." msgstr "" +"`mpsc` là viết tắt của Multi-Producer, Single-Consumer. `Sender` và " +"`SyncSender` triển khai `Clone` (để bạn có thể tạo nhiều nhà sản xuất) nhưng" +" `Người nhận` thì không." #: src/concurrency/channels/senders-receivers.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()` và `recv()` trả về `Result`. Nếu chúng trả về `Err`, điều đó có " +"nghĩa là `Người gửi` hoặc `Người nhận` đối tác bị loại bỏ và kênh bị đóng." #: src/concurrency/channels/unbounded.md msgid "You get an unbounded and asynchronous channel with `mpsc::channel()`:" msgstr "" +"Bạn nhận được một kênh không đồng bộ và không giới hạn với " +"`mpsc::channel()`:" #: src/concurrency/channels/unbounded.md src/concurrency/channels/bounded.md msgid "\"Message {i}\"" -msgstr "" +msgstr "\"Tin nhắn {i}\"" #: src/concurrency/channels/unbounded.md src/concurrency/channels/bounded.md msgid "\"{thread_id:?}: sent Message {i}\"" -msgstr "" +msgstr "\"{thread_id:?}: đã gửi tin nhắn {i}\"" #: src/concurrency/channels/unbounded.md src/concurrency/channels/bounded.md msgid "\"{thread_id:?}: done\"" -msgstr "" +msgstr "\"{thread_id:?}: xong\"" #: src/concurrency/channels/unbounded.md src/concurrency/channels/bounded.md msgid "\"Main: got {msg}\"" -msgstr "" +msgstr "\"Chính: đã nhận được {tin nhắn}\"" #: src/concurrency/channels/bounded.md msgid "" "With bounded (synchronous) channels, `send` can block the current thread:" -msgstr "" +msgstr "Với các kênh bị chặn (đồng bộ), `send` có thể chặn luồng hiện tại:" #: 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 "" +"Việc gọi `send` sẽ chặn luồng hiện tại cho đến khi có chỗ trống trong kênh " +"cho tin nhắn mới. Chủ đề có thể bị chặn vô thời hạn nếu không có ai đọc " +"kênh." #: 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." msgstr "" +"Cuộc gọi tới `send` sẽ bị hủy do có lỗi (đó là lý do tại sao nó trả về `Kết " +"quả`) nếu kênh bị đóng. Một kênh sẽ bị đóng khi máy thu bị rơi." #: 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 `recv`." msgstr "" +"Kênh giới hạn có kích thước bằng 0 được gọi là \"kênh điểm hẹn\". Mỗi lần " +"gửi sẽ chặn luồng hiện tại cho đến khi một luồng khác gọi `recv`." #: src/concurrency/send-sync.md msgid "Send" -msgstr "" +msgstr "Gửi" #: src/concurrency/send-sync.md msgid "Sync" -msgstr "" +msgstr "Đồng bộ hóa" #: src/concurrency/send-sync/marker-traits.md msgid "" "How does Rust know to forbid shared access across threads? The answer is in " "two traits:" msgstr "" +"Làm sao Rust biết cấm truy cập chia sẻ giữa các chủ đề? Câu trả lời nằm ở " +"hai đặc điểm:" #: src/concurrency/send-sync/marker-traits.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." msgstr "" +"[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html): loại `T` là " +"`Gửi` nếu việc di chuyển `T` qua ranh giới luồng là an toàn." #: src/concurrency/send-sync/marker-traits.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." msgstr "" +"[`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html): loại `T` là " +"`Sync` nếu việc di chuyển `&T` qua ranh giới luồng là an toàn." #: src/concurrency/send-sync/marker-traits.md msgid "" @@ -17407,22 +20542,32 @@ msgid "" "only contain `Send` and `Sync` types. You can also implement them manually " "when you know it is valid." msgstr "" +"`Gửi` và `Đồng bộ hóa` là [các đặc điểm không an toàn](../../unsafe-" +"rust/unsafe-traits.md). compiler sẽ tự động lấy chúng cho các loại của bạn " +"miễn là chúng chỉ chứa các loại `Send` và `Sync`. Bạn cũng có thể triển khai" +" chúng theo cách thủ công khi bạn biết nó hợp lệ." #: src/concurrency/send-sync/marker-traits.md msgid "" "One can think of these traits as markers that the type has certain thread-" "safety properties." msgstr "" +"Người ta có thể coi những đặc điểm này là điểm đánh dấu rằng loại này có các" +" thuộc tính an toàn luồng nhất định." #: src/concurrency/send-sync/marker-traits.md msgid "They can be used in the generic constraints as normal traits." msgstr "" +"Chúng có thể được sử dụng trong các ràng buộc chung như những đặc điểm bình " +"thường." #: 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 "" +"Loại `T` là [`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html) " +"nếu việc di chuyển giá trị `T` sang một chuỗi khác là an toàn." #: src/concurrency/send-sync/send.md msgid "" @@ -17430,26 +20575,32 @@ msgid "" "run in that thread. So the question is when you can allocate a value in one " "thread and deallocate it in another." msgstr "" +"Tác dụng của việc chuyển quyền sở hữu sang một luồng khác là _structors_ sẽ " +"chạy trong luồng đó. Vì vậy, câu hỏi đặt ra là khi nào bạn có thể phân bổ " +"một giá trị trong một luồng và giải phóng nó trong một luồng khác." #: 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 "" +"Ví dụ: kết nối tới thư viện SQLite chỉ được truy cập từ một luồng duy nhất." #: 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 "" +"Loại `T` là [`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) " +"nếu việc truy cập giá trị `T` từ nhiều luồng cùng một lúc là an toàn." #: src/concurrency/send-sync/sync.md msgid "More precisely, the definition is:" -msgstr "" +msgstr "Chính xác hơn, định nghĩa là:" #: src/concurrency/send-sync/sync.md msgid "`T` is `Sync` if and only if `&T` is `Send`" -msgstr "" +msgstr "`T` là `Sync` khi và chỉ khi `&T` là `Send`" #: src/concurrency/send-sync/sync.md msgid "" @@ -17457,6 +20608,9 @@ msgid "" "thread-safe for shared use, it is also thread-safe to pass references of it " "across threads." msgstr "" +"Câu lệnh này về cơ bản là một cách viết tắt để nói rằng nếu một kiểu an toàn" +" theo luồng để sử dụng chung thì nó cũng an toàn theo luồng khi chuyển các " +"tham chiếu của nó qua các luồng." #: src/concurrency/send-sync/sync.md msgid "" @@ -17466,155 +20620,188 @@ msgid "" "is also safe to move to another thread, because the data it references can " "be accessed from any thread safely." msgstr "" +"Điều này là do nếu một loại là Đồng bộ hóa, điều đó có nghĩa là nó có thể " +"được chia sẻ trên nhiều luồng mà không gặp rủi ro về xung đột dữ liệu hoặc " +"các vấn đề đồng bộ hóa khác, do đó, việc di chuyển nó sang một luồng khác là" +" an toàn. Tham chiếu đến loại cũng an toàn khi di chuyển sang luồng khác, vì" +" dữ liệu mà nó tham chiếu có thể được truy cập từ bất kỳ luồng nào một cách " +"an toàn." #: src/concurrency/send-sync/examples.md msgid "`Send + Sync`" -msgstr "" +msgstr "`Gửi + Đồng bộ hóa`" #: src/concurrency/send-sync/examples.md msgid "Most types you come across are `Send + Sync`:" -msgstr "" +msgstr "Hầu hết các loại bạn gặp là `Send + Sync`:" #: src/concurrency/send-sync/examples.md msgid "`i8`, `f32`, `bool`, `char`, `&str`, ..." -msgstr "" +msgstr "`i8`, `f32`, `bool`, `char`, `&str`, ..." #: src/concurrency/send-sync/examples.md msgid "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." -msgstr "" +msgstr "`(T1, T2)`, `[T; N]`, `&[T]`, `struct { x: T }`, ..." #: src/concurrency/send-sync/examples.md msgid "`String`, `Option`, `Vec`, `Box`, ..." -msgstr "" +msgstr "`Chuỗi`, `Tùy chọn`, `Vec`, `Hộp`, ..." #: src/concurrency/send-sync/examples.md msgid "`Arc`: Explicitly thread-safe via atomic reference count." msgstr "" +"`Arc`: An toàn luồng một cách rõ ràng thông qua số lượng tham chiếu " +"nguyên tử." #: src/concurrency/send-sync/examples.md msgid "`Mutex`: Explicitly thread-safe via internal locking." msgstr "" +"`Mutex`: An toàn cho luồng một cách rõ ràng thông qua khóa bên trong." #: src/concurrency/send-sync/examples.md msgid "`mpsc::Sender`: As of 1.72.0." -msgstr "" +msgstr "`mpsc::Sender`: Kể từ phiên bản 1.72.0." #: src/concurrency/send-sync/examples.md msgid "`AtomicBool`, `AtomicU8`, ...: Uses special atomic instructions." -msgstr "" +msgstr "`AtomicBool`, `AtomicU8`, ...: Sử dụng các lệnh nguyên tử đặc biệt." #: src/concurrency/send-sync/examples.md msgid "" "The generic types are typically `Send + Sync` when the type parameters are " "`Send + Sync`." msgstr "" +"Loại chung thường là `Gửi + Đồng bộ hóa` khi tham số loại là `Gửi + Đồng bộ " +"hóa`." #: src/concurrency/send-sync/examples.md msgid "`Send + !Sync`" -msgstr "" +msgstr "`Gửi + !Đồng bộ`" #: src/concurrency/send-sync/examples.md msgid "" "These types can be moved to other threads, but they're not thread-safe. " "Typically because of interior mutability:" msgstr "" +"Những loại này có thể được chuyển sang các luồng khác, nhưng chúng không an " +"toàn cho luồng. Thông thường do tính biến đổi nội tại:" #: src/concurrency/send-sync/examples.md msgid "`mpsc::Receiver`" -msgstr "" +msgstr "`mpsc::Bộ thu`" #: src/concurrency/send-sync/examples.md msgid "`Cell`" -msgstr "" +msgstr "`Ô`" #: src/concurrency/send-sync/examples.md msgid "`RefCell`" -msgstr "" +msgstr "`RefCell`" #: src/concurrency/send-sync/examples.md msgid "`!Send + Sync`" -msgstr "" +msgstr "`!Gửi + Đồng bộ`" #: src/concurrency/send-sync/examples.md msgid "" "These types are thread-safe, but they cannot be moved to another thread:" msgstr "" +"Những loại này an toàn cho luồng, nhưng chúng không thể được chuyển sang " +"luồng khác:" #: src/concurrency/send-sync/examples.md msgid "" -"`MutexGuard`: Uses OS level primitives which must be deallocated on " -"the thread which created them." +"`MutexGuard`: Uses OS level primitives which must be deallocated on" +" the thread which created them." msgstr "" +"`MutexGuard`: Sử dụng các nguyên hàm cấp độ hệ điều hành phải được " +"giải phóng trên luồng đã tạo ra chúng." #: src/concurrency/send-sync/examples.md msgid "`!Send + !Sync`" -msgstr "" +msgstr "`!Gửi + !Đồng bộ`" #: src/concurrency/send-sync/examples.md msgid "These types are not thread-safe and cannot be moved to other threads:" msgstr "" +"Các loại này không an toàn cho luồng và không thể chuyển sang các luồng " +"khác:" #: src/concurrency/send-sync/examples.md msgid "" -"`Rc`: each `Rc` has a reference to an `RcBox`, which contains a non-" -"atomic reference count." +"`Rc`: each `Rc` has a reference to an `RcBox`, which contains a " +"non-atomic reference count." msgstr "" +"`Rc`: mỗi `Rc` có một tham chiếu đến một `RcBox`, chứa số lượng " +"tham chiếu phi nguyên tử." #: src/concurrency/send-sync/examples.md msgid "" -"`*const T`, `*mut T`: Rust assumes raw pointers may have special concurrency " -"considerations." +"`*const T`, `*mut T`: Rust assumes raw pointers may have special concurrency" +" considerations." msgstr "" +"`*const T`, `*mut T`: Rust giả sử các con trỏ thô có thể có những cân nhắc " +"đặc biệt về tính tương tranh." #: src/concurrency/shared-state.md msgid "Arc" -msgstr "" +msgstr "vòng cung" #: src/concurrency/shared-state.md msgid "Mutex" -msgstr "" +msgstr "Mutex" #: src/concurrency/shared-state/arc.md msgid "" -"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html) allows shared " -"read-only access via `Arc::clone`:" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html) allows shared" +" read-only access via `Arc::clone`:" msgstr "" +"[`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html) cho phép truy" +" cập chỉ đọc được chia sẻ thông qua `Arc::clone`:" #: src/concurrency/shared-state/arc.md msgid "\"{thread_id:?}: {v:?}\"" -msgstr "" +msgstr "\"{thread_id:?}: {v:?}\"" #: src/concurrency/shared-state/arc.md src/concurrency/shared-state/example.md msgid "\"v: {v:?}\"" -msgstr "" +msgstr "\"v: {v:?}\"" #: src/concurrency/shared-state/arc.md msgid "" -"`Arc` stands for \"Atomic Reference Counted\", a thread safe version of `Rc` " -"that uses atomic operations." +"`Arc` stands for \"Atomic Reference Counted\", a thread safe version of `Rc`" +" that uses atomic operations." msgstr "" +"`Arc` là viết tắt của \"Đã tính tham chiếu nguyên tử\", một phiên bản an " +"toàn theo luồng của `Rc` sử dụng các phép toán nguyên tử." #: src/concurrency/shared-state/arc.md msgid "" "`Arc` implements `Clone` whether or not `T` does. It implements `Send` " "and `Sync` if and only if `T` implements them both." msgstr "" +"`Arc` thực hiện `Bản sao` cho dù `T` có thực hiện hay không. Nó triển " +"khai `Gửi` và `Đồng bộ hóa` khi và chỉ khi `T` triển khai cả hai." #: 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." msgstr "" +"`Arc::clone()` có chi phí cho các hoạt động nguyên tử được thực thi, nhưng " +"sau đó việc sử dụng `T` là miễn phí." #: src/concurrency/shared-state/arc.md msgid "" -"Beware of reference cycles, `Arc` does not use a garbage collector to detect " -"them." +"Beware of reference cycles, `Arc` does not use a garbage collector to detect" +" them." msgstr "" +"Hãy cẩn thận với các chu trình tham chiếu, `Arc` không sử dụng trình thu gom" +" rác để phát hiện chúng." #: src/concurrency/shared-state/arc.md msgid "`std::sync::Weak` can help." -msgstr "" +msgstr "`std::sync::Weak` có thể hữu ích." #: src/concurrency/shared-state/mutex.md msgid "" @@ -17623,10 +20810,14 @@ msgid "" "interface (another form of [interior mutability](../../borrowing/interior-" "mutability)):" msgstr "" +"[`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) đảm bảo " +"loại trừ lẫn nhau _and_ cho phép truy cập có thể thay đổi vào `T` đằng sau " +"giao diện chỉ đọc (một dạng khác của [khả năng biến đổi bên " +"trong](../../borrowing/interior-mutability)):" #: src/concurrency/shared-state/mutex.md msgid "\"v: {:?}\"" -msgstr "" +msgstr "\"v: {:?}\"" #: src/concurrency/shared-state/mutex.md msgid "" @@ -17634,87 +20825,109 @@ msgid "" "lang.org/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E) blanket " "implementation." msgstr "" +"Hãy lưu ý cách chúng tôi triển khai tổng thể [`impl Sync for " +"Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#impl-Sync-" +"for-Mutex%3CT%3E)." #: src/concurrency/shared-state/mutex.md msgid "" "`Mutex` in Rust looks like a collection with just one element --- the " "protected data." msgstr "" +"`Mutex` trong Rust trông giống như một bộ sưu tập chỉ có một phần tử --- dữ " +"liệu được bảo vệ." #: src/concurrency/shared-state/mutex.md msgid "" "It is not possible to forget to acquire the mutex before accessing the " "protected data." -msgstr "" +msgstr "Không thể quên lấy mutex trước khi truy cập dữ liệu được bảo vệ." #: src/concurrency/shared-state/mutex.md 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 "" +"Bạn có thể nhận được `&mut T` từ `&Mutex` bằng cách lấy khóa. " +"`MutexGuard` đảm bảo rằng `&mut T` không tồn tại lâu hơn khóa đang được giữ." #: src/concurrency/shared-state/mutex.md msgid "" "`Mutex` implements both `Send` and `Sync` iff (if and only if) `T` " "implements `Send`." msgstr "" +"`Mutex` triển khai cả `Send` và `Sync` iff (nếu và chỉ khi) `T` triển " +"khai `Send`." #: src/concurrency/shared-state/mutex.md msgid "A read-write lock counterpart: `RwLock`." -msgstr "" +msgstr "Một bản sao khóa đọc-ghi: `RwLock`." #: src/concurrency/shared-state/mutex.md msgid "Why does `lock()` return a `Result`?" -msgstr "" +msgstr "Tại sao `lock()` trả về `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." +"[`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 "" +"Nếu luồng chứa `Mutex` bị hoảng loạn, `Mutex` sẽ bị \"độc\" để báo hiệu rằng" +" dữ liệu mà nó bảo vệ có thể ở trạng thái không nhất quán. Việc gọi `lock()`" +" trên một mutex bị nhiễm độc không thành công với " +"[`PoisonError`](https://doc.rust-lang.org/std/sync/struct.PoisonError.html)." +" Bạn có thể gọi `into_inner()` khi gặp lỗi để khôi phục dữ liệu." #: src/concurrency/shared-state/example.md msgid "Let us see `Arc` and `Mutex` in action:" -msgstr "" +msgstr "Chúng ta hãy xem `Arc` và `Mutex` hoạt động:" #: src/concurrency/shared-state/example.md msgid "// use std::sync::{Arc, Mutex};\n" -msgstr "" +msgstr "// sử dụng std::sync::{Arc, Mutex};\n" #: src/concurrency/shared-state/example.md msgid "Possible solution:" -msgstr "" +msgstr "Giải pháp khả thi:" #: src/concurrency/shared-state/example.md msgid "Notable parts:" -msgstr "" +msgstr "Những phần đáng chú ý:" #: src/concurrency/shared-state/example.md msgid "" "`v` is wrapped in both `Arc` and `Mutex`, because their concerns are " "orthogonal." msgstr "" +"`v` được bao bọc trong cả `Arc` và `Mutex`, vì mối quan hệ của chúng là trực" +" giao." #: src/concurrency/shared-state/example.md msgid "" "Wrapping a `Mutex` in an `Arc` is a common pattern to share mutable state " "between threads." msgstr "" +"Gói `Mutex` trong `Arc` là mẫu phổ biến để chia sẻ trạng thái có thể thay " +"đổi giữa các luồng." #: src/concurrency/shared-state/example.md msgid "" "`v: Arc<_>` needs to be cloned as `v2` before it can be moved into another " "thread. Note `move` was added to the lambda signature." msgstr "" +"`v: Arc<_>` cần được sao chép thành `v2` trước khi có thể chuyển nó sang một" +" luồng khác. Lưu ý `move` đã được thêm vào chữ ký lambda." #: src/concurrency/shared-state/example.md msgid "" "Blocks are introduced to narrow the scope of the `LockGuard` as much as " "possible." msgstr "" +"Các khối được đưa vào để thu hẹp phạm vi của `LockGuard` càng nhiều càng " +"tốt." #: src/concurrency/sync-exercises.md src/concurrency/async-exercises.md msgid "This segment should take about 1 hour and 10 minutes. It contains:" @@ -17723,6 +20936,8 @@ msgstr "Phần này sẽ kéo dài khoảng 1 giờ và 10 phút, bao gồm:" #: src/concurrency/sync-exercises/dining-philosophers.md msgid "The dining philosophers problem is a classic problem in concurrency:" msgstr "" +"Bài toán triết gia ăn uống là một bài toán kinh điển trong vấn đề tương " +"tranh:" #: src/concurrency/sync-exercises/dining-philosophers.md msgid "" @@ -17730,11 +20945,18 @@ msgid "" "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 " +"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 "" +"Năm nhà triết học cùng ăn tối tại cùng một bàn. Mỗi triết gia đều có vị trí " +"riêng của mình trên bàn đàm phán. Có một cái nĩa giữa mỗi tấm. Món ăn được " +"phục vụ là một loại spaghetti phải ăn bằng hai nĩa. Mỗi triết gia chỉ có thể" +" luân phiên suy nghĩ và ăn uống. Hơn nữa, một triết gia chỉ có thể ăn mì " +"spaghetti khi họ có cả nĩa trái và nĩa phải. Như vậy, hai chiếc nĩa sẽ chỉ " +"được dùng khi hai người hàng xóm gần nhất của họ đang suy nghĩ chứ chưa ăn " +"uống. Sau khi một triết gia ăn xong, họ sẽ đặt cả hai chiếc nĩa xuống." #: src/concurrency/sync-exercises/dining-philosophers.md msgid "" @@ -17742,6 +20964,9 @@ msgid "" "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 "" +"Bạn sẽ cần một [Cargo Installation](../../cargo/running-locally.md) cục bộ " +"cho bài tập này. Sao chép mã bên dưới vào tệp có tên `src/main.rs`, điền vào" +" chỗ trống và kiểm tra xem `cargo run` không bị bế tắc:" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/async-exercises/dining-philosophers.md @@ -17750,86 +20975,89 @@ msgid "" " // right_fork: ...\n" " // thoughts: ...\n" msgstr "" +"// left_fork: ...\n" +" // right_fork: ...\n" +" // suy nghĩ: ...\n" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Eureka! {} has a new idea!\"" -msgstr "" +msgstr "\"Eureka! {} có ý tưởng mới!\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Pick up forks...\n" -msgstr "" +msgstr "// Nhặt nĩa...\n" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"{} is eating...\"" -msgstr "" +msgstr "\"{} đang ăn...\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Socrates\"" -msgstr "" +msgstr "\"Socrates\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Hypatia\"" -msgstr "" +msgstr "\"Hypatia\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Plato\"" -msgstr "" +msgstr "\"Plato\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Aristotle\"" -msgstr "" +msgstr "\"Aristotle\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/sync-exercises/solutions.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "\"Pythagoras\"" -msgstr "" +msgstr "\"Pythagoras\"" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Create forks\n" -msgstr "" +msgstr "// Tạo nhánh\n" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Create philosophers\n" -msgstr "" +msgstr "// Tạo triết gia\n" #: src/concurrency/sync-exercises/dining-philosophers.md msgid "// Make each of them think and eat 100 times\n" -msgstr "" +msgstr "// Khiến mỗi người phải suy nghĩ và ăn 100 lần\n" #: src/concurrency/sync-exercises/dining-philosophers.md #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Output their thoughts\n" -msgstr "" +msgstr "// Xuất suy nghĩ của họ\n" #: src/concurrency/sync-exercises/dining-philosophers.md msgid "You can use the following `Cargo.toml`:" -msgstr "" +msgstr "Bạn có thể sử dụng `Cargo.toml` sau:" #: src/concurrency/sync-exercises/dining-philosophers.md msgid "" @@ -17840,6 +21068,12 @@ msgid "" "edition = \"2021\"\n" "```" msgstr "" +"``` toml\n" +"[gói]\n" +"name = \"triết gia ăn uống\"\n" +"phiên bản = \"0.1.0\"\n" +"phiên bản = \"2021\"\n" +"```" #: src/concurrency/sync-exercises/link-checker.md msgid "" @@ -17848,29 +21082,43 @@ msgid "" "should recursively check other pages on the same domain and keep doing this " "until all pages have been validated." msgstr "" +"Hãy để chúng tôi sử dụng kiến ​​thức mới của mình để tạo trình kiểm tra liên" +" kết đa luồng. Nó sẽ bắt đầu tại một trang web và kiểm tra xem các liên kết " +"trên trang đó có hợp lệ không. Nó sẽ kiểm tra đệ quy các trang khác trên " +"cùng một tên miền và tiếp tục thực hiện việc này cho đến khi tất cả các " +"trang được xác thực." #: src/concurrency/sync-exercises/link-checker.md msgid "" -"For this, you will need an HTTP client such as [`reqwest`](https://docs.rs/" -"reqwest/). You will also need a way to find links, we can use [`scraper`]" -"(https://docs.rs/scraper/). Finally, we'll need some way of handling errors, " -"we will use [`thiserror`](https://docs.rs/thiserror/)." +"For this, you will need an HTTP client such as " +"[`reqwest`](https://docs.rs/reqwest/). You will also need a way to find " +"links, we can use [`scraper`](https://docs.rs/scraper/). Finally, we'll need" +" some way of handling errors, we will use " +"[`thiserror`](https://docs.rs/thiserror/)." msgstr "" +"Để làm được điều này, bạn sẽ cần một ứng dụng khách HTTP chẳng hạn như " +"[`reqwest`](https://docs.rs/reqwest/). Bạn cũng sẽ cần một cách để tìm liên " +"kết, chúng tôi có thể sử dụng [`scraper`](https://docs.rs/scraper/). Cuối " +"cùng, chúng ta cần một số cách xử lý lỗi, chúng ta sẽ sử dụng " +"[`thiserror`](https://docs.rs/thiserror/)." #: src/concurrency/sync-exercises/link-checker.md msgid "Create a new Cargo project and `reqwest` it as a dependency with:" -msgstr "" +msgstr "Tạo một dự án Cargo mới và `reqwest` nó như một phần phụ thuộc với:" #: src/concurrency/sync-exercises/link-checker.md msgid "" "If `cargo add` fails with `error: no such subcommand`, then please edit the " "`Cargo.toml` file by hand. Add the dependencies listed below." msgstr "" +"Nếu `cargo add` không thành công với `error: no such subcommand`, thì vui " +"lòng chỉnh sửa tệp `Cargo.toml` bằng tay. Thêm các phần phụ thuộc được liệt " +"kê bên dưới." #: src/concurrency/sync-exercises/link-checker.md msgid "" "The `cargo add` calls will update the `Cargo.toml` file to look like this:" -msgstr "" +msgstr "Lệnh gọi `cargo add` sẽ cập nhật tệp `Cargo.toml` trông như thế này:" #: src/concurrency/sync-exercises/link-checker.md msgid "" @@ -17882,81 +21130,100 @@ 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" "```" msgstr "" +"``` toml\n" +"[gói]\n" +"name = \"trình kiểm tra liên kết\"\n" +"phiên bản = \"0.1.0\"\n" +"phiên bản = \"2021\"\n" +"xuất bản = sai\n" +"\n" +"[phụ thuộc]\n" +"reqwest = { phiên bản = \"0.11.12\", tính năng = [\"chặn\", \"rustls-tls\"] }\n" +"máy cạo = \"0.13.0\"\n" +"lỗi này = \"1.0.37\"\n" +"```" #: src/concurrency/sync-exercises/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 "" +"Bây giờ bạn có thể tải xuống trang bắt đầu. Hãy thử với một trang web nhỏ " +"chẳng hạn như `https://www.google.org/`." #: src/concurrency/sync-exercises/link-checker.md msgid "Your `src/main.rs` file should look something like this:" -msgstr "" +msgstr "Tệp `src/main.rs` của bạn sẽ trông giống như thế này:" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"request error: {0}\"" -msgstr "" +msgstr "\"lỗi yêu cầu: {0}\"" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"bad http response: {0}\"" -msgstr "" +msgstr "\"phản hồi http kém: {0}\"" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"Checking {:#}\"" -msgstr "" +msgstr "\"Đang kiểm tra {:#}\"" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"href\"" -msgstr "" +msgstr "\"href\"" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"On {base_url:#}: ignored unparsable {href:?}: {err}\"" msgstr "" +"\"Trên {base_url:#}: bị bỏ qua {href:?} không thể phân tích cú pháp: {err}\"" #: src/concurrency/sync-exercises/link-checker.md #: src/concurrency/sync-exercises/solutions.md msgid "\"https://www.google.org\"" -msgstr "" +msgstr "\"https://www.google.org\"" #: src/concurrency/sync-exercises/link-checker.md msgid "\"Links: {links:#?}\"" -msgstr "" +msgstr "\"Liên kết: {liên kết:#?}\"" #: src/concurrency/sync-exercises/link-checker.md msgid "\"Could not extract links: {err:#}\"" -msgstr "" +msgstr "\"Không thể trích xuất liên kết: {err:#}\"" #: src/concurrency/sync-exercises/link-checker.md msgid "Run the code in `src/main.rs` with" -msgstr "" +msgstr "Chạy mã trong `src/main.rs` với" #: src/concurrency/sync-exercises/link-checker.md msgid "" -"Use threads to check the links in parallel: send the URLs to be checked to a " -"channel and let a few threads check the URLs in parallel." +"Use threads to check the links in parallel: send the URLs to be checked to a" +" channel and let a few threads check the URLs in parallel." msgstr "" +"Sử dụng các luồng để kiểm tra các liên kết song song: gửi các URL cần kiểm " +"tra đến một kênh và để một số luồng kiểm tra các URL song song." #: src/concurrency/sync-exercises/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 "" +"Mở rộng tính năng này để trích xuất đệ quy các liên kết từ tất cả các trang " +"trên miền `www.google.org`. Đặt giới hạn trên là 100 trang hoặc hơn để bạn " +"không bị trang web chặn." #: src/concurrency/sync-exercises/solutions.md msgid "\"{} is trying to eat\"" -msgstr "" +msgstr "\"{} đang cố ăn\"" #: src/concurrency/sync-exercises/solutions.md msgid "" @@ -17964,37 +21231,43 @@ msgid "" " // somewhere. This will swap the forks without deinitializing\n" " // either of them.\n" msgstr "" +"// Để tránh bế tắc, chúng ta phải phá vỡ tính đối xứng\n" +" // ở đâu đó. Điều này sẽ trao đổi các nhánh mà không cần khởi tạo lại\n" +" // một trong hai.\n" #: src/concurrency/sync-exercises/solutions.md msgid "\"{thought}\"" -msgstr "" +msgstr "\"{nghĩ}\"" #: src/concurrency/sync-exercises/solutions.md msgid "Link Checker" -msgstr "" +msgstr "Trình kiểm tra liên kết" #: src/concurrency/sync-exercises/solutions.md -msgid "" -"/// Determine whether links within the given page should be extracted.\n" +msgid "/// Determine whether links within the given page should be extracted.\n" msgstr "" +"/// Xác định xem có nên trích xuất các liên kết trong trang nhất định hay " +"không.\n" #: src/concurrency/sync-exercises/solutions.md msgid "" "/// Mark the given page as visited, returning false if it had already\n" " /// been visited.\n" msgstr "" +"/// Đánh dấu trang đã truy cập, trả về false nếu nó đã truy cập\n" +" /// đã được ghé thăm.\n" #: src/concurrency/sync-exercises/solutions.md msgid "// The sender got dropped. No more commands coming in.\n" -msgstr "" +msgstr "// Người gửi bị loại bỏ. Không còn lệnh nào đến nữa.\n" #: src/concurrency/sync-exercises/solutions.md msgid "\"Got crawling error: {:#}\"" -msgstr "" +msgstr "\"Gặp lỗi thu thập thông tin: {:#}\"" #: src/concurrency/sync-exercises/solutions.md msgid "\"Bad URLs: {:#?}\"" -msgstr "" +msgstr "\"URL xấu: {:#?}\"" #: src/concurrency/welcome-async.md msgid "" @@ -18005,6 +21278,12 @@ msgid "" "per-task overhead is typically very low and operating systems provide " "primitives for efficiently identifying I/O that is able to proceed." msgstr "" +"\"Async\" là mô hình đồng thời trong đó nhiều tác vụ được thực thi đồng thời" +" bằng cách thực thi từng tác vụ cho đến khi tác vụ đó bị chặn, sau đó chuyển" +" sang tác vụ khác đã sẵn sàng để thực hiện. Mô hình cho phép chạy số lượng " +"tác vụ lớn hơn trên một số luồng hạn chế. Điều này là do chi phí cho mỗi tác" +" vụ thường rất thấp và hệ điều hành cung cấp các nguyên tắc cơ bản để xác " +"định hiệu quả I/O có thể tiếp tục." #: src/concurrency/welcome-async.md msgid "" @@ -18012,12 +21291,17 @@ msgid "" "that may be completed in the future. Futures are \"polled\" until they " "signal that they are complete." msgstr "" +"Hoạt động không đồng bộ của Rust dựa trên \"tương lai\", đại diện cho công " +"việc có thể được hoàn thành trong tương lai. Hợp đồng tương lai được \"thăm " +"dò ý kiến\" cho đến khi chúng báo hiệu rằng chúng đã hoàn tất." #: src/concurrency/welcome-async.md msgid "" "Futures are polled by an async runtime, and several different runtimes are " "available." msgstr "" +"Hợp đồng tương lai được thăm dò bằng thời gian chạy không đồng bộ và có sẵn " +"một số thời gian chạy khác nhau." #: src/concurrency/welcome-async.md msgid "" @@ -18025,6 +21309,10 @@ msgid "" "callback-based, and not polled. Async Python programs require a \"loop\", " "similar to a runtime in Rust." msgstr "" +"Python có một mô hình tương tự trong `asyncio`. Tuy nhiên, loại `Tương lai` " +"của nó dựa trên lệnh gọi lại và không được thăm dò ý kiến. Các chương trình " +"Python không đồng bộ yêu cầu một \"vòng lặp\", tương tự như thời gian chạy " +"trong Rust." #: src/concurrency/welcome-async.md msgid "" @@ -18032,72 +21320,94 @@ msgid "" "runtime implements the event loop, so many of the details of Promise " "resolution are hidden." msgstr "" +"`Promise` của JavaScript cũng tương tự nhưng lại dựa trên lệnh gọi lại. Thời" +" gian chạy ngôn ngữ triển khai vòng lặp sự kiện nên nhiều chi tiết về độ " +"phân giải Promise bị ẩn." #: src/concurrency/async.md msgid "async/await" -msgstr "" +msgstr "không đồng bộ/đang chờ" #: src/concurrency/async/async-await.md msgid "" "At a high level, async Rust code looks very much like \"normal\" sequential " "code:" msgstr "" +"Ở mức độ cao, mã Rust không đồng bộ trông rất giống mã tuần tự \"bình " +"thường\":" #: src/concurrency/async/async-await.md msgid "\"Count is: {i}!\"" -msgstr "" +msgstr "\"Đếm là: {i}!\"" #: src/concurrency/async/async-await.md 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 "" +"Lưu ý rằng đây là một ví dụ đơn giản để hiển thị cú pháp. Không có hoạt động" +" chạy dài hoặc bất kỳ hoạt động đồng thời thực sự nào trong đó!" #: src/concurrency/async/async-await.md msgid "What is the return type of an async call?" -msgstr "" +msgstr "Kiểu trả về của cuộc gọi không đồng bộ là gì?" #: src/concurrency/async/async-await.md msgid "Use `let future: () = async_main(10);` in `main` to see the type." msgstr "" +"Sử dụng `let tương lai: () = async_main(10);` trong `main` để xem loại." #: src/concurrency/async/async-await.md msgid "" "The \"async\" keyword is syntactic sugar. The compiler replaces the return " "type with a future." msgstr "" +"Từ khóa \"không đồng bộ\" là đường cú pháp. compiler thay thế kiểu trả về " +"bằng kiểu tương lai." #: src/concurrency/async/async-await.md msgid "" "You cannot make `main` async, without additional instructions to the " "compiler on how to use the returned future." msgstr "" +"Bạn không thể tạo `main` không đồng bộ nếu không có hướng dẫn bổ sung cho " +"compiler về cách sử dụng tương lai được trả về." #: src/concurrency/async/async-await.md msgid "" -"You need an executor to run async code. `block_on` blocks the current thread " -"until the provided future has run to completion." +"You need an executor to run async code. `block_on` blocks the current thread" +" until the provided future has run to completion." msgstr "" +"Bạn cần một người thực thi để chạy mã không đồng bộ. `block_on` chặn luồng " +"hiện tại cho đến khi luồng tương lai được cung cấp chạy hoàn tất." #: src/concurrency/async/async-await.md msgid "" "`.await` asynchronously waits for the completion of another operation. " "Unlike `block_on`, `.await` doesn't block the current thread." msgstr "" +"`.await` chờ đợi không đồng bộ để hoàn thành một thao tác khác. Không giống " +"như `block_on`, `.await` không chặn luồng hiện tại." #: src/concurrency/async/async-await.md msgid "" "`.await` can only be used inside an `async` function (or block; these are " "introduced later)." msgstr "" +"`.await` chỉ có thể được sử dụng bên trong hàm `async` (hoặc khối; chúng sẽ " +"được giới thiệu sau)." #: src/concurrency/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)." +"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) là một " +"đặc điểm, được triển khai bởi các đối tượng đại diện cho một thao tác có thể" +" chưa hoàn thành. Một tương lai có thể được thăm dò ý kiến ​​và `poll` trả " +"về [`Poll`](https://doc.rust-lang.org/std/task/enum.Poll.html)." #: src/concurrency/async/futures.md msgid "" @@ -18106,30 +21416,42 @@ msgid "" "`JoinHandle` returned from `tokio::spawn` implements `Future` to allow " "joining to it." msgstr "" +"Hàm async trả về `impl Future`. Bạn cũng có thể (nhưng không phổ biến) triển" +" khai `Tương lai` cho các loại của riêng bạn. Ví dụ: `JoinHandle` được trả " +"về từ `tokio::spawn` triển khai `Future` để cho phép tham gia vào nó." #: src/concurrency/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 "" +"Từ khóa `.await`, được áp dụng cho Tương lai, khiến hàm async hiện tại tạm " +"dừng cho đến khi Tương lai đó sẵn sàng và sau đó đánh giá kết quả đầu ra của" +" nó." #: src/concurrency/async/futures.md msgid "" "The `Future` and `Poll` types are implemented exactly as shown; click the " "links to show the implementations in the docs." msgstr "" +"Các loại `Tương lai` và `Thăm dò ý kiến` được triển khai chính xác như được " +"hiển thị; nhấp vào liên kết để hiển thị cách triển khai trong tài liệu." #: src/concurrency/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:" msgstr "" +"Chúng ta sẽ không đề cập đến `Pin` và `Context` vì chúng ta sẽ tập trung vào" +" việc viết mã không đồng bộ thay vì xây dựng các mã gốc không đồng bộ mới. " +"Tóm tắt:" #: src/concurrency/async/futures.md msgid "" "`Context` allows a Future to schedule itself to be polled again when an " "event occurs." msgstr "" +"`Context` cho phép Future tự lên lịch để thăm dò lại khi một sự kiện xảy ra." #: src/concurrency/async/futures.md msgid "" @@ -18137,6 +21459,9 @@ msgid "" "that future remain valid. This is required to allow references to remain " "valid after an `.await`." msgstr "" +"`Pin` đảm bảo rằng Tương lai không bị di chuyển trong bộ nhớ, do đó các con " +"trỏ tới tương lai đó vẫn hợp lệ. Điều này là bắt buộc để cho phép các tham " +"chiếu vẫn hợp lệ sau `.await`." #: src/concurrency/async/runtimes.md msgid "" @@ -18144,85 +21469,106 @@ msgid "" "_reactor_) and is responsible for executing futures (an _executor_). Rust " "does not have a \"built-in\" runtime, but several options are available:" msgstr "" +"_runtime_ cung cấp hỗ trợ để thực hiện các hoạt động không đồng bộ (a " +"_reactor_) và chịu trách nhiệm thực thi các hợp đồng tương lai (một " +"_executor_). Rust không có thời gian chạy \"tích hợp sẵn\", nhưng có sẵn một" +" số tùy chọn:" #: src/concurrency/async/runtimes.md msgid "" "[Tokio](https://tokio.rs/): performant, with a well-developed ecosystem of " -"functionality like [Hyper](https://hyper.rs/) for HTTP or [Tonic](https://" -"github.com/hyperium/tonic) for gRPC." +"functionality like [Hyper](https://hyper.rs/) for HTTP or " +"[Tonic](https://github.com/hyperium/tonic) for gRPC." msgstr "" +"[Tokio](https://tokio.rs/): hoạt động hiệu quả, với hệ sinh thái chức năng " +"được phát triển tốt như [Hyper](https://hyper.rs/) cho HTTP hoặc " +"[Tonic](https://github.com/hyperium/tonic) cho gRPC." #: src/concurrency/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/): nhằm mục đích trở thành \"std cho async\" và" +" bao gồm thời gian chạy cơ bản trong `async::task`." #: src/concurrency/async/runtimes.md msgid "[smol](https://docs.rs/smol/latest/smol/): simple and lightweight" -msgstr "" +msgstr "[smol](https://docs.rs/smol/latest/smol/): đơn giản và nhẹ" #: src/concurrency/async/runtimes.md msgid "" -"Several larger applications have their own runtimes. For example, [Fuchsia]" -"(https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-" +"Several larger applications have their own runtimes. For example, " +"[Fuchsia](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-" "async/src/lib.rs) already has one." msgstr "" +"Một số ứng dụng lớn hơn có thời gian chạy riêng. Ví dụ: " +"[Fuchsia](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/lib/fuchsia-" +"async/src/lib.rs) đã có một." #: src/concurrency/async/runtimes.md msgid "" "Note that of the listed runtimes, only Tokio is supported in the Rust " -"playground. The playground also does not permit any I/O, so most interesting " -"async things can't run in the playground." +"playground. The playground also does not permit any I/O, so most interesting" +" async things can't run in the playground." msgstr "" +"Lưu ý rằng trong số các thời gian chạy được liệt kê, chỉ Tokio được hỗ trợ " +"trong sân chơi Rust. Sân chơi cũng không cho phép bất kỳ I/O nào, vì vậy hầu" +" hết những thứ không đồng bộ thú vị đều không thể chạy trong sân chơi." #: src/concurrency/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 " +"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." msgstr "" +"Hợp đồng tương lai \"trơ\" ở chỗ chúng không làm bất cứ điều gì (thậm chí " +"không bắt đầu thao tác I/O) trừ khi có người thực thi thăm dò ý kiến ​​của " +"chúng. Ví dụ: điều này khác với Lời hứa JS, sẽ chạy đến khi hoàn thành ngay " +"cả khi chúng không bao giờ được sử dụng." #: src/concurrency/async/runtimes/tokio.md msgid "Tokio provides:" -msgstr "" +msgstr "Tokio cung cấp:" #: src/concurrency/async/runtimes/tokio.md msgid "A multi-threaded runtime for executing asynchronous code." -msgstr "" +msgstr "Thời gian chạy đa luồng để thực thi mã không đồng bộ." #: src/concurrency/async/runtimes/tokio.md msgid "An asynchronous version of the standard library." -msgstr "" +msgstr "Phiên bản không đồng bộ của thư viện chuẩn." #: src/concurrency/async/runtimes/tokio.md msgid "A large ecosystem of libraries." -msgstr "" +msgstr "Một hệ sinh thái thư viện rộng lớn." #: src/concurrency/async/runtimes/tokio.md msgid "\"Count in task: {i}!\"" -msgstr "" +msgstr "\"Đếm nhiệm vụ: {i}!\"" #: src/concurrency/async/runtimes/tokio.md msgid "\"Main task: {i}\"" -msgstr "" +msgstr "\"Nhiệm vụ chính: {i}\"" #: src/concurrency/async/runtimes/tokio.md msgid "With the `tokio::main` macro we can now make `main` async." msgstr "" +"Với macro `tokio::main` giờ đây chúng ta có thể tạo `main` không đồng bộ." #: src/concurrency/async/runtimes/tokio.md msgid "The `spawn` function creates a new, concurrent \"task\"." -msgstr "" +msgstr "Hàm `spawn` tạo một \"tác vụ\" mới, đồng thời." #: src/concurrency/async/runtimes/tokio.md msgid "Note: `spawn` takes a `Future`, you don't call `.await` on `count_to`." msgstr "" +"Lưu ý: `spawn` nhận `Tương lai`, bạn không gọi `.await` trên `count_to`." #: src/concurrency/async/runtimes/tokio.md msgid "**Further exploration:**" -msgstr "" +msgstr "**Khám phá thêm:**" #: src/concurrency/async/runtimes/tokio.md msgid "" @@ -18230,18 +21576,21 @@ msgid "" "cancellation. `tokio::spawn` returns a handle which can be awaited to wait " "until it finishes." msgstr "" +"Tại sao `count_to` không (thường) đạt đến 10? Đây là một ví dụ về việc hủy " +"không đồng bộ. `tokio::spawn` trả về một điều khiển có thể đợi cho đến khi " +"nó kết thúc." #: src/concurrency/async/runtimes/tokio.md msgid "Try `count_to(10).await` instead of spawning." -msgstr "" +msgstr "Hãy thử `count_to(10).await` thay vì sinh sản." #: src/concurrency/async/runtimes/tokio.md msgid "Try awaiting the task returned from `tokio::spawn`." -msgstr "" +msgstr "Hãy thử chờ tác vụ được trả về từ `tokio::spawn`." #: src/concurrency/async/tasks.md msgid "Rust has a task system, which is a form of lightweight threading." -msgstr "" +msgstr "Rust có một hệ thống nhiệm vụ, là một dạng phân luồng nhẹ." #: src/concurrency/async/tasks.md msgid "" @@ -18251,48 +21600,60 @@ msgid "" "task is possible by polling multiple child futures, such as racing a timer " "and an I/O operation." msgstr "" +"Một nhiệm vụ có một tương lai cấp cao nhất mà người thực thi thăm dò ý kiến " +"​​để đạt được tiến bộ. Tương lai đó có thể có một hoặc nhiều tương lai lồng " +"nhau mà phương thức `poll` của nó thăm dò, tương ứng một cách lỏng lẻo với " +"một ngăn xếp cuộc gọi. Có thể thực hiện đồng thời trong một nhiệm vụ bằng " +"cách thăm dò nhiều tương lai con, chẳng hạn như đua đồng hồ tính giờ và thao" +" tác I/O." #: src/concurrency/async/tasks.md msgid "\"127.0.0.1:0\"" -msgstr "" +msgstr "\"127.0.0.1:0\"" #: src/concurrency/async/tasks.md msgid "\"listening on port {}\"" -msgstr "" +msgstr "\"nghe trên cổng {}\"" #: src/concurrency/async/tasks.md msgid "\"connection from {addr:?}\"" -msgstr "" +msgstr "\"kết nối từ {addr:?}\"" #: src/concurrency/async/tasks.md msgid "b\"Who are you?\\n\"" -msgstr "" +msgstr "b\"Bạn là ai?\\n\"" #: src/concurrency/async/tasks.md msgid "\"socket error\"" -msgstr "" +msgstr "\"lỗi ổ cắm\"" #: src/concurrency/async/tasks.md msgid "\"Thanks for dialing in, {name}!\\n\"" -msgstr "" +msgstr "\"Cảm ơn bạn đã gọi điện, {name}!\\n\"" #: src/concurrency/async/tasks.md src/concurrency/async-control-flow/join.md msgid "" "Copy this example into your prepared `src/main.rs` and run it from there." msgstr "" +"Sao chép ví dụ này vào `src/main.rs` đã chuẩn bị của bạn và chạy nó từ đó." #: src/concurrency/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/" -"telnet/)." +"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 "" +"Hãy thử kết nối với nó bằng công cụ kết nối TCP như " +"[nc](https://www.unix.com/man-page/linux/1/nc/) hoặc " +"[telnet](https://www.unix.com/man-page/linux/1/telnet/)." #: src/concurrency/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 "" +"Yêu cầu học sinh hình dung trạng thái của máy chủ ví dụ với một số máy khách" +" được kết nối. Những nhiệm vụ tồn tại? Tương lai của họ là gì?" #: src/concurrency/async/tasks.md msgid "" @@ -18300,51 +21661,60 @@ msgid "" "closure, but does not take any arguments. Its return value is a Future, " "similar to an `async fn`." msgstr "" +"Đây là lần đầu tiên chúng tôi thấy khối `async`. Điều này tương tự như việc " +"đóng cửa, nhưng không có bất kỳ đối số nào. Giá trị trả về của nó là Tương " +"lai, tương tự như `async fn`." #: src/concurrency/async/tasks.md msgid "" "Refactor the async block into a function, and improve the error handling " "using `?`." msgstr "" +"Tái cấu trúc khối async thành một hàm và cải thiện việc xử lý lỗi bằng cách " +"sử dụng `?`." #: src/concurrency/async-control-flow/channels.md msgid "" "Several crates have support for asynchronous channels. For instance `tokio`:" -msgstr "" +msgstr "Một số crate có hỗ trợ các kênh không đồng bộ. Ví dụ: `tokio`:" #: src/concurrency/async-control-flow/channels.md msgid "\"Received {count} pings so far.\"" -msgstr "" +msgstr "\"Đã nhận được {count} ping cho đến nay.\"" #: src/concurrency/async-control-flow/channels.md msgid "\"ping_handler complete\"" -msgstr "" +msgstr "\"ping_handler hoàn tất\"" #: src/concurrency/async-control-flow/channels.md msgid "\"Failed to send ping.\"" -msgstr "" +msgstr "\"Không gửi được ping.\"" #: src/concurrency/async-control-flow/channels.md msgid "\"Sent {} pings so far.\"" -msgstr "" +msgstr "\"Đã gửi {} ping cho đến nay.\"" #: src/concurrency/async-control-flow/channels.md msgid "\"Something went wrong in ping handler task.\"" -msgstr "" +msgstr "\"Đã xảy ra lỗi trong tác vụ xử lý ping.\"" #: src/concurrency/async-control-flow/channels.md msgid "Change the channel size to `3` and see how it affects the execution." msgstr "" +"Thay đổi kích thước kênh thành `3` và xem nó ảnh hưởng như thế nào đến việc " +"thực thi." #: src/concurrency/async-control-flow/channels.md msgid "" "Overall, the interface is similar to the `sync` channels as seen in the " "[morning class](concurrency/channels.md)." msgstr "" +"Nhìn chung, giao diện tương tự như các kênh `sync` như trong [lớp buổi " +"sáng](concurrency/channels.md)." #: src/concurrency/async-control-flow/channels.md msgid "Try removing the `std::mem::drop` call. What happens? Why?" -msgstr "" +msgstr "Hãy thử xóa lệnh gọi `std::mem::drop`. Điều gì xảy ra? Tại sao?" #: src/concurrency/async-control-flow/channels.md msgid "" @@ -18352,13 +21722,19 @@ msgid "" "implement both `sync` and `async` `send` and `recv`. This can be convenient " "for complex applications with both IO and heavy CPU processing tasks." msgstr "" +"Crate [Flume](https://docs.rs/flume/latest/flume/) có các kênh triển khai cả" +" `sync` và `async` `send` và `recv`. Điều này có thể thuận tiện cho các ứng " +"dụng phức tạp với cả tác vụ xử lý IO và CPU nặng." #: src/concurrency/async-control-flow/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." +"combine them with other `future`s to combine them and create complex control" +" flow." msgstr "" +"Điều khiến việc làm việc với các kênh `async` trở nên thích hợp hơn là khả " +"năng kết hợp chúng với các kênh `tương lai` khác để kết hợp chúng và tạo ra " +"luồng điều khiển phức tạp." #: src/concurrency/async-control-flow/join.md msgid "" @@ -18366,35 +21742,44 @@ msgid "" "a collection of their results. This is similar to `Promise.all` in " "JavaScript or `asyncio.gather` in Python." msgstr "" +"Thao tác nối sẽ đợi cho đến khi tất cả các hợp đồng tương lai đã sẵn sàng và" +" trả về tập hợp kết quả của chúng. Điều này tương tự như `Promise.all` trong" +" JavaScript hoặc `asyncio.gather` trong Python." #: src/concurrency/async-control-flow/join.md msgid "\"https://google.com\"" -msgstr "" +msgstr "\"https://google.com\"" #: src/concurrency/async-control-flow/join.md msgid "\"https://httpbin.org/ip\"" -msgstr "" +msgstr "\"https://httpbin.org/ip\"" #: src/concurrency/async-control-flow/join.md msgid "\"https://play.rust-lang.org/\"" -msgstr "" +msgstr "\"https://play.rust-lang.org/\"" #: src/concurrency/async-control-flow/join.md msgid "\"BAD_URL\"" -msgstr "" +msgstr "\"BAD_URL\"" #: src/concurrency/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 " +"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`." msgstr "" +"Đối với nhiều tương lai của các loại rời rạc, bạn có thể sử dụng " +"`std::future::join!` nhưng bạn phải biết mình sẽ có bao nhiêu tương lai tại " +"thời điểm biên dịch. Điều này hiện đang ở trong crate `tương lai`, sẽ sớm " +"được ổn định trong `std::future`." #: src/concurrency/async-control-flow/join.md msgid "" "The risk of `join` is that one of the futures may never resolve, this would " "cause your program to stall." msgstr "" +"Rủi ro của việc `tham gia` là một trong những tương lai có thể không bao giờ" +" được giải quyết, điều này sẽ khiến chương trình của bạn bị đình trệ." #: src/concurrency/async-control-flow/join.md msgid "" @@ -18404,14 +21789,23 @@ msgid "" "timeout (that requires `select!`, explained in the next chapter), but " "demonstrates `join!`." msgstr "" +"Ví dụ: bạn cũng có thể kết hợp `join_all` với `join!` để nối tất cả các yêu " +"cầu tới dịch vụ http cũng như truy vấn cơ sở dữ liệu. Hãy thử thêm " +"`tokio::time::sleep` vào tương lai bằng cách sử dụng `futures::join!`. Đây " +"không phải là thời gian chờ (yêu cầu `select!`, được giải thích trong chương" +" tiếp theo), nhưng thể hiện `join!`." #: src/concurrency/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." -"FIRST_COMPLETED)`." +"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 "" +"Thao tác chọn sẽ đợi cho đến khi bất kỳ tập hợp tương lai nào sẵn sàng và " +"phản hồi kết quả của tương lai đó. Trong JavaScript, điều này tương tự như " +"`Promise.race`. Trong Python, nó được so sánh với `asyncio.wait(task_set, " +"return_when=asyncio.FIRST_COMPLETED)`." #: src/concurrency/async-control-flow/select.md msgid "" @@ -18421,26 +21815,31 @@ msgid "" "run with the resulting variables. The `statement` result becomes the result " "of the `select!` macro." msgstr "" +"Tương tự như một câu lệnh so khớp, phần thân của `select!` có một số nhánh, " +"mỗi nhánh có dạng `pattern = tương lai => câu lệnh`. Khi `tương lai` đã sẵn " +"sàng, giá trị trả về của nó sẽ bị hủy cấu trúc bởi `mẫu`. Sau đó, `câu lệnh`" +" được chạy với các biến kết quả. Kết quả `câu lệnh` trở thành kết quả của " +"macro `select!`." #: src/concurrency/async-control-flow/select.md msgid "\"Felix\"" -msgstr "" +msgstr "\"Felix\"" #: src/concurrency/async-control-flow/select.md msgid "\"Failed to send cat.\"" -msgstr "" +msgstr "\"Không gửi được mèo.\"" #: src/concurrency/async-control-flow/select.md msgid "\"Failed to send dog.\"" -msgstr "" +msgstr "\"Không gửi được chó.\"" #: src/concurrency/async-control-flow/select.md msgid "\"Failed to receive winner\"" -msgstr "" +msgstr "\"Không nhận được người chiến thắng\"" #: src/concurrency/async-control-flow/select.md msgid "\"Winner is {winner:?}\"" -msgstr "" +msgstr "\"Người chiến thắng là {người chiến thắng:?}\"" #: src/concurrency/async-control-flow/select.md msgid "" @@ -18449,30 +21848,43 @@ msgid "" "whichever arrives first. Since the dog takes 50ms, it wins against the cat " "that take 500ms." msgstr "" +"Trong ví dụ này, chúng ta có một cuộc đua giữa một con mèo và một con chó. " +"`first_animal_to_finish_race` nghe cả hai kênh và sẽ chọn kênh nào đến " +"trước. Vì con chó mất 50 mili giây nên nó thắng con mèo mất 500 mili giây." #: src/concurrency/async-control-flow/select.md msgid "" "You can use `oneshot` channels in this example as the channels are supposed " "to receive only one `send`." msgstr "" +"Bạn có thể sử dụng các kênh `oneshot` trong ví dụ này vì các kênh được cho " +"là chỉ nhận được một `gửi`." #: src/concurrency/async-control-flow/select.md msgid "" "Try adding a deadline to the race, demonstrating selecting different sorts " "of futures." msgstr "" +"Hãy thử thêm thời hạn cho cuộc đua, thể hiện việc lựa chọn các loại tương " +"lai khác nhau." #: src/concurrency/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." msgstr "" +"Lưu ý rằng `select!` loại bỏ các nhánh chưa khớp, làm hủy bỏ tương lai của " +"chúng. Nó dễ sử dụng nhất khi mỗi lần thực thi `select!` tạo ra các tương " +"lai mới." #: src/concurrency/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." msgstr "" +"Một cách khác là chuyển `&thay đổi tương lai` thay vì chính tương lai, nhưng" +" điều này có thể dẫn đến các vấn đề, sẽ được thảo luận thêm trong trang " +"trình bày ghim." #: src/concurrency/async-pitfalls.md msgid "" @@ -18481,36 +21893,46 @@ msgid "" "with its share of pitfalls and footguns. We illustrate some of them in this " "chapter." msgstr "" +"Async/await cung cấp khả năng trừu tượng thuận tiện và hiệu quả cho lập " +"trình không đồng bộ đồng thời. Tuy nhiên, mô hình async/await trong Rust " +"cũng đi kèm với nhiều cạm bẫy và súng ngắn. Chúng tôi minh họa một số trong " +"số họ trong chương này." #: src/concurrency/async-pitfalls.md msgid "Pin" -msgstr "" +msgstr "Ghim" #: src/concurrency/async-pitfalls/blocking-executor.md msgid "Blocking the executor" -msgstr "" +msgstr "Chặn người thực thi" #: src/concurrency/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 " +"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." msgstr "" +"Hầu hết thời gian chạy không đồng bộ chỉ cho phép các tác vụ IO chạy đồng " +"thời. Điều này có nghĩa là các tác vụ chặn CPU sẽ chặn người thực thi và " +"ngăn các tác vụ khác được thực thi. Một cách giải quyết dễ dàng là sử dụng " +"các phương pháp tương đương không đồng bộ nếu có thể." #: src/concurrency/async-pitfalls/blocking-executor.md msgid "\"future {id} slept for {duration_ms}ms, finished after {}ms\"" -msgstr "" +msgstr "\"{id} tương lai đã ngủ trong {duration_ms}ms, kết thúc sau {}ms\"" #: src/concurrency/async-pitfalls/blocking-executor.md msgid "\"current_thread\"" -msgstr "" +msgstr "\"current_thread\"" #: src/concurrency/async-pitfalls/blocking-executor.md msgid "" "Run the code and see that the sleeps happen consecutively rather than " "concurrently." msgstr "" +"Chạy mã và thấy rằng các giấc ngủ diễn ra liên tiếp chứ không phải đồng " +"thời." #: src/concurrency/async-pitfalls/blocking-executor.md msgid "" @@ -18518,123 +21940,163 @@ msgid "" "makes the effect more obvious, but the bug is still present in the multi-" "threaded flavor." msgstr "" +"Loại `\"current_thread\"` đặt tất cả tác vụ trên một luồng duy nhất. Điều " +"này làm cho hiệu ứng trở nên rõ ràng hơn nhưng lỗi vẫn tồn tại ở phiên bản " +"đa luồng." #: src/concurrency/async-pitfalls/blocking-executor.md msgid "" -"Switch the `std::thread::sleep` to `tokio::time::sleep` and await its result." +"Switch the `std::thread::sleep` to `tokio::time::sleep` and await its " +"result." msgstr "" +"Chuyển `std::thread::sleep` sang `tokio::time::sleep` và chờ kết quả của nó." #: src/concurrency/async-pitfalls/blocking-executor.md 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." +"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 "" +"Một cách khắc phục khác là `tokio::task::spawn_blocking` sẽ sinh ra một " +"luồng thực tế và biến tay cầm của nó thành một tương lai mà không chặn người" +" thực thi." #: src/concurrency/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 " +"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." msgstr "" +"Bạn không nên coi các tác vụ như các luồng hệ điều hành. Chúng không ánh xạ " +"1 đến 1 và hầu hết các trình thực thi sẽ cho phép nhiều tác vụ chạy trên một" +" luồng hệ điều hành. Điều này đặc biệt có vấn đề khi tương tác với các thư " +"viện khác thông qua FFI, trong đó thư viện đó có thể phụ thuộc vào bộ lưu " +"trữ cục bộ theo luồng hoặc ánh xạ tới các luồng hệ điều hành cụ thể (ví dụ: " +"CUDA). Ưu tiên `tokio::task::spawn_blocking` trong những tình huống như vậy." #: src/concurrency/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." msgstr "" +"Sử dụng các mutex đồng bộ một cách cẩn thận. Việc giữ một mutex trên " +"`.await` có thể khiến một tác vụ khác bị chặn và tác vụ đó có thể đang chạy " +"trên cùng một luồng." #: src/concurrency/async-pitfalls/pin.md msgid "" -"Async blocks and functions return types implementing the `Future` trait. The " -"type returned is the result of a compiler transformation which turns local " +"Async blocks and functions return types implementing the `Future` trait. The" +" type returned is the result of a compiler transformation which turns local " "variables into data stored inside the future." msgstr "" +"Các khối và hàm không đồng bộ trả về các kiểu triển khai đặc điểm `Tương " +"lai`. Kiểu được trả về là kết quả của quá trình chuyển đổi compiler biến các" +" biến cục bộ thành dữ liệu được lưu trữ trong tương lai." #: src/concurrency/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." +"of that, the future should never be moved to a different memory location, as" +" it would invalidate those pointers." msgstr "" +"Một số biến đó có thể chứa con trỏ tới các biến cục bộ khác. Do đó, tương " +"lai không bao giờ được chuyển đến một vị trí bộ nhớ khác vì nó sẽ làm mất " +"hiệu lực các con trỏ đó." #: src/concurrency/async-pitfalls/pin.md msgid "" -"To prevent moving the future type in memory, it can only be polled through a " -"pinned pointer. `Pin` is a wrapper around a reference that disallows all " -"operations that would move the instance it points to into a different memory " -"location." +"To prevent moving the future type in memory, it can only be polled through a" +" pinned pointer. `Pin` is a wrapper around a reference that disallows all " +"operations that would move the instance it points to into a different memory" +" location." msgstr "" +"Để ngăn việc di chuyển loại tương lai trong bộ nhớ, nó chỉ có thể được thăm " +"dò thông qua một con trỏ được ghim. `Pin` là một trình bao bọc xung quanh " +"một tham chiếu không cho phép tất cả các hoạt động có thể di chuyển phiên " +"bản mà nó trỏ đến vào một vị trí bộ nhớ khác." #: src/concurrency/async-pitfalls/pin.md msgid "" "// A work item. In this case, just sleep for the given time and respond\n" "// with a message on the `respond_on` channel.\n" msgstr "" +"// Một mục công việc. Trong trường hợp này, chỉ cần ngủ trong thời gian nhất định và trả lời\n" +"// với một tin nhắn trên kênh `respond_on`.\n" #: src/concurrency/async-pitfalls/pin.md msgid "// A worker which listens for work on a queue and performs it.\n" -msgstr "" +msgstr "// Một công nhân lắng nghe công việc trên hàng đợi và thực hiện nó.\n" #: src/concurrency/async-pitfalls/pin.md msgid "// Pretend to work.\n" -msgstr "" +msgstr "// Giả vờ làm việc.\n" #: src/concurrency/async-pitfalls/pin.md msgid "\"failed to send response\"" -msgstr "" +msgstr "\"không gửi được phản hồi\"" #: src/concurrency/async-pitfalls/pin.md msgid "// TODO: report number of iterations every 100ms\n" -msgstr "" +msgstr "// TODO: báo cáo số lần lặp mỗi 100ms\n" #: src/concurrency/async-pitfalls/pin.md msgid "// A requester which requests work and waits for it to complete.\n" -msgstr "" +msgstr "// Người yêu cầu yêu cầu công việc và đợi nó hoàn thành.\n" #: src/concurrency/async-pitfalls/pin.md msgid "\"failed to send on work queue\"" -msgstr "" +msgstr "\"không thể gửi hàng đợi công việc\"" #: src/concurrency/async-pitfalls/pin.md msgid "\"failed waiting for response\"" -msgstr "" +msgstr "\"không thể chờ phản hồi\"" #: src/concurrency/async-pitfalls/pin.md msgid "\"work result for iteration {i}: {resp}\"" -msgstr "" +msgstr "\"kết quả công việc cho phép lặp {i}: {resp}\"" #: src/concurrency/async-pitfalls/pin.md msgid "" "You may recognize this as an example of the actor pattern. Actors typically " "call `select!` in a loop." msgstr "" +"Bạn có thể nhận ra đây là một ví dụ về mẫu diễn viên. Các tác nhân thường " +"gọi `select!` trong một vòng lặp." #: src/concurrency/async-pitfalls/pin.md msgid "" "This serves as a summation of a few of the previous lessons, so take your " "time with it." msgstr "" +"Đây là phần tóm tắt của một số bài học trước đó, vì vậy hãy dành thời gian " +"cho nó." #: src/concurrency/async-pitfalls/pin.md msgid "" -"Naively add a `_ = sleep(Duration::from_millis(100)) => { println!(..) }` to " -"the `select!`. This will never execute. Why?" +"Naively add a `_ = sleep(Duration::from_millis(100)) => { println!(..) }` to" +" the `select!`. This will never execute. Why?" msgstr "" +"Thêm một `_ = sleep(Duration::from_millis(100)) => { println!(..) }` vào " +"`select!`. Điều này sẽ không bao giờ thực thi. Tại sao?" #: src/concurrency/async-pitfalls/pin.md msgid "" "Instead, add a `timeout_fut` containing that future outside of the `loop`:" msgstr "" +"Thay vào đó, hãy thêm `timeout_fut` chứa tương lai đó bên ngoài `loop`:" #: src/concurrency/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 "" +"Điều này vẫn không hoạt động. Thực hiện theo các lỗi compiler, thêm `&mut` " +"vào `timeout_fut` trong `select!` để xử lý việc di chuyển, sau đó sử dụng " +"`Box::pin`:" #: src/concurrency/async-pitfalls/pin.md msgid "" @@ -18642,6 +22104,9 @@ msgid "" "iteration (a fused future would help with this). Update to reset " "`timeout_fut` every time it expires." msgstr "" +"Điều này sẽ biên dịch, nhưng khi hết thời gian chờ, nó sẽ là `Poll::Ready` " +"trên mỗi lần lặp lại (một tương lai hợp nhất sẽ giúp ích cho việc này). Cập " +"nhật để đặt lại `timeout_fut` mỗi khi hết hạn." #: src/concurrency/async-pitfalls/pin.md msgid "" @@ -18649,21 +22114,31 @@ msgid "" "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 "" +"Hộp phân bổ trên heap. Trong một số trường hợp, `std::pin::pin!` (chỉ mới ổn" +" định gần đây, với mã cũ hơn thường sử dụng `tokio::pin!`) cũng là một tùy " +"chọn, nhưng tùy chọn này khó sử dụng trong tương lai được chỉ định lại." #: src/concurrency/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." msgstr "" +"Một cách khác là không sử dụng `pin` mà tạo ra một tác vụ khác sẽ gửi đến " +"kênh `oneshot` sau mỗi 100 mili giây." #: src/concurrency/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 " +"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 "" +"Dữ liệu chứa con trỏ tới chính nó được gọi là tự tham chiếu. Thông thường, " +"trình kiểm tra mượn Rust sẽ ngăn dữ liệu tự tham chiếu bị di chuyển vì các " +"tham chiếu không thể tồn tại lâu hơn dữ liệu mà chúng trỏ tới. Tuy nhiên, " +"việc chuyển đổi mã cho các khối và chức năng không đồng bộ không được người " +"kiểm tra mượn xác minh." #: src/concurrency/async-pitfalls/pin.md msgid "" @@ -18671,6 +22146,9 @@ msgid "" "place using a pinned pointer. However, it can still be moved through an " "unpinned pointer." msgstr "" +"`Pin` là một trình bao bọc xung quanh một tham chiếu. Không thể di chuyển " +"một đối tượng khỏi vị trí của nó bằng con trỏ được ghim. Tuy nhiên, nó vẫn " +"có thể được di chuyển qua một con trỏ đã được bỏ ghim." #: src/concurrency/async-pitfalls/pin.md msgid "" @@ -18678,32 +22156,45 @@ msgid "" "`&mut Self` to refer to the instance. That's why it can only be called on a " "pinned pointer." msgstr "" +"Phương thức `pol` của đặc điểm `Tương lai` sử dụng `Pin<&mut Self>` thay vì " +"`&mut Self` để tham chiếu đến phiên bản. Đó là lý do tại sao nó chỉ có thể " +"được gọi trên một con trỏ được ghim." #: src/concurrency/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`." +"release. This required support for using return-position `impl Trait` (RPIT)" +" in traits, as the desugaring for `async fn` includes `-> impl Future`." msgstr "" +"Các phương pháp không đồng bộ trong các đặc điểm chỉ mới được ổn định gần " +"đây, trong bản phát hành 1.75. Điều này cần có sự hỗ trợ để sử dụng vị trí " +"trả về `impl Trait` (RPIT) trong các đặc điểm, vì việc giải mã cho `async " +"fn` bao gồm `-> impl Future`." #: src/concurrency/async-pitfalls/async-traits.md msgid "" "However, even with the native support today there are some pitfalls around " "`async fn` and RPIT in traits:" msgstr "" +"Tuy nhiên, ngay cả với sự hỗ trợ gốc ngày nay, vẫn có một số cạm bẫy xung " +"quanh đặc điểm `async fn` và RPIT:" #: src/concurrency/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 "" +"Hàm ý vị trí trả về Đặc điểm nắm bắt tất cả thời gian tồn tại trong phạm vi " +"(vì vậy không thể biểu thị một số mô hình vay mượn)" #: src/concurrency/async-pitfalls/async-traits.md msgid "" "Traits whose methods use return-position `impl trait` or `async` are not " "`dyn` compatible." msgstr "" +"Các đặc điểm có phương thức sử dụng vị trí trả về `impl trait` hoặc `async` " +"không tương thích với `dyn`." #: src/concurrency/async-pitfalls/async-traits.md msgid "" @@ -18711,35 +22202,47 @@ msgid "" "trait/latest/async_trait/) provides a workaround through a macro, with some " "caveats:" msgstr "" +"Nếu chúng tôi thực sự cần hỗ trợ `dyn`, crate " +"[async_trait](https://docs.rs/async-trait/latest/async_trait/) sẽ cung cấp " +"giải pháp thông qua macro, kèm theo một số cảnh báo:" #: src/concurrency/async-pitfalls/async-traits.md msgid "\"running all sleepers..\"" -msgstr "" +msgstr "\"chạy tất cả người ngủ..\"" #: src/concurrency/async-pitfalls/async-traits.md msgid "\"slept for {}ms\"" -msgstr "" +msgstr "\"ngủ trong {} mili giây\"" #: src/concurrency/async-pitfalls/async-traits.md 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` rất dễ sử dụng, nhưng hãy lưu ý rằng nó sử dụng phân bổ vùng " +"heap để đạt được điều này. Phân bổ heap này có chi phí hiệu suất." #: src/concurrency/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." +"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 "" +"Những thách thức trong việc hỗ trợ ngôn ngữ cho `đặc điểm không đồng bộ` là " +"Rust sâu sắc và có lẽ không đáng để mô tả sâu. Niko Matsakis đã làm rất tốt " +"khi giải thích chúng trong [bài đăng " +"này](https://smallcultfollowing.com/babysteps/blog/2019/10/26/async-fn-in-" +"traits-are-hard/) nếu bạn muốn tìm hiểu sâu hơn." #: src/concurrency/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." msgstr "" +"Hãy thử tạo cấu trúc bộ ngủ mới sẽ ngủ trong một khoảng thời gian ngẫu nhiên" +" và thêm nó vào Vec." #: src/concurrency/async-pitfalls/cancellation.md msgid "" @@ -18748,105 +22251,132 @@ msgid "" "ensure the system works correctly even when futures are cancelled. For " "example, it shouldn't deadlock or lose data." msgstr "" +"Việc loại bỏ một tương lai có nghĩa là nó không bao giờ có thể được thăm dò " +"lại. Điều này được gọi là _cancellation_ và nó có thể xảy ra ở bất kỳ thời " +"điểm `await` nào. Cần phải cẩn thận để đảm bảo hệ thống hoạt động chính xác " +"ngay cả khi hợp đồng tương lai bị hủy bỏ. Ví dụ: nó không bị bế tắc hoặc mất" +" dữ liệu." #: src/concurrency/async-pitfalls/cancellation.md msgid "\"not UTF-8\"" -msgstr "" +msgstr "\"không phải UTF-8\"" #: src/concurrency/async-pitfalls/cancellation.md msgid "\"hi\\nthere\\n\"" -msgstr "" +msgstr "\"chào\\nđó\\n\"" #: src/concurrency/async-pitfalls/cancellation.md msgid "\"tick!\"" -msgstr "" +msgstr "\"đánh dấu!\"" #: src/concurrency/async-pitfalls/cancellation.md msgid "" "The compiler doesn't help with cancellation-safety. You need to read API " "documentation and consider what state your `async fn` holds." msgstr "" +"compiler không giúp ích cho việc hủy an toàn. Bạn cần đọc tài liệu API và " +"xem xét trạng thái `async fn` của bạn." #: src/concurrency/async-pitfalls/cancellation.md msgid "" "Unlike `panic` and `?`, cancellation is part of normal control flow (vs " "error-handling)." msgstr "" +"Không giống như `hoảng loạn` và `?`, việc hủy là một phần của luồng điều " +"khiển thông thường (so với xử lý lỗi)." #: src/concurrency/async-pitfalls/cancellation.md msgid "The example loses parts of the string." -msgstr "" +msgstr "Ví dụ mất các phần của chuỗi." #: src/concurrency/async-pitfalls/cancellation.md msgid "" "Whenever the `tick()` branch finishes first, `next()` and its `buf` are " "dropped." msgstr "" +"Bất cứ khi nào nhánh `tick()` kết thúc trước, `next()` và `buf` của nó sẽ bị" +" loại bỏ." #: src/concurrency/async-pitfalls/cancellation.md msgid "" "`LinesReader` can be made cancellation-safe by making `buf` part of the " "struct:" msgstr "" +"`LinesReader` có thể được thực hiện an toàn khi hủy bằng cách đặt `buf` " +"thành một phần của cấu trúc:" #: src/concurrency/async-pitfalls/cancellation.md msgid "// prefix buf and bytes with self.\n" -msgstr "" +msgstr "// tiền tố buf và byte với self.\n" #: src/concurrency/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'." +"[`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'." msgstr "" +"[`Interval::tick`](https://docs.rs/tokio/latest/tokio/time/struct.Interval.html#method.tick)" +" có thể hủy an toàn vì nó theo dõi xem liệu một đánh dấu đã được 'gửi' hay " +"chưa." #: src/concurrency/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)" +" có thể hủy an toàn vì nó trả về hoặc không đọc dữ liệu." #: src/concurrency/async-pitfalls/cancellation.md msgid "" -"[`AsyncBufReadExt::read_line`](https://docs.rs/tokio/latest/tokio/io/trait." -"AsyncBufReadExt.html#method.read_line) is similar to the example and _isn't_ " -"cancellation-safe. See its documentation for details and alternatives." +"[`AsyncBufReadExt::read_line`](https://docs.rs/tokio/latest/tokio/io/trait.AsyncBufReadExt.html#method.read_line)" +" is similar to the example and _isn't_ cancellation-safe. See its " +"documentation for details and alternatives." msgstr "" +"[`AsyncBufReadExt::read_line`](https://docs.rs/tokio/latest/tokio/io/trait.AsyncBufReadExt.html#method.read_line)" +" tương tự như ví dụ và _không_an toàn khi hủy. Xem tài liệu của nó để biết " +"chi tiết và lựa chọn thay thế." #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "Dining Philosophers --- Async" -msgstr "" +msgstr "Nhà triết học ăn uống --- Async" #: src/concurrency/async-exercises/dining-philosophers.md msgid "" "See [dining philosophers](dining-philosophers.md) for a description of the " "problem." -msgstr "" +msgstr "Xem [dining triết gia](dining-philosophers.md) để biết mô tả vấn đề." #: src/concurrency/async-exercises/dining-philosophers.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 "" +"Như trước đây, bạn sẽ cần [Cargo Installation](../../cargo/running-" +"locally.md) cục bộ cho bài tập này. Sao chép mã bên dưới vào tệp có tên " +"`src/main.rs`, điền vào chỗ trống và kiểm tra xem `cargo run` không bị bế " +"tắc:" #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Keep trying until we have both forks\n" -msgstr "" +msgstr "// Tiếp tục cố gắng cho đến khi chúng ta có cả hai fork\n" #: src/concurrency/async-exercises/dining-philosophers.md #: src/concurrency/async-exercises/solutions.md msgid "// Make them think and eat\n" -msgstr "" +msgstr "// Làm họ suy nghĩ và ăn\n" #: src/concurrency/async-exercises/dining-philosophers.md msgid "" "Since this time you are using Async Rust, you'll need a `tokio` dependency. " "You can use the following `Cargo.toml`:" msgstr "" +"Vì lần này bạn đang sử dụng Async Rust nên bạn sẽ cần phần phụ thuộc " +"`tokio`. Bạn có thể sử dụng `Cargo.toml` sau:" #: src/concurrency/async-exercises/dining-philosophers.md msgid "" @@ -18857,45 +22387,64 @@ msgid "" "edition = \"2021\"\n" "\n" "[dependencies]\n" -"tokio = { version = \"1.26.0\", features = [\"sync\", \"time\", \"macros\", " -"\"rt-multi-thread\"] }\n" +"tokio = { version = \"1.26.0\", features = [\"sync\", \"time\", \"macros\", \"rt-multi-thread\"] }\n" "```" msgstr "" +"``` toml\n" +"[gói]\n" +"name = \"ăn-triết gia-async-dine\"\n" +"phiên bản = \"0.1.0\"\n" +"phiên bản = \"2021\"\n" +"\n" +"[phụ thuộc]\n" +"tokio = { version = \"1.26.0\", tính năng = [\"đồng bộ\", \"thời gian\", \"macro\", \"rt-multi-thread\"] }\n" +"```" #: src/concurrency/async-exercises/dining-philosophers.md msgid "" "Also note that this time you have to use the `Mutex` and the `mpsc` module " "from the `tokio` crate." msgstr "" +"Cũng lưu ý rằng lần này bạn phải sử dụng mô-đun `Mutex` và `mpsc` từ crate " +"`tokio`." #: src/concurrency/async-exercises/dining-philosophers.md msgid "Can you make your implementation single-threaded?" -msgstr "" +msgstr "Bạn có thể thực hiện việc triển khai của mình theo một luồng không?" #: src/concurrency/async-exercises/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." +"input, and sends them to the server. The chat server broadcasts each message" +" that it receives to all the clients." msgstr "" +"Trong bài tập này, chúng ta muốn sử dụng kiến ​​thức mới của mình để triển " +"khai một ứng dụng trò chuyện quảng bá. Chúng tôi có một máy chủ trò chuyện " +"mà khách hàng kết nối và xuất bản tin nhắn của họ. Máy khách đọc tin nhắn " +"của người dùng từ đầu vào tiêu chuẩn và gửi chúng đến máy chủ. Máy chủ trò " +"chuyện sẽ phát từng tin nhắn mà nó nhận được tới tất cả khách hàng." #: src/concurrency/async-exercises/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 "" +"Để thực hiện việc này, chúng tôi sử dụng [kênh phát " +"sóng](https://docs.rs/tokio/latest/tokio/sync/broadcast/fn.channel.html) " +"trên máy chủ và [`tokio_websockets`](https://docs.rs/tokio-websockets/) để " +"liên lạc giữa máy khách và máy chủ." #: src/concurrency/async-exercises/chat-app.md msgid "Create a new Cargo project and add the following dependencies:" -msgstr "" +msgstr "Tạo một dự án Cargo mới và thêm các phần phụ thuộc sau:" #: src/concurrency/async-exercises/chat-app.md msgid "_Cargo.toml_:" -msgstr "" +msgstr "_Cargo.toml_:" #: src/concurrency/async-exercises/chat-app.md msgid "" @@ -18909,125 +22458,162 @@ msgid "" "futures-util = { version = \"0.3.30\", features = [\"sink\"] }\n" "http = \"1.1.0\"\n" "tokio = { version = \"1.37.0\", features = [\"full\"] }\n" -"tokio-websockets = { version = \"0.8.2\", features = [\"client\", " -"\"fastrand\", \"server\", \"sha1_smol\"] }\n" +"tokio-websockets = { version = \"0.8.2\", features = [\"client\", \"fastrand\", \"server\", \"sha1_smol\"] }\n" "```" msgstr "" +"``` toml\n" +"[gói]\n" +"name = \"chat-async\"\n" +"phiên bản = \"0.1.0\"\n" +"phiên bản = \"2021\"\n" +"\n" +"[phụ thuộc]\n" +"tương lai-util = { phiên bản = \"0.3.30\", tính năng = [\"chìm\"] }\n" +"http=\"1.1.0\"\n" +"tokio = { phiên bản = \"1.37.0\", tính năng = [\"đầy đủ\"] }\n" +"tokio-websockets = { phiên bản = \"0.8.2\", tính năng = [\"khách hàng\", \"fastrand\", \"máy chủ\", \"sha1_smol\"] }\n" +"```" #: src/concurrency/async-exercises/chat-app.md msgid "The required APIs" -msgstr "" +msgstr "Các API cần thiết" #: src/concurrency/async-exercises/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 "" +"Bạn sẽ cần các chức năng sau từ `tokio` và " +"[`tokio_websockets`](https://docs.rs/tokio-websockets/). Hãy dành vài phút " +"để làm quen với API." #: src/concurrency/async-exercises/chat-app.md msgid "" -"[StreamExt::next()](https://docs.rs/futures-util/0.3.28/futures_util/stream/" -"trait.StreamExt.html#method.next) implemented by `WebSocketStream`: for " -"asynchronously reading messages from a Websocket Stream." +"[StreamExt::next()](https://docs.rs/futures-" +"util/0.3.28/futures_util/stream/trait.StreamExt.html#method.next) " +"implemented by `WebSocketStream`: for asynchronously reading messages from a" +" Websocket Stream." msgstr "" +"[StreamExt::next()](https://docs.rs/futures-" +"util/0.3.28/futures_util/stream/trait.StreamExt.html#method.next) do " +"`WebSocketStream` triển khai: để đọc tin nhắn không đồng bộ từ Luồng " +"Websocket." #: src/concurrency/async-exercises/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 "" +"[SinkExt::send()](https://docs.rs/futures-" +"util/0.3.28/futures_util/sink/trait.SinkExt.html#method.send) do " +"`WebSocketStream` triển khai: để gửi tin nhắn không đồng bộ trên Luồng " +"Websocket." #: src/concurrency/async-exercises/chat-app.md msgid "" -"[Lines::next_line()](https://docs.rs/tokio/latest/tokio/io/struct.Lines." -"html#method.next_line): for asynchronously reading user messages from the " -"standard input." +"[Lines::next_line()](https://docs.rs/tokio/latest/tokio/io/struct.Lines.html#method.next_line):" +" for asynchronously reading user messages from the standard input." msgstr "" +"[Lines::next_line()](https://docs.rs/tokio/latest/tokio/io/struct.Lines.html#method.next_line):" +" để đọc không đồng bộ tin nhắn của người dùng từ đầu vào tiêu chuẩn." #: src/concurrency/async-exercises/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):" +" để đăng ký kênh phát sóng." #: src/concurrency/async-exercises/chat-app.md msgid "Two binaries" -msgstr "" +msgstr "Hai nhị phân" #: src/concurrency/async-exercises/chat-app.md 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))." -msgstr "" +"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))." +msgstr "" +"Thông thường trong dự án Cargo, bạn chỉ có thể có một tệp nhị phân và một " +"tệp `src/main.rs`. Trong dự án này, chúng tôi cần hai tệp nhị phân. Một cho " +"máy khách và một cho máy chủ. Bạn có thể biến chúng thành hai dự án Cargo " +"riêng biệt, nhưng chúng tôi sẽ đặt chúng vào một dự án Cargo duy nhất có hai" +" tệp nhị phân. Để tính năng này hoạt động, mã máy khách và mã máy chủ phải " +"nằm trong `src/bin` (xem [tài liệu](https://doc.rust-" +"lang.org/cargo/reference/cargo-targets.html#binaries))." #: src/concurrency/async-exercises/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 " +"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 "" +"Sao chép mã máy chủ và máy khách sau lần lượt vào `src/bin/server.rs` và " +"`src/bin/client.rs`. Nhiệm vụ của bạn là hoàn thành các tệp này như được mô " +"tả bên dưới." #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "_src/bin/server.rs_:" -msgstr "" +msgstr "_src/bin/server.rs_:" #: src/concurrency/async-exercises/chat-app.md msgid "// TODO: For a hint, see the description of the task below.\n" -msgstr "" +msgstr "// TODO: Để biết gợi ý, hãy xem mô tả nhiệm vụ bên dưới.\n" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "\"127.0.0.1:2000\"" -msgstr "" +msgstr "\"127.0.0.1:2000\"" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "\"listening on port 2000\"" -msgstr "" +msgstr "\"nghe trên cổng 2000\"" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "\"New connection from {addr:?}\"" -msgstr "" +msgstr "\"Kết nối mới từ {addr:?}\"" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "// Wrap the raw TCP stream into a websocket.\n" -msgstr "" +msgstr "// Gói luồng TCP thô vào websocket.\n" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "_src/bin/client.rs_:" -msgstr "" +msgstr "_src/bin/client.rs_:" #: src/concurrency/async-exercises/chat-app.md #: src/concurrency/async-exercises/solutions.md msgid "\"ws://127.0.0.1:2000\"" -msgstr "" +msgstr "\"ws://127.0.0.1:2000\"" #: src/concurrency/async-exercises/chat-app.md msgid "Running the binaries" -msgstr "" +msgstr "Chạy các tệp nhị phân" #: src/concurrency/async-exercises/chat-app.md msgid "Run the server with:" -msgstr "" +msgstr "Chạy máy chủ với:" #: src/concurrency/async-exercises/chat-app.md msgid "and the client with:" -msgstr "" +msgstr "và khách hàng với:" #: src/concurrency/async-exercises/chat-app.md msgid "Implement the `handle_connection` function in `src/bin/server.rs`." -msgstr "" +msgstr "Triển khai hàm `handle_connection` trong `src/bin/server.rs`." #: src/concurrency/async-exercises/chat-app.md msgid "" @@ -19035,10 +22621,13 @@ 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 "" +"Gợi ý: Sử dụng `tokio::select!` để thực hiện đồng thời hai tác vụ trong một " +"vòng lặp liên tục. Một tác vụ nhận tin nhắn từ máy khách và phát chúng. Cái " +"còn lại gửi tin nhắn mà máy chủ nhận được đến máy khách." #: src/concurrency/async-exercises/chat-app.md msgid "Complete the main function in `src/bin/client.rs`." -msgstr "" +msgstr "Hoàn thành hàm main trong `src/bin/client.rs`." #: src/concurrency/async-exercises/chat-app.md msgid "" @@ -19047,40 +22636,52 @@ msgid "" "sending them to the server, and (2) receiving messages from the server, and " "displaying them for the user." msgstr "" +"Gợi ý: Như trước, hãy sử dụng `tokio::select!` trong vòng lặp liên tục để " +"thực hiện đồng thời hai tác vụ: (1) đọc tin nhắn của người dùng từ đầu vào " +"tiêu chuẩn và gửi chúng đến máy chủ, và (2) nhận tin nhắn từ máy chủ và hiển" +" thị chúng cho người dùng." #: src/concurrency/async-exercises/chat-app.md msgid "" "Optional: Once you are done, change the code to broadcast messages to all " "clients, but the sender of the message." msgstr "" +"Tùy chọn: Sau khi bạn hoàn tất, hãy thay đổi mã để truyền phát tin nhắn tới " +"tất cả khách hàng, trừ người gửi tin nhắn." #: src/concurrency/async-exercises/solutions.md msgid "" "// If we didn't get the left fork, drop the right fork if we\n" " // have it and let other tasks make progress.\n" msgstr "" +"// Nếu chúng ta không lấy được nĩa bên trái, hãy bỏ nĩa bên phải nếu chúng ta\n" +" // có nó và để các nhiệm vụ khác tiến triển.\n" #: src/concurrency/async-exercises/solutions.md msgid "" "// If we didn't get the right fork, drop the left fork and let\n" " // other tasks make progress.\n" msgstr "" +"// Nếu chúng ta không lấy được nĩa bên phải, hãy bỏ nĩa bên trái và để\n" +" // các nhiệm vụ khác đều tiến triển.\n" #: src/concurrency/async-exercises/solutions.md msgid "// The locks are dropped here\n" -msgstr "" +msgstr "// Các ổ khóa được thả ở đây\n" #: src/concurrency/async-exercises/solutions.md msgid "// tx is dropped here, so we don't need to explicitly drop it later\n" msgstr "" +"// tx được bỏ ở đây nên sau này chúng ta không cần phải bỏ nó một cách rõ " +"ràng\n" #: src/concurrency/async-exercises/solutions.md msgid "\"Here is a thought: {thought}\"" -msgstr "" +msgstr "\"Đây là một ý nghĩ: {suy nghĩ}\"" #: src/concurrency/async-exercises/solutions.md msgid "\"Welcome to chat! Type a message\"" -msgstr "" +msgstr "\"Chào mừng đến với trò chuyện! Nhập tin nhắn\"" #: src/concurrency/async-exercises/solutions.md msgid "" @@ -19088,41 +22689,54 @@ msgid "" " // messages from `ws_stream` and broadcasting them, and (2) receiving\n" " // messages on `bcast_rx` and sending them to the client.\n" msgstr "" +"// Một vòng lặp liên tục để thực hiện đồng thời hai tác vụ: (1) nhận\n" +" // tin nhắn từ `ws_stream` và phát chúng, và (2) nhận\n" +" // tin nhắn trên `bcast_rx` và gửi chúng đến máy khách.\n" #: src/concurrency/async-exercises/solutions.md msgid "\"From client {addr:?} {text:?}\"" -msgstr "" +msgstr "\"Từ khách hàng {addr:?} {text:?}\"" #: src/concurrency/async-exercises/solutions.md msgid "// Continuous loop for concurrently sending and receiving messages.\n" -msgstr "" +msgstr "// Vòng lặp liên tục để gửi và nhận tin nhắn đồng thời.\n" #: src/concurrency/async-exercises/solutions.md msgid "\"From server: {}\"" -msgstr "" +msgstr "\"Từ máy chủ: {}\"" #: src/thanks.md msgid "" -"_Thank you for taking Comprehensive Rust 🦀!_ We hope you enjoyed it and " -"that it was useful." +"_Thank you for taking Comprehensive Rust 🦀!_ We hope you enjoyed it and that" +" it was useful." msgstr "" +"_Cảm ơn bạn đã sử dụng Rust toàn diện 🦀!_ Chúng tôi hy vọng bạn thích nó và " +"nó hữu ích." #: 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." -msgstr "" - -# this is a translation, so the second part of the sentence need not be translated +"please get in [contact with us on " +"GitHub](https://github.com/google/comprehensive-rust/discussions). We would " +"love to hear from you." +msgstr "" +"Chúng tôi đã có rất nhiều niềm vui khi kết hợp khóa học lại với nhau. Khóa " +"học này không hoàn hảo nên nếu bạn phát hiện bất kỳ sai sót nào hoặc có ý " +"tưởng cải tiến, vui lòng liên hệ [liên hệ với chúng tôi trên " +"GitHub](https://github.com/google/comprehensive-rust/discussions). Chúng tôi" +" rất mong nhận được phản hồi từ bạn." + +# this is a translation, so the second part of the sentence need not be +# translated #: 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." msgstr "" -"Bảng từ vựng dưới đây cung cấp định nghĩa ngắn gọn của nhiều thuật ngữ Rust. " +"Bảng từ vựng dưới đây cung cấp định nghĩa ngắn gọn của nhiều thuật ngữ Rust." +" " #: src/glossary.md msgid "" @@ -19143,12 +22757,10 @@ msgstr "" #: src/glossary.md msgid "" "Bare-metal Rust: \n" -"Low-level Rust development, often deployed to a system without an operating " -"system. See [Bare-metal Rust](bare-metal.md)." +"Low-level Rust development, often deployed to a system without an operating system. See [Bare-metal Rust](bare-metal.md)." msgstr "" "Bare-metal Rust: \n" -"Việc phát triển chương trình Rust ở cấp thấp, thường để triển khai trên hệ " -"thống không cần hệ điều hành. Xem [Bare-metal Rust](bare-metal.md)." +"Việc phát triển chương trình Rust ở cấp thấp, thường để triển khai trên hệ thống không cần hệ điều hành. Xem [Bare-metal Rust](bare-metal.md)." #: src/glossary.md msgid "" @@ -19172,8 +22784,7 @@ msgid "" "The part of the Rust compiler which checks that all borrows are valid." msgstr "" "borrow checker: \n" -"Một bộ phận của Rust compiler kiểm tra xem tất cả các _borrow_ có hợp lệ hay " -"không." +"Một bộ phận của Rust compiler kiểm tra xem tất cả các _borrow_ có hợp lệ hay không." #: src/glossary.md msgid "" @@ -19186,8 +22797,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 "" "build: \n" "Quá trình chuyển đổi mã nguồn thành một chương trình executable." @@ -19206,8 +22816,7 @@ msgid "" "Used to safely pass messages [between threads](concurrency/channels.md)." msgstr "" "channel: \n" -"Dùng để truyền thông điệp một cách an toàn [giữa các _thread_](concurrency/" -"channels.md)." +"Dùng để truyền thông điệp một cách an toàn [giữa các _thread_](concurrency/channels.md)." #: src/glossary.md msgid "" @@ -19239,18 +22848,15 @@ msgid "" "A value that does not change during the execution of a program." msgstr "" "constant: \n" -"Một giá trị không thay đổi trong quá trình thực thi của chương trình. Còn " -"được gọi là _hằng số_." +"Một giá trị không thay đổi trong quá trình thực thi của chương trình. Còn được gọi là _hằng số_." #: 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 "" "control flow: \n" -"Thứ tự thực thi của các câu lệnh trong một chương trình. Một vài sách gọi từ " -"này là _luồng điều khiển_." +"Thứ tự thực thi của các câu lệnh trong một chương trình. Một vài sách gọi từ này là _luồng điều khiển_." #: src/glossary.md msgid "" @@ -19263,12 +22869,10 @@ msgstr "" #: src/glossary.md msgid "" "enumeration: \n" -"A data type that holds one of several named constants, possibly with an " -"associated tuple or struct." +"A data type that holds one of several named constants, possibly with an associated tuple or struct." msgstr "" "enumeration: \n" -"Môt kiểu dữ liệu chứa một hoặc nhiều hằng số, có thể kèm theo một _tuple_ " -"hoặc một _struct_." +"Môt kiểu dữ liệu chứa một hoặc nhiều hằng số, có thể kèm theo một _tuple_ hoặc một _struct_." #: src/glossary.md msgid "" @@ -19281,8 +22885,7 @@ msgstr "" #: src/glossary.md msgid "" "error handling: \n" -"The process of managing and responding to errors that occur during program " -"execution." +"The process of managing and responding to errors that occur during program execution." msgstr "" "error handling: \n" "Quá trình quản lý và xử lý lỗi xảy ra trong quá trình thực thi chương trình." @@ -19293,8 +22896,7 @@ msgid "" "A task or problem designed to practice and test programming skills." msgstr "" "exercise: \n" -"Bài tập được thiết kế giúp học viên luyện tập và kiểm tra năng lực lập " -"trình. " +"Bài tập được thiết kế giúp học viên luyện tập và kiểm tra năng lực lập trình. " #: src/glossary.md msgid "" @@ -19302,29 +22904,23 @@ msgid "" "A reusable block of code that performs a specific task." msgstr "" "function: \n" -"Một đoạn code có thể được tái sử dụng, nhằm thực hiện một nhiệm vụ cụ thể." -"Còn được gọi là _hàm_." +"Một đoạn code có thể được tái sử dụng, nhằm thực hiện một nhiệm vụ cụ thể.Còn được gọi là _hàm_." #: 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 "" "garbage collector: \n" -"Một cơ chế tự động giải phóng bộ nhớ bị chiếm bởi các biến không còn được sử " -"dụng nữa." +"Một cơ chế tự động giải phóng bộ nhớ bị chiếm bởi các biến không còn được sử dụng nữa." #: 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 "" "generics: \n" -"Một tính năng của ngôn ngữ lập trình, cho phép code được viết nhưng không " -"cần phải định rõ kiểu dữ liệu, giúp tái sử dụng code với nhiều kiểu dữ liệu " -"khác nhau." +"Một tính năng của ngôn ngữ lập trình, cho phép code được viết nhưng không cần phải định rõ kiểu dữ liệu, giúp tái sử dụng code với nhiều kiểu dữ liệu khác nhau." #: src/glossary.md msgid "" @@ -19337,22 +22933,18 @@ msgstr "" #: src/glossary.md msgid "" "integration test: \n" -"A type of test that verifies the interactions between different parts or " -"components of a system." +"A type of test that verifies the interactions between different parts or components of a system." msgstr "" "integration test: \n" -"Một quy trình _test_ code để kiểm tra sự tương tác giữa các thành phần của " -"hệ thống." +"Một quy trình _test_ code để kiểm tra sự tương tác giữa các thành phần của hệ thống." #: src/glossary.md msgid "" "keyword: \n" -"A reserved word in a programming language that has a specific meaning and " -"cannot be used as an identifier." +"A reserved word in a programming language that has a specific meaning and cannot be used as an identifier." msgstr "" "keyword: \n" -"Một từ khóa trong ngôn ngữ lập trình, có ý nghĩa cụ thể và không thể sử dụng " -"như một _identifier_ (tên biến)." +"Một từ khóa trong ngôn ngữ lập trình, có ý nghĩa cụ thể và không thể sử dụng như một _identifier_ (tên biến)." #: src/glossary.md msgid "" @@ -19360,22 +22952,15 @@ msgid "" "A collection of precompiled routines or code that can be used by programs." msgstr "" "library: \n" -"Một bộ sưu tập các hàm hoặc code đã được biên dịch trước, có thể được sử " -"dụng trong chương trình. Thường được gọi là _thư viện_." +"Một bộ sưu tập các hàm hoặc code đã được biên dịch trước, có thể được sử dụng trong chương trình. Thường được gọi là _thư viện_." #: 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 "" "macro: \n" -"Macros trong Rust có thể được nhận diện bằng việc tên có dấu `!`. Macros " -"được sử dụng khi hàm thông thường không đáp ứng được nhu cầu của chương " -"trình. Một ví dụ điển hình là `format!`, macro này có thể nhận một số lượng " -"tham số không cố định (có thể 1 tham số, 2 tham số, hay thậm chí là không có " -"tham số nào). Hàm thông thường trong Rust không làm được điều này." +"Macros trong Rust có thể được nhận diện bằng việc tên có dấu `!`. Macros được sử dụng khi hàm thông thường không đáp ứng được nhu cầu của chương trình. Một ví dụ điển hình là `format!`, macro này có thể nhận một số lượng tham số không cố định (có thể 1 tham số, 2 tham số, hay thậm chí là không có tham số nào). Hàm thông thường trong Rust không làm được điều này." #: src/glossary.md msgid "" @@ -19388,22 +22973,18 @@ 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 "" "match: \n" -"Một _control flow_ trong Rust cho phép so sánh một giá trị với một số " -"_pattern_ cho trước." +"Một _control flow_ trong Rust cho phép so sánh một giá trị với một số _pattern_ cho trước." #: 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 "" "memory leak: \n" -"Khi chương trình không giải phóng bộ nhớ của biến không còn cần thiết, dẫn " -"đến việc bộ nhớ sử dụng tăng dần trong quá trình thực thi." +"Khi chương trình không giải phóng bộ nhớ của biến không còn cần thiết, dẫn đến việc bộ nhớ sử dụng tăng dần trong quá trình thực thi." #: src/glossary.md msgid "" @@ -19416,12 +22997,10 @@ 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 "" "module: \n" -"Một phương pháp đẻ nhóm các định nghĩa, như hàm, kiểu dữ liệu, hoặc traits, " -"trong Rust." +"Một phương pháp đẻ nhóm các định nghĩa, như hàm, kiểu dữ liệu, hoặc traits, trong Rust." #: src/glossary.md msgid "" @@ -19429,38 +23008,31 @@ msgid "" "The transfer of ownership of a value from one variable to another in Rust." msgstr "" "move: \n" -"Chuyển quyền sở hữu của một giá trị từ một biến sang một biến khác trong " -"Rust." +"Chuyển quyền sở hữu của một giá trị từ một biến sang một biến khác trong Rust." #: src/glossary.md msgid "" "mutable: \n" -"A property in Rust that allows variables to be modified after they have been " -"declared." +"A property in Rust that allows variables to be modified after they have been declared." msgstr "" "mutable: \n" -"Một thuộc tính trong Rust cho phép biến có thể được thay đổi sau khi đã được " -"khai báo." +"Một thuộc tính trong Rust cho phép biến có thể được thay đổi sau khi đã được khai báo." #: src/glossary.md msgid "" "ownership: \n" -"The concept in Rust that defines which part of the code is responsible for " -"managing the memory associated with a value." +"The concept in Rust that defines which part of the code is responsible for managing the memory associated with a value." msgstr "" "ownership: \n" -"Một khái niệm trong Rust xác định phần nào của code chịu trách nhiệm quản lý " -"bộ nhớ liên quan đến một giá trị." +"Một khái niệm trong Rust xác định phần nào của code chịu trách nhiệm quản lý bộ nhớ liên quan đến một giá trị." #: 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 "" "panic: \n" -"Khi chương trình gặp phải một lỗi không thể phục hồi được, dẫn đến việc dừng " -"chương trình." +"Khi chương trình gặp phải một lỗi không thể phục hồi được, dẫn đến việc dừng chương trình." #: src/glossary.md msgid "" @@ -19473,12 +23045,10 @@ 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 "" "pattern: \n" -"Cách sử dụng giá trị, hằng số, hoặc cấu trúc để so sánh với một biểu thức " -"trong Rust." +"Cách sử dụng giá trị, hằng số, hoặc cấu trúc để so sánh với một biểu thức trong Rust." #: src/glossary.md msgid "" @@ -19486,18 +23056,15 @@ msgid "" "The data or information carried by a message, event, or data structure." msgstr "" "payload: \n" -"Dữ liệu hoặc thông tin được chuyển đi, thường sử dụng khi nhắc đến việc " -"chuyển dữ liệu qua mạng." +"Dữ liệu hoặc thông tin được chuyển đi, thường sử dụng khi nhắc đến việc chuyển dữ liệu qua mạng." #: 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 "" "program: \n" -"Một tập hợp các dòng lệnh máy tính có thể thực thi để thực hiện một nhiệm vụ " -"hoặc giải quyết một vấn đề cụ thể. Còn được gọi là _chương trình_." +"Một tập hợp các dòng lệnh máy tính có thể thực thi để thực hiện một nhiệm vụ hoặc giải quyết một vấn đề cụ thể. Còn được gọi là _chương trình_." #: src/glossary.md msgid "" @@ -19505,29 +23072,23 @@ msgid "" "A formal system used to communicate instructions to a computer, such as Rust." msgstr "" "programming language: \n" -"Một hệ thống ngôn ngữ được sử dụng để truyền thông điệp cho máy tính, như " -"Rust." +"Một hệ thống ngôn ngữ được sử dụng để truyền thông điệp cho máy tính, như Rust." #: 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 "" "receiver: \n" -"Tham số đầu tiên trong một _method_ của Rust, đại diện cho biến mà _method_ " -"đó gọi lên." +"Tham số đầu tiên trong một _method_ của Rust, đại diện cho biến mà _method_ đó gọi lên." #: 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 "" "reference counting: \n" -"Một kỹ thuật quản lý bộ nhớ trong đó số lượng tham chiếu đến một đối tượng " -"được theo dõi, và đối tượng được giải phóng khi số lượng tham chiếu giảm về " -"0." +"Một kỹ thuật quản lý bộ nhớ trong đó số lượng tham chiếu đến một đối tượng được theo dõi, và đối tượng được giải phóng khi số lượng tham chiếu giảm về 0." #: src/glossary.md msgid "" @@ -19540,8 +23101,7 @@ msgstr "" #: src/glossary.md msgid "" "Rust: \n" -"A systems programming language that focuses on safety, performance, and " -"concurrency." +"A systems programming language that focuses on safety, performance, and concurrency." msgstr "" "Rust: \n" "Ngôn ngữ lập trình hệ thống chú trọng vào an toàn và hiệu suất." @@ -19573,12 +23133,10 @@ 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 "" "safe: \n" -"Đoạn code tuân thủ các quy tắc về _ownership_ và _borrowing_ của Rust, ngăn " -"chặn lỗi liên quan đến bộ nhớ." +"Đoạn code tuân thủ các quy tắc về _ownership_ và _borrowing_ của Rust, ngăn chặn lỗi liên quan đến bộ nhớ." #: src/glossary.md msgid "" @@ -19594,44 +23152,36 @@ msgid "" "A collection of modules providing essential functionality in Rust." msgstr "" "standard library: \n" -"Một bộ sưu tập các _module_ cung cấp các chức năng cần thiết trong Rust. Một " -"số sách gọi là _thư viện chuẩn_." +"Một bộ sưu tập các _module_ cung cấp các chức năng cần thiết trong Rust. Một số sách gọi là _thư viện chuẩn_." #: src/glossary.md msgid "" "static: \n" -"A keyword in Rust used to define static variables or items with a `'static` " -"lifetime." +"A keyword in Rust used to define static variables or items with a `'static` lifetime." msgstr "" "static: \n" -"Một từ khóa trong Rust dùng để định nghĩa biến tĩnh hoặc các phần tử với " -"_lifetime_ là `'static`." +"Một từ khóa trong Rust dùng để định nghĩa biến tĩnh hoặc các phần tử với _lifetime_ là `'static`." #: 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 "" "string: \n" -"Một kiểu dữ liệu lưu trữ dữ liệu văn bản. Xem [`String` vs `str`](basic-" -"syntax/string-slices.html) để biết thêm chi tiết. Còn được gọi là _chuỗi_." +"Một kiểu dữ liệu lưu trữ dữ liệu văn bản. Xem [`String` vs `str`](basic-syntax/string-slices.html) để biết thêm chi tiết. Còn được gọi là _chuỗi_." #: 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 "" "struct: \n" -"Một kiểu dữ liệu trong Rust, dùng để nhóm các biến khác nhau với nhau thành " -"một kiểu dữ liệu mới." +"Một kiểu dữ liệu trong Rust, dùng để nhóm các biến khác nhau với nhau thành một kiểu dữ liệu mới." #: 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 "" "test: \n" "Một _module_ trong Rust chứa các hàm kiểm tra sự chính xác của các hàm khác." @@ -19642,24 +23192,20 @@ msgid "" "A separate sequence of execution in a program, allowing concurrent execution." msgstr "" "thread: \n" -"Một cơ chế cho phép thực thi nhiều tác vụ cùng một lúc trong chương trình. " -"Còn được gọi là _luồng_." +"Một cơ chế cho phép thực thi nhiều tác vụ cùng một lúc trong chương trình. Còn được gọi là _luồng_." #: src/glossary.md msgid "" "thread safety: \n" -"The property of a program that ensures correct behavior in a multithreaded " -"environment." +"The property of a program that ensures correct behavior in a multithreaded environment." msgstr "" "thread safety: \n" -"Thuộc tính của chương trình đảm bảo chương trình hoạt động chuẩn xác trong " -"môi trường đa luồng." +"Thuộc tính của chương trình đảm bảo chương trình hoạt động chuẩn xác trong môi trường đa luồng." #: 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 "" "trait: \n" "Một tập hợp các hành vi mà ta muốn một kiểu dữ liệu cụ thể phải có." @@ -19667,8 +23213,7 @@ msgstr "" #: src/glossary.md msgid "" "trait bound: \n" -"An abstraction where you can require types to implement some traits of your " -"interest." +"An abstraction where you can require types to implement some traits of your interest." msgstr "" "trait bound: \n" "Một cách để yêu cầu một kiểu dữ liệu phải _implement_ một số _trait_ cụ thể." @@ -19676,42 +23221,34 @@ 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 "" "tuple: \n" -"Một kiểu dữ liệu trong Rust chứa các biến khác nhau. Các trường của _tuple_ " -"không có tên, và được truy cập bằng số thứ tự." +"Một kiểu dữ liệu trong Rust chứa các biến khác nhau. Các trường của _tuple_ không có tên, và được truy cập bằng số thứ tự." #: 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 "" "type: \n" -"Một cơ chế giúp xác định các thao tác có thể thực hiện trên giá trị của một " -"kiểu dữ liệu cụ thể trong Rust." +"Một cơ chế giúp xác định các thao tác có thể thực hiện trên giá trị của một kiểu dữ liệu cụ thể trong Rust." #: 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 "" "type inference: \n" -"Một chức năng của Rust compiler giúp suy luận kiểu dữ liệu của biến hoặc " -"biểu thức, thay vì phải khai báo kiểu dữ liệu cho từng biến." +"Một chức năng của Rust compiler giúp suy luận kiểu dữ liệu của biến hoặc biểu thức, thay vì phải khai báo kiểu dữ liệu cho từng biến." #: 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 "" "undefined behavior: \n" -"Một số hành vi và điều kiện trong Rust không có kết quả cụ thể, thường dẫn " -"đến việc chương trình hoạt động bất thường." +"Một số hành vi và điều kiện trong Rust không có kết quả cụ thể, thường dẫn đến việc chương trình hoạt động bất thường." #: src/glossary.md msgid "" @@ -19719,18 +23256,15 @@ msgid "" "A data type that can hold values of different types but only one at a time." msgstr "" "union: \n" -"Một kiểu dữ liệu có thể chứa giá trị của nhiều kiểu dữ liệu khác nhau, nhưng " -"chỉ một giá trị một lúc." +"Một kiểu dữ liệu có thể chứa giá trị của nhiều kiểu dữ liệu khác nhau, nhưng chỉ một giá trị một lúc." #: src/glossary.md msgid "" "unit test: \n" -"Rust comes with built-in support for running small unit tests and larger " -"integration tests. See [Unit Tests](testing/unit-tests.html)." +"Rust comes with built-in support for running small unit tests and larger integration tests. See [Unit Tests](testing/unit-tests.html)." msgstr "" "unit test: \n" -"Một loại _test_ trong Rust, giúp kiểm tra từng phần nhỏ của chương trình. " -"Xem [Unit Tests](testing/unit-tests.html)." +"Một loại _test_ trong Rust, giúp kiểm tra từng phần nhỏ của chương trình. Xem [Unit Tests](testing/unit-tests.html)." #: src/glossary.md msgid "" @@ -19743,12 +23277,10 @@ msgstr "" #: src/glossary.md msgid "" "unsafe: \n" -"The subset of Rust which allows you to trigger _undefined behavior_. See " -"[Unsafe Rust](unsafe.html)." +"The subset of Rust which allows you to trigger _undefined behavior_. See [Unsafe Rust](unsafe.html)." msgstr "" "unsafe: \n" -"Một phần của Rust cho phép người lập trình gây ra _undefined behavior_. Xem " -"[Unsafe Rust](unsafe.html)." +"Một phần của Rust cho phép người lập trình gây ra _undefined behavior_. Xem [Unsafe Rust](unsafe.html)." #: src/glossary.md msgid "" @@ -19756,57 +23288,72 @@ msgid "" "A memory location storing data. Variables are valid in a _scope_." msgstr "" "variable: \n" -"Một vùng bộ nhớ lưu trữ dữ liệu. Có thể được sử dụng trong một _scope_. Còn " -"được gọi là _biến_." +"Một vùng bộ nhớ lưu trữ dữ liệu. Có thể được sử dụng trong một _scope_. Còn được gọi là _biến_." #: src/other-resources.md msgid "Other Rust Resources" -msgstr "" +msgstr "Tài nguyên Rust khác" #: src/other-resources.md msgid "" "The Rust community has created a wealth of high-quality and free resources " "online." msgstr "" +"Cộng đồng Rust đã tạo ra vô số tài nguyên trực tuyến miễn phí và chất lượng " +"cao." #: src/other-resources.md msgid "Official Documentation" -msgstr "" +msgstr "Tài liệu chính thức" #: src/other-resources.md msgid "The Rust project hosts many resources. These cover Rust in general:" msgstr "" +"Dự án Rust lưu trữ nhiều tài nguyên. Những điều này bao gồm Rust nói chung:" #: 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." +"canonical free book about Rust. Covers the language in detail and includes a" +" few projects for people to build." msgstr "" +"[Ngôn ngữ lập trình Rust](https://doc.rust-lang.org/book/): cuốn sách kinh " +"điển miễn phí về Rust. Trình bày ngôn ngữ một cách chi tiết và bao gồm một " +"số dự án để mọi người xây dựng." #: 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." +"Sometimes includes small exercises where you are asked to expand on the code" +" in the examples." msgstr "" +"[Rust By Ví dụ](https://doc.rust-lang.org/rust-by-example/): trình bày cú " +"pháp Rust thông qua một loạt ví dụ thể hiện các cấu trúc khác nhau. Đôi khi " +"bao gồm các bài tập nhỏ trong đó bạn được yêu cầu mở rộng mã trong các ví " +"dụ." #: src/other-resources.md msgid "" "[Rust Standard Library](https://doc.rust-lang.org/std/): full documentation " "of the standard library for Rust." msgstr "" +"[Thư viện chuẩn Rust](https://doc.rust-lang.org/std/): tài liệu đầy đủ về " +"thư viện chuẩn cho 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." msgstr "" +"[The Rust Reference](https://doc.rust-lang.org/reference/): một cuốn sách " +"chưa hoàn chỉnh mô tả mô hình bộ nhớ và ngữ pháp của Rust." #: src/other-resources.md msgid "More specialized guides hosted on the official Rust site:" msgstr "" +"Các hướng dẫn chuyên biệt khác được lưu trữ trên trang web chính thức của " +"Rust:" #: src/other-resources.md msgid "" @@ -19814,13 +23361,19 @@ msgid "" "including working with raw pointers and interfacing with other languages " "(FFI)." msgstr "" +"[The Rustonomicon](https://doc.rust-lang.org/nomicon/): đề cập đến Rust " +"không an toàn, bao gồm làm việc với các con trỏ thô và giao tiếp với các " +"ngôn ngữ khác (FFI)." #: src/other-resources.md msgid "" -"[Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/): " -"covers the new asynchronous programming model which was introduced after the " -"Rust Book was written." +"[Asynchronous Programming in Rust](https://rust-lang.github.io/async-book/):" +" covers the new asynchronous programming model which was introduced after " +"the Rust Book was written." msgstr "" +"[Lập trình không đồng bộ trong Rust](https://rust-lang.github.io/async-" +"book/): đề cập đến mô hình lập trình không đồng bộ mới được giới thiệu sau " +"khi Rust Book được viết." #: src/other-resources.md msgid "" @@ -19828,27 +23381,35 @@ msgid "" "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/): " +"giới thiệu về cách sử dụng Rust trên các thiết bị nhúng không có hệ điều " +"hành." #: src/other-resources.md msgid "Unofficial Learning Material" -msgstr "" +msgstr "Tài liệu học tập không chính thức" #: src/other-resources.md msgid "A small selection of other guides and tutorial for Rust:" -msgstr "" +msgstr "Một số hướng dẫn và hướng dẫn khác dành cho Rust:" #: src/other-resources.md msgid "" -"[Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/): covers Rust " -"from the perspective of low-level C programmers." +"[Learn Rust the Dangerous Way](http://cliffle.com/p/dangerust/): covers Rust" +" from the perspective of low-level C programmers." msgstr "" +"[Tìm hiểu Rust theo cách nguy hiểm](http://cliffle.com/p/dangrust/): trình " +"bày về Rust từ góc nhìn của các lập trình viên C cấp thấp." #: 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 Embedded C " +"Programmers](https://docs.opentitan.org/doc/ug/rust_for_c/): covers Rust " +"from the perspective of developers who write firmware in C." msgstr "" +"[Rust dành cho lập trình viên C " +"nhúng](https://docs.opentitan.org/doc/ug/rust_for_c/): trình bày về Rust từ " +"góc nhìn của các nhà phát triển viết chương trình cơ sở trong C." #: src/other-resources.md msgid "" @@ -19856,12 +23417,17 @@ msgid "" "covers the syntax of Rust using side-by-side comparisons with other " "languages such as C, C++, Java, JavaScript, and Python." msgstr "" +"[Rust dành cho chuyên gia](https://overexact.com/rust-for-professionals/): " +"trình bày cú pháp của Rust bằng cách so sánh song song với các ngôn ngữ khác" +" như C, C++, Java, JavaScript và Python." #: src/other-resources.md msgid "" -"[Rust on Exercism](https://exercism.org/tracks/rust): 100+ exercises to help " -"you learn Rust." +"[Rust on Exercism](https://exercism.org/tracks/rust): 100+ exercises to help" +" you learn Rust." msgstr "" +"[Rust on Exercism](https://exercism.org/tracks/rust): Hơn 100 bài tập giúp " +"bạn học Rust." #: src/other-resources.md msgid "" @@ -19870,6 +23436,10 @@ msgid "" "and advanced part of the Rust language. Other topics such as WebAssembly, " "and async/await are also covered." msgstr "" +"[Tài liệu giảng dạy sắt](https://ferrous-systems.github.io/teaching-" +"material/index.html): một loạt bài thuyết trình nhỏ bao gồm cả phần cơ bản " +"và nâng cao của ngôn ngữ Rust. Các chủ đề khác như WebAssugging và " +"async/await cũng được đề cập." #: src/other-resources.md msgid "" @@ -19878,28 +23448,47 @@ msgid "" "built-in testing framework. It covers `googletest`, snapshot testing, " "mocking as well as how to write your own custom test harness." msgstr "" +"[Thử nghiệm nâng cao cho các ứng dụng " +"Rust](https://github.com/mainmatter/rust-advanced-testing-workshop): một hội" +" thảo theo nhịp độ riêng vượt xa khuôn khổ thử nghiệm tích hợp của Rust. Nó " +"bao gồm `googletest`, kiểm tra ảnh chụp nhanh, mô phỏng cũng như cách viết " +"khai thác kiểm tra tùy chỉnh của riêng bạn." #: 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." +"[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." msgstr "" +"[Sê-ri dành cho người mới bắt đầu về Rust](https://docs.microsoft.com/en-" +"us/shows/beginners-series-to-rust/) và [Thực hiện những bước đầu tiên của " +"bạn với Rust](https://docs.microsoft.com/en-us/learn/paths/rust-first-" +"steps/): hai hướng dẫn về Rust dành cho các nhà phát triển mới. Đầu tiên là " +"bộ 35 video và thứ hai là bộ 11 mô-đun bao gồm cú pháp Rust và các cấu trúc " +"cơ bản." #: 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 "" +"[Tìm hiểu Rust với quá nhiều danh sách liên kết](https://rust-" +"unofficial.github.io/too-many-lists/): khám phá chuyên sâu các quy tắc quản " +"lý bộ nhớ của Rust, thông qua việc triển khai một số loại cấu trúc danh sách" +" khác nhau." #: src/other-resources.md msgid "" "Please see the [Little Book of Rust Books](https://lborb.github.io/book/) " "for even more Rust books." msgstr "" +"Vui lòng xem [Sách nhỏ về Sách rỉ sét](https://lborb.github.io/book/) để " +"biết thêm sách về Rust." #: src/credits.md msgid "" @@ -19907,17 +23496,25 @@ msgid "" "documentation. See the page on [other resources](other-resources.md) for a " "full list of useful resources." msgstr "" +"Tài liệu ở đây được xây dựng dựa trên nhiều nguồn tài liệu tuyệt vời về " +"Rust. Xem trang trên [other Resources](other-resources.md) để biết danh sách" +" đầy đủ các tài nguyên hữu ích." #: src/credits.md msgid "" -"The material of Comprehensive Rust is licensed under the terms of the Apache " -"2.0 license, please see [`LICENSE`](https://github.com/google/comprehensive-" -"rust/blob/main/LICENSE) for details." +"The material of Comprehensive Rust is licensed under the terms of the Apache" +" 2.0 license, please see " +"[`LICENSE`](https://github.com/google/comprehensive-rust/blob/main/LICENSE) " +"for details." msgstr "" +"Tài liệu của Complete Rust được cấp phép theo các điều khoản của giấy phép " +"Apache 2.0, vui lòng xem " +"[`LICENSE`](https://github.com/google/comprehensive-rust/blob/main/LICENSE) " +"để biết chi tiết." #: src/credits.md msgid "Rust by Example" -msgstr "" +msgstr "Rust bằng ví dụ" #: src/credits.md msgid "" @@ -19926,28 +23523,40 @@ msgid "" "`third_party/rust-by-example/` directory for details, including the license " "terms." msgstr "" +"Một số ví dụ và bài tập đã được sao chép và điều chỉnh từ [Rust by Ví " +"dụ](https://doc.rust-lang.org/rust-by-example/). Vui lòng xem thư mục " +"`third_party/rust-by-example/` để biết chi tiết, bao gồm cả điều khoản cấp " +"phép." #: src/credits.md msgid "Rust on Exercism" -msgstr "" +msgstr "Rust tập thể dục" #: src/credits.md msgid "" -"Some exercises have been copied and adapted from [Rust on Exercism](https://" -"exercism.org/tracks/rust). Please see the `third_party/rust-on-exercism/` " -"directory for details, including the license terms." +"Some exercises have been copied and adapted from [Rust on " +"Exercism](https://exercism.org/tracks/rust). Please see the " +"`third_party/rust-on-exercism/` directory for details, including the license" +" terms." msgstr "" +"Một số bài tập đã được sao chép và phỏng theo [Rust on " +"Exercism](https://exercism.org/tracks/rust). Vui lòng xem thư mục " +"`third_party/rust-on-exercism/` để biết chi tiết, bao gồm cả điều khoản cấp " +"phép." #: src/credits.md msgid "CXX" -msgstr "" +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/` " -"directory for details, including the license terms." +"uses an image from [CXX](https://cxx.rs/). Please see the `third_party/cxx/`" +" directory for details, including the license terms." msgstr "" +"Phần [Khả năng tương tác với C++](android/interoperability/cpp.md) sử dụng " +"hình ảnh từ [CXX](https://cxx.rs/). Vui lòng xem thư mục `third_party/cxx/` " +"để biết chi tiết, bao gồm cả điều khoản cấp phép." #~ msgid "[Welcome](../welcome-day-1.md) (5 minutes)" #~ msgstr "[Lời Chào Mừng](../welcome-day-1.md) (5 phút)" @@ -19984,13 +23593,13 @@ msgstr "" #~ msgid "[Standard Library Types](../std-types.md) (1 hour and 20 minutes)" #~ msgstr "" -#~ "[Thư Viện Kiểu Dữ Liệu Tiêu Chuẩn (Standard Library Types)](../std-types." -#~ "md) (1 tiếng và 20 phút)" +#~ "[Thư Viện Kiểu Dữ Liệu Tiêu Chuẩn (Standard Library Types)](../std-types.md)" +#~ " (1 tiếng và 20 phút)" #~ msgid "[Standard Library Traits](../std-traits.md) (1 hour and 40 minutes)" #~ msgstr "" -#~ "[Thư Viện Traits Tiêu Chuẩn (Standard Library Traits)](../std-traits.md) " -#~ "(1 tiếng và 40 phút)" +#~ "[Thư Viện Traits Tiêu Chuẩn (Standard Library Traits)](../std-traits.md) (1 " +#~ "tiếng và 40 phút)" #~ msgid "[Welcome](../welcome-day-3.md) (3 minutes)" #~ msgstr "[Lời Chào Mừng](../welcome-day-3.md) (3 phút)" @@ -20053,8 +23662,7 @@ msgstr "" #~ "phút)" #~ msgid "" -#~ "[Blocks and Scopes](./control-flow-basics/blocks-and-scopes.md) (5 " -#~ "minutes)" +#~ "[Blocks and Scopes](./control-flow-basics/blocks-and-scopes.md) (5 minutes)" #~ msgstr "" #~ "[Khối và phạm vi](./control-flow-basics/blocks-and-scopes.md) (5 phút)" @@ -20065,10 +23673,8 @@ msgstr "" #~ msgstr "[Macros](./control-flow-basics/macros.md) (2 phút)" #~ msgid "" -#~ "[Exercise: Collatz Sequence](./control-flow-basics/exercise.md) (15 " -#~ "minutes)" -#~ msgstr "" -#~ "[Bài tập: Chuỗi Collatz](./control-flow-basics/exercise.md) (15 phút)" +#~ "[Exercise: Collatz Sequence](./control-flow-basics/exercise.md) (15 minutes)" +#~ msgstr "[Bài tập: Chuỗi Collatz](./control-flow-basics/exercise.md) (15 phút)" #~ msgid "[Standard Library](./std-types/std.md) (3 minutes)" #~ msgstr "[Thư viện chuẩn](./std-types/std.md) (3 phút)"