検索
Results of 11 - 19 of about 19 for new (0.041 sec.)
- Drain 7683
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
イベートな実装詳細ですので問題ありません。 unsafe fn new(slice: &[T]) -> Self { RawValIter { start: slice.a...
) -> IntoIter<T> { unsafe { let iter = RawValIter::new(&self); let buf = ptr::read(&self.buf); mem::forge...
elf) -> Drain<T> { unsafe { let iter = RawValIter::new(&self); // これは mem::forget に対する安全策です。...
- https://man.plustar.jp/rust/nomicon/vec-drain.html - [similar]
- レイアウト 7683
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
> Sync for Unique<T> {} impl<T> Unique<T> { pub fn new(ptr: *mut T) -> Self { Unique { ptr: ptr, _marker:...
を有効にするような設計していきます。 特に、 Unique::new を呼ぶことはアンセーフです。なぜなら null を中に突...
義動作を引き起こしてしまうからです。安定版のコードの new はアンセーフに する必要はありません。中身についての...
- https://man.plustar.jp/rust/nomicon/vec-layout.html - [similar]
- Subtyping and Variance 7496
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
llowing code: fn overwrite<T: Copy>(input: &mut T, new: &mut T) { *input = *new; } fn main() { let mut fo...
es to two values of the same type, and overwrites one with the other. If &mut T was variant over T, then...
str> { // string literals are `&'static str`s Box::new("hello") } } Weakening when you pass by-value is f...
- https://man.plustar.jp/rust/nomicon/subtyping.html - [similar]
- 借用の分割 7222
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
&mut []); if slice.is_empty() { return None; } let new_len = slice.len() - 1; let (l, r) = slice.split_at...
_mut(new_len); self.0 = l; r.get_mut(0) } } そしてこれは二分...
ut self) -> IterMut<T> { let mut deque = VecDeque::new(); self.root.as_mut().map(|root| deque.push_front(...
- https://man.plustar.jp/rust/nomicon/borrow-splitting.html - [similar]
- 例外安全性 7222
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
Hole<'a, T: 'a> { data: &'a mut [T], /// `elt` は new で生成されたときからドロップまで、常に Some です e...
ion<T>, pos: usize, } impl<'a, T> Hole<'a, T> { fn new(data: &'a mut [T], pos: usize) -> Self { unsafe {...
る値を受け取り、穴を作ります。 let mut hole = Hole::new(&mut self.data, pos); while hole.pos() != 0 { let...
- https://man.plustar.jp/rust/nomicon/exception-safety.html - [similar]
- ライフタイムの省略 7222
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
gs: &'b [T]) -> &'a mut Command // 展開した場合 fn new(buf: &mut [u8]) -> BufWriter; // 省略した場合 fn n...
- https://man.plustar.jp/rust/nomicon/lifetime-elision.html - [similar]
- リーク 7052
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
以下の例を考えてみましょう。 let mut vec = vec![Box::new(0); 4]; { // ドレインを開始します。 vec にはもうア...
{ data: T, ref_count: usize, } impl<T> Rc<T> { fn new(data: T) -> Self { unsafe { // もし heap::allocate...
るということに頼っている以外は。 let mut data = Box::new(0); { let guard = thread::scoped(|| { // これは良く...
- https://man.plustar.jp/rust/nomicon/leaking.html - [similar]
- Atomics 6949
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
ing}; use std::thread; fn main() { let lock = Arc::new(AtomicBool::new(false)); // value answers "am I lo...
- https://man.plustar.jp/rust/nomicon/atomics.html - [similar]
- チェックされないメモリ 6591
- はじめに 1. 安全と危険のご紹介 1.1. 安全と危険の相互作用 1.2. Unsafe と連携する 2. データレイアウ
...
ox はパニックできません ptr::write(&mut x[i], Box::new(i as u32)); } } println!("{:?}", x); } Drop を実装...
- https://man.plustar.jp/rust/nomicon/unchecked-uninit.html - [similar]