この記事は Rust Advent Calendar 2023 22日目の記事です. TL;DR std::thread::JoinHanlde<T> は join() しないとメモリリークすると思い込んでいたがそんなことはなかったな! 問題 Rust はメモリ安全・スレッド安全な言語であることを標榜しており, 多くの場合は安全でないことをしようとするとコンパイルが通りません. 例えば複数のスレッドからあるオブジェクトに対して可変参照 &mut T を通じて変更をすることはできず, 例えば Arc<Mutex<T>> などを利用する必要があります. 一方で安全な (unsafe でない) 操作のみを使っていても防げないものもあります. 典型的なものはメモリリークです. 例えば Rc を使って循環参照を作ってその部分を切り離すと, 切り離された側は永遠に drop されません. (参照カウン
Recently, I found myself returning to a compelling series of blog posts titled Zero-cost futures in Rust by Aaron Turon about what would become the foundation of Rust's async ecosystem and the Tokio runtime. This series stands as a cornerstone in writings about Rust. People like Aaron are the reason why I wanted to be part of the Rust community in the first place. While 2016 evokes nostalgic memor
Introduction About 9 months ago we announced the creation of the Keyword Generics Initiative; a group working under the lang team with the intent to solve the function coloring problem 1 through the type system not just for async, but for const and all current and future function modifier keywords as well. We're happy to share that we've made a lot of progress over these last several months, and w
Builder Lite May 29, 2022 In this short post, I describe and name a cousin of the builder pattern — builder lite. Unlike a traditional builder, which uses a separate builder object, builder lite re-uses the object itself to provide builder functionality. Here’s an illustrative example Builder Lite pub struct Shape { position: Vec3, geometry: Geometry, material: Option<Material>, } impl Shape { pub
lalrpop A convenient LR(1) parser generator nom A byte-oriented, zero-copy, parser combinators library combine Fast parser combinators on arbitrary streams with zero-copy support. pom PEG parser combinators using operator overloading without macros. peg A simple Parsing Expression Grammar (PEG) parser generator. glue Glue is a parser combinator framework for parsing text based formats, it is easy
Rust is not a particularly original language, with design elements coming from a wide range of sources. Some of these are listed below (including elements that have since been removed): SML, OCaml: algebraic data types, pattern matching, type inference, semicolon statement separation C++: references, RAII, smart pointers, move semantics, monomorphization, memory model ML Kit, Cyclone: region based
Between 2016 and 2020 I wrote a series of blog posts called “How to speed up the Rust compiler”. These were mostly about my work on the Rust compiler, plus some updates on the progress on the Rust compiler’s speed in general. I am now back on the Rust bandwagon as a member of Futurewei’s Rust team, and it’s time to start up the blog series again. Successes In the past few months I have landed some
Today, we, the Tokio team, are announcing the initial release of Tokio Console (Github), enabling Rust developers to gain deeper insight into the runtime behavior of their applications. And just like that, we get to peek under the hood. —niedzejkob Tokio Console is a diagnostics and debugging tool for asynchronous Rust programs. It gives you a live, easy-to-navigate view into the program's tasks a
A goal of the async foundations working group is for async Rust to be portable and interoperable. I want to dig in to what that means in this blog post. For a little background, see my earlier post on async runtimes. To run async Rust code, you need an async runtime. Currently however, choosing a runtime locks you into a subset of the ecosystem. Library crates and tools are often restricted to a s
To implement its safety guarantees, the Rust compiler keeps careful track of ownership and references throughout a program. This makes writing certain kinds of data structures challenging; in particular, data structures that have circular references. Let's start with a simple binary tree: struct Tree { root: Option<Node>, } struct Node { data: i32, left: Option<Box<Node>>, right: Option<Box<Node>>
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く