検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 13 for box (0.035 sec.)
デストラクタ 14111
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ほとんどの型にとっては、全く問題ありません。 例えば Box のカスタム実装では、以下のような Drop を書くかもし ... ce, Unique}; use std::mem; use alloc::heap; struct Box<T>{ ptr: Unique<T> } impl<T> Drop for Box<T> { fn ... ce, Unique}; use std::mem; use alloc::heap; struct Box<T>{ ptr: Unique<T> } impl<T> Drop for Box<T> { fn ... f::<T>(), mem::align_of::<T>()); } } } struct SuperBox<T> { my_box: Box<T> } impl<T> Drop for SuperBox<T> ...
https://man.plustar.jp/rust/nomicon/destructors.html - [similar]
print.html 9853
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ヌルポインタを含まない型がたくさんあります。 例えば Box<T> , Vec<T> , String , &T , &mut T などです。 同様 ... ヒープ上のデータを独占的に所有する型の例としては、Box, Vec, String, HashMap があります。 残念ながら、ヒー ... マークされた変数だけが変更可能なように借用されます。 Box がまさに所有中参照のように振る舞うということを覚え ... ておくと良いでしょう。 Box は値を解放することができ、変数が解放された時と同様 ...
https://man.plustar.jp/rust/nomicon/print.html - [similar]
Subtyping and Variance 9536
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... n(T) -> U is invariant over T , but variant over U Box , Vec , and all other collections are variant over ... other way: &'a mut T owns 'a , but only borrows T. Box and Vec are interesting cases because they're vari ... a short-lived type into them. Being variant allows Box and Vec to be weakened when shared immutably. So y ... ou can pass a &Box<&'static str> where a &Box<&'a str> is expected. H ...
https://man.plustar.jp/rust/nomicon/subtyping.html - [similar]
ドロップフラグ 9378
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... 代入では、状況によらずドロップしません。 let mut x = Box::new(0); // let によって新しい変数が生成されるので ... 、ドロップの必要はありません let y = &mut x; *y = Box::new(1); // 参照外しでは、参照される側の変数は初期 ... ています。 #![allow(unused)] fn main() { let mut x = Box::new(0); // x は初期化されていないので、単に上書き ... 書きします。そして x を初期化前の状態にします。 x = Box::new(0); // x は初期化されていないので、単に上書き ...
https://man.plustar.jp/rust/nomicon/drop-flags.html - [similar]
Drop Check 9149
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... &'a u8); fn main() { let (inspector, days); days = Box::new(1); inspector = Inspector(&days); } This prog ... .0); } } fn main() { let (inspector, days); days = Box::new(1); inspector = Inspector(&days); // Let's sa ... <anon>:10 let (inspector, days); <anon>:11 days = Box::new(1); <anon>:12 inspector = Inspector(&days); < ... <anon>:10 let (inspector, days); <anon>:11 days = Box::new(1); <anon>:12 inspector = Inspector(&days); < ...
https://man.plustar.jp/rust/nomicon/dropck.html - [similar]
チェックされるメモリ 8657
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... いない事になります。 fn main() { let x = 0; let y = Box::new(0); let z1 = x; // i32 は Copy を実装している ... ため、 x はまだ有効です let z2 = y; // Box は Copy を実装していないため、もはや y は論理的には ... わったと認識出来るからです。 fn main() { let mut y = Box::new(0); let z = y; // Box が Copy を実装していない ... ため、もはや y は論理的には初期化されていません y = Box::new(1); // y を再初期化します } そうでなければ、 ...
https://man.plustar.jp/rust/nomicon/checked-uninit.html - [similar]
リーク 8234
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... らこれは問題ではありません。 そうですよね? 例えば、 Box<u8> をリークしても、いくらかのメモリを無駄にはしま ... では以下の例を考えてみましょう。 let mut vec = vec![Box::new(0); 4]; { // ドレインを開始します。 vec にはも ... りドロップされるのを 妨害します。けれどもこれは単に Box に似ています。そうですよね? いいえ。 では、以下の単 ... の実装を確認しましょう。 struct Rc<T> { ptr: *mut RcBox<T>, } struct RcBox<T> { data: T, ref_count: usize, ...
https://man.plustar.jp/rust/nomicon/leaking.html - [similar]
チェックされないメモリ 7900
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... 意味しますがね! const SIZE: usize = 10; let mut x: [Box<u32>; SIZE]; unsafe { // Rust に x が完全に初期化さ ... 書きします // 注意: 例外安全性は考慮されていません。 Box はパニックできません ptr::write(&mut x[i], Box::ne ...
https://man.plustar.jp/rust/nomicon/unchecked-uninit.html - [similar]
リファレンス 7742
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ヒープ上のデータを独占的に所有する型の例としては、Box, Vec, String, HashMap があります。 残念ながら、ヒー ... マークされた変数だけが変更可能なように借用されます。 Box がまさに所有中参照のように振る舞うということを覚え ... ておくと良いでしょう。 Box は値を解放することができ、変数が解放された時と同様 ...
https://man.plustar.jp/rust/nomicon/references.html - [similar]
借用の分割 7513
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... 方向リストです。 fn main() {} type Link<T> = Option<Box<Node<T>>>; struct Node<T> { elem: T, next: Link<T> ... std::collections::VecDeque; type Link<T> = Option<Box<Node<T>>>; struct Node<T> { elem: T, left: Link<T> ...
https://man.plustar.jp/rust/nomicon/borrow-splitting.html - [similar]
PREV 1 2 NEXT