Rust Glossary
Bảng Thuật Ngữ Rust
Key Rust terms and concepts with Vietnamese translations. Search or browse alphabetically.
A
Atomically Reference Counted smart pointer for safe shared ownership across threads
Con trỏ thông minh đếm tham chiếu nguyên tử để chia sẻ quyền sở hữu an toàn giữa các luồng
async/await
See: Async/AwaitKeywords for writing asynchronous code that looks synchronous, built on the Future trait
Từ khóa để viết mã bất đồng bộ trông giống đồng bộ, xây dựng trên trait Future
B
Borrow Checker
See: References & BorrowingThe Rust compiler component that enforces ownership and borrowing rules at compile time
Thành phần biên dịch Rust kiểm tra quy tắc sở hữu và mượn tại thời điểm biên dịch
Box<T>
See: Smart PointersA smart pointer that allocates data on the heap, providing owned access to a value of type T
Con trỏ thông minh cấp phát dữ liệu trên heap, cung cấp quyền sở hữu giá trị kiểu T
C
Rust's official build system and package manager for compiling, testing, and managing dependencies
Hệ thống xây dựng và quản lý gói chính thức của Rust để biên dịch, kiểm thử và quản lý phụ thuộc
Clone
See: OwnershipA trait that allows explicit deep copying of a value, as opposed to implicit moves
Trait cho phép sao chép sâu giá trị một cách tường minh, khác với di chuyển ngầm
Closure
See: Closures & IteratorsAn anonymous function that captures variables from its enclosing scope
Hàm ẩn danh bắt giữ biến từ phạm vi bao quanh
Copy
See: OwnershipA marker trait indicating a type can be duplicated by simple bitwise copy without move semantics
Trait đánh dấu cho biết kiểu có thể sao chép bằng sao chép bit đơn giản mà không cần ngữ nghĩa di chuyển
A compilation unit in Rust, either a library or a binary, managed by Cargo
Đơn vị biên dịch trong Rust, có thể là thư viện hoặc chương trình, được quản lý bởi Cargo
D
derive
See: Generics & TraitsAn attribute macro that auto-generates trait implementations for structs and enums
Macro thuộc tính tự động tạo triển khai trait cho struct và enum
A trait whose drop() method is called automatically when a value goes out of scope, used for cleanup
Trait có phương thức drop() được gọi tự động khi giá trị ra khỏi phạm vi, dùng để dọn dẹp
E
A type that can be one of several variants, each optionally holding data
Kiểu dữ liệu có thể là một trong nhiều biến thể, mỗi biến thể có thể chứa dữ liệu
F
Foreign Function Interface — mechanism for calling code written in other languages such as C
Giao diện hàm ngoại — cơ chế gọi mã viết bằng ngôn ngữ khác như C
Future
See: Async/AwaitA trait representing an asynchronous computation that will produce a value at some point
Trait biểu thị một phép tính bất đồng bộ sẽ tạo ra giá trị tại một thời điểm nào đó
G
Generic
See: Generics & TraitsA way to write code that works with multiple types using type parameters like <T>
Cách viết mã hoạt động với nhiều kiểu dữ liệu bằng tham số kiểu như <T>
H
HashMap
See: CollectionsA hash map collection that stores key-value pairs with O(1) average lookup time
Bộ sưu tập bảng băm lưu trữ cặp khóa-giá trị với thời gian tra cứu trung bình O(1)
I
impl
See: StructsKeyword used to define method implementations for a type or to implement a trait for a type
Từ khóa dùng để định nghĩa triển khai phương thức cho kiểu hoặc triển khai trait cho kiểu
Iterator
See: Closures & IteratorsA trait for types that produce a sequence of values one at a time via the next() method
Trait cho các kiểu tạo ra chuỗi giá trị từng cái một qua phương thức next()
L
Lifetime
See: LifetimesA compile-time annotation (e.g. 'a) that tells the borrow checker how long references are valid
Chú thích tại thời điểm biên dịch (ví dụ 'a) cho bộ kiểm tra mượn biết tham chiếu hợp lệ bao lâu
M
macro
See: MacrosMetaprogramming construct that generates code at compile time, invoked with ! (e.g. println!)
Cấu trúc siêu lập trình tạo mã tại thời điểm biên dịch, gọi bằng ! (ví dụ println!)
A control flow expression that compares a value against patterns and executes the matching arm
Biểu thức luồng điều khiển so sánh giá trị với các mẫu và thực thi nhánh khớp
Module
See: Cargo & EcosystemA namespace that organizes code within a crate using the mod keyword
Không gian tên tổ chức mã trong crate bằng từ khóa mod
Keyword that marks a binding or reference as mutable, allowing its value to be changed
Từ khóa đánh dấu ràng buộc hoặc tham chiếu là có thể thay đổi
O
Option<T>
See: Enums & Pattern MatchingAn enum representing an optional value: either Some(T) containing a value or None
Enum biểu thị giá trị tùy chọn: hoặc Some(T) chứa giá trị hoặc None
Ownership
See: OwnershipRust's core memory management concept where each value has exactly one owner at a time
Khái niệm quản lý bộ nhớ cốt lõi của Rust, mỗi giá trị có đúng một chủ sở hữu tại một thời điểm
P
panic!
See: Error HandlingA macro that causes the program to terminate immediately with an error message, for unrecoverable errors
Macro khiến chương trình kết thúc ngay lập tức với thông báo lỗi, dùng cho lỗi không thể phục hồi
Pattern Matching
See: Enums & Pattern MatchingA mechanism for checking a value against patterns, used in match, if let, and while let
Cơ chế kiểm tra giá trị với các mẫu, dùng trong match, if let và while let
A wrapper that prevents a value from being moved in memory, required for self-referential futures
Trình bọc ngăn giá trị bị di chuyển trong bộ nhớ, cần thiết cho future tự tham chiếu
R
Raw Pointer
See: Unsafe RustAn unsafe pointer (*const T or *mut T) that bypasses the borrow checker's safety guarantees
Con trỏ không an toàn (*const T hoặc *mut T) bỏ qua các đảm bảo an toàn của bộ kiểm tra mượn
Rc<T>
See: Smart PointersReference Counted smart pointer for shared ownership within a single thread
Con trỏ thông minh đếm tham chiếu để chia sẻ quyền sở hữu trong một luồng duy nhất
RefCell<T>
See: Smart PointersA type that enforces borrowing rules at runtime instead of compile time, enabling interior mutability
Kiểu kiểm tra quy tắc mượn tại thời điểm chạy thay vì biên dịch, cho phép khả biến nội tại
Result<T, E>
See: Error HandlingAn enum for recoverable errors: either Ok(T) for success or Err(E) for failure
Enum cho lỗi có thể phục hồi: hoặc Ok(T) thành công hoặc Err(E) thất bại
S
self
See: StructsKeyword referring to the current instance in method definitions (&self, &mut self, self)
Từ khóa tham chiếu đến thực thể hiện tại trong định nghĩa phương thức (&self, &mut self, self)
Send
See: ConcurrencyA marker trait indicating a type can be safely transferred between threads
Trait đánh dấu cho biết kiểu có thể chuyển giao an toàn giữa các luồng
A dynamically-sized view into a contiguous sequence of elements, like &[T] or &str
Một dạng xem kích thước động vào chuỗi phần tử liền kề, như &[T] hoặc &str
Smart Pointer
See: Smart PointersA data structure that acts like a pointer but also has metadata and capabilities like Drop and Deref
Cấu trúc dữ liệu hoạt động như con trỏ nhưng có thêm siêu dữ liệu và khả năng như Drop và Deref
static
See: LifetimesA lifetime or storage duration that lasts for the entire program execution ('static)
Thời gian sống hoặc thời gian lưu trữ kéo dài suốt quá trình thực thi chương trình ('static)
String
See: CollectionsA growable, heap-allocated, UTF-8 encoded string type, as opposed to the string slice &str
Kiểu chuỗi có thể mở rộng, cấp phát trên heap, mã hóa UTF-8, khác với slice chuỗi &str
struct
See: StructsA custom data type that groups related fields together into a named structure
Kiểu dữ liệu tùy chỉnh nhóm các trường liên quan lại thành cấu trúc có tên
Sync
See: ConcurrencyA marker trait indicating a type can be safely referenced from multiple threads simultaneously
Trait đánh dấu cho biết kiểu có thể được tham chiếu an toàn từ nhiều luồng đồng thời
T
Tokio
See: Async/AwaitThe most popular async runtime for Rust, providing task scheduling, I/O, and timer utilities
Runtime bất đồng bộ phổ biến nhất cho Rust, cung cấp lập lịch tác vụ, I/O và tiện ích hẹn giờ
A collection of methods that define shared behavior, similar to interfaces in other languages
Tập hợp phương thức định nghĩa hành vi chung, tương tự interface trong các ngôn ngữ khác
Trait Object
See: Generics & TraitsA dynamically dispatched reference (dyn Trait) that enables runtime polymorphism
Tham chiếu phân phối động (dyn Trait) cho phép đa hình tại thời điểm chạy
Tuple
See: Basic ConceptsA fixed-size collection of values with potentially different types, like (i32, &str, bool)
Tập hợp giá trị kích thước cố định với các kiểu có thể khác nhau, như (i32, &str, bool)
Type Inference
See: Basic ConceptsThe compiler's ability to deduce the type of a variable or expression without explicit annotation
Khả năng của trình biên dịch suy luận kiểu của biến hoặc biểu thức mà không cần chú thích tường minh
U
unsafe
See: Unsafe RustA keyword that disables certain compiler safety checks, allowing raw pointer dereference and FFI calls
Từ khóa vô hiệu hóa một số kiểm tra an toàn của trình biên dịch, cho phép giải tham chiếu con trỏ thô và gọi FFI
unwrap
See: Error HandlingA method on Option/Result that returns the inner value or panics if None/Err
Phương thức trên Option/Result trả về giá trị bên trong hoặc panic nếu là None/Err
V
Vec<T>
See: CollectionsA growable, heap-allocated array type that stores elements of type T contiguously
Kiểu mảng có thể mở rộng, cấp phát trên heap, lưu trữ phần tử kiểu T liền kề nhau