検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 21 for impl (0.024 sec.)
Final Code 13124
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ; struct RawVec<T> { ptr: Unique<T>, cap: usize, } impl<T> RawVec<T> { fn new() -> Self { unsafe { // !0 i ... que::new(ptr as *mut _); self.cap = new_cap; } } } impl<T> Drop for RawVec<T> { fn drop(&mut self) { let e ... pub struct Vec<T> { buf: RawVec<T>, len: usize, } impl<T> Vec<T> { fn ptr(&self) -> *mut T { *self.buf.pt ... = 0; Drain { iter: iter, vec: PhantomData, } } } } impl<T> Drop for Vec<T> { fn drop(&mut self) { while le ...
https://man.plustar.jp/rust/nomicon/vec-final.html - [similar]
Drain 12093
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... <&'a mut Vec<T>> start: *const T, end: *const T, } impl<'a, T> Iterator for Drain<'a, T> { type Item = T; ... RawValIter<T> { start: *const T, end: *const T, } impl<T> RawValIter<T> { // 値のコンストラクトはアンセー ... ize) } } } } // Iterator と DoubleEndedIterator の impl は IntoIter と同一です。 } そして IntoIter は以下の ... ですが、その存在は必要です。 iter: RawValIter<T>, } impl<T> Iterator for IntoIter<T> { type Item = T; fn ne ...
https://man.plustar.jp/rust/nomicon/vec-drain.html - [similar]
Drop Check 9843
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... We have seen how lifetimes provide us some fairly simple rules for ensuring that we never read dangling re ... s via pure-library code. In general, anything that implements Drop has a chance to fiddle with its innards ... destruction order of the contents of any type that implements Drop. So why do we care? We care because if ... ly make dangling pointers. Consider the following simple program: struct Inspector<'a>(&'a u8); fn main() ...
https://man.plustar.jp/rust/nomicon/dropck.html - [similar]
借用の分割 9759
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... truct IterMut<'a, T: 'a>(Option<&'a mut Node<T>>); impl<T> LinkedList<T> { fn iter_mut(&mut self) -> IterM ... ut(self.head.as_mut().map(|node| &mut **node)) } } impl<'a, T> Iterator for IterMut<'a, T> { type Item = & ... d::mem; pub struct IterMut<'a, T: 'a>(&'a mut[T]); impl<'a, T> Iterator for IterMut<'a, T> { type Item = & ... lice.split_at_mut(1); self.0 = r; l.get_mut(0) } } impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { fn ...
https://man.plustar.jp/rust/nomicon/borrow-splitting.html - [similar]
RawVec 9403
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... 。 struct RawVec<T> { ptr: Unique<T>, cap: usize, } impl<T> RawVec<T> { fn new() -> Self { assert!(mem::siz ... e_of::<T>() != 0, "TODO: implement ZST support"); unsafe { RawVec { ptr: Unique: ... que::new(ptr as *mut _); self.cap = new_cap; } } } impl<T> Drop for RawVec<T> { fn drop(&mut self) { if se ... pub struct Vec<T> { buf: RawVec<T>, len: usize, } impl<T> Vec<T> { fn ptr(&self) -> *mut T { *self.buf.pt ...
https://man.plustar.jp/rust/nomicon/vec-raw.html - [similar]
print.html 9319
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ズの型しか存在しない素敵な仮想的な世界を仮定します。 impl<T> Vec<T> { pub fn push(&mut self, elem: T) { if s ... テムの限界 次のコードを見てみましょう。 struct Foo; impl Foo { fn mutate_and_share(&mut self) -> &Self { &* ... コードを脱糖すると、次のようになります。 struct Foo; impl Foo { fn mutate_and_share<'a>(&'a mut self) -> &'a ... 。 fn メソッド定義の入力ポジションには、 メソッドの impl ヘッダに現れるライフタイムは含まれません。 (デフォ ...
https://man.plustar.jp/rust/nomicon/print.html - [similar]
Send and Sync 9150
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... unsafe traits . This means that they are unsafe to implement, and other unsafe code can assume that they a ... re correctly implemented. Since they're marker traits (they have no ... associated items like methods), correctly implemented simply means that they have the intrinsic p ... roperties an implementor should have. Incorrectly implementing Send ...
https://man.plustar.jp/rust/nomicon/send-and-sync.html - [similar]
サイズが 0 の型を扱う 8710
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ずつ、合わせて 3 つの ガードを書くことを意味します。 impl<T> RawVec<T> { fn new() -> Self { unsafe { // !0 は ... que::new(ptr as *mut _); self.cap = new_cap; } } } impl<T> Drop for RawVec<T> { fn drop(&mut self) { let e ... トし、インクリメントした後に元に戻すという方法です。 impl<T> RawValIter<T> { unsafe fn new(slice: &[T]) -> S ... に 動き続けてしまいます。同じトリックをイテレータの impl に 行なう必要があります。また、 size_hint の計算で ...
https://man.plustar.jp/rust/nomicon/vec-zsts.html - [similar]
デストラクタ 8287
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... ; use alloc::heap; struct Box<T>{ ptr: Unique<T> } impl<T> Drop for Box<T> { fn drop(&mut self) { unsafe { ... ; use alloc::heap; struct Box<T>{ ptr: Unique<T> } impl<T> Drop for Box<T> { fn drop(&mut self) { unsafe { ... T>()); } } } struct SuperBox<T> { my_box: Box<T> } impl<T> Drop for SuperBox<T> { fn drop(&mut self) { uns ... ; use alloc::heap; struct Box<T>{ ptr: Unique<T> } impl<T> Drop for Box<T> { fn drop(&mut self) { unsafe { ...
https://man.plustar.jp/rust/nomicon/destructors.html - [similar]
レイアウト 8203
はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ ... Unique<T> は "単なる" T のようなものです。 unsafe impl<T: Send> Send for Unique<T> {} unsafe impl<T: Sync ... > Sync for Unique<T> {} impl<T> Unique<T> { pub fn new(ptr: *mut T) -> Self { U ... nique { ptr: ptr, _marker: PhantomData } } } impl<T> Deref for Unique<T> { type Target = *mut T; fn ...
https://man.plustar.jp/rust/nomicon/vec-layout.html - [similar]
PREV 1 2 3 NEXT