该文章将 Rust 的并发库与 C++ 的并发库进行了比较,指出 Rust 标准库中的特性——线程、原子操作、互斥锁和条件变量——与 C++11 中引入的特性非常相似。此后,C++ 通过 C++17 和 C++20 获得了更多的并发特性,并且还有更多针对未来版本的提案。该文章回顾了这些 C++ 特性,讨论了 Rust 中的对应实现可能是什么样子,以及实现它们需要做些什么。
The concurrency features that are included in the Rust standard library
are quite similar to what was available in C++11: threads, atomics, mutexes, condition variables, and so on.
In the past few years, however, C++ has gained quite a few new concurrency related
features as part C++17 and C++20, with more proposals still coming in for future versions.
Let’s take some time to review C++ concurrency features,
discuss what their Rust equivalent could look like,
and what it’d take to get there.
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要This blog post explores Rust's fmt::Arguments type and the format_args!() macro, which power common text formatting macros such as print!(), format!(), and log::info!(). The author describes fmt::Arguments as a great building block that is indirectly used in nearly every Rust program. The post covers how it works, how it is implemented today, and how it might change in the future.
AI 摘要This article explores the complicated and often overlooked topic of temporary lifetimes in Rust, noting that while simple cases work automatically, there are many situations where temporaries don't last exactly as long as desired. The authors rediscover the rules governing temporary lifetimes, examine several use cases for temporary lifetime extension, and introduce a proposed new language feature called 'super let' that would give developers more control over temporary lifetimes.
AI 摘要This blog post examines whether Rust should receive a formal standards document like those that exist for C and C++. The author argues that while Rust needs an accurate specification, full 'standardization' may not be necessary depending on how it is defined. The post also provides an overview of the current state of Rust's stability guarantees and specification efforts.
AI 摘要The author recounts how, through an unexpected chain of events, they implemented a conversion from 128-bit integers to 64-bit floats that turned out to be faster than the built-in conversion of every compiler they tested. The blog post explains what happened, how floats work, how the conversion functions, and how the project got a bit out of hand.
AI 摘要The author, a contributor to the Rust project, initially perceived the project's hierarchy of teams and leaders as just another typical organizational structure. After becoming more involved—joining the library team and eventually becoming its team lead—they started reflecting more deeply on why this structure exists and what purpose these teams actually serve.