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 fn from_address(addr: usize) -> Self
pub const fn from_address(addr: usize) -> Self
Returns a SyncConstPtr from an arbitrary address.
This is equivalent to casting usize as *const T
Sourcepub fn as_address(&self) -> usize
pub fn as_address(&self) -> usize
Returns the address of the pointer.
This is equivalent to casting the pointer using *mut T as usize.
§Note
Starting with rust 1.84.0, the pointer itself
has the functions addr and expose_provenance.
These functions should be used instead.
They are available via the deref trait.
This function is roughly equivalent to the expose_provenance function.
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) -> Self
pub const fn as_sync_const(&self) -> Self
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 for SyncConstPtr<T>
impl<T> Debug for SyncConstPtr<T>
Source§impl<T> Deref for SyncConstPtr<T>
impl<T> Deref for SyncConstPtr<T>
Source§impl<T> From<*const T> for SyncConstPtr<T>
impl<T> From<*const T> for SyncConstPtr<T>
Source§impl<T> From<*mut T> for SyncConstPtr<T>
impl<T> From<*mut T> for SyncConstPtr<T>
Source§impl<T> From<SyncConstPtr<T>> for *const T
impl<T> From<SyncConstPtr<T>> for *const T
Source§fn from(val: SyncConstPtr<T>) -> Self
fn from(val: SyncConstPtr<T>) -> Self
Converts to this type from the input type.
Source§impl<T> From<SyncConstPtr<T>> for usize
impl<T> From<SyncConstPtr<T>> for usize
Source§fn from(val: SyncConstPtr<T>) -> Self
fn from(val: SyncConstPtr<T>) -> Self
Converts to this type from the input type.
Source§impl<T> From<usize> for SyncConstPtr<T>
impl<T> From<usize> for SyncConstPtr<T>
Source§impl<T> Hash for SyncConstPtr<T>
impl<T> Hash for SyncConstPtr<T>
Source§impl<T> Ord for SyncConstPtr<T>
impl<T> Ord for SyncConstPtr<T>
Source§impl<T> PartialEq for SyncConstPtr<T>
impl<T> PartialEq for SyncConstPtr<T>
Source§impl<T> PartialOrd for SyncConstPtr<T>
impl<T> PartialOrd for SyncConstPtr<T>
Source§impl<T> Pointer for SyncConstPtr<T>
impl<T> Pointer for SyncConstPtr<T>
impl<T> Copy for SyncConstPtr<T>
impl<T> Eq for SyncConstPtr<T>
impl<T> Send 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