1.33.0[][src]Trait frame_support::dispatch::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());

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 Unpin for Waker[src]

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

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

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

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

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

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

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

impl<Fut> Unpin for SelectOk<Fut> where
    Fut: Unpin
[src]

impl<'_, R> Unpin for ReadVectored<'_, R> where
    R: Unpin + ?Sized
[src]

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

impl<'a, R, W> Unpin for Copy<'a, R, W> where
    R: AsyncRead,
    W: ?Sized,
    CopyBuf<'a, BufReader<R>, W>: Unpin
[src]

impl<'_, W> Unpin for Write<'_, W> where
    W: Unpin + ?Sized
[src]

impl<St, Fut, F> Unpin for AndThen<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<Fut> Unpin for Once<Fut> where
    Fut: Unpin
[src]

impl<'_, St> Unpin for Peek<'_, St> where
    St: Stream
[src]

impl<St1, St2> Unpin for Zip<St1, St2> where
    St1: Stream,
    St2: Stream,
    Fuse<St1>: Unpin,
    Fuse<St2>: Unpin
[src]

impl<St, C> Unpin for Collect<St, C> where
    St: Unpin
[src]

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

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

impl<St, Fut, F> Unpin for TryFilter<St, Fut, F> where
    Fut: Unpin,
    St: TryStream + Unpin
[src]

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

impl<St, Si> Unpin for Forward<St, Si> where
    Si: Unpin,
    St: Unpin + TryStream
[src]

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

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

impl<'_, R> Unpin for ReadToString<'_, R> where
    R: Unpin + ?Sized
[src]

impl<St> Unpin for TryFlatten<St> where
    St: TryStream + Unpin,
    <St as TryStream>::Ok: Unpin
[src]

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

impl<'_, R, W> Unpin for CopyBuf<'_, R, W> where
    R: Unpin,
    W: ?Sized
[src]

impl<St, Fut, F> Unpin for Then<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<St, Fut, F> Unpin for TryForEach<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<St> Unpin for Chunks<St> where
    St: Unpin + Stream
[src]

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

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

impl<'_, W> Unpin for WriteAll<'_, W> where
    W: Unpin + ?Sized
[src]

impl<'_, Si, Item> Unpin for Flush<'_, Si, Item> where
    Si: Unpin + ?Sized
[src]

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

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

impl<'_, R> Unpin for ReadToEnd<'_, R> where
    R: Unpin + ?Sized
[src]

impl<Fut, E> Unpin for ErrInto<Fut, E> where
    Fut: Unpin
[src]

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

impl<St, Fut, F> Unpin for SkipWhile<St, Fut, F> where
    Fut: Unpin,
    St: Unpin + Stream
[src]

impl<Fut, F> Unpin for MapErr<Fut, F> where
    Fut: Unpin
[src]

impl<Fut> Unpin for Abortable<Fut> where
    Fut: Unpin
[src]

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

impl<St> Unpin for Buffered<St> where
    St: Stream + Unpin,
    <St as Stream>::Item: Future
[src]

impl<St> Unpin for TryConcat<St> where
    St: Unpin + TryStream
[src]

impl<St, Fut, F> Unpin for ForEachConcurrent<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

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

impl<Fut, F> Unpin for Inspect<Fut, F> where
    Fut: Unpin + Future
[src]

impl<'_, S> Unpin for Seek<'_, S> where
    S: Unpin + ?Sized
[src]

impl<Fut> Unpin for UnitError<Fut> where
    Fut: Unpin
[src]

impl<St, Fut, T, F> Unpin for TryFold<St, Fut, T, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<I> Unpin for Iter<I>[src]

impl<Fut> Unpin for MaybeDone<Fut> where
    Fut: Unpin + Future
[src]

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

impl<Fut> Unpin for Remote<Fut> where
    Fut: Unpin + Future
[src]

impl<'_, Si, Item> Unpin for Send<'_, Si, Item> where
    Si: Unpin + ?Sized
[src]

impl<Fut, F> Unpin for InspectErr<Fut, F> where
    Fut: Unpin
[src]

impl<St> Unpin for Concat<St> where
    St: Unpin + Stream
[src]

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

impl<St, Fut, F> Unpin for TryForEachConcurrent<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<T, U> Unpin for Chain<T, U> where
    T: Unpin,
    U: Unpin
[src]

impl<Fut> Unpin for NeverError<Fut> where
    Fut: Unpin
[src]

impl<Fut, F> Unpin for UnwrapOrElse<Fut, F> where
    Fut: Unpin
[src]

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

impl<'_, R> Unpin for ReadLine<'_, R> where
    R: Unpin + ?Sized
[src]

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

impl<St> Unpin for IntoAsyncRead<St> where
    St: TryStream<Error = Error> + Unpin,
    <St as TryStream>::Ok: AsRef<[u8]>, 
[src]

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

impl<St, Fut, F> Unpin for OrElse<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<Si, Item, U, Fut, F> Unpin for With<Si, Item, U, Fut, F> where
    Fut: Unpin,
    Si: Unpin
[src]

impl<St> Unpin for Peekable<St> where
    St: Unpin + Stream
[src]

impl<S, Item> Unpin for SplitSink<S, Item>[src]

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

impl<'_, St> Unpin for Next<'_, St> where
    St: Unpin + ?Sized
[src]

impl<'_, R> Unpin for Read<'_, R> where
    R: Unpin + ?Sized
[src]

impl<St, Fut, T, F> Unpin for Fold<St, Fut, T, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<'_, R> Unpin for ReadUntil<'_, R> where
    R: Unpin + ?Sized
[src]

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

impl<Fut> Unpin for FuturesUnordered<Fut>[src]

impl<St> Unpin for BufferUnordered<St> where
    St: Stream + Unpin
[src]

impl<'_, Si, Item> Unpin for Close<'_, Si, Item> where
    Si: Unpin + ?Sized
[src]

impl<Si, Item> Unpin for Buffer<Si, Item> where
    Si: Unpin
[src]

impl<Si, F> Unpin for SinkMapErr<Si, F> where
    Si: Unpin
[src]

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

impl<Fut> Unpin for Shared<Fut> where
    Fut: Future
[src]

impl<St> Unpin for Flatten<St> where
    St: Stream + Unpin,
    <St as Stream>::Item: Unpin
[src]

impl<St, E> Unpin for ErrInto<St, E> where
    St: Unpin
[src]

impl<St, Fut, F> Unpin for TryFilterMap<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<St> Unpin for TryBufferUnordered<St> where
    St: TryStream + Unpin
[src]

impl<Si, Item, U, St, F> Unpin for WithFlatMap<Si, Item, U, St, F> where
    Si: Unpin,
    St: Unpin
[src]

impl<'_, W> Unpin for Flush<'_, W> where
    W: Unpin + ?Sized
[src]

impl<S> Unpin for SplitStream<S>[src]

impl<St, Fut, F> Unpin for ForEach<St, Fut, F> where
    Fut: Unpin,
    St: Unpin
[src]

impl<'_, St> Unpin for TryNext<'_, St> where
    St: Unpin + ?Sized
[src]

impl<Fut, F> Unpin for InspectOk<Fut, F> where
    Fut: Unpin
[src]

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

impl<'_, R> Unpin for ReadExact<'_, R> where
    R: Unpin + ?Sized
[src]

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

impl<W, Item> Unpin for IntoSink<W, Item> where
    W: Unpin
[src]

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

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

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

impl<St, Fut, F> Unpin for Filter<St, Fut, F> where
    Fut: Unpin,
    St: Stream + Unpin
[src]

impl<St> Unpin for StreamFuture<St> where
    St: Unpin
[src]

impl<St, C> Unpin for TryCollect<St, C> where
    St: Unpin + TryStream
[src]

impl<St, Fut, F> Unpin for TakeWhile<St, Fut, F> where
    Fut: Unpin,
    St: Unpin + Stream
[src]

impl<Fut> Unpin for SelectAll<Fut> where
    Fut: Unpin
[src]

impl<St1, St2> Unpin for Select<St1, St2> where
    St1: Unpin,
    St2: Unpin
[src]

impl<'_, W> Unpin for WriteVectored<'_, W> where
    W: Unpin + ?Sized
[src]

impl<R> Unpin for Lines<R> where
    R: Unpin
[src]

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

impl<St, S, Fut, F> Unpin for Scan<St, S, Fut, F> where
    Fut: Unpin,
    St: Unpin + Stream
[src]

impl<Fut, F> Unpin for MapOk<Fut, F> where
    Fut: Unpin
[src]

impl<'_, Si, St> Unpin for SendAll<'_, Si, St> where
    Si: Unpin + ?Sized,
    St: TryStream + Unpin + ?Sized
[src]

impl<St, Fut, F> Unpin for TrySkipWhile<St, Fut, F> where
    Fut: Unpin,
    St: Unpin + TryStream
[src]

impl<'_, W> Unpin for Close<'_, W> where
    W: Unpin + ?Sized
[src]

impl<'_, T> Unpin for LocalFutureObj<'_, T>[src]

impl<'_, T> Unpin for FutureObj<'_, T>[src]

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

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

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

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

impl Unpin for isize

impl Unpin for i8

impl Unpin for i16

impl Unpin for i32

impl Unpin for i64

impl Unpin for i128

impl Unpin for usize

impl Unpin for u8

impl Unpin for u16

impl Unpin for u32

impl Unpin for u64

impl Unpin for u128

impl Unpin for f32

impl Unpin for f64

impl Unpin for bool

impl Unpin for char

impl Unpin for str

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

impl Unpin for [u8]

Loading content...

Implementors

impl !Unpin for PhantomPinned[src]

Loading content...

Auto implementors

impl Unpin for DispatchError

impl Unpin for frame_support::dispatch::fmt::Alignment

impl Unpin for Never

impl Unpin for Void

impl Unpin for RuntimeMetadata

impl Unpin for StorageEntryModifier

impl Unpin for StorageEntryType

impl Unpin for StorageHasher

impl Unpin for ChildInfo

impl Unpin for ChildType

impl Unpin for BalanceStatus

impl Unpin for ExistenceRequirement

impl Unpin for WithdrawReason

impl Unpin for DispatchClass

impl Unpin for Pays

impl Unpin for RuntimeLogger

impl Unpin for Writer

impl Unpin for Error

impl Unpin for ErrorMetadata

impl Unpin for FunctionArgumentMetadata

impl Unpin for FunctionMetadata

impl Unpin for ModuleConstantMetadata

impl Unpin for EventMetadata

impl Unpin for OuterEventMetadata

impl Unpin for DefaultByteGetter

impl Unpin for ExtrinsicMetadata

impl Unpin for ModuleMetadata

impl Unpin for RuntimeMetadataPrefixed

impl Unpin for StorageEntryMetadata

impl Unpin for StorageMetadata

impl Unpin for Blake2_128

impl Unpin for Blake2_128Concat

impl Unpin for Blake2_256

impl Unpin for Identity

impl Unpin for Twox128

impl Unpin for Twox256

impl Unpin for Twox64Concat

impl Unpin for CallMetadata

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<'a> Unpin for Arguments<'a>

impl<'a> Unpin for Formatter<'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, T> Unpin for frame_support::dispatch::result::Iter<'a, T>

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

impl<B, O> Unpin for DecodeDifferent<B, O> where
    B: Unpin,
    O: Unpin

impl<B, P> Unpin for SignedImbalance<B, P> where
    P: Unpin,
    <P as Imbalance<B>>::Opposite: 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<E> Unpin for FnEncode<E>

impl<K, T, H> Unpin for StorageKeyIterator<K, T, H> where
    H: Unpin,
    K: Unpin,
    T: Unpin

impl<S, Created, Removed, K, T> Unpin for StorageMapShim<S, Created, Removed, K, T> where
    Created: Unpin,
    K: Unpin,
    Removed: Unpin,
    S: Unpin,
    T: Unpin

impl<T> Unpin for IntoIter<T> where
    T: Unpin

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

impl<T> Unpin for StorageIterator<T> where
    T: Unpin

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

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

impl<Value> Unpin for PrefixIterator<Value> where
    Value: Unpin

impl<WD, CD, PF> Unpin for FunctionOf<WD, CD, PF> where
    CD: Unpin,
    PF: Unpin,
    WD: Unpin

Loading content...