検索
Results of 11 - 20 of about 57 for mut (0.038 sec.)
- 捕捉時の型推論 - Rust By Example 日本語版 7812
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
りです。 Fn : 参照( &T )によって捕捉するクロージャ FnMut : ミュータブルな参照( &mut T )によって捕捉するクロ...
タを考えてみましょう。 これはそのクロージャが &T 、 &mut T もしくは T の どれか で捕捉することを指定するもの...
タが Fn としてアノテーションされている場合、変数を &mut T や T で捕捉することは許可されません。 以下の例で...
は、 Fn 、 FnMut 、および FnOnce を入れ替えて、何が起こるのかを見て...
- https://man.plustar.jp/rust/example/fn/closures/input_parameters.html - [similar]
- クロージャを返す関数 - Rust By Example 日本語版 7518
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
ャを返すために有効なトレイトは下記の通りです。 Fn FnMut FnOnce 更に、 move というキーワードを使用し、全ての...
e || println!("This is a: {}", text) } fn create_fnmut() -> impl FnMut() { let text = "FnMut".to_owned();...
ext) } fn main() { let fn_plain = create_fn(); let mut fn_mut = create_fnmut(); let fn_once = create_fnon...
ce(); fn_plain(); fn_mut(); fn_once(); } 参照 Fn , FnMut , ジェネリクス , i...
- https://man.plustar.jp/rust/example/fn/closures/output_parameters.html - [similar]
- open - Rust By Example 日本語版 7518
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
用モードで開く。これは`io::Result<File>`を返す。 let mut file = match File::open(&path) { // The `descripti...
を文字列に読み込む。`io::Result<useize>`を返す。 let mut s = String::new(); match file.read_to_string(&mut...
- https://man.plustar.jp/rust/example/std_misc/file/open.html - [similar]
- Iterator::any - Rust By Example 日本語版 7430
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
イテレートされる値の型 type Item; // `any` takes `&mut self` meaning the caller may be borrowed // and mo...
dified, but not consumed. // `any`は`&mut self`を取るため、イテレータを呼び出した値を借用し...
しますが、消費し尽くすことはありません。 fn any<F>(&mut self, f: F) -> bool where // `FnMut` meaning any c...
takes // arguments to the closure by value. // `FnMut`はクロージャによって補足される変数が変更される //...
- https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_any.html - [similar]
- 基本データ型 - Rust By Example 日本語版 7430
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
from context // 型を文脈から推定することも可能 let mut inferred_type = 12; // Type i64 is inferred from a...
容に基づいて推定 inferred_type = 4294967296i64; // A mutable variable's value can be changed. // ミュータブ...
ルな変数は値を変更できる let mut mutable = 12; // Mutable `i32` // ミュータブルな `...
i32`. mutable = 21; // Error! The type of a variable can't b...
- https://man.plustar.jp/rust/example/primitives.html - [similar]
- エイリアス - Rust By Example 日本語版 7430
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
t Point { x: i32, y: i32, z: i32 } fn main() { let mut point = Point { x: 0, y: 0, z: 0 }; let borrowed_p...
row.y, point.z); // Error! Can't borrow `point` as mutable because it's currently // borrowed as immutabl...
、 // ミュータブルに借用することができない。 // let mutable_borrow = &mut point; // TODO ^ Try uncommentin...
owed_point.x, another_borrow.y, point.z); // The immutable references are no longer used for the rest of...
- https://man.plustar.jp/rust/example/scope/borrow/alias.html - [similar]
- 関数 - Rust By Example 日本語版 7430
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
a i32) { println!("`print_one`: x is {}", x); } // Mutable references are possible with lifetimes as well...
/ ミュータブルな参照でも同様 fn add_one<'a>(x: &'a mut i32) { *x += 1; } // Multiple elements with differ...
&x, &y); let z = pass_x(&x, &y); print_one(z); let mut t = 3; add_one(&mut t); print_one(&t); } 参照 func...
- https://man.plustar.jp/rust/example/scope/lifetime/fn.html - [similar]
- ベクタ型 - Rust By Example 日本語版 7430
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
/ ベクタの初期化には`vec!`マクロが使用できる。 let mut xs = vec![1i32, 2, 3]; println!("Initial vector: {...
push(4); println!("Vector: {:?}", xs); // Error! Immutable vectors can't grow // エラー!イミュータブルなベ...
{} we have value {}", i, x); } // Thanks to `iter_mut`, mutable `Vector`s can also be iterated // over i...
that allows modifying each value for x in xs.iter_mut() { *x *= 3; } println!("Updated vector: {:?}", xs...
- https://man.plustar.jp/rust/example/std/vec.html - [similar]
- ディスプレイ - Rust By Example 日本語版 7239
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
シグネチャであることを要求します。 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // Write strictly...
。 impl fmt::Display for MinMax { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // Use `self.numb...
impl fmt::Display for Point2D { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // Customize so o...
- https://man.plustar.jp/rust/example/hello/print/print_display.html - [similar]
- メソッド - Rust By Example 日本語版 7048
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...
の関数と同様にライフタイムを明示 fn add_one<'a>(&'a mut self) { self.0 += 1; } fn print<'a>(&'a self) { pr...
intln!("`print`: {}", self.0); } } fn main() { let mut owner = Owner(18); owner.add_one(); owner.print();...
- https://man.plustar.jp/rust/example/scope/lifetime/methods.html - [similar]