Trait scale_info::prelude::marker::Unpin

1.33.0 · source ·
pub auto trait Unpin { }
Expand description

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.

Implementors§

source§

impl !Unpin for PhantomPinned

1.36.0 · source§

impl Unpin for Waker

source§

impl<Dyn> Unpin for DynMetadata<Dyn>
where Dyn: ?Sized,

1.64.0 · source§

impl<F> Unpin for PollFn<F>
where F: Unpin,

source§

impl<I> Unpin for FromIter<I>

1.38.0 · source§

impl<T> Unpin for *const T
where T: ?Sized,

1.38.0 · source§

impl<T> Unpin for *mut T
where T: ?Sized,

source§

impl<T> Unpin for &T
where T: ?Sized,

source§

impl<T> Unpin for &mut T
where T: ?Sized,

1.48.0 · source§

impl<T> Unpin for Ready<T>

source§

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

source§

impl<T, A> Unpin for Rc<T, A>
where A: Allocator, T: ?Sized,

source§

impl<T, A> Unpin for Arc<T, A>
where A: Allocator, T: ?Sized,

Auto implementors§

§

impl Unpin for NamedFields

§

impl Unpin for NoFields

§

impl Unpin for UnnamedFields

§

impl Unpin for NameAssigned

§

impl Unpin for NameNotAssigned

§

impl Unpin for TypeAssigned

§

impl Unpin for TypeNotAssigned

§

impl Unpin for PathAssigned

§

impl Unpin for PathNotAssigned

§

impl Unpin for IndexAssigned

§

impl Unpin for IndexNotAssigned

§

impl Unpin for PathError

§

impl Unpin for TypeDefPrimitive

§

impl Unpin for MetaForm

§

impl Unpin for PortableForm

§

impl Unpin for scale_info::prelude::cmp::Ordering

§

impl Unpin for TryReserveErrorKind

§

impl Unpin for Alignment

§

impl Unpin for FpCategory

§

impl Unpin for IntErrorKind

§

impl Unpin for scale_info::prelude::sync::atomic::Ordering

§

impl Unpin for RecvTimeoutError

§

impl Unpin for TryRecvError

§

impl Unpin for MetaType

§

impl Unpin for PortableRegistry

§

impl Unpin for PortableRegistryBuilder

§

impl Unpin for PortableType

§

impl Unpin for Registry

§

impl Unpin for TypeId

§

impl Unpin for TryReserveError

§

impl Unpin for Error

§

impl Unpin for DefaultHasher

§

impl Unpin for RandomState

§

impl Unpin for SipHasher

§

impl Unpin for Assume

§

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 FromUtf8Error

§

impl Unpin for FromUtf16Error

§

impl Unpin for String

§

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 RecvError

§

impl Unpin for Barrier

§

impl Unpin for BarrierWaitResult

§

impl Unpin for Condvar

§

impl Unpin for scale_info::prelude::sync::Once

§

impl Unpin for OnceState

§

impl Unpin for WaitTimeoutResult

§

impl Unpin for Duration

§

impl Unpin for Instant

§

impl Unpin for SystemTime

§

impl Unpin for SystemTimeError

§

impl Unpin for TryFromFloatSecsError

§

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

§

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

§

impl<'a> Unpin for scale_info::prelude::string::Drain<'a>

§

impl<'a, 'b> Unpin for DebugList<'a, 'b>

§

impl<'a, 'b> Unpin for DebugMap<'a, 'b>

§

impl<'a, 'b> Unpin for DebugSet<'a, 'b>

§

impl<'a, 'b> Unpin for DebugStruct<'a, 'b>

§

impl<'a, 'b> Unpin for DebugTuple<'a, 'b>

§

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

§

impl<'a, I> Unpin for ByRefSized<'a, I>

§

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

§

impl<'a, K> Unpin for scale_info::prelude::collections::hash_set::Drain<'a, K>

§

impl<'a, K> Unpin for scale_info::prelude::collections::hash_set::Iter<'a, K>

§

impl<'a, K, F> Unpin for scale_info::prelude::collections::hash_set::ExtractIf<'a, K, F>
where F: Unpin,

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Entry<'a, K, V>
where K: Unpin,

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Cursor<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Iter<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::IterMut<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Keys<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Range<'a, K, V>

§

impl<'a, K, V> Unpin for RangeMut<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Values<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::ValuesMut<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Drain<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Iter<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::IterMut<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Keys<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::OccupiedEntry<'a, K, V>
where K: Unpin,

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::OccupiedError<'a, K, V>
where K: Unpin, V: Unpin,

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::VacantEntry<'a, K, V>
where K: Unpin,

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Values<'a, K, V>

§

impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::ValuesMut<'a, K, V>

§

impl<'a, K, V, A> Unpin for scale_info::prelude::collections::btree_map::Entry<'a, K, V, A>
where A: Unpin, K: Unpin,

§

impl<'a, K, V, A> Unpin for scale_info::prelude::collections::btree_map::CursorMut<'a, K, V, A>

§

impl<'a, K, V, A> Unpin for scale_info::prelude::collections::btree_map::OccupiedEntry<'a, K, V, A>
where A: Unpin,

§

impl<'a, K, V, A> Unpin for scale_info::prelude::collections::btree_map::OccupiedError<'a, K, V, A>
where A: Unpin, V: Unpin,

§

impl<'a, K, V, A> Unpin for scale_info::prelude::collections::btree_map::VacantEntry<'a, K, V, A>
where A: Unpin, K: Unpin,

§

impl<'a, K, V, F> Unpin for scale_info::prelude::collections::hash_map::ExtractIf<'a, K, V, F>
where F: Unpin,

§

impl<'a, K, V, F, A> Unpin for scale_info::prelude::collections::btree_map::ExtractIf<'a, K, V, F, A>
where A: Unpin, F: Unpin,

§

impl<'a, K, V, S> Unpin for RawEntryMut<'a, K, V, S>

§

impl<'a, K, V, S> Unpin for RawEntryBuilder<'a, K, V, S>

§

impl<'a, K, V, S> Unpin for RawEntryBuilderMut<'a, K, V, S>

§

impl<'a, K, V, S> Unpin for RawOccupiedEntryMut<'a, K, V, S>

§

impl<'a, K, V, S> Unpin for RawVacantEntryMut<'a, K, V, S>

§

impl<'a, T> Unpin for Symbol<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::binary_heap::Iter<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Iter<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Range<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::SymmetricDifference<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Union<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::linked_list::Iter<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::linked_list::IterMut<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::vec_deque::Iter<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::collections::vec_deque::IterMut<'a, T>

§

impl<'a, T> Unpin for scale_info::prelude::sync::mpsc::Iter<'a, T>

§

impl<'a, T> Unpin for TryIter<'a, T>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::binary_heap::Drain<'a, T, A>

§

impl<'a, T, A> Unpin for DrainSorted<'a, T, A>

§

impl<'a, T, A> Unpin for PeekMut<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::btree_set::Difference<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::btree_set::Intersection<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::linked_list::Cursor<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::linked_list::CursorMut<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::collections::vec_deque::Drain<'a, T, A>

§

impl<'a, T, A> Unpin for scale_info::prelude::vec::Drain<'a, T, A>

§

impl<'a, T, F, A> Unpin for scale_info::prelude::collections::btree_set::ExtractIf<'a, T, F, A>
where A: Unpin, F: Unpin,

§

impl<'a, T, F, A> Unpin for scale_info::prelude::collections::linked_list::ExtractIf<'a, T, F, A>
where F: Unpin,

§

impl<'a, T, F, A> Unpin for scale_info::prelude::vec::ExtractIf<'a, T, F, A>
where F: Unpin,

§

impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Difference<'a, T, S>

§

impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Intersection<'a, T, S>

§

impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::SymmetricDifference<'a, T, S>

§

impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Union<'a, T, S>

§

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

§

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

§

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

§

impl<A> Unpin for Repeat<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<B, C> Unpin for ControlFlow<B, C>
where B: Unpin, C: Unpin,

§

impl<F> Unpin for Fields<F>

§

impl<F> Unpin for Variants<F>
where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<F> Unpin for FormatterFn<F>
where F: 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<F, N, T> Unpin for FieldBuilder<F, N, T>
where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<F, S> Unpin for TypeBuilder<F, S>
where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<F, S> Unpin for VariantBuilder<F, S>
where S: Unpin, <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<F, T> Unpin for FieldsBuilder<F, T>
where <F as Form>::String: Unpin, <F as Form>::Type: Unpin,

§

impl<H> Unpin for BuildHasherDefault<H>

§

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 Intersperse<I>
where I: Unpin, <I as Iterator>::Item: 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, F, const N: usize> Unpin for MapWindows<I, F, N>
where F: Unpin, I: Unpin, <I as Iterator>::Item: Unpin,

§

impl<I, G> Unpin for IntersperseWith<I, G>
where G: Unpin, I: Unpin, <I as Iterator>::Item: 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<I, const N: usize> Unpin for ArrayChunks<I, N>
where I: Unpin, <I as Iterator>::Item: Unpin,

§

impl<Idx> Unpin for scale_info::prelude::ops::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<K> Unpin for scale_info::prelude::collections::hash_set::IntoIter<K>
where K: Unpin,

§

impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoIter<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoKeys<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoValues<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V, A> Unpin for scale_info::prelude::collections::btree_map::IntoIter<K, V, A>
where A: Unpin,

§

impl<K, V, A> Unpin for scale_info::prelude::collections::btree_map::IntoKeys<K, V, A>
where A: Unpin,

§

impl<K, V, A> Unpin for scale_info::prelude::collections::btree_map::IntoValues<K, V, A>
where A: Unpin,

§

impl<K, V, A> Unpin for BTreeMap<K, V, A>
where A: Unpin,

§

impl<K, V, S> Unpin for HashMap<K, V, S>
where K: Unpin, S: Unpin, V: Unpin,

§

impl<T> Unpin for TypeDef<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

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

§

impl<T> Unpin for TryLockError<T>
where T: Unpin,

§

impl<T> Unpin for TrySendError<T>
where T: Unpin,

§

impl<T> Unpin for Interner<T>
where T: Unpin,

§

impl<T> Unpin for UntrackedSymbol<T>

§

impl<T> Unpin for Field<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

impl<T> Unpin for Path<T>
where <T as Form>::String: Unpin,

§

impl<T> Unpin for Type<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefArray<T>
where <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefBitSequence<T>
where <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefCompact<T>
where <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefComposite<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefSequence<T>
where <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefTuple<T>
where <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeDefVariant<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

impl<T> Unpin for TypeParameter<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

impl<T> Unpin for Variant<T>
where <T as Form>::String: Unpin, <T as Form>::Type: Unpin,

§

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

§

impl<T> Unpin for Empty<T>

§

impl<T> Unpin for scale_info::prelude::iter::Once<T>
where T: Unpin,

§

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

§

impl<T> Unpin for Discriminant<T>

§

impl<T> Unpin for Saturating<T>
where T: Unpin,

§

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

§

impl<T> Unpin for Yeet<T>
where T: Unpin,

§

impl<T> Unpin for UniqueRc<T>
where T: Unpin,

§

impl<T> Unpin for AtomicPtr<T>

§

impl<T> Unpin for scale_info::prelude::sync::mpsc::IntoIter<T>

§

impl<T> Unpin for Receiver<T>

§

impl<T> Unpin for SendError<T>
where T: Unpin,

§

impl<T> Unpin for Sender<T>

§

impl<T> Unpin for SyncSender<T>

§

impl<T> Unpin for OnceLock<T>
where T: Unpin,

§

impl<T> Unpin for PoisonError<T>
where T: Unpin,

§

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

§

impl<T, A> Unpin for scale_info::prelude::collections::binary_heap::IntoIter<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for IntoIterSorted<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for scale_info::prelude::collections::btree_set::IntoIter<T, A>
where A: Unpin,

§

impl<T, A> Unpin for scale_info::prelude::collections::linked_list::IntoIter<T, A>
where A: Unpin,

§

impl<T, A> Unpin for BTreeSet<T, A>
where A: Unpin,

§

impl<T, A> Unpin for BinaryHeap<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for LinkedList<T, A>
where A: Unpin,

§

impl<T, A> Unpin for VecDeque<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for scale_info::prelude::collections::vec_deque::IntoIter<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for scale_info::prelude::vec::IntoIter<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> Unpin for Vec<T, A>
where A: Unpin, T: Unpin,

§

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

§

impl<T, F> Unpin for LazyLock<T, F>
where F: Unpin, T: Unpin,

§

impl<T, S> Unpin for HashSet<T, S>
where S: Unpin, T: Unpin,

§

impl<T: ?Sized> Unpin for ThinBox<T>
where T: Unpin,

§

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

§

impl<T: ?Sized> Unpin for Exclusive<T>
where T: Unpin,

§

impl<T: ?Sized> Unpin for Mutex<T>
where T: Unpin,

§

impl<T: ?Sized> Unpin for RwLock<T>
where T: Unpin,

§

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

§

impl<T: ?Sized, A> Unpin for scale_info::prelude::rc::Weak<T, A>
where A: Unpin,

§

impl<T: ?Sized, A> Unpin for scale_info::prelude::sync::Weak<T, A>
where A: Unpin,

§

impl<Y, R> Unpin for CoroutineState<Y, R>
where R: Unpin, Y: Unpin,