1.33.0[][src]Trait sp_std::marker::Unpin

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

Types that can be safely moved after being pinned.

Rust itself has no notion of immovable types, and considers moves (e.g., through assignment or mem::replace) to always be safe.

The Pin type is used instead to prevent moves through the type system. Pointers P<T> wrapped in the Pin<P<T>> wrapper can't be moved out of. See the pin module documentation for more information on pinning.

Implementing the Unpin trait for T lifts the restrictions of pinning off the type, which then allows moving T out of Pin<P<T>> 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<T>> 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());

This trait is automatically implemented for almost every type.

Implementations on Foreign Types

impl Unpin for Argument[src]

impl Unpin for FormatSpec[src]

impl Unpin for Alignment[src]

impl Unpin for Count[src]

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

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

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

impl Unpin for Waker[src]

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

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

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

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

impl Unpin for isize[src]

impl<T> Unpin for [T] where
    T: Unpin
[src]

impl Unpin for [u8][src]

impl Unpin for char[src]

impl Unpin for u128[src]

impl Unpin for u16[src]

impl Unpin for i128[src]

impl Unpin for i16[src]

impl Unpin for str[src]

impl Unpin for f64[src]

impl Unpin for u64[src]

impl Unpin for u8[src]

impl Unpin for i64[src]

impl Unpin for i8[src]

impl<T, const N: usize> Unpin for [T; N] where
    T: Unpin
[src]

impl Unpin for bool[src]

impl Unpin for f32[src]

impl Unpin for u32[src]

impl Unpin for usize[src]

impl Unpin for i32[src]

Loading content...

Implementors

impl !Unpin for PhantomPinned[src]

impl<T> Unpin for Rc<T> where
    T: ?Sized
[src]

impl<T> Unpin for Arc<T> where
    T: ?Sized
[src]

impl<T, A> Unpin for Box<T, A> where
    T: ?Sized,
    A: Allocator + 'static, 
[src]

Loading content...

Auto implementors

impl Unpin for sp_std::cmp::Ordering[src]

impl Unpin for Infallible[src]

impl Unpin for sp_std::fmt::Alignment[src]

impl Unpin for FpCategory[src]

impl Unpin for IntErrorKind[src]

impl Unpin for SearchStep[src]

impl Unpin for sp_std::sync::atomic::Ordering[src]

impl Unpin for RecvTimeoutError[src]

impl Unpin for TryRecvError[src]

impl Unpin for AllocError[src]

impl Unpin for Global[src]

impl Unpin for Layout[src]

impl Unpin for LayoutError[src]

impl Unpin for System[src]

impl Unpin for TypeId[src]

impl Unpin for BorrowError[src]

impl Unpin for BorrowMutError[src]

impl Unpin for Error[src]

impl Unpin for SipHasher[src]

impl Unpin for NonZeroI8[src]

impl Unpin for NonZeroI16[src]

impl Unpin for NonZeroI32[src]

impl Unpin for NonZeroI64[src]

impl Unpin for NonZeroI128[src]

impl Unpin for NonZeroIsize[src]

impl Unpin for NonZeroU8[src]

impl Unpin for NonZeroU16[src]

impl Unpin for NonZeroU32[src]

impl Unpin for NonZeroU64[src]

impl Unpin for NonZeroU128[src]

impl Unpin for NonZeroUsize[src]

impl Unpin for ParseFloatError[src]

impl Unpin for ParseIntError[src]

impl Unpin for TryFromIntError[src]

impl Unpin for RangeFull[src]

impl Unpin for ParseBoolError[src]

impl Unpin for Utf8Error[src]

impl Unpin for Writer[src]

impl Unpin for AtomicBool[src]

impl Unpin for AtomicI8[src]

impl Unpin for AtomicI16[src]

impl Unpin for AtomicI32[src]

impl Unpin for AtomicI64[src]

impl Unpin for AtomicIsize[src]

impl Unpin for AtomicU8[src]

impl Unpin for AtomicU16[src]

impl Unpin for AtomicU32[src]

impl Unpin for AtomicU64[src]

impl Unpin for AtomicUsize[src]

impl Unpin for RecvError[src]

impl Unpin for Barrier[src]

impl Unpin for BarrierWaitResult[src]

impl Unpin for Condvar[src]

impl Unpin for sp_std::sync::Once[src]

impl Unpin for OnceState[src]

impl Unpin for WaitTimeoutResult[src]

impl<'a> Unpin for Arguments<'a>[src]

impl<'a> Unpin for Formatter<'a>[src]

impl<'a> Unpin for CharSearcher<'a>[src]

impl<'a> Unpin for Bytes<'a>[src]

impl<'a> Unpin for CharIndices<'a>[src]

impl<'a> Unpin for Chars<'a>[src]

impl<'a> Unpin for EncodeUtf16<'a>[src]

impl<'a> Unpin for EscapeDebug<'a>[src]

impl<'a> Unpin for EscapeDefault<'a>[src]

impl<'a> Unpin for EscapeUnicode<'a>[src]

impl<'a> Unpin for Lines<'a>[src]

impl<'a> Unpin for LinesAny<'a>[src]

impl<'a> Unpin for SplitAsciiWhitespace<'a>[src]

impl<'a> Unpin for SplitWhitespace<'a>[src]

impl<'a, 'b> Unpin for DebugList<'a, 'b> where
    'b: 'a, 
[src]

impl<'a, 'b> Unpin for DebugMap<'a, 'b> where
    'b: 'a, 
[src]

impl<'a, 'b> Unpin for DebugSet<'a, 'b> where
    'b: 'a, 
[src]

impl<'a, 'b> Unpin for DebugStruct<'a, 'b> where
    'b: 'a, 
[src]

impl<'a, 'b> Unpin for DebugTuple<'a, 'b> where
    'b: 'a, 
[src]

impl<'a, 'b> Unpin for CharSliceSearcher<'a, 'b>[src]

impl<'a, 'b> Unpin for StrSearcher<'a, 'b>[src]

impl<'a, B: ?Sized> Unpin for Cow<'a, B> where
    <B as ToOwned>::Owned: Unpin
[src]

impl<'a, F> Unpin for CharPredicateSearcher<'a, F> where
    F: MultiCharEq + Unpin
[src]

impl<'a, I, A> Unpin for Splice<'a, I, A> where
    I: Unpin
[src]

impl<'a, K, V> Unpin for Entry<'a, K, V> where
    K: Unpin
[src]

impl<'a, K, V> Unpin for sp_std::collections::btree_map::Iter<'a, K, V>[src]

impl<'a, K, V> Unpin for sp_std::collections::btree_map::IterMut<'a, K, V>[src]

impl<'a, K, V> Unpin for Keys<'a, K, V>[src]

impl<'a, K, V> Unpin for OccupiedEntry<'a, K, V>[src]

impl<'a, K, V> Unpin for sp_std::collections::btree_map::Range<'a, K, V>[src]

impl<'a, K, V> Unpin for RangeMut<'a, K, V>[src]

impl<'a, K, V> Unpin for VacantEntry<'a, K, V> where
    K: Unpin
[src]

impl<'a, K, V> Unpin for Values<'a, K, V>[src]

impl<'a, K, V> Unpin for ValuesMut<'a, K, V>[src]

impl<'a, K, V, F> Unpin for sp_std::collections::btree_map::DrainFilter<'a, K, V, F> where
    F: Unpin
[src]

impl<'a, P> Unpin for MatchIndices<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for Matches<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for RMatchIndices<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for RMatches<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for sp_std::str::RSplit<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for sp_std::str::RSplitN<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for RSplitTerminator<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for sp_std::str::Split<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for sp_std::str::SplitN<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, P> Unpin for SplitTerminator<'a, P> where
    <P as Pattern<'a>>::Searcher: Unpin
[src]

impl<'a, T> Unpin for Difference<'a, T>[src]

impl<'a, T> Unpin for Intersection<'a, T>[src]

impl<'a, T> Unpin for sp_std::collections::btree_set::Iter<'a, T>[src]

impl<'a, T> Unpin for sp_std::collections::btree_set::Range<'a, T>[src]

impl<'a, T> Unpin for SymmetricDifference<'a, T>[src]

impl<'a, T> Unpin for Union<'a, T>[src]

impl<'a, T> Unpin for sp_std::collections::vec_deque::Drain<'a, T>[src]

impl<'a, T> Unpin for sp_std::collections::vec_deque::Iter<'a, T>[src]

impl<'a, T> Unpin for sp_std::collections::vec_deque::IterMut<'a, T>[src]

impl<'a, T> Unpin for sp_std::result::Iter<'a, T>[src]

impl<'a, T> Unpin for sp_std::result::IterMut<'a, T>[src]

impl<'a, T> Unpin for Chunks<'a, T>[src]

impl<'a, T> Unpin for ChunksExact<'a, T>[src]

impl<'a, T> Unpin for ChunksExactMut<'a, T>[src]

impl<'a, T> Unpin for ChunksMut<'a, T>[src]

impl<'a, T> Unpin for sp_std::slice::Iter<'a, T>[src]

impl<'a, T> Unpin for sp_std::slice::IterMut<'a, T>[src]

impl<'a, T> Unpin for RChunks<'a, T>[src]

impl<'a, T> Unpin for RChunksExact<'a, T>[src]

impl<'a, T> Unpin for RChunksExactMut<'a, T>[src]

impl<'a, T> Unpin for RChunksMut<'a, T>[src]

impl<'a, T> Unpin for Windows<'a, T>[src]

impl<'a, T> Unpin for sp_std::sync::mpsc::Iter<'a, T>[src]

impl<'a, T> Unpin for TryIter<'a, T>[src]

impl<'a, T, A> Unpin for sp_std::vec::Drain<'a, T, A>[src]

impl<'a, T, F> Unpin for sp_std::collections::btree_set::DrainFilter<'a, T, F> where
    F: Unpin
[src]

impl<'a, T, F, A> Unpin for sp_std::vec::DrainFilter<'a, T, F, A> where
    F: Unpin
[src]

impl<'a, T, P> Unpin for GroupBy<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for GroupByMut<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for sp_std::slice::RSplit<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for RSplitMut<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for sp_std::slice::RSplitN<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for RSplitNMut<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for sp_std::slice::Split<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for SplitMut<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for sp_std::slice::SplitN<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, P> Unpin for SplitNMut<'a, T, P> where
    P: Unpin
[src]

impl<'a, T, const N: usize> Unpin for ArrayChunks<'a, T, N>[src]

impl<'a, T, const N: usize> Unpin for ArrayChunksMut<'a, T, N>[src]

impl<'a, T, const N: usize> Unpin for ArrayWindows<'a, T, N>[src]

impl<'a, T: ?Sized> Unpin for MutexGuard<'a, T>[src]

impl<'a, T: ?Sized> Unpin for RwLockReadGuard<'a, T>[src]

impl<'a, T: ?Sized> Unpin for RwLockWriteGuard<'a, T>[src]

impl<'b, T: ?Sized> Unpin for Ref<'b, T>[src]

impl<'b, T: ?Sized> Unpin for RefMut<'b, T>[src]

impl<A> Unpin for Repeat<A> where
    A: Unpin
[src]

impl<A, B> Unpin for Chain<A, B> where
    A: Unpin,
    B: Unpin
[src]

impl<A, B> Unpin for Zip<A, B> where
    A: Unpin,
    B: Unpin
[src]

impl<B, C> Unpin for ControlFlow<B, C> where
    B: Unpin,
    C: Unpin
[src]

impl<F> Unpin for FromFn<F> where
    F: Unpin
[src]

impl<F> Unpin for OnceWith<F> where
    F: Unpin
[src]

impl<F> Unpin for RepeatWith<F> where
    F: Unpin
[src]

impl<H> Unpin for BuildHasherDefault<H> where
    H: Unpin
[src]

impl<I> Unpin for Cloned<I> where
    I: Unpin
[src]

impl<I> Unpin for Copied<I> where
    I: Unpin
[src]

impl<I> Unpin for Cycle<I> where
    I: Unpin
[src]

impl<I> Unpin for Enumerate<I> where
    I: Unpin
[src]

impl<I> Unpin for Flatten<I> where
    I: Unpin,
    <<I as Iterator>::Item as IntoIterator>::IntoIter: Unpin
[src]

impl<I> Unpin for Fuse<I> where
    I: Unpin
[src]

impl<I> Unpin for Intersperse<I> where
    I: Unpin,
    <I as Iterator>::Item: Unpin
[src]

impl<I> Unpin for Peekable<I> where
    I: Unpin,
    <I as Iterator>::Item: Unpin
[src]

impl<I> Unpin for Skip<I> where
    I: Unpin
[src]

impl<I> Unpin for StepBy<I> where
    I: Unpin
[src]

impl<I> Unpin for Take<I> where
    I: Unpin
[src]

impl<I, F> Unpin for FilterMap<I, F> where
    F: Unpin,
    I: Unpin
[src]

impl<I, F> Unpin for Inspect<I, F> where
    F: Unpin,
    I: Unpin
[src]

impl<I, F> Unpin for Map<I, F> where
    F: Unpin,
    I: Unpin
[src]

impl<I, P> Unpin for Filter<I, P> where
    I: Unpin,
    P: Unpin
[src]

impl<I, P> Unpin for MapWhile<I, P> where
    I: Unpin,
    P: Unpin
[src]

impl<I, P> Unpin for SkipWhile<I, P> where
    I: Unpin,
    P: Unpin
[src]

impl<I, P> Unpin for TakeWhile<I, P> where
    I: Unpin,
    P: Unpin
[src]

impl<I, St, F> Unpin for Scan<I, St, F> where
    F: Unpin,
    I: Unpin,
    St: Unpin
[src]

impl<I, U, F> Unpin for FlatMap<I, U, F> where
    F: Unpin,
    I: Unpin,
    <U as IntoIterator>::IntoIter: Unpin
[src]

impl<Idx> Unpin for sp_std::ops::Range<Idx> where
    Idx: Unpin
[src]

impl<Idx> Unpin for RangeFrom<Idx> where
    Idx: Unpin
[src]

impl<Idx> Unpin for RangeInclusive<Idx> where
    Idx: Unpin
[src]

impl<Idx> Unpin for RangeTo<Idx> where
    Idx: Unpin
[src]

impl<Idx> Unpin for RangeToInclusive<Idx> where
    Idx: Unpin
[src]

impl<K, V> Unpin for BTreeMap<K, V>[src]

impl<K, V> Unpin for sp_std::collections::btree_map::IntoIter<K, V>[src]

impl<K, V> Unpin for IntoKeys<K, V>[src]

impl<K, V> Unpin for IntoValues<K, V>[src]

impl<T> Unpin for Bound<T> where
    T: Unpin
[src]

impl<T> Unpin for TryLockError<T> where
    T: Unpin
[src]

impl<T> Unpin for TrySendError<T> where
    T: Unpin
[src]

impl<T> Unpin for BTreeSet<T>[src]

impl<T> Unpin for sp_std::collections::btree_set::IntoIter<T>[src]

impl<T> Unpin for sp_std::collections::vec_deque::IntoIter<T> where
    T: Unpin
[src]

impl<T> Unpin for VecDeque<T> where
    T: Unpin
[src]

impl<T> Unpin for Empty<T> where
    T: Unpin
[src]

impl<T> Unpin for sp_std::iter::Once<T> where
    T: Unpin
[src]

impl<T> Unpin for Rev<T> where
    T: Unpin
[src]

impl<T> Unpin for Discriminant<T> where
    <T as DiscriminantKind>::Discriminant: Unpin
[src]

impl<T> Unpin for Wrapping<T> where
    T: Unpin
[src]

impl<T> Unpin for Reverse<T> where
    T: Unpin
[src]

impl<T> Unpin for sp_std::result::IntoIter<T> where
    T: Unpin
[src]

impl<T> Unpin for AtomicPtr<T>[src]

impl<T> Unpin for sp_std::sync::mpsc::IntoIter<T>[src]

impl<T> Unpin for Receiver<T>[src]

impl<T> Unpin for SendError<T> where
    T: Unpin
[src]

impl<T> Unpin for Sender<T>[src]

impl<T> Unpin for SyncSender<T>[src]

impl<T> Unpin for PoisonError<T> where
    T: Unpin
[src]

impl<T> Unpin for MaybeUninit<T> where
    T: Unpin
[src]

impl<T, A> Unpin for Vec<T, A> where
    A: Unpin,
    T: Unpin
[src]

impl<T, A> Unpin for sp_std::vec::IntoIter<T, A> where
    A: Unpin,
    T: Unpin
[src]

impl<T, E> Unpin for Result<T, E> where
    E: Unpin,
    T: Unpin
[src]

impl<T, F> Unpin for Successors<T, F> where
    F: Unpin,
    T: Unpin
[src]

impl<T: ?Sized> Unpin for Cell<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for RefCell<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for UnsafeCell<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for PhantomData<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for ManuallyDrop<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for NonNull<T>[src]

impl<T: ?Sized> Unpin for sp_std::rc::Weak<T>[src]

impl<T: ?Sized> Unpin for Mutex<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for RwLock<T> where
    T: Unpin
[src]

impl<T: ?Sized> Unpin for sp_std::sync::Weak<T>[src]

impl<Y, R> Unpin for GeneratorState<Y, R> where
    R: Unpin,
    Y: Unpin
[src]

Loading content...