検索

phrase: max: clip:
target: order:
Results of 11 - 18 of about 18 for use (0.029 sec.)
チェックされるメモリ 7652
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... println!("{}", x); } src/main.rs:3:20: 3:21 error: use of possibly uninitialized variable: `x` (エラー: 初 ... println!("{}", x); } src/main.rs:6:17: 6:18 error: use of possibly uninitialized variable: `x` (エラー: 初 ... れます。例えば、このコードは動作します。 #![allow(unused)] fn main() { let x: i32; loop { // Rust は、この ...
https://man.plustar.jp/rust/nomicon/checked-uninit.html - [similar]
Drain 7652
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... "基本的な" 全範囲のバージョンだけを実装しましょう。 use std::marker::PhantomData; struct Drain<'a, T: 'a> ... 同じ構造を持っています。抽出しましょう。 #![allow(unused)] fn main() { struct RawValIter<T> { start: *cons ... ます。 よし、これで Drain を本当に楽に実装できます。 use std::marker::PhantomData; pub struct Drain<'a, T: ...
https://man.plustar.jp/rust/nomicon/vec-drain.html - [similar]
Subtyping and Variance 7498
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... e of 'b . This is a large source of confusion, because it seems intuitively backwards to many: the bigger ... o subtypes of every concrete lifetime. This is because taking an arbitrary lifetime is strictly more gene ... d. For now, fn(T) is contravariant in T , which is used in matching methods in trait implementations to t ... y borrows T. Box and Vec are interesting cases because they're variant, but you can definitely store valu ...
https://man.plustar.jp/rust/nomicon/subtyping.html - [similar]
チェックされないメモリ 7498
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... にすると、以下のようなコードとなります。 #![allow(unused)] fn main() { use std::mem; use std::ptr; // 配列 ...
https://man.plustar.jp/rust/nomicon/unchecked-uninit.html - [similar]
借用の分割 7206
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ですから、このコードは今日動作します。 #![allow(unused)] fn main() { struct Foo { a: i32, b: i32, c: i32 ... a, b); <anon>:6 } ^ error: aborting due to 2 previous errors (エラー: 上記の 2 つのエラーのため中止) 仮に ... タのトレイトは以下のように定義されます。 #![allow(unused)] fn main() { trait Iterator { type Item; fn next ... .elem }) } } これは可変スライスです。 fn main() {} use std::mem; pub struct IterMut<'a, T: 'a>(&'a mut[T] ...
https://man.plustar.jp/rust/nomicon/borrow-splitting.html - [similar]
アロケーティング 6897
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... しょう。 こうなります: #![feature(alloc, heap_api)] use std::mem; use alloc::heap::EMPTY; impl<T> Vec<T> { ... s::exit を 適当な値と共に呼び出します。 #![allow(unused)] fn main() { fn oom() { ::std::process::exit(-99 ... して、以下のコード片を考えてみましょう。 #![allow(unused)] fn main() { let x = &mut 0; let y = &mut 0; *x ...
https://man.plustar.jp/rust/nomicon/vec-alloc.html - [similar]
Unsafe と連携する 6743
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... えば、以下の簡単な関数を見てみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u8]) -> ... が残ります。 < を <= に変えてみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u8]) -> ... 厄介になります。 Vec の簡単な実装を見てみましょう。 use std::ptr; // この定義は不完全であることに注意してく ...
https://man.plustar.jp/rust/nomicon/working-with-unsafe.html - [similar]
安全と危険の相互作用 6605
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... きます。 このようなコードになるでしょう。 #![allow(unused)] fn main() { use std::cmp::Ordering; unsafe trai ...
https://man.plustar.jp/rust/nomicon/safe-unsafe-meaning.html - [similar]
PREV 1 2 NEXT