Skip to main content

11 docs tagged with "rust"

View all tags

AOP

Rust 没有运行期织入与注解代理,横切逻辑只能用泛型包装器、dyn 包装、宏和 tower 中间件显式组合,代价是单态化膨胀与必须自己维护调用顺序。

Async

async fn 被编译成惰性的 Future 状态机,执行器轮询、反应器唤醒、Pin 固定地址,取消由 drop 完成;理解这套分工才不会把阻塞调用塞进运行时。

Concept

Rust 用所有权、借用检查与 trait 抽象取代垃圾回收,在编译期证明内存与线程安全,以更陡的学习曲线和更长的编译时间换取确定性的释放时机与接近 C 的运行性能。

Concurrency

Futures as compiler-built state machines, the executor that polls them, and the Send and Sync markers that keep shared state honest.

Error

Rust 把失败编码进类型:Result 承载可恢复错误、Option 表示缺失、panic 留给不变量破坏,? 与 From 让错误沿调用链携带上下文向上传播。

Feature: Interop

The five unsafe abilities, the invariants they transfer to the developer, and the ABI contract at a foreign function boundary.

Functions

Rust 把函数与闭包当作可传递的值:fn 项、泛型约束、捕获方式与 Fn 系列 trait 共同决定调用点是内联、单态化还是间接调用。

OOP

Traits as contracts, generics that monomorphize, and Result-based errors that make every failure part of the signature.

Syntax

Rust 的语法把声明、模式解构与类型约束写在同一套表达式规则里,用 match 的穷尽性、? 的短路传播和生命周期标注把控制流与借用范围显式化。

Type

One owner per value, borrows checked at compile time, and lifetimes that bound how long a reference stays valid.