# 1.33.0[−][src]Trait core::marker::Unpin

    #[lang = "unpin"]pub auto trait Unpin { }

Types that can be safely moved after being pinned.

Since Rust itself has no notion of immovable types, and considers moves (e.g., through assignment or `mem::replace`) to always be safe, this trait cannot prevent types from moving by itself.

Instead it is used to prevent moves through the type system, by controlling the behavior of pointers `P` wrapped in the `Pin<P>` wrapper, which "pin" the type in place by not allowing it to be moved out of them. See the `pin module` documentation for more information on pinning.

Implementing this trait lifts the restrictions of pinning off a type, which then allows it to move out with functions such as `mem::replace`.

`Unpin` has no consequence at all for non-pinned data. In particular, `mem::replace` happily moves `!Unpin` data (it works for any `&mut T`, not just when `T: Unpin`). However, you cannot use `mem::replace` on data wrapped inside a `Pin<P>` because you cannot get the `&mut T` you need for that, and that is what makes this system work.

So this, for example, can only be done on types implementing `Unpin`:

    use std::mem;
    use std::pin::Pin;

    let mut string = "this".to_string();
    let mut pinned_string = Pin::new(&mut string);

    // We need a mutable reference to call `mem::replace`.
    // We can obtain such a reference by (implicitly) invoking `Pin::deref_mut`,
    // but that is only possible because `String` implements `Unpin`.
    mem::replace(&mut *pinned_string, "other".to_string());

Run

This trait is automatically implemented for almost every type.

## Implementors

### `impl !Unpin for PhantomPinned`[src]

### `impl Unpin for Waker`[src]

### `impl<'a, T: ?Sized + 'a> Unpin for &'a T`[src]

### `impl<'a, T: ?Sized + 'a> Unpin for &'a mut T`[src]

### `impl<F> Unpin for PollFn<F>`[src]

### `impl<T> Unpin for Pending<T>`[src]

### `impl<T> Unpin for Ready<T>`[src]

### `impl<T: ?Sized> Unpin for *const T`[src]

### `impl<T: ?Sized> Unpin for *mut T`[src]

Loading content...

## Auto implementors

### `impl Unpin for core::cmp::Ordering`

### `impl Unpin for Infallible`

### `impl Unpin for c_void`

### `impl Unpin for Alignment`

### `impl Unpin for FpCategory`

### `impl Unpin for IntErrorKind`

### `impl Unpin for SearchStep`

### `impl Unpin for core::sync::atomic::Ordering`

### `impl Unpin for AllocErr`

### `impl Unpin for Layout`

### `impl Unpin for LayoutErr`

### `impl Unpin for TypeId`

### `impl Unpin for float64x1_t`

### `impl Unpin for float64x2_t`

### `impl Unpin for int8x16x2_t`

### `impl Unpin for int8x16x3_t`

### `impl Unpin for int8x16x4_t`

### `impl Unpin for poly8x16x2_t`

### `impl Unpin for poly8x16x3_t`

### `impl Unpin for poly8x16x4_t`

### `impl Unpin for poly64_t`

### `impl Unpin for poly64x1_t`

### `impl Unpin for poly64x2_t`

### `impl Unpin for poly128_t`

### `impl Unpin for uint8x16x2_t`

### `impl Unpin for uint8x16x3_t`

### `impl Unpin for uint8x16x4_t`

### `impl Unpin for APSR`

### `impl Unpin for SY`

### `impl Unpin for float32x2_t`

### `impl Unpin for float32x4_t`

### `impl Unpin for int8x8_t`

### `impl Unpin for int8x8x2_t`

### `impl Unpin for int8x8x3_t`

### `impl Unpin for int8x8x4_t`

### `impl Unpin for int8x16_t`

### `impl Unpin for int16x4_t`

### `impl Unpin for int16x8_t`

### `impl Unpin for int32x2_t`

### `impl Unpin for int32x4_t`

### `impl Unpin for int64x1_t`

### `impl Unpin for int64x2_t`

### `impl Unpin for poly8x8_t`

### `impl Unpin for poly8x8x2_t`

### `impl Unpin for poly8x8x3_t`

### `impl Unpin for poly8x8x4_t`

### `impl Unpin for poly8x16_t`

### `impl Unpin for poly16x4_t`

### `impl Unpin for poly16x8_t`

### `impl Unpin for uint8x8_t`

### `impl Unpin for uint8x8x2_t`

### `impl Unpin for uint8x8x3_t`

### `impl Unpin for uint8x8x4_t`

### `impl Unpin for uint8x16_t`

### `impl Unpin for uint16x4_t`

### `impl Unpin for uint16x8_t`

### `impl Unpin for uint32x2_t`

### `impl Unpin for uint32x4_t`

### `impl Unpin for uint64x1_t`

### `impl Unpin for uint64x2_t`

### `impl Unpin for vector_bool_long`

### `impl Unpin for vector_double`

### `impl Unpin for vector_signed_long`

### `impl Unpin for vector_unsigned_long`

### `impl Unpin for v128`

### `impl Unpin for CpuidResult`

### `impl Unpin for __m64`

### `impl Unpin for __m128`

### `impl Unpin for __m128d`

### `impl Unpin for __m128i`

### `impl Unpin for __m256`

### `impl Unpin for __m256d`

### `impl Unpin for __m256i`

### `impl Unpin for __m512`

### `impl Unpin for __m512d`

### `impl Unpin for __m512i`

### `impl Unpin for TryFromSliceError`

### `impl Unpin for core::ascii::EscapeDefault`

### `impl Unpin for BorrowError`

### `impl Unpin for BorrowMutError`

### `impl Unpin for CharTryFromError`

### `impl Unpin for DecodeUtf16Error`

### `impl Unpin for core::char::EscapeDebug`

### `impl Unpin for core::char::EscapeDefault`

### `impl Unpin for core::char::EscapeUnicode`

### `impl Unpin for ParseCharError`

### `impl Unpin for ToLowercase`

### `impl Unpin for ToUppercase`

### `impl Unpin for Error`

### `impl Unpin for SipHasher`

### `impl Unpin for NonZeroI8`

### `impl Unpin for NonZeroI16`

### `impl Unpin for NonZeroI32`

### `impl Unpin for NonZeroI64`

### `impl Unpin for NonZeroI128`

### `impl Unpin for NonZeroIsize`

### `impl Unpin for NonZeroU8`

### `impl Unpin for NonZeroU16`

### `impl Unpin for NonZeroU32`

### `impl Unpin for NonZeroU64`

### `impl Unpin for NonZeroU128`

### `impl Unpin for NonZeroUsize`

### `impl Unpin for ParseFloatError`

### `impl Unpin for ParseIntError`

### `impl Unpin for TryFromIntError`

### `impl Unpin for RangeFull`

### `impl Unpin for NoneError`

### `impl Unpin for TraitObject`

### `impl Unpin for Utf8Lossy`

### `impl Unpin for ParseBoolError`

### `impl Unpin for Utf8Error`

### `impl Unpin for AtomicBool`

### `impl Unpin for AtomicI8`

### `impl Unpin for AtomicI16`

### `impl Unpin for AtomicI32`

### `impl Unpin for AtomicI64`

### `impl Unpin for AtomicIsize`

### `impl Unpin for AtomicU8`

### `impl Unpin for AtomicU16`

### `impl Unpin for AtomicU32`

### `impl Unpin for AtomicU64`

### `impl Unpin for AtomicUsize`

### `impl Unpin for RawWaker`

### `impl Unpin for RawWakerVTable`

### `impl Unpin for Duration`

### `impl<'a> Unpin for Arguments<'a>`

### `impl<'a> Unpin for Formatter<'a>`

### `impl<'a> Unpin for Location<'a>`

### `impl<'a> Unpin for PanicInfo<'a>`

### `impl<'a> Unpin for Utf8LossyChunk<'a>`

### `impl<'a> Unpin for Utf8LossyChunksIter<'a>`

### `impl<'a> Unpin for CharSearcher<'a>`

### `impl<'a> Unpin for Bytes<'a>`

### `impl<'a> Unpin for CharIndices<'a>`

### `impl<'a> Unpin for Chars<'a>`

### `impl<'a> Unpin for EncodeUtf16<'a>`

### `impl<'a> Unpin for core::str::EscapeDebug<'a>`

### `impl<'a> Unpin for core::str::EscapeDefault<'a>`

### `impl<'a> Unpin for core::str::EscapeUnicode<'a>`

### `impl<'a> Unpin for Lines<'a>`

### `impl<'a> Unpin for LinesAny<'a>`

### `impl<'a> Unpin for SplitAsciiWhitespace<'a>`

### `impl<'a> Unpin for SplitWhitespace<'a>`

### `impl<'a> Unpin for Context<'a>`

### `impl<'a, 'b> Unpin for DebugList<'a, 'b> where
'b: 'a,`

### `impl<'a, 'b> Unpin for DebugMap<'a, 'b> where
'b: 'a,`

### `impl<'a, 'b> Unpin for DebugSet<'a, 'b> where
'b: 'a,`

### `impl<'a, 'b> Unpin for DebugStruct<'a, 'b> where
'b: 'a,`

### `impl<'a, 'b> Unpin for DebugTuple<'a, 'b> where
'b: 'a,`

### `impl<'a, 'b> Unpin for CharSliceSearcher<'a, 'b>`

### `impl<'a, 'b> Unpin for StrSearcher<'a, 'b>`

### `impl<'a, 'f> Unpin for VaList<'a, 'f> where
'f: 'a,`

### `impl<'a, A> Unpin for core::option::Iter<'a, A>`

### `impl<'a, A> Unpin for core::option::IterMut<'a, A>`

### `impl<'a, F> Unpin for CharPredicateSearcher<'a, F> where
F: MultiCharEq + Unpin,`

### `impl<'a, P> Unpin for MatchIndices<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for Matches<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for RMatchIndices<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for RMatches<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for core::str::RSplit<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for core::str::RSplitN<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for RSplitTerminator<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for core::str::Split<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for core::str::SplitInclusive<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for core::str::SplitN<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, P> Unpin for SplitTerminator<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,`

### `impl<'a, T> Unpin for core::result::Iter<'a, T>`

### `impl<'a, T> Unpin for core::result::IterMut<'a, T>`

### `impl<'a, T> Unpin for Chunks<'a, T>`

### `impl<'a, T> Unpin for ChunksExact<'a, T>`

### `impl<'a, T> Unpin for ChunksExactMut<'a, T>`

### `impl<'a, T> Unpin for ChunksMut<'a, T>`

### `impl<'a, T> Unpin for core::slice::Iter<'a, T>`

### `impl<'a, T> Unpin for core::slice::IterMut<'a, T>`

### `impl<'a, T> Unpin for RChunks<'a, T>`

### `impl<'a, T> Unpin for RChunksExact<'a, T>`

### `impl<'a, T> Unpin for RChunksExactMut<'a, T>`

### `impl<'a, T> Unpin for RChunksMut<'a, T>`

### `impl<'a, T> Unpin for Windows<'a, T>`

### `impl<'a, T, P> Unpin for core::slice::RSplit<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for RSplitMut<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for core::slice::RSplitN<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for RSplitNMut<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for core::slice::Split<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for core::slice::SplitInclusive<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for SplitInclusiveMut<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for SplitMut<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for core::slice::SplitN<'a, T, P> where
P: Unpin,`

### `impl<'a, T, P> Unpin for SplitNMut<'a, T, P> where
P: Unpin,`

### `impl<'a, T, const N: usize> Unpin for ArrayChunks<'a, T, N>`

### `impl<'b, T: ?Sized> Unpin for Ref<'b, T>`

### `impl<'b, T: ?Sized> Unpin for RefMut<'b, T>`

### `impl<'f> Unpin for VaListImpl<'f>`

### `impl<A> Unpin for Repeat<A> where
A: Unpin,`

### `impl<A> Unpin for core::option::IntoIter<A> where
A: Unpin,`

### `impl<A, B> Unpin for Chain<A, B> where
A: Unpin,
B: Unpin,`

### `impl<A, B> Unpin for Zip<A, B> where
A: Unpin,
B: Unpin,`

### `impl<F> Unpin for FromFn<F> where
F: Unpin,`

### `impl<F> Unpin for OnceWith<F> where
F: Unpin,`

### `impl<F> Unpin for RepeatWith<F> where
F: Unpin,`

### `impl<H> Unpin for BuildHasherDefault<H> where
H: Unpin,`

### `impl<I> Unpin for DecodeUtf16<I> where
I: Unpin,`

### `impl<I> Unpin for Cloned<I> where
I: Unpin,`

### `impl<I> Unpin for Copied<I> where
I: Unpin,`

### `impl<I> Unpin for Cycle<I> where
I: Unpin,`

### `impl<I> Unpin for Enumerate<I> where
I: Unpin,`

### `impl<I> Unpin for Flatten<I> where
I: Unpin,
<<I as Iterator>::Item as IntoIterator>::IntoIter: Unpin,`

### `impl<I> Unpin for Fuse<I> where
I: Unpin,`

### `impl<I> Unpin for Peekable<I> where
I: Unpin,
<I as Iterator>::Item: Unpin,`

### `impl<I> Unpin for Skip<I> where
I: Unpin,`

### `impl<I> Unpin for StepBy<I> where
I: Unpin,`

### `impl<I> Unpin for Take<I> where
I: Unpin,`

### `impl<I, F> Unpin for FilterMap<I, F> where
F: Unpin,
I: Unpin,`

### `impl<I, F> Unpin for Inspect<I, F> where
F: Unpin,
I: Unpin,`

### `impl<I, F> Unpin for Map<I, F> where
F: Unpin,
I: Unpin,`

### `impl<I, P> Unpin for Filter<I, P> where
I: Unpin,
P: Unpin,`

### `impl<I, P> Unpin for MapWhile<I, P> where
I: Unpin,
P: Unpin,`

### `impl<I, P> Unpin for SkipWhile<I, P> where
I: Unpin,
P: Unpin,`

### `impl<I, P> Unpin for TakeWhile<I, P> where
I: Unpin,
P: Unpin,`

### `impl<I, St, F> Unpin for Scan<I, St, F> where
F: Unpin,
I: Unpin,
St: Unpin,`

### `impl<I, U, F> Unpin for FlatMap<I, U, F> where
F: Unpin,
I: Unpin,
<U as IntoIterator>::IntoIter: Unpin,`

### `impl<Idx> Unpin for Range<Idx> where
Idx: Unpin,`

### `impl<Idx> Unpin for RangeFrom<Idx> where
Idx: Unpin,`

### `impl<Idx> Unpin for RangeInclusive<Idx> where
Idx: Unpin,`

### `impl<Idx> Unpin for RangeTo<Idx> where
Idx: Unpin,`

### `impl<Idx> Unpin for RangeToInclusive<Idx> where
Idx: Unpin,`

### `impl<P> Unpin for Pin<P> where
P: Unpin,`

### `impl<T> Unpin for Bound<T> where
T: Unpin,`

### `impl<T> Unpin for Option<T> where
T: Unpin,`

### `impl<T> Unpin for Poll<T> where
T: Unpin,`

### `impl<T> Unpin for Reverse<T> where
T: Unpin,`

### `impl<T> Unpin for Empty<T> where
T: Unpin,`

### `impl<T> Unpin for Once<T> where
T: Unpin,`

### `impl<T> Unpin for Rev<T> where
T: Unpin,`

### `impl<T> Unpin for OnceCell<T> where
T: Unpin,`

### `impl<T> Unpin for Discriminant<T> where
<T as DiscriminantKind>::Discriminant: Unpin,`

### `impl<T> Unpin for Wrapping<T> where
T: Unpin,`

### `impl<T> Unpin for core::result::IntoIter<T> where
T: Unpin,`

### `impl<T> Unpin for AtomicPtr<T>`

### `impl<T> Unpin for MaybeUninit<T> where
T: Unpin,`

### `impl<T, E> Unpin for Result<T, E> where
E: Unpin,
T: Unpin,`

### `impl<T, F> Unpin for Successors<T, F> where
F: Unpin,
T: Unpin,`

### `impl<T, F> Unpin for Lazy<T, F> where
F: Unpin,
T: Unpin,`

### `impl<T, const N: usize> Unpin for core::array::IntoIter<T, N> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for Cell<T> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for RefCell<T> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for UnsafeCell<T> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for PhantomData<T> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for ManuallyDrop<T> where
T: Unpin,`

### `impl<T: ?Sized> Unpin for NonNull<T>`

### `impl<Y, R> Unpin for GeneratorState<Y, R> where
R: Unpin,
Y: Unpin,`

Loading content...