Struct sync_ptr::SyncConstPtr
source · pub struct SyncConstPtr<T>(/* private fields */);Expand description
Wrapped const raw pointer that is Send+Sync
Implementations§
source§impl<T> SyncConstPtr<T>
impl<T> SyncConstPtr<T>
sourcepub const unsafe fn new(ptr: *const T) -> Self
pub const unsafe fn new(ptr: *const 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) -> SyncConstPtr<Y>
pub const fn cast<Y>(&self) -> SyncConstPtr<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>
This is equivalent to .clone() and does nothing.
sourcepub const fn as_send_const(&self) -> SendConstPtr<T>
pub const fn as_send_const(&self) -> SendConstPtr<T>
Makes this ptr no longer Sync.
sourcepub const fn as_sync_mut(&self) -> SyncMutPtr<T>
pub const fn as_sync_mut(&self) -> SyncMutPtr<T>
sourcepub const fn as_send_mut(&self) -> SendMutPtr<T>
pub const fn as_send_mut(&self) -> SendMutPtr<T>
Trait Implementations§
source§impl<T> Clone for SyncConstPtr<T>
impl<T> Clone for SyncConstPtr<T>
source§impl<T: Debug> Debug for SyncConstPtr<T>
impl<T: Debug> Debug for SyncConstPtr<T>
source§impl<T> Deref for SyncConstPtr<T>
impl<T> Deref for SyncConstPtr<T>
source§impl<T: Hash> Hash for SyncConstPtr<T>
impl<T: Hash> Hash for SyncConstPtr<T>
source§impl<T> Into<*const T> for SyncConstPtr<T>
impl<T> Into<*const T> for SyncConstPtr<T>
source§impl<T: Ord> Ord for SyncConstPtr<T>
impl<T: Ord> Ord for SyncConstPtr<T>
source§fn cmp(&self, other: &SyncConstPtr<T>) -> Ordering
fn cmp(&self, other: &SyncConstPtr<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 SyncConstPtr<T>
impl<T: PartialEq> PartialEq for SyncConstPtr<T>
source§impl<T: PartialOrd> PartialOrd for SyncConstPtr<T>
impl<T: PartialOrd> PartialOrd for SyncConstPtr<T>
impl<T> Copy for SyncConstPtr<T>
impl<T: Eq> Eq for SyncConstPtr<T>
impl<T> Send for SyncConstPtr<T>
impl<T> StructuralPartialEq for SyncConstPtr<T>
impl<T> Sync for SyncConstPtr<T>
Auto Trait Implementations§
impl<T> Freeze for SyncConstPtr<T>
impl<T> RefUnwindSafe for SyncConstPtr<T>where
T: RefUnwindSafe,
impl<T> Unpin for SyncConstPtr<T>
impl<T> UnwindSafe for SyncConstPtr<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)