検索
Results of 1 - 10 of about 20 for allow (0.005 sec.)
- print.html 13323
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...る事ができます。 このようなコードになるでしょう。 #![allow(unused)] fn main() { use std::cmp::Ordering; unsaf...です。例えば、以下の簡単な関数を見てみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u...には疑問が残ります。 < を <= に変えてみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u...アラインメントの倍数になるようにします。 例えば、 #![allow(unused)] fn main() { struct A { a: u8, b: u32, c:... - https://man.plustar.jp/rust/nomicon/print.html - [similar]
- repr(Rust) 12388
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...アラインメントの倍数になるようにします。 例えば、 #![allow(unused)] fn main() { struct A { a: u8, b: u32, c:...ビットの倍数になります。 このようになるでしょう。 #![allow(unused)] fn main() { struct A { a: u8, _pad1: [u8;...せん。以下の 2 つの構造体の定義を見てみましょう。 #![allow(unused)] fn main() { struct A { a: i32, b: u64, }...しいのです。 例えば、次の構造体を見てみましょう。 #![allow(unused)] fn main() { struct Foo<T, U> { count: u16... - https://man.plustar.jp/rust/nomicon/repr-rust.html - [similar]
- ドロップフラグ 10145
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...うな 静的ドロップセマンティクス を持っています。 #![allow(unused)] fn main() { let mut x = Box::new(0); // x...では、 静的ドロップセマンティクスを持っています。 #![allow(unused)] fn main() { let condition = true; let mut...ドロップするために実行時の情報が必要となります。 #![allow(unused)] fn main() { let condition = true; let x;...プセマンティクスを復活させるのは些細なことです。 #![allow(unused)] fn main() { let condition = true; if cond... - https://man.plustar.jp/rust/nomicon/drop-flags.html - [similar]
- Send and Sync 9958
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...ing obeys inherited mutability, though. Some types allow you to multiply alias a location in memory while m...y derived can simply implement them if desired: #![allow(unused)] fn main() { struct MyBox(*mut u8); unsafe...c, then one can also unimplement Send and Sync: #![allow(unused)] #![feature(optin_builtin_traits)] fn main... - https://man.plustar.jp/rust/nomicon/send-and-sync.html - [similar]
- Subtyping and Variance 9023
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...theme of variance vs invariance: if variance would allow you to store a short-lived value into a longer-liv...ggling a short-lived type into them. Being variant allows Box and Vec to be weakened when shared immutably....ing when passing by-value. That is, this works: #![allow(unused)] fn main() { fn get_box<'a>(str: &'a str)...riant over A Otherwise, Foo is invariant over A #![allow(unused)] fn main() { use std::cell::Cell; struct F... - https://man.plustar.jp/rust/nomicon/subtyping.html - [similar]
- 奇妙なサイズの型 8836
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...とができますが、その構造体自体も DST になります。 #![allow(unused)] fn main() { // 直接スタックには置けません...んと、スペースを持たない型を使うことができます。 #![allow(unused)] fn main() { struct Foo; // フィールドがな...型は、識別子を持たない enum として宣言できます。 #![allow(unused)] fn main() { enum Void {} // 識別子なし =... - https://man.plustar.jp/rust/nomicon/exotic-sizes.html - [similar]
- ライフタイム 8462
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...て、この単純な Rust コードを脱糖してみましょう。 #![allow(unused)] fn main() { let x = 0; let y = &x; let z...より大きいライフタイムを推論することになります。 #![allow(unused)] fn main() { let x = 0; let z; let y = &x;...この関数を正しく書くと、当然次のようになります。 #![allow(unused)] fn main() { fn to_string(data: &u32) -> S... - https://man.plustar.jp/rust/nomicon/lifetimes.html - [similar]
- 競合 8089
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...メモリ安全性を侵害することが出来ないのです。例: #![allow(unused)] fn main() { use std::thread; use std::syn...tln!("{}", data[idx.load(Ordering::SeqCst)]); } #![allow(unused)] fn main() { use std::thread; use std::syn... - https://man.plustar.jp/rust/nomicon/races.html - [similar]
- Unsafe と連携する 8089
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...です。例えば、以下の簡単な関数を見てみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u...には疑問が残ります。 < を <= に変えてみましょう。 #![allow(unused)] fn main() { fn index(idx: usize, arr: &[u... - https://man.plustar.jp/rust/nomicon/working-with-unsafe.html - [similar]
- デストラクタ 7902
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...ることに注意してください。 ですから、以下のような #![allow(unused)] fn main() { struct Boxy<T> { data1: Box<T...す。型が Drop を 実装していなくてもです。 同様に #![allow(unused)] fn main() { enum Link { Next(Box<Link>),... - https://man.plustar.jp/rust/nomicon/destructors.html - [similar]