Struct sync_ptr::SendConstPtr
source · pub struct SendConstPtr<T>(/* private fields */);Expand description
Wrapped const raw pointer that is Send but not Sync
Implementations§
source§impl<T> SendConstPtr<T>
impl<T> SendConstPtr<T>
sourcepub const unsafe fn new(ptr: *const T) -> Self
pub const unsafe fn new(ptr: *const T) -> Self
Makes ptr Send
§Safety
The ptr parameter must be able to handle being sent to other threads
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) -> SendConstPtr<Y>
pub const fn cast<Y>(&self) -> SendConstPtr<Y>
Casts ptr to another data type while keeping it Send.
sourcepub const unsafe fn as_sync_const(&self) -> SyncConstPtr<T>
pub const unsafe fn as_sync_const(&self) -> SyncConstPtr<T>
Makes this ptr Sync
§Safety
This ptr must be able to handle being accessed by multiple threads at the same time,
or special care must be taken when using the wrapped ptr to not use it
in any way in other threads.
sourcepub const fn as_send_const(&self) -> SendConstPtr<T>
pub const fn as_send_const(&self) -> SendConstPtr<T>
This is equivalent to .clone() and does nothing.
sourcepub const unsafe fn as_sync_mut(&self) -> SyncMutPtr<T>
pub const unsafe fn as_sync_mut(&self) -> SyncMutPtr<T>
Makes this ptr Sync
§Safety
This ptr must be able to handle being accessed by multiple threads at the same time,
or special care must be taken when using the wrapped ptr to not use it
in any way in other threads.
ptr is also marked as mutable. Writing to immutable data is usually UB.
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 SendConstPtr<T>
impl<T> Clone for SendConstPtr<T>
source§impl<T: Debug> Debug for SendConstPtr<T>
impl<T: Debug> Debug for SendConstPtr<T>
source§impl<T> Deref for SendConstPtr<T>
impl<T> Deref for SendConstPtr<T>
source§impl<T: Hash> Hash for SendConstPtr<T>
impl<T: Hash> Hash for SendConstPtr<T>
source§impl<T> Into<*const T> for SendConstPtr<T>
impl<T> Into<*const T> for SendConstPtr<T>
source§impl<T: Ord> Ord for SendConstPtr<T>
impl<T: Ord> Ord for SendConstPtr<T>
source§fn cmp(&self, other: &SendConstPtr<T>) -> Ordering
fn cmp(&self, other: &SendConstPtr<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<T: PartialEq> PartialEq for SendConstPtr<T>
impl<T: PartialEq> PartialEq for SendConstPtr<T>
source§impl<T: PartialOrd> PartialOrd for SendConstPtr<T>
impl<T: PartialOrd> PartialOrd for SendConstPtr<T>
impl<T> Copy for SendConstPtr<T>
impl<T: Eq> Eq for SendConstPtr<T>
impl<T> Send for SendConstPtr<T>
impl<T> StructuralPartialEq for SendConstPtr<T>
Auto Trait Implementations§
impl<T> Freeze for SendConstPtr<T>
impl<T> RefUnwindSafe for SendConstPtr<T>where
T: RefUnwindSafe,
impl<T> !Sync for SendConstPtr<T>
impl<T> Unpin for SendConstPtr<T>
impl<T> UnwindSafe for SendConstPtr<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
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)
clone_to_uninit)