ядро языкаcore language
Ownership, borrowing, lifetimes, трейты, обобщённое программирование, обработка ошибок, конкурентность и unsafe — то, что делает Rust языком, а не просто ещё одной обёрткой над LLVM. 20 фич, каждая — отдельная страница; фичи с меткой "собеседование" — самые частые темы на технических интервью.Ownership, borrowing, lifetimes, traits, generic programming, error handling, concurrency, and unsafe — what makes Rust a language rather than just another LLVM wrapper. 20 features, each its own page; features tagged "interview" are the most common technical-interview topics.
Один владелец, move по умолчанию — безопасность памяти без сборщика мусора, проверяемая на этапе компиляции.One owner, move by default — memory safety with no garbage collector, checked at compile time.
&T и &mut T — временный доступ без передачи владения, с проверкой правил алиасинга компилятором.&T and &mut T — temporary access with no ownership transfer, with aliasing rules checked by the compiler.
Явные аннотации времени жизни ссылок — как компилятор доказывает отсутствие dangling-ссылок статически.Explicit reference lifetime annotations — how the compiler statically proves the absence of dangling references.
&[T] и &str — невладеющее представление непрерывного участка данных, аналог std::span/std::string_view.&[T] and &str — a non-owning view over a contiguous chunk of data, the analogue of std::span/std::string_view.
Алгебраические типы данных — enum как настоящий sum-тип, а не просто именованные константы.Algebraic data types — enum as a genuine sum type, not just named constants.
Интерфейсы Rust — общее поведение для разных типов, с default-методами и trait bounds вместо наследования.Rust's interfaces — shared behavior across types, with default methods and trait bounds instead of inheritance.
Динамическая диспетчеризация через vtable — рантайм-полиморфизм, аналог виртуальных функций C++.Dynamic dispatch via a vtable — runtime polymorphism, the analogue of C++ virtual functions.
Мономорфизация на этапе компиляции — нулевая цена абстракции, аналог шаблонов C++.Compile-time monomorphization — zero-cost abstraction, the analogue of C++ templates.
Type-level выход трейта — когда у типа-реализации ровно один "естественный" связанный тип, а не параметр.A trait's type-level output — when an implementing type has exactly one "natural" associated type rather than a parameter.
Значения (не только типы) как параметры дженериков — например, массив фиксированного размера [T; N].Values (not just types) as generic parameters — for example, a fixed-size array [T; N].
match — исчерпывающая проверка вариантов компилятором, деструктуризация и guard-условия.match — exhaustiveness checked by the compiler, destructuring, and guard conditions.
Ошибки и отсутствие значения как часть типа — предшественник идей std::expected/std::optional в C++23/17.Errors and absence-of-value as part of the type — the predecessor of the ideas behind C++23/17's std::expected/std::optional.
Fn/FnMut/FnOnce — три трейта замыканий, кодирующие способ захвата окружения прямо в системе типов.Fn/FnMut/FnOnce — three closure traits encoding the capture mode directly in the type system.
Ленивый Iterator trait и адаптеры (map/filter/fold) — обобщённые алгоритмы без промежуточных аллокаций.The lazy Iterator trait and adaptors (map/filter/fold) — generic algorithms with no intermediate allocations.
Box, Rc, Arc, RefCell, Cell — владение на куче, разделяемое владение, внутренняя изменяемость.Box, Rc, Arc, RefCell, Cell — heap ownership, shared ownership, interior mutability.
Future как ленивое состояние вычисления — язык не диктует executor, в отличие от большинства других языков.Future as a lazy computation state — the language doesn't dictate an executor, unlike most other languages.
Потокобезопасность как маркерные трейты — компилятор статически запрещает передачу не-Send типа между потоками.Thread-safety as marker traits — the compiler statically forbids passing a non-Send type between threads.
Выход из-под проверок borrow checker под личную ответственность программиста — инварианты, а не запрет.Opting out of borrow-checker guarantees under the programmer's own responsibility — invariants, not a ban.
macro_rules! и derive-макросы — метапрограммирование на уровне AST, работающее до типовой проверки.macro_rules! and derive macros — AST-level metaprogramming that runs before type checking.
mod, pub, структура крейта — инкапсуляция на уровне модулей, а не только классов.mod, pub, crate structure — encapsulation at the module level, not just the class level.
порядок чтенияreading order
Ownership → Borrowing → Lifetimes — читать строго по порядку, это единая связка идей, каждая следующая опирается на предыдущую. Traits стоит читать до dyn Trait и до Generics — оба следующих раздела предполагают понимание трейтов как основы. Result/Option логично читать после Pattern matching — обработка ошибок в Rust целиком построена на деструктуризации через match.Ownership → Borrowing → Lifetimes — read strictly in order, this is one connected chain of ideas, each building on the previous one. Traits should be read before dyn Trait and before Generics — both following sections assume an understanding of traits as the foundation. Result/Option is naturally read after Pattern matching — Rust's error handling is built entirely on destructuring via match.
unsafe лучше читать в конце — он подразумевает уверенное понимание ownership/borrowing, чтобы осознанно решать, какие инварианты компилятор больше не проверяет за вас.unsafe is best read last — it assumes a confident understanding of ownership/borrowing, so you can consciously decide which invariants the compiler is no longer checking for you.