Lines Matching defs:Pin

14 use core::pin::Pin;
259 /// Constructs a new `Pin<Box<T, A>>`. If `T` does not implement [`Unpin`], then `x` will be
262 pub fn pin(x: T, flags: Flags) -> Result<Pin<Box<T, A>>, AllocError>
269 /// Construct a pinned slice of elements `Pin<Box<[T], A>>`.
315 ) -> Result<Pin<Box<[T], A>>, E>
343 Ok(Pin::from(unsafe { Box::from_raw(slice) }))
346 /// Convert a [`Box<T,A>`] to a [`Pin<Box<T,A>>`]. If `T` does not implement
348 pub fn into_pin(this: Self) -> Pin<Self> {
392 impl<T, A> From<Box<T, A>> for Pin<Box<T, A>>
397 /// Converts a `Box<T, A>` into a `Pin<Box<T, A>>`. If `T` does not implement [`Unpin`], then
400 /// This moves `b` into `Pin` without moving `*b` or allocating and copying any memory.
402 // SAFETY: The value wrapped inside a `Pin<Box<T, A>>` cannot be moved or replaced as long
404 unsafe { Pin::new_unchecked(b) }
423 fn write_pin_init<E>(mut self, init: impl PinInit<T, E>) -> Result<Pin<Self::Initialized>, E> {
437 type PinnedSelf = Pin<Self>;
440 fn try_pin_init<E>(init: impl PinInit<T, E>, flags: Flags) -> Result<Pin<Self>, E>
497 unsafe impl<T: 'static, A> ForeignOwnable for Pin<Box<T, A>>
502 type Borrowed<'a> = Pin<&'a T>;
503 type BorrowedMut<'a> = Pin<&'a mut T>;
507 Box::into_raw(unsafe { Pin::into_inner_unchecked(self) }).cast()
513 unsafe { Pin::new_unchecked(Box::from_raw(ptr.cast())) }
516 unsafe fn borrow<'a>(ptr: *mut c_void) -> Pin<&'a T> {
523 // SAFETY: This pointer originates from a `Pin<Box<T>>`.
524 unsafe { Pin::new_unchecked(r) }
527 unsafe fn borrow_mut<'a>(ptr: *mut c_void) -> Pin<&'a mut T> {
535 // SAFETY: This pointer originates from a `Pin<Box<T>>`.
536 unsafe { Pin::new_unchecked(r) }