Trait ockam_core::lib::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<T> Unpin for JoinHandle<T>
impl Unpin for AccessError
impl Unpin for EscapeDefault
impl Unpin for BacktraceStatus
impl Unpin for BacktraceFrame
impl<'a, K, V, F> Unpin for DrainFilter<'a, K, V, F> where
F: Unpin,
impl<K, V> Unpin for IntoValues<K, V> where
K: Unpin,
V: Unpin,
impl<'a, K, V, S> Unpin for RawEntryBuilderMut<'a, K, V, S>
impl<'a, K, V, S> Unpin for RawEntryMut<'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, K, V, S> Unpin for RawEntryBuilder<'a, K, V, S>
impl<'a, K, V> Unpin for OccupiedEntry<'a, K, V> where
K: Unpin,
impl<'a, K, V> Unpin for VacantEntry<'a, K, V> where
K: Unpin,
impl<'a, K, V> Unpin for OccupiedError<'a, K, V> where
K: Unpin,
V: Unpin,
impl Unpin for RandomState
impl Unpin for DefaultHasher
impl<'a, K, F> Unpin for DrainFilter<'a, K, F> where
F: Unpin,
impl<'a, T, S> Unpin for Intersection<'a, T, S>
impl<'a, T, S> Unpin for Difference<'a, T, S>
impl<'a, T, S> Unpin for SymmetricDifference<'a, T, S>
impl<T> Unpin for IntoIterSorted<T> where
T: Unpin,
impl<'a, T> Unpin for DrainSorted<'a, T>
impl<'a, K, V> Unpin for OccupiedEntry<'a, K, V>
impl<'a, K, V> Unpin for OccupiedError<'a, K, V> where
V: Unpin,
impl<'a, K, V> Unpin for VacantEntry<'a, K, V> where
K: Unpin,
impl<K, V> Unpin for IntoValues<K, V>
impl<'a, K, V, F> Unpin for DrainFilter<'a, K, V, F> where
F: Unpin,
impl<'a, T> Unpin for Difference<'a, T>
impl<'a, T> Unpin for SymmetricDifference<'a, T>
impl<'a, T> Unpin for Intersection<'a, T>
impl<'a, T, F> Unpin for DrainFilter<'a, T, F> where
F: Unpin,
impl<'a, T, F> Unpin for DrainFilter<'a, T, F> where
F: Unpin,
impl Unpin for TryReserveError
impl<'a> Unpin for SplitPaths<'a>
impl Unpin for JoinPathsError
impl Unpin for FromBytesWithNulError
impl Unpin for FromVecWithNulError
impl Unpin for IntoStringError
impl<'f> Unpin for VaListImpl<'f>
impl Unpin for OpenOptions
impl Unpin for Permissions
impl Unpin for DirBuilder
impl<'a> Unpin for IoSliceMut<'a>
impl Unpin for Initializer
impl<W> Unpin for IntoInnerError<W> where
W: Unpin,
impl<W> Unpin for LineWriter<W> where
W: Unpin,
impl<'a> Unpin for StderrLock<'a>
impl<'a> Unpin for StdoutLock<'a>
impl Unpin for SocketAddr
impl<'a> Unpin for SocketAncillary<'a>
impl Unpin for UnixStream
impl<'a> Unpin for ScmCredentials<'a>
impl<'a> Unpin for AncillaryData<'a>
impl Unpin for UnixDatagram
impl Unpin for UnixListener
impl Unpin for SocketCred
impl Unpin for AncillaryError
impl<T> Unpin for AssertUnwindSafe<T> where
T: Unpin,
impl<'a> Unpin for PrefixComponent<'a>
impl<'a> Unpin for Components<'a>
impl Unpin for StripPrefixError
impl Unpin for ChildStdin
impl Unpin for ChildStdout
impl Unpin for ChildStderr
impl<'a> Unpin for CommandArgs<'a>
impl Unpin for ExitStatus
impl Unpin for ExitStatusError
impl<'a> Unpin for CommandEnvs<'a>
impl<T> Unpin for SyncSender<T>
impl Unpin for TryRecvError
impl Unpin for RecvTimeoutError
impl<T> Unpin for TrySendError<T> where
T: Unpin,
impl Unpin for AtomicBool
impl Unpin for AtomicIsize
impl Unpin for AtomicUsize
impl Unpin for BarrierWaitResult
impl Unpin for WaitTimeoutResult
impl<'a, T: ?Sized> Unpin for MutexGuard<'a, T>
impl<T> Unpin for PoisonError<T> where
T: Unpin,
impl<T> Unpin for TryLockError<T> where
T: Unpin,
impl<'a, T: ?Sized> Unpin for RwLockReadGuard<'a, T>
impl<'a, T: ?Sized> Unpin for RwLockWriteGuard<'a, T>
impl Unpin for SystemTime
impl Unpin for SystemTimeError
impl<T> Unpin for SyncOnceCell<T> where
T: Unpin,
impl Unpin for RawWakerVTable
impl Unpin for AllocError
impl Unpin for LayoutError
impl Unpin for Argument
impl Unpin for FormatSpec
impl Unpin for Alignment
impl Unpin for Count
impl Unpin for FromUtf8Error
impl Unpin for FromUtf16Error
impl<'a, T, F, A> Unpin for DrainFilter<'a, T, F, A> where
F: Unpin,
impl Unpin for CpuidResult
impl Unpin for TryFromSliceError
impl Unpin for BorrowError
impl Unpin for BorrowMutError
impl<T: ?Sized> Unpin for UnsafeCell<T> where
T: Unpin,
impl Unpin for EscapeUnicode
impl Unpin for EscapeDefault
impl Unpin for EscapeDebug
impl Unpin for ToLowercase
impl Unpin for ToUppercase
impl Unpin for CharTryFromError
impl Unpin for ParseCharError
impl<I> Unpin for DecodeUtf16<I> where
I: Unpin,
impl Unpin for DecodeUtf16Error
impl<H> Unpin for BuildHasherDefault<H> where
H: Unpin,
impl<Idx> Unpin for RangeInclusive<Idx> where
Idx: Unpin,
impl<Idx> Unpin for RangeToInclusive<Idx> where
Idx: Unpin,
impl<Y, R> Unpin for GeneratorState<Y, R> where
R: Unpin,
Y: Unpin,
impl<B, C> Unpin for ControlFlow<B, C> where
B: Unpin,
C: Unpin,
Implementors
Auto implementors
impl Unpin for RouteError
impl Unpin for RouterMessage
impl Unpin for Infallible
impl Unpin for Ipv6MulticastScope
impl Unpin for ockam_core::lib::net::SocketAddr
impl Unpin for FpCategory
impl Unpin for IntErrorKind
impl Unpin for SearchStep
impl Unpin for AddressSet
impl Unpin for LocalMessage
impl Unpin for ProtocolId
impl Unpin for ServiceBuilder
impl Unpin for TransportMessage
impl Unpin for AddrParseError
impl Unpin for SocketAddrV4
impl Unpin for SocketAddrV6
impl Unpin for TcpListener
impl Unpin for NonZeroI16
impl Unpin for NonZeroI32
impl Unpin for NonZeroI64
impl Unpin for NonZeroI128
impl Unpin for NonZeroIsize
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 ParseBoolError
impl<'a> Unpin for CharSearcher<'a>
impl<'a> Unpin for CharIndices<'a>
impl<'a> Unpin for EncodeUtf16<'a>
impl<'a> Unpin for ockam_core::lib::str::EscapeDebug<'a>
impl<'a> Unpin for ockam_core::lib::str::EscapeDefault<'a>
impl<'a> Unpin for ockam_core::lib::str::EscapeUnicode<'a>
impl<'a> Unpin for SplitAsciiWhitespace<'a>
impl<'a> Unpin for SplitWhitespace<'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, 'b> Unpin for CharSliceSearcher<'a, 'b>
impl<'a, 'b> Unpin for StrSearcher<'a, 'b>
impl<'a, F> Unpin for CharPredicateSearcher<'a, F> where
F: Unpin,
impl<'a, P> Unpin for MatchIndices<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for RMatchIndices<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for ockam_core::lib::str::RSplit<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for ockam_core::lib::str::RSplitN<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for RSplitTerminator<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for SplitInclusive<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for ockam_core::lib::str::SplitN<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, P> Unpin for SplitTerminator<'a, P> where
<P as Pattern<'a>>::Searcher: Unpin,
impl<'a, T> Unpin for ChunksExact<'a, T>
impl<'a, T> Unpin for ChunksExactMut<'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, P> Unpin for GroupByMut<'a, T, P> where
P: Unpin,
impl<'a, T, P> Unpin for RSplitNMut<'a, T, P> where
P: Unpin,
impl<'a, T, const N: usize> Unpin for 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<'r> Unpin for RouteBuilder<'r>
impl<F> Unpin for RepeatWith<F> where
F: Unpin,
impl<I> Unpin for Flatten<I> where
I: Unpin,
<<I as Iterator>::Item as IntoIterator>::IntoIter: Unpin,
impl<I, U, F> Unpin for FlatMap<I, U, F> where
F: Unpin,
I: Unpin,
<U as IntoIterator>::IntoIter: Unpin,
impl<K, V, S, A> Unpin for ockam_core::lib::HashMap<K, V, S, A> where
A: Unpin,
K: Unpin,
S: Unpin,
V: Unpin,
impl<M> Unpin for ResultMessage<M> where
M: Unpin,
impl<T> Unpin for Discriminant<T>
impl<T> Unpin for BinaryHeap<T> where
T: Unpin,
impl<T> Unpin for LinkedList<T>
impl<T> Unpin for MaybeUninit<T> where
T: Unpin,
impl<T, F> Unpin for Successors<T, F> where
F: Unpin,
T: Unpin,
impl<T: ?Sized> Unpin for ManuallyDrop<T> where
T: Unpin,
impl<T: ?Sized> Unpin for PhantomData<T> where
T: Unpin,