Trait wasmer_types::lib::std::marker::Unpin

1.33.0 · source ·
pub auto trait Unpin { }
Available on crate feature std only.
Expand description

Types that do not require any pinning guarantees.

For information on what “pinning” is, see the pin module documentation.

Implementing the Unpin trait for T expresses the fact that T is pinning-agnostic: it shall not expose nor rely on any pinning guarantees. This, in turn, means that a Pin-wrapped pointer to such a type can feature a fully unrestricted API. In other words, if T: Unpin, a value of type T will not be bound by the invariants which pinning otherwise offers, even when “pinned” by a Pin<Ptr> pointing at it. When a value of type T is pointed at by a Pin<Ptr>, Pin will not restrict access to the pointee value like it normally would, thus allowing the user to do anything that they normally could with a non-Pin-wrapped Ptr to that value.

The idea of this trait is to alleviate the reduced ergonomics of APIs that require the use of Pin for soundness for some types, but which also want to be used by other types that don’t care about pinning. The prime example of such an API is Future::poll. There are many Future types that don’t care about pinning. These futures can implement Unpin and therefore get around the pinning related restrictions in the API, while still allowing the subset of Futures which do require pinning to be implemented soundly.

For more discussion on the consequences of Unpin within the wider scope of the pinning system, see the section about Unpin in the pin module.

Unpin has no consequence at all for non-pinned data. In particular, mem::replace happily moves !Unpin data, which would be immovable when pinned (mem::replace works for any &mut T, not just when T: Unpin).

However, you cannot use mem::replace on !Unpin data which is pinned by being wrapped inside a Pin<Ptr> pointing at it. This is because you cannot (safely) use a Pin<Ptr> to get an &mut T to its pointee value, which you would need to call mem::replace, 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. The compiler is free to take the conservative stance of marking types as Unpin so long as all of the types that compose its fields are also Unpin. This is because if a type implements Unpin, then it is unsound for that type’s implementation to rely on pinning-related guarantees for soundness, even when viewed through a “pinning” pointer! It is the responsibility of the implementor of a type that relies upon pinning for soundness to ensure that type is not marked as Unpin by adding PhantomPinned field. For more details, see the pin module docs.

Implementors§

1.33.0 · source§

impl !Unpin for PhantomPinned

source§

impl Unpin for LocalWaker

1.36.0 · source§

impl Unpin for Waker

source§

impl Unpin for AlignedVec

source§

impl<Dyn> Unpin for wasmer_types::lib::std::ptr::DynMetadata<Dyn>
where Dyn: ?Sized,

source§

impl<Dyn> Unpin for ptr_meta::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,

1.33.0 · source§

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

1.33.0 · source§

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

1.48.0 · source§

impl<T> Unpin for Ready<T>

1.28.0 · source§

impl<T> Unpin for NonZero<T>

1.33.0 · source§

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

1.33.0 · source§

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

1.33.0 · source§

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

Auto implementors§

§

impl !Unpin for ArchivedCompiledFunctionUnwindInfo

§

impl !Unpin for ArchivedFunctionAddressMap

§

impl !Unpin for ArchivedCompiledFunction

§

impl !Unpin for ArchivedCompiledFunctionFrameInfo

§

impl !Unpin for ArchivedFunctionBody

§

impl !Unpin for ArchivedCompileModuleInfo

§

impl !Unpin for ArchivedCustomSection

§

impl !Unpin for ArchivedSectionBody

§

impl !Unpin for ArchivedModuleMetadata

§

impl !Unpin for ArchivedOwnedDataInitializer

§

impl !Unpin for ArchivedSerializableCompilation

§

impl !Unpin for ArchivedSerializableModule

§

impl Unpin for RelocationKind

§

impl Unpin for RelocationKindResolver

§

impl Unpin for RelocationTarget

§

impl Unpin for RelocationTargetResolver

§

impl Unpin for CustomSectionProtection

§

impl Unpin for CustomSectionProtectionResolver

§

impl Unpin for Symbol

§

impl Unpin for SymbolResolver

§

impl Unpin for CpuFeature

§

impl Unpin for CompiledFunctionUnwindInfo

§

impl Unpin for CompiledFunctionUnwindInfoResolver

§

impl Unpin for Aarch64Architecture

§

impl Unpin for Architecture

§

impl Unpin for BinaryFormat

§

impl Unpin for CallingConvention

§

impl Unpin for Endianness

§

impl Unpin for Environment

§

impl Unpin for ExportIndex

§

impl Unpin for ExternType

§

impl Unpin for GlobalInit

§

impl Unpin for HashAlgorithm

§

impl Unpin for ImportIndex

§

impl Unpin for LibCall

§

impl Unpin for MemoryStyle

§

impl Unpin for ModuleHash

§

impl Unpin for Mutability

§

impl Unpin for OnCalledAction

§

impl Unpin for OperatingSystem

§

impl Unpin for PointerWidth

§

impl Unpin for TableStyle

§

impl Unpin for TrapCode

§

impl Unpin for Type

§

impl Unpin for Vendor

§

impl Unpin for CompileError

§

impl Unpin for DeserializeError

§

impl Unpin for ImportError

§

impl Unpin for MemoryError

§

impl Unpin for ParseCpuFeatureError

§

impl Unpin for PreInstantiationError

§

impl Unpin for SerializeError

§

impl Unpin for WasmError

§

impl Unpin for wasmer_types::lib::std::cmp::Ordering

§

impl Unpin for Infallible

§

impl Unpin for wasmer_types::lib::std::fmt::Alignment

§

impl Unpin for wasmer_types::lib::std::sync::atomic::Ordering

§

impl Unpin for RecvTimeoutError

§

impl Unpin for TryRecvError

§

impl Unpin for ArchivedInstructionAddressMap

§

impl Unpin for FunctionAddressMap

§

impl Unpin for FunctionAddressMapResolver

§

impl Unpin for InstructionAddressMap

§

impl Unpin for InstructionAddressMapResolver

§

impl Unpin for Compilation

§

impl Unpin for CompiledFunction

§

impl Unpin for CompiledFunctionFrameInfo

§

impl Unpin for CompiledFunctionFrameInfoResolver

§

impl Unpin for CompiledFunctionResolver

§

impl Unpin for Dwarf

§

impl Unpin for DwarfResolver

§

impl Unpin for FunctionBody

§

impl Unpin for FunctionBodyResolver

§

impl Unpin for CompileModuleInfo

§

impl Unpin for CompileModuleInfoResolver

§

impl Unpin for ArchivedRelocation

§

impl Unpin for Relocation

§

impl Unpin for RelocationResolver

§

impl Unpin for CustomSection

§

impl Unpin for CustomSectionResolver

§

impl Unpin for SectionBody

§

impl Unpin for SectionBodyResolver

§

impl Unpin for SectionIndex

§

impl Unpin for SectionIndexResolver

§

impl Unpin for ModuleMetadata

§

impl Unpin for ModuleMetadataResolver

§

impl Unpin for ModuleMetadataSymbolRegistry

§

impl Unpin for Target

§

impl Unpin for MiddlewareError

§

impl Unpin for ArchivedDataInitializerLocation

§

impl Unpin for Bytes

§

impl Unpin for CustomSectionIndex

§

impl Unpin for DataIndex

§

impl Unpin for DataInitializerLocation

§

impl Unpin for ElemIndex

§

impl Unpin for Features

§

impl Unpin for FrameInfo

§

impl Unpin for FunctionIndex

§

impl Unpin for FunctionType

§

impl Unpin for GlobalIndex

§

impl Unpin for GlobalType

§

impl Unpin for ImportKey

§

impl Unpin for LocalFunctionIndex

§

impl Unpin for LocalGlobalIndex

§

impl Unpin for LocalMemoryIndex

§

impl Unpin for LocalTableIndex

§

impl Unpin for Memory32

§

impl Unpin for Memory64

§

impl Unpin for MemoryIndex

§

impl Unpin for MemoryType

§

impl Unpin for MetadataHeader

§

impl Unpin for ModuleInfo

§

impl Unpin for OwnedDataInitializer

§

impl Unpin for PageCountOutOfRange

§

impl Unpin for Pages

§

impl Unpin for SerializableCompilation

§

impl Unpin for SerializableModule

§

impl Unpin for SignatureIndex

§

impl Unpin for SourceLoc

§

impl Unpin for StoreId

§

impl Unpin for TableIndex

§

impl Unpin for TableInitializer

§

impl Unpin for TableType

§

impl Unpin for TargetSharedSignatureIndex

§

impl Unpin for TrapInformation

§

impl Unpin for Triple

§

impl Unpin for V128

§

impl Unpin for VMBuiltinFunctionIndex

§

impl Unpin for VMOffsets

§

impl Unpin for TypeId

§

impl Unpin for BorrowError

§

impl Unpin for BorrowMutError

§

impl Unpin for Error

§

impl Unpin for DefaultHasher

§

impl Unpin for RandomState

§

impl Unpin for SipHasher

§

impl Unpin for Assume

§

impl Unpin for RangeFull

§

impl Unpin for wasmer_types::lib::std::ptr::Alignment

§

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 AtomicI128

§

impl Unpin for AtomicIsize

§

impl Unpin for AtomicU8

§

impl Unpin for AtomicU16

§

impl Unpin for AtomicU32

§

impl Unpin for AtomicU64

§

impl Unpin for AtomicU128

§

impl Unpin for AtomicUsize

§

impl Unpin for RecvError

§

impl Unpin for Barrier

§

impl Unpin for BarrierWaitResult

§

impl Unpin for Condvar

§

impl Unpin for wasmer_types::lib::std::sync::Once

§

impl Unpin for OnceState

§

impl Unpin for WaitTimeoutResult

§

impl Unpin for RawValue

§

impl<'a> Unpin for CompiledFunctionUnwindInfoReference<'a>

§

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

§

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

§

impl<'a> Unpin for EscapeAscii<'a>

§

impl<'a> Unpin for wasmer_types::lib::std::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> Unpin for Cow<'a, B>
where <B as ToOwned>::Owned: Unpin, B: ?Sized,

§

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

§

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

§

impl<'a, K, V> Unpin for wasmer_types::entity::Iter<'a, K, V>
where K: Unpin,

§

impl<'a, K, V> Unpin for wasmer_types::entity::IterMut<'a, K, V>
where K: Unpin,

§

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

§

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

§

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

§

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

§

impl<'a, T> Unpin for wasmer_types::lib::std::slice::Iter<'a, T>

§

impl<'a, T> Unpin for wasmer_types::lib::std::slice::IterMut<'a, T>

§

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

§

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

§

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

§

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

§

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

§

impl<'a, T> Unpin for wasmer_types::lib::std::sync::mpsc::Iter<'a, T>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a, T, A> Unpin for wasmer_types::lib::std::vec::Drain<'a, T, A>

§

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

§

impl<'a, T, P> Unpin for ChunkBy<'a, T, P>
where P: Unpin,

§

impl<'a, T, P> Unpin for ChunkByMut<'a, T, P>
where P: Unpin,

§

impl<'a, T, P> Unpin for RSplit<'a, T, P>
where P: Unpin,

§

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

§

impl<'a, T, P> Unpin for RSplitN<'a, T, P>
where P: Unpin,

§

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

§

impl<'a, T, P> Unpin for Split<'a, T, P>
where P: Unpin,

§

impl<'a, T, P> Unpin for SplitInclusive<'a, T, P>
where P: Unpin,

§

impl<'a, T, P> Unpin for SplitInclusiveMut<'a, T, P>
where P: Unpin,

§

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

§

impl<'a, T, P> Unpin for SplitN<'a, T, P>
where P: Unpin,

§

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

§

impl<'a, T, const N: usize> Unpin for wasmer_types::lib::std::slice::ArrayChunks<'a, T, N>

§

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

§

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

§

impl<'b, T> Unpin for Ref<'b, T>
where T: ?Sized,

§

impl<'b, T> Unpin for RefMut<'b, T>
where T: ?Sized,

§

impl<'data> Unpin for DataInitializer<'data>

§

impl<A> Unpin for Repeat<A>
where A: Unpin,

§

impl<A> Unpin for RepeatN<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 C: Unpin, B: 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<H> Unpin for BuildHasherDefault<H>

§

impl<I> Unpin for ExportsIterator<I>
where I: Unpin,

§

impl<I> Unpin for ImportsIterator<I>
where I: Unpin,

§

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 as Iterator>::Item as IntoIterator>::IntoIter: Unpin, I: Unpin,

§

impl<I> Unpin for Fuse<I>
where I: Unpin,

§

impl<I> Unpin for Intersperse<I>
where <I as Iterator>::Item: Sized + Unpin, I: 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 I: Unpin, F: Unpin,

§

impl<I, F> Unpin for Inspect<I, F>
where I: Unpin, F: Unpin,

§

impl<I, F> Unpin for Map<I, F>
where I: Unpin, F: 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 as Iterator>::Item: Unpin, I: 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 I: Unpin, F: Unpin, St: Unpin,

§

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

§

impl<I, const N: usize> Unpin for wasmer_types::lib::std::iter::ArrayChunks<I, N>
where I: Unpin, <I as Iterator>::Item: Unpin,

§

impl<Idx> Unpin for 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 Keys<K>
where K: Unpin,

§

impl<K, V> !Unpin for ArchivedPrimaryMap<K, V>

§

impl<K, V> Unpin for BoxedSlice<K, V>
where K: Unpin,

§

impl<K, V> Unpin for PrimaryMap<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> Unpin for SecondaryMap<K, V>
where V: Unpin, K: 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 PackedOption<T>
where T: Unpin,

§

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

§

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

§

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

§

impl<T> Unpin for Cell<T>
where T: Unpin + ?Sized,

§

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

§

impl<T> Unpin for RefCell<T>
where T: Unpin + ?Sized,

§

impl<T> Unpin for SyncUnsafeCell<T>
where T: Unpin + ?Sized,

§

impl<T> Unpin for UnsafeCell<T>
where T: Unpin + ?Sized,

§

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

§

impl<T> Unpin for Empty<T>

§

impl<T> Unpin for wasmer_types::lib::std::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 ManuallyDrop<T>
where T: Unpin + ?Sized,

§

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

§

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

§

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

§

impl<T> Unpin for AtomicPtr<T>

§

impl<T> Unpin for wasmer_types::lib::std::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 Exclusive<T>
where T: Unpin + ?Sized,

§

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

§

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

§

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

§

impl<T> Unpin for ReentrantLock<T>
where T: Unpin + ?Sized,

§

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

§

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

§

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

§

impl<T, A> Unpin for wasmer_types::lib::std::rc::Weak<T, A>
where A: Unpin, T: ?Sized,

§

impl<T, A> Unpin for wasmer_types::lib::std::sync::Weak<T, A>
where A: Unpin, T: ?Sized,

§

impl<T, A> Unpin for wasmer_types::lib::std::vec::IntoIter<T, A>
where T: Unpin, A: Unpin,

§

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

§

impl<T, F> Unpin for LazyCell<T, F>
where F: 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 T: Unpin, F: Unpin,

§

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