検索
Results of 1 - 10 of about 24 for Reference (0.004 sec.)
- ポインタとref - Rust By Example 日本語版 14745
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
..., ref , ref mut を用いる。 fn main() { // Assign a reference of type `i32`. The `&` signifies there // is a ref...`によってリファレンスであることを明示している。 let reference = &4; match reference { // If `reference` is patte...t results // in a comparison like: // 上で定義した`reference`という変数が`&val`とのパターンマッチ // に用いられ...cturing: {:?}", val), } // To avoid the `&`, you dereference before matching. // `&`を使用したくない場合は、マッ... - https://man.plustar.jp/rust/example/flow_control/match/destructuring/destructure... - [similar]
- Rc - Rust By Example 日本語版 10341
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...日本語版 Rc When multiple ownership is needed, Rc (Reference Counting) can be used. Rc keeps track of the numbe...r of the references which means the number of owners of the value wra...pped inside an Rc . Reference count of an Rc increases by 1 whenever an Rc is cl...oned Rc is dropped out of the scope. When an Rc 's reference count becomes zero, which means there are no owner... - https://man.plustar.jp/rust/example/std/rc.html - [similar]
- Rust By Example 日本語版 10074
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...ct the value using tuple indexing, // and create a reference to `vec`. let vec = &self.0; write!(f, "[")?; // I.../ concrete type `T` is preferred over a match on a reference `&T` // after Rust 2018 you can use self here and...ail, because `self` is borrowed; // instead take a reference to the tail // `self`をすでに借用しているので、tai..., ref , ref mut を用いる。 fn main() { // Assign a reference of type `i32`. The `&` signifies there // is a ref... - https://man.plustar.jp/rust/example/print.html - [similar]
- スタティックライフタイム - Rust By Example 日本語版 10074
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...tatic で、2つの状況で使用することがあります。 // A reference with 'static lifetime: let s: &'static str = "hell...g Rust. Here are some examples for each situation: Reference lifetime As a reference lifetime 'static indicates...that the data pointed to by the reference lives for the entire lifetime of the running progr...を持つ定数を作成 static NUM: i32 = 18; // Returns a reference to `NUM` where its `'static` // lifetime is coerce... - https://man.plustar.jp/rust/example/scope/lifetime/static_lifetime.html - [similar]
- 構造体 - Rust By Example 日本語版 9541
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...それと似ている。 // A type `Borrowed` which houses a reference to an // `i32`. The reference to `i32` must outliv...] struct Borrowed<'a>(&'a i32); // Similarly, both references here must outlive this structure. // 同様に、ここ...'a i32, } // An enum which is either an `i32` or a reference to one. // `i32`、あるいは`i32`への参照のいずれかと...; let double = NamedBorrowed { x: &x, y: &y }; let reference = Either::Ref(&x); let number = Either::Num(y); pr... - https://man.plustar.jp/rust/example/scope/lifetime/struct.html - [similar]
- Arc - Rust By Example 日本語版 9174
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...d ownership between threads is needed, Arc (Atomic Reference Counted) can be used. This struct, via the Clone i...mplementation can create a reference pointer for the location of a value in the memory...heap while increasing the reference counter. As it shares ownership between threads, w...hen the last reference pointer to a value is out of scope, the variable i... - https://man.plustar.jp/rust/example/std/arc.html - [similar]
- エイリアス - Rust By Example 日本語版 8456
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...r_borrow = &point; // Data can be accessed via the references and the original owner // データは元々の持ち主と参...nt.x, another_borrow.y, point.z); // The immutable references are no longer used for the rest of the code so //...it is possible to reborrow with a mutable reference. let mutable_borrow = &mut point; // Change data v...ia mutable reference // ミュータブルなリファレンスを介してデータを変更す... - https://man.plustar.jp/rust/example/scope/borrow/alias.html - [similar]
- Iterator::find - Rust By Example 日本語版 8006
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...em` states it takes // arguments to the closure by reference. // `FnMut`はクロージャによって補足される変数が変更...// `iter()` for vecs yields `&i32`, and we want to reference one of its // items, so we have to destructure `&&...into_iter()` for vecs yields `i32`, and we want to reference one of // its items, so we have to destructure `&i... - https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_find.html - [similar]
- ミュータビリティ - Rust By Example 日本語版 8006
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...Clone, Copy)] struct Book { // `&'static str` is a reference to a string allocated in read only memory // `&'st...'static str, year: u32, } // This function takes a reference to a book // この関数はBook型へのリファレンスを取る...book.title, book.year); } // This function takes a reference to a mutable book and changes `year` to 2014 // こ... - https://man.plustar.jp/rust/example/scope/borrow/mut.html - [similar]
- 関数 - Rust By Example 日本語版 8006
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...タへの参照になるならば、禁止されている // One input reference with lifetime `'a` which must live // at least as...println!("`print_one`: x is {}", x); } // Mutable references are possible with lifetimes as well. // ミュータブ...t_multi`: x is {}, y is {}", x, y); } // Returning references that have been passed in is acceptable. // Howeve...("foo")` would create a `String`, followed by a // reference. Then the data is dropped upon exiting the scope,... - https://man.plustar.jp/rust/example/scope/lifetime/fn.html - [similar]