Struct sync_ptr::SyncMutPtr
source · pub struct SyncMutPtr<T>(/* private fields */);Expand description
Wrapped mutable raw pointer that is Send+Sync
Implementations§
source§impl<T> SyncMutPtr<T>
impl<T> SyncMutPtr<T>
sourcepub const unsafe fn new(ptr: *mut T) -> Self
pub const unsafe fn new(ptr: *mut T) -> Self
Makes ptr Send+Sync
§Safety
The ptr parameter must be able to handle being sent and used in other threads concurrently,
or special care must be taken when using the wrapped ptr to not use it
in any way in other threads.
sourcepub const fn cast<Y>(&self) -> SyncMutPtr<Y>
pub const fn cast<Y>(&self) -> SyncMutPtr<Y>
Casts ptr to another data type while keeping it Send+Sync.
sourcepub const fn as_sync_const(&self) -> SyncConstPtr<T>
pub const fn as_sync_const(&self) -> SyncConstPtr<T>
Makes ptr immutable.
sourcepub const fn as_send_const(&self) -> SendConstPtr<T>
pub const fn as_send_const(&self) -> SendConstPtr<T>
Makes ptr immutable and no longer Sync.
sourcepub const fn as_sync_mut(&self) -> SyncMutPtr<T>
pub const fn as_sync_mut(&self) -> SyncMutPtr<T>
This is equivalent to .clone() and does nothing.
sourcepub const fn as_send_mut(&self) -> SendMutPtr<T>
pub const fn as_send_mut(&self) -> SendMutPtr<T>
Makes ptr no longer Sync.
Trait Implementations§
source§impl<T> Clone for SyncMutPtr<T>
impl<T> Clone for SyncMutPtr<T>
source§impl<T: Debug> Debug for SyncMutPtr<T>
impl<T: Debug> Debug for SyncMutPtr<T>
source§impl<T> Deref for SyncMutPtr<T>
impl<T> Deref for SyncMutPtr<T>
source§impl<T: Hash> Hash for SyncMutPtr<T>
impl<T: Hash> Hash for SyncMutPtr<T>
source§impl<T> Into<*const T> for SyncMutPtr<T>
impl<T> Into<*const T> for SyncMutPtr<T>
source§impl<T> Into<*mut T> for SyncMutPtr<T>
impl<T> Into<*mut T> for SyncMutPtr<T>
source§impl<T: Ord> Ord for SyncMutPtr<T>
impl<T: Ord> Ord for SyncMutPtr<T>
source§fn cmp(&self, other: &SyncMutPtr<T>) -> Ordering
fn cmp(&self, other: &SyncMutPtr<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq for SyncMutPtr<T>
impl<T: PartialEq> PartialEq for SyncMutPtr<T>
source§impl<T: PartialOrd> PartialOrd for SyncMutPtr<T>
impl<T: PartialOrd> PartialOrd for SyncMutPtr<T>
impl<T> Copy for SyncMutPtr<T>
impl<T: Eq> Eq for SyncMutPtr<T>
impl<T> Send for SyncMutPtr<T>
impl<T> StructuralPartialEq for SyncMutPtr<T>
impl<T> Sync for SyncMutPtr<T>
Auto Trait Implementations§
impl<T> Freeze for SyncMutPtr<T>
impl<T> RefUnwindSafe for SyncMutPtr<T>where
T: RefUnwindSafe,
impl<T> Unpin for SyncMutPtr<T>
impl<T> UnwindSafe for SyncMutPtr<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)