pub(crate) struct SendPtr<T>(pub(crate) *mut T);Expand description
We need to transmit raw pointers across threads. It is possible to do this
without any unsafe code by converting pointers to usize or to AtomicPtr
Unsafe code is still required to dereference the pointer, so this type is not unsound on its own, although it does partly lift the unconditional !Send and !Sync on raw pointers. As always, dereference with care.
Tuple Fields§
§0: *mut TImplementations§
Trait Implementations§
impl<T> Copy for SendPtr<T>
impl<T: Send> Send for SendPtr<T>
impl<T: Send> Sync for SendPtr<T>
Auto Trait Implementations§
impl<T> Freeze for SendPtr<T>
impl<T> RefUnwindSafe for SendPtr<T>where
T: RefUnwindSafe,
impl<T> Unpin for SendPtr<T>
impl<T> UnwindSafe for SendPtr<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more