1.33.0[−][src]Trait scale_info::prelude::marker::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 *mut T where
T: ?Sized,
[src]
T: ?Sized,
impl<F> Unpin for PollFn<F>
[src]
impl<T> Unpin for Pending<T>
[src]
impl<'a, T> Unpin for &'a T where
T: 'a + ?Sized,
[src]
T: 'a + ?Sized,
impl<T> Unpin for *const T where
T: ?Sized,
[src]
T: ?Sized,
impl<'a, T> Unpin for &'a mut T where
T: 'a + ?Sized,
[src]
T: 'a + ?Sized,
impl<T> Unpin for Ready<T>
[src]
impl Unpin for Waker
[src]
impl<T> Unpin for Rc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Unpin for Arc<T> where
T: ?Sized,
[src]
T: ?Sized,
impl Unpin for isize
[src]
impl<T> Unpin for [T] where
T: Unpin,
[src]
T: Unpin,
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]
T: Unpin,
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, A> Unpin for Box<T, A> where
T: ?Sized,
A: Allocator + 'static,
[src]
T: ?Sized,
A: Allocator + 'static,
Auto implementors
impl Unpin for Fieldless
[src]
impl Unpin for Fields
[src]
impl Unpin for NamedFields
[src]
impl Unpin for NoFields
[src]
impl Unpin for NoVariants
[src]
impl Unpin for UnnamedFields
[src]
impl Unpin for VariantFields
[src]
impl Unpin for Variants
[src]
impl Unpin for PathAssigned
[src]
impl Unpin for PathNotAssigned
[src]
impl Unpin for PathError
[src]
impl Unpin for TypeDefPrimitive
[src]
impl Unpin for MetaForm
[src]
impl Unpin for Ordering
[src]
impl Unpin for TryReserveError
[src]
impl Unpin for scale_info::prelude::fmt::Alignment
[src]
impl Unpin for FpCategory
[src]
impl Unpin for IntErrorKind
[src]
impl Unpin for TypeId
[src]
impl Unpin for DefaultHasher
[src]
impl Unpin for RandomState
[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 FromUtf8Error
[src]
impl Unpin for FromUtf16Error
[src]
impl Unpin for String
[src]
impl Unpin for MetaType
[src]
impl Unpin for Registry
[src]
impl<'a> Unpin for Arguments<'a>
[src]
impl<'a> Unpin for Formatter<'a>
[src]
impl<'a> Unpin for scale_info::prelude::string::Drain<'a>
[src]
impl<'a, 'b> Unpin for DebugList<'a, 'b> where
'b: 'a,
[src]
'b: 'a,
impl<'a, 'b> Unpin for DebugMap<'a, 'b> where
'b: 'a,
[src]
'b: 'a,
impl<'a, 'b> Unpin for DebugSet<'a, 'b> where
'b: 'a,
[src]
'b: 'a,
impl<'a, 'b> Unpin for DebugStruct<'a, 'b> where
'b: 'a,
[src]
'b: 'a,
impl<'a, 'b> Unpin for DebugTuple<'a, 'b> where
'b: 'a,
[src]
'b: 'a,
impl<'a, I, A> Unpin for Splice<'a, I, A> where
I: Unpin,
[src]
I: Unpin,
impl<'a, K> Unpin for scale_info::prelude::collections::hash_set::Drain<'a, K> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K> Unpin for scale_info::prelude::collections::hash_set::Iter<'a, K>
[src]
impl<'a, K, F> Unpin for scale_info::prelude::collections::hash_set::DrainFilter<'a, K, F> where
F: Unpin,
[src]
F: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Entry<'a, K, V> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Entry<'a, K, V> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Iter<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::IterMut<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Keys<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::OccupiedEntry<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::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 scale_info::prelude::collections::btree_map::VacantEntry<'a, K, V> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::Values<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::btree_map::ValuesMut<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Drain<'a, K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Iter<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::IterMut<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Keys<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::OccupiedEntry<'a, K, V> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::VacantEntry<'a, K, V> where
K: Unpin,
[src]
K: Unpin,
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::Values<'a, K, V>
[src]
impl<'a, K, V> Unpin for scale_info::prelude::collections::hash_map::ValuesMut<'a, K, V>
[src]
impl<'a, K, V, F> Unpin for scale_info::prelude::collections::btree_map::DrainFilter<'a, K, V, F> where
F: Unpin,
[src]
F: Unpin,
impl<'a, K, V, F> Unpin for scale_info::prelude::collections::hash_map::DrainFilter<'a, K, V, F> where
F: Unpin,
[src]
F: Unpin,
impl<'a, K, V, S> Unpin for RawEntryMut<'a, K, V, S>
[src]
impl<'a, K, V, S> Unpin for RawEntryBuilder<'a, K, V, S>
[src]
impl<'a, K, V, S> Unpin for RawEntryBuilderMut<'a, K, V, S>
[src]
impl<'a, K, V, S> Unpin for RawOccupiedEntryMut<'a, K, V, S>
[src]
impl<'a, K, V, S> Unpin for RawVacantEntryMut<'a, K, V, S>
[src]
impl<'a, T> Unpin for Symbol<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::binary_heap::Drain<'a, T>
[src]
impl<'a, T> Unpin for DrainSorted<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::binary_heap::Iter<'a, T>
[src]
impl<'a, T> Unpin for PeekMut<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Difference<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Intersection<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Iter<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Range<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::SymmetricDifference<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::btree_set::Union<'a, T>
[src]
impl<'a, T> Unpin for Cursor<'a, T>
[src]
impl<'a, T> Unpin for CursorMut<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::linked_list::Iter<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::linked_list::IterMut<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::vec_deque::Drain<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::vec_deque::Iter<'a, T>
[src]
impl<'a, T> Unpin for scale_info::prelude::collections::vec_deque::IterMut<'a, T>
[src]
impl<'a, T, A> Unpin for scale_info::prelude::vec::Drain<'a, T, A>
[src]
impl<'a, T, F> Unpin for scale_info::prelude::collections::btree_set::DrainFilter<'a, T, F> where
F: Unpin,
[src]
F: Unpin,
impl<'a, T, F> Unpin for scale_info::prelude::collections::linked_list::DrainFilter<'a, T, F> where
F: Unpin,
[src]
F: Unpin,
impl<'a, T, F, A> Unpin for scale_info::prelude::vec::DrainFilter<'a, T, F, A> where
F: Unpin,
[src]
F: Unpin,
impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Difference<'a, T, S>
[src]
impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Intersection<'a, T, S>
[src]
impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::SymmetricDifference<'a, T, S>
[src]
impl<'a, T, S> Unpin for scale_info::prelude::collections::hash_set::Union<'a, T, S>
[src]
impl<H> Unpin for BuildHasherDefault<H> where
H: Unpin,
[src]
H: Unpin,
impl<K> Unpin for scale_info::prelude::collections::hash_set::IntoIter<K> where
K: Unpin,
[src]
K: Unpin,
impl<K, V> Unpin for scale_info::prelude::collections::btree_map::IntoIter<K, V>
[src]
impl<K, V> Unpin for scale_info::prelude::collections::btree_map::IntoKeys<K, V>
[src]
impl<K, V> Unpin for scale_info::prelude::collections::btree_map::IntoValues<K, V>
[src]
impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoIter<K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoKeys<K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<K, V> Unpin for scale_info::prelude::collections::hash_map::IntoValues<K, V> where
K: Unpin,
V: Unpin,
[src]
K: Unpin,
V: Unpin,
impl<K, V> Unpin for BTreeMap<K, V>
[src]
impl<K, V, S> Unpin for HashMap<K, V, S> where
K: Unpin,
S: Unpin,
V: Unpin,
[src]
K: Unpin,
S: Unpin,
V: Unpin,
impl<S> Unpin for TypeBuilder<S>
[src]
impl<S> Unpin for PortableForm<S> where
S: Unpin,
[src]
S: Unpin,
impl<S> Unpin for PortableRegistry<S> where
S: Unpin,
[src]
S: Unpin,
impl<T> Unpin for TypeDef<T> where
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
[src]
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
impl<T> Unpin for Bound<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for FieldsBuilder<T>
[src]
impl<T> Unpin for VariantsBuilder<T>
[src]
impl<T> Unpin for Interner<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for UntrackedSymbol<T>
[src]
impl<T> Unpin for Reverse<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for scale_info::prelude::collections::binary_heap::IntoIter<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for IntoIterSorted<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for scale_info::prelude::collections::btree_set::IntoIter<T>
[src]
impl<T> Unpin for scale_info::prelude::collections::linked_list::IntoIter<T>
[src]
impl<T> Unpin for BTreeSet<T>
[src]
impl<T> Unpin for BinaryHeap<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for LinkedList<T>
[src]
impl<T> Unpin for VecDeque<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for scale_info::prelude::collections::vec_deque::IntoIter<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for Discriminant<T>
[src]
impl<T> Unpin for Wrapping<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> Unpin for Field<T> where
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
[src]
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
impl<T> Unpin for Path<T> where
<T as Form>::String: Unpin,
[src]
<T as Form>::String: Unpin,
impl<T> Unpin for Type<T> where
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
[src]
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefArray<T> where
<T as Form>::Type: Unpin,
[src]
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefComposite<T> where
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
[src]
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefPhantom<T> where
<T as Form>::Type: Unpin,
[src]
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefSequence<T> where
<T as Form>::Type: Unpin,
[src]
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefTuple<T> where
<T as Form>::Type: Unpin,
[src]
<T as Form>::Type: Unpin,
impl<T> Unpin for TypeDefVariant<T> where
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
[src]
<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,
[src]
<T as Form>::String: Unpin,
<T as Form>::Type: Unpin,
impl<T> Unpin for MaybeUninit<T> where
T: Unpin,
[src]
T: Unpin,
impl<T, A> Unpin for scale_info::prelude::vec::IntoIter<T, A> where
A: Unpin,
T: Unpin,
[src]
A: Unpin,
T: Unpin,
impl<T, A> Unpin for Vec<T, A> where
A: Unpin,
T: Unpin,
[src]
A: Unpin,
T: Unpin,
impl<T, S> Unpin for HashSet<T, S> where
S: Unpin,
T: Unpin,
[src]
S: Unpin,
T: Unpin,
impl<T: ?Sized> Unpin for PhantomData<T> where
T: Unpin,
[src]
T: Unpin,
impl<T: ?Sized> Unpin for ManuallyDrop<T> where
T: Unpin,
[src]
T: Unpin,