Lines Matching defs:unsafe
121 unsafe impl<T, A: Allocator> ZeroableOption for Box<T, A> {}
124 unsafe impl<T, A> Send for Box<T, A>
132 unsafe impl<T, A> Sync for Box<T, A>
154 pub const unsafe fn from_raw(raw: *mut T) -> Self {
157 Self(unsafe { NonNull::new_unchecked(raw) }, PhantomData)
172 /// let x = unsafe { KBox::from_raw(ptr) };
189 unsafe { &mut *Box::into_raw(b) }
205 pub unsafe fn assume_init(self) -> Box<T, A> {
211 unsafe { Box::from_raw(raw.cast()) }
219 unsafe { self.assume_init() }
328 unsafe { init(i).__pinned_init(ptr)? };
335 unsafe { buffer.inc_len(1) };
343 Ok(Pin::from(unsafe { Box::from_raw(slice) }))
357 unsafe { Box::from_raw(ptr.cast()) }
378 unsafe { core::ptr::drop_in_place(ptr) };
386 let value = unsafe { core::ptr::read(&*b) };
404 unsafe { Pin::new_unchecked(b) }
418 unsafe { init.__init(slot)? };
420 Ok(unsafe { Box::assume_init(self) })
427 unsafe { init.__pinned_init(slot)? };
429 Ok(unsafe { Box::assume_init(self) }.into())
458 unsafe impl<T: 'static, A> ForeignOwnable for Box<T, A>
475 unsafe fn from_foreign(ptr: *mut c_void) -> Self {
478 unsafe { Box::from_raw(ptr.cast()) }
481 unsafe fn borrow<'a>(ptr: *mut c_void) -> &'a T {
484 unsafe { &*ptr.cast() }
487 unsafe fn borrow_mut<'a>(ptr: *mut c_void) -> &'a mut T {
491 unsafe { &mut *ptr }
497 unsafe impl<T: 'static, A> ForeignOwnable for Pin<Box<T, A>>
507 Box::into_raw(unsafe { Pin::into_inner_unchecked(self) }).cast()
510 unsafe fn from_foreign(ptr: *mut c_void) -> Self {
513 unsafe { Pin::new_unchecked(Box::from_raw(ptr.cast())) }
516 unsafe fn borrow<'a>(ptr: *mut c_void) -> Pin<&'a T> {
521 let r = unsafe { &*ptr.cast() };
524 unsafe { Pin::new_unchecked(r) }
527 unsafe fn borrow_mut<'a>(ptr: *mut c_void) -> Pin<&'a mut T> {
533 let r = unsafe { &mut *ptr };
536 unsafe { Pin::new_unchecked(r) }
550 unsafe { self.0.as_ref() }
562 unsafe { self.0.as_mut() }
651 unsafe { core::ptr::drop_in_place::<T>(self.deref_mut()) };
656 unsafe { A::free(self.0.cast(), layout) };
676 /// unsafe { page.fill_zero_raw(0, PAGE_SIZE)? };
693 unsafe { VmallocPageIter::new(ptr, size) }