サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Google I/O
doc.rust-lang.org
Rust by Example Rust は安全性、速度、並列性にフォーカスした現代的なシステムプログラミング用のプログラミング言語です。ガベージコレクション無しでメモリ安全であることが、これを可能にしています。 Rust by Example(RBE)はRustの実行可能なサンプルスクリプト集で、ここではRustの様々なコンセプトと標準ライブラリを紹介していきます。この例をより活用するためにはRustをローカルにインストールし、公式ドキュメントをチェックすることをおすすめします。興味がある方はこのサイト自体のソースのチェックもどうぞ。 それでははじめましょう! Hello World - お決まりのHello Worldプログラムから始めましょう。 基本データ型 - 符号付き整数や符号無し整数、その他の基本データ型について学びましょう。 カスタム型 - structとenumについて。
Introduction This book is the primary reference for the Rust programming language. It provides three kinds of material: Chapters that informally describe each language construct and their use. Chapters that informally describe the memory model, concurrency model, runtime services, linkage model, and debugging facilities. Appendix chapters providing rationale and references to languages that influe
The Rust Programming Language by Steve Klabnik, Carol Nichols, and Chris Krycho, with contributions from the Rust Community This version of the text assumes you’re using Rust 1.82.0 (released 2024-10-17) or later. See the “Installation” section of Chapter 1 to install or update Rust. The HTML format is available online at https://doc.rust-lang.org/stable/book/ and offline with installations of Rus
dyn is a prefix of a trait object’s type. The dyn keyword is used to highlight that calls to methods on the associated Trait are dynamically dispatched. To use the trait this way, it must be dyn compatible1. Unlike generic parameters or impl Trait, the compiler does not know the concrete type that is being passed. That is, the type has been erased. As such, a dyn Trait reference contains two point
Collection types. Rust’s standard collection library provides efficient implementations of the most common general purpose programming data structures. By using the standard implementations, it should be possible for two libraries to communicate without significant data conversion. To get this out of the way: you should probably just use Vec or HashMap. These two collections cover most use cases f
§The Rust Standard Library The Rust Standard Library is the foundation of portable Rust software, a set of minimal and battle-tested shared abstractions for the broader Rust ecosystem. It offers core types, like Vec<T> and Option<T>, library-defined operations on language primitives, standard macros, I/O and multithreading, among many other things. std is available to all Rust crates by default. T
Rust by Example Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection. Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don't forget to install Rust locally and check out
The Cargo Book Cargo is the Rust package manager. Cargo downloads your Rust package’s dependencies, compiles your packages, makes distributable packages, and uploads them to crates.io, the Rust community’s package registry. You can contribute to this book on GitHub. Sections Getting Started To get started with Cargo, install Cargo (and Rust) and set up your first crate. Cargo Guide The guide will
pub struct RwLock<T: ?Sized> { /* private fields */ }Expand description A reader-writer lock This type of lock allows a number of readers or at most one writer at any point in time. The write portion of this lock typically allows modification of the underlying data (exclusive access) and the read portion of this lock typically allows for read-only access (shared access). In comparison, a Mutex doe
pub enum Option<T> { None, Some(T), }Expand description
The Manifest Format The Cargo.toml file for each package is called its manifest. It is written in the TOML format. It contains metadata that is needed to compile the package. Checkout the cargo locate-project section for more detail on how cargo finds the manifest file. Every manifest file consists of the following sections: cargo-features — Unstable, nightly-only features. [package] — Defines a p
Warning: This book is incomplete. Documenting everything and rewriting outdated parts take a while. See the issue tracker to check what's missing/outdated, and if there are any mistakes or ideas that haven't been reported, feel free to open a new issue there. The Dark Arts of Unsafe Rust THE KNOWLEDGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
Procedural Macros (and custom Derive) The first edition of the book is no longer distributed with Rust's documentation. If you came here via a link or web search, you may want to check out the current version of the book instead. If you have an internet connection, you can find a copy distributed with Rust 1.30.
Ownership This guide is one of three presenting Rust’s ownership system. This is one of Rust’s most unique and compelling features, with which Rust developers should become quite acquainted. Ownership is how Rust achieves its largest goal, memory safety. There are a few distinct concepts, each with its own chapter: ownership, which you’re reading now borrowing, and their associated feature ‘refere
Rust Inside Other Languages For our third project, we’re going to choose something that shows off one of Rust’s greatest strengths: a lack of a substantial runtime. As organizations grow, they increasingly rely on a multitude of programming languages. Different programming languages have different strengths and weaknesses, and a polyglot stack lets you use a particular language where its strengths
Foreword The second edition of the book is no longer distributed with Rust's documentation. If you came here via a link or web search, you may want to check out the current version of the book instead. If you have an internet connection, you can find a copy distributed with Rust 1.30.
Platform Support Support for different platforms ("targets") are organized into three tiers, each with a different set of guarantees. For more information on the policies for targets at each tier, see the Target Tier Policy. Targets are identified by their "target triple" which is the string to inform the compiler what kind of output should be produced. Component availability is tracked here. Tier
pub struct Cursor<T> { /* private fields */ }Expand description A Cursor wraps an in-memory buffer and provides it with a Seek implementation. Cursors are used with in-memory buffers, anything implementing AsRef<[u8]>, to allow them to implement Read and/or Write, allowing these buffers to be used anywhere you might use a reader or writer that does actual I/O. The standard library implements some
pub trait Iterator { type Item; Show 76 methods // Required method fn next(&mut self) -> Option<Self::Item>; // Provided methods fn next_chunk<const N: usize>( &mut self, ) -> Result<[Self::Item; N], IntoIter<Self::Item, N>> where Self: Sized { ... } fn size_hint(&self) -> (usize, Option<usize>) { ... } fn count(self) -> usize where Self: Sized { ... } fn last(self) -> Option<Self::Item> where Sel
pub trait Debug { // Required method fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>; }Expand description ? formatting. Debug should format the output in a programmer-facing, debugging context. Generally speaking, you should just derive a Debug implementation. When used with the alternate format specifier #?, the output is pretty-printed. For more information on formatters, see the modul
Procedural Macros (and custom Derive) There is a new edition of the book and this is an old link. Procedural macros allow for all sorts of advanced metaprogramming in Rust. This chapter does not exist yet in the second edition. You can check out other resources that describe macros. In the current edition: Ch 19.06 Macros In the Rust Reference: Ch 3.2 — Procedural Macros The proc_macro crate docum
pub struct PhantomData<T> where T: ?Sized;Expand description Zero-sized type used to mark things that “act like” they own a T. Adding a PhantomData<T> field to your type tells the compiler that your type acts as though it stores a value of type T, even though it doesn’t really. This information is used when computing certain safety properties. For a more in-depth explanation of how to use PhantomD
The Rust Reference has moved We’ve split up the reference into chapters. Please find it at its new home here.
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’. The type Arc<T> provides shared ownership of a value of type T, allocated in the heap. Invoking clone on Arc produces a new Arc instance, which points to the same allocation on the heap as the source Arc, while increasing a reference count. When the last Arc pointer to a given allocation is destroyed, the va
The Rustonomicon The Dark Arts of Advanced and Unsafe Rust Programming Instead of the programs I had hoped for, there came only a shuddering blackness and ineffable loneliness; and I saw at last a fearful truth which no one had ever dared to breathe before — the unwhisperable secret of secrets — The fact that this language of stone and stridor is not a sentient perpetuation of Rust as London is of
次のページ
このページを最初にブックマークしてみませんか?
『Rust Documentation』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く