Trait frame_support::dispatch::marker::Unpin 1.33.0[−][src]
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.
Implementations on Foreign Types
impl Unpin for Argument
impl Unpin for FormatSpec
impl Unpin for Alignment
impl Unpin for Count
impl<'__pin, Si, Item, E> Unpin for SinkErrInto<Si, Item, E> where
Si: Sink<Item>,
__Origin<'__pin, Si, Item, E>: Unpin,
impl<F> Unpin for PollFn<F>
impl<'__pin, St1, St2, Clos, State> Unpin for SelectWithStrategy<St1, St2, Clos, State> where
__Origin<'__pin, St1, St2, Clos, State>: Unpin,
impl<'__pin, St, Fut, F> Unpin for TakeWhile<St, Fut, F> where
St: Stream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, Fut1, Fut2, Fut3> Unpin for TryJoin3<Fut1, Fut2, Fut3> where
Fut1: TryFuture,
Fut2: TryFuture,
Fut3: TryFuture,
__Origin<'__pin, Fut1, Fut2, Fut3>: Unpin,
impl<'__pin, St, S, Fut, F> Unpin for Scan<St, S, Fut, F> where
St: Stream,
__Origin<'__pin, St, S, Fut, F>: Unpin,
impl<'__pin, St, Fut, F> Unpin for TryFilterMap<St, Fut, F> where
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, Fut1, Fut2, F> Unpin for Then<Fut1, Fut2, F> where
__Origin<'__pin, Fut1, Fut2, F>: Unpin,
impl<'__pin, St, Fut, F> Unpin for TryForEach<St, Fut, F> where
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, St1, St2> Unpin for Zip<St1, St2> where
St1: Stream,
St2: Stream,
__Origin<'__pin, St1, St2>: Unpin,
impl<T> Unpin for AllowStdIo<T>
impl<T> Unpin for Compat01As03<T>
impl<'__pin, St, Fut, F> Unpin for Filter<St, Fut, F> where
St: Stream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, St, Fut, F> Unpin for ForEachConcurrent<St, Fut, F> where
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, 'a, St, T> Unpin for NextIfEq<'a, St, T> where
T: ?Sized,
St: Stream,
__Origin<'__pin, 'a, St, T>: Unpin,
impl<'__pin, 'a, St, F> Unpin for NextIf<'a, St, F> where
St: Stream,
__Origin<'__pin, 'a, St, F>: Unpin,
impl<St> Unpin for IntoAsyncRead<St> where
St: TryStream<Error = Error> + Unpin,
<St as TryStream>::Ok: AsRef<[u8]>,
impl<'__pin, St, Fut, F> Unpin for TryTakeWhile<St, Fut, F> where
St: TryStream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<T> Unpin for Repeat<T>
impl<'__pin, Fut1, Fut2, Fut3, Fut4> Unpin for Join4<Fut1, Fut2, Fut3, Fut4> where
Fut1: Future,
Fut2: Future,
Fut3: Future,
Fut4: Future,
__Origin<'__pin, Fut1, Fut2, Fut3, Fut4>: Unpin,
impl<'__pin, Fut1, Fut2, F> Unpin for AndThen<Fut1, Fut2, F> where
__Origin<'__pin, Fut1, Fut2, F>: Unpin,
impl<'__pin, Fut1, Fut2, Fut3, Fut4, Fut5> Unpin for TryJoin5<Fut1, Fut2, Fut3, Fut4, Fut5> where
Fut1: TryFuture,
Fut2: TryFuture,
Fut3: TryFuture,
Fut4: TryFuture,
Fut5: TryFuture,
__Origin<'__pin, Fut1, Fut2, Fut3, Fut4, Fut5>: Unpin,
impl<'__pin, St, Si> Unpin for Forward<St, Si> where
St: TryStream,
__Origin<'__pin, St, Si>: Unpin,
impl<'__pin, 'a, R, W> Unpin for CopyBuf<'a, R, W> where
W: ?Sized,
__Origin<'__pin, 'a, R, W>: Unpin,
impl<T> Unpin for Ready<T>
impl<'__pin, St, Fut, F> Unpin for TrySkipWhile<St, Fut, F> where
St: TryStream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<T> Unpin for Drain<T>
impl<'__pin, St, Fut, F> Unpin for TryForEachConcurrent<St, Fut, F> where
__Origin<'__pin, St, Fut, F>: Unpin,
impl<F> Unpin for Lazy<F>
impl<'_, T> Unpin for BiLockAcquire<'_, T>
impl<'__pin, Fut1, Fut2> Unpin for TryFlatten<Fut1, Fut2> where
__Origin<'__pin, Fut1, Fut2>: Unpin,
impl<'__pin, Fut1, Fut2, Fut3, Fut4, Fut5> Unpin for Join5<Fut1, Fut2, Fut3, Fut4, Fut5> where
Fut1: Future,
Fut2: Future,
Fut3: Future,
Fut4: Future,
Fut5: Future,
__Origin<'__pin, Fut1, Fut2, Fut3, Fut4, Fut5>: Unpin,
impl<S> Unpin for SplitStream<S>
impl<I> Unpin for Iter<I>
impl<'__pin, St, Fut, T, F> Unpin for TryFold<St, Fut, T, F> where
__Origin<'__pin, St, Fut, T, F>: Unpin,
impl<S, Item> Unpin for SplitSink<S, Item>
impl<'__pin, St, Fut, F> Unpin for SkipWhile<St, Fut, F> where
St: Stream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, St, Fut, F> Unpin for TryFilter<St, Fut, F> where
St: TryStream,
__Origin<'__pin, St, Fut, F>: Unpin,
impl<'__pin, Fut1, Fut2> Unpin for TryJoin<Fut1, Fut2> where
Fut1: TryFuture,
Fut2: TryFuture,
__Origin<'__pin, Fut1, Fut2>: Unpin,
impl<T> Unpin for Empty<T>
impl<'__pin, Fut1, Fut2, Fut3, Fut4> Unpin for TryJoin4<Fut1, Fut2, Fut3, Fut4> where
Fut1: TryFuture,
Fut2: TryFuture,
Fut3: TryFuture,
Fut4: TryFuture,
__Origin<'__pin, Fut1, Fut2, Fut3, Fut4>: Unpin,
impl<'__pin, St, Fut, T, F> Unpin for Fold<St, Fut, T, F> where
__Origin<'__pin, St, Fut, T, F>: Unpin,
impl<'__pin, Si, Item, U, St, F> Unpin for WithFlatMap<Si, Item, U, St, F> where
__Origin<'__pin, Si, Item, U, St, F>: Unpin,
impl<'__pin, Fut1, Fut2> Unpin for Join<Fut1, Fut2> where
Fut1: Future,
Fut2: Future,
__Origin<'__pin, Fut1, Fut2>: Unpin,
impl<S, SinkItem> Unpin for Compat01As03Sink<S, SinkItem>
impl<'__pin, St, Fut> Unpin for TakeUntil<St, Fut> where
Fut: Future,
St: Stream,
__Origin<'__pin, St, Fut>: Unpin,
impl<F> Unpin for PollFn<F>
impl<'__pin, Fut1, Fut2, F> Unpin for OrElse<Fut1, Fut2, F> where
__Origin<'__pin, Fut1, Fut2, F>: Unpin,
impl<'__pin, Si, Item, U, Fut, F> Unpin for With<Si, Item, U, Fut, F> where
__Origin<'__pin, Si, Item, U, Fut, F>: Unpin,
impl<T> Unpin for Pending<T>
impl<'__pin, St, FromA, FromB> Unpin for Unzip<St, FromA, FromB> where
__Origin<'__pin, St, FromA, FromB>: Unpin,
impl<'__pin, Fut1, Fut2, Fut3> Unpin for Join3<Fut1, Fut2, Fut3> where
Fut1: Future,
Fut2: Future,
Fut3: Future,
__Origin<'__pin, Fut1, Fut2, Fut3>: Unpin,
impl<'__pin, St> Unpin for Buffered<St> where
St: Stream,
__Origin<'__pin, St>: Unpin,
<St as Stream>::Item: Future,
impl<Fut> Unpin for FuturesUnordered<Fut>
impl<'__pin, Fut> Unpin for TryFlattenStream<Fut> where
Fut: TryFuture,
__Origin<'__pin, Fut>: Unpin,
impl<T> Unpin for Pending<T>
impl<'__pin, St> Unpin for TryBuffered<St> where
St: TryStream,
__Origin<'__pin, St>: Unpin,
<St as TryStream>::Ok: TryFuture,
impl<'_, Si, St> Unpin for SendAll<'_, Si, St> where
St: TryStream + Unpin + ?Sized,
Si: Unpin + ?Sized,
impl<'_, T> Unpin for LocalFutureObj<'_, T>
impl<'_, T> Unpin for FutureObj<'_, T>
impl<T> Unpin for Sender<T>
impl<T> Unpin for UnboundedReceiver<T>
impl<T> Unpin for Receiver<T>
impl<T> Unpin for Receiver<T>
Implementors
Auto implementors
impl Unpin for DispatchError
impl Unpin for InvalidTransaction
impl Unpin for TransactionSource
impl Unpin for TransactionValidityError
impl Unpin for UnknownTransaction
impl Unpin for KillStorageResult
impl Unpin for Everything
impl Unpin for BalanceStatus
impl Unpin for DepositConsequence
impl Unpin for ExistenceRequirement
impl Unpin for DispatchClass
impl Unpin for FrameTransactionPriority
impl Unpin for EventMetadata
impl Unpin for OuterEventMetadata
impl Unpin for CheckInherentsResult
impl Unpin for Instance10
impl Unpin for Instance11
impl Unpin for Instance12
impl Unpin for Instance13
impl Unpin for Instance14
impl Unpin for Instance15
impl Unpin for Instance16
impl Unpin for Blake2_128
impl Unpin for Blake2_128Concat
impl Unpin for Blake2_256
impl Unpin for InherentData
impl Unpin for Twox64Concat
impl Unpin for ValidTransaction
impl Unpin for OptionQuery
impl Unpin for ValueQuery
impl Unpin for GetDefault
impl Unpin for SaturatingCurrencyToVote
impl Unpin for StorageInfo
impl Unpin for StorageVersion
impl Unpin for U128CurrencyToVote
impl Unpin for WithdrawReasons
impl Unpin for BlockExecutionWeight
impl Unpin for ExtrinsicBaseWeight
impl Unpin for ParityDbWeight
impl Unpin for RocksDbWeight
impl Unpin for DispatchInfo
impl Unpin for PostDispatchInfo
impl Unpin for RuntimeDbWeight
impl Unpin for CallMetadata
impl Unpin for DefaultByteGetter
impl Unpin for ErrorMetadata
impl Unpin for FunctionArgumentMetadata
impl Unpin for FunctionMetadata
impl Unpin for ModuleConstantMetadata
impl<'a, 'b> Unpin for DebugStruct<'a, 'b> where
'b: 'a,
impl<'a, 'b> Unpin for DebugTuple<'a, 'b> where
'b: 'a,
impl<'a, T, S> Unpin for BoundedSlice<'a, T, S> where
S: Unpin,
impl<A, B> Unpin for SameOrOther<A, B> where
A: Unpin,
B: Unpin,
impl<A, B, OnDrop, OppositeOnDrop> Unpin for frame_support::traits::tokens::fungibles::Imbalance<A, B, OnDrop, OppositeOnDrop> where
A: Unpin,
B: Unpin,
OnDrop: Unpin,
OppositeOnDrop: Unpin,
impl<B, O> Unpin for DecodeDifferent<B, O> where
B: Unpin,
O: Unpin,
impl<B, OnDrop, OppositeOnDrop> Unpin for frame_support::traits::tokens::fungible::Imbalance<B, OnDrop, OppositeOnDrop> where
B: Unpin,
OnDrop: Unpin,
OppositeOnDrop: Unpin,
impl<B, PositiveImbalance> Unpin for SignedImbalance<B, PositiveImbalance> where
PositiveImbalance: Unpin,
<PositiveImbalance as Imbalance<B>>::Opposite: Unpin,
impl<Balance> Unpin for WithdrawConsequence<Balance> where
Balance: Unpin,
impl<Balance> Unpin for WeightToFeeCoefficient<Balance> where
Balance: Unpin,
impl<Balance, Imbalance, Part1, Target1, Part2, Target2> Unpin for SplitTwoWays<Balance, Imbalance, Part1, Target1, Part2, Target2> where
Balance: Unpin,
Imbalance: Unpin,
Part1: Unpin,
Part2: Unpin,
Target1: Unpin,
Target2: Unpin,
impl<BlockNumber> Unpin for DispatchTime<BlockNumber> where
BlockNumber: Unpin,
impl<E> Unpin for MakeFatalError<E> where
E: Unpin,
impl<F, A, AccountId> Unpin for frame_support::traits::tokens::fungible::ItemOf<F, A, AccountId> where
A: Unpin,
AccountId: Unpin,
F: Unpin,
impl<F, A, AccountId> Unpin for frame_support::traits::tokens::nonfungible::ItemOf<F, A, AccountId> where
A: Unpin,
AccountId: Unpin,
F: Unpin,
impl<F, T> Unpin for ClearFilterGuard<F, T> where
T: Unpin,
<F as FilterStack<T>>::Stack: Unpin,
impl<F, T> Unpin for FilterStackGuard<F, T> where
F: Unpin,
T: Unpin,
impl<K, T, H> Unpin for StorageKeyIterator<K, T, H> where
H: Unpin,
K: Unpin,
T: Unpin,
impl<K, V, S> Unpin for BoundedBTreeMap<K, V, S> where
S: Unpin,
impl<OM> Unpin for AsContains<OM> where
OM: Unpin,
impl<Prefix, Hasher1, Key1, Hasher2, Key2, Value, QueryKind, OnEmpty, MaxValues> Unpin for StorageDoubleMap<Prefix, Hasher1, Key1, Hasher2, Key2, Value, QueryKind, OnEmpty, MaxValues> where
Hasher1: Unpin,
Hasher2: Unpin,
Key1: Unpin,
Key2: Unpin,
MaxValues: Unpin,
OnEmpty: Unpin,
Prefix: Unpin,
QueryKind: Unpin,
Value: Unpin,
impl<Prefix, Hasher, Key, Value, QueryKind, OnEmpty, MaxValues> Unpin for StorageMap<Prefix, Hasher, Key, Value, QueryKind, OnEmpty, MaxValues> where
Hasher: Unpin,
Key: Unpin,
MaxValues: Unpin,
OnEmpty: Unpin,
Prefix: Unpin,
QueryKind: Unpin,
Value: Unpin,
impl<Prefix, Key, Value, QueryKind, OnEmpty, MaxValues> Unpin for StorageNMap<Prefix, Key, Value, QueryKind, OnEmpty, MaxValues> where
Key: Unpin,
MaxValues: Unpin,
OnEmpty: Unpin,
Prefix: Unpin,
QueryKind: Unpin,
Value: Unpin,
impl<Prefix, Value, QueryKind, OnEmpty> Unpin for StorageValue<Prefix, Value, QueryKind, OnEmpty> where
OnEmpty: Unpin,
Prefix: Unpin,
QueryKind: Unpin,
Value: Unpin,
impl<R> Unpin for TransactionOutcome<R> where
R: Unpin,
impl<T> Unpin for StorageIterator<T> where
T: Unpin,
impl<T> Unpin for ChildTriePrefixIterator<T>
impl<T> Unpin for KeyPrefixIterator<T>
impl<T> Unpin for PrefixIterator<T>
impl<T> Unpin for IdentityFee<T> where
T: Unpin,
impl<T> Unpin for PerDispatchClass<T> where
T: Unpin,
impl<T, S> Unpin for BoundedBTreeSet<T, S> where
S: Unpin,
impl<T, S> Unpin for BoundedVec<T, S> where
S: Unpin,
T: Unpin,
impl<T, S> Unpin for WeakBoundedVec<T, S> where
S: Unpin,
T: Unpin,
impl<T: ?Sized> Unpin for PhantomData<T> where
T: Unpin,
impl<WD, CD, PF> Unpin for FunctionOf<WD, CD, PF> where
CD: Unpin,
PF: Unpin,
WD: Unpin,