pub struct SendPtr<T> { /* private fields */ }Expand description
Sendable wrapper for raw pointers that are only dereferenced on a known-safe thread.
This is useful when a raw ABI pointer must be moved into an async task but the caller controls where it is dereferenced.
let mut value = 1_u32;
let ptr = xabi::SendPtr::new(&mut value as *mut u32);
let raw = ptr.as_ptr();
unsafe { *raw = 2 };
assert_eq!(value, 2);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> !Sync for SendPtr<T>
impl<T> Freeze for SendPtr<T>
impl<T> RefUnwindSafe for SendPtr<T>where
T: RefUnwindSafe,
impl<T> Unpin for SendPtr<T>
impl<T> UnsafeUnpin 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