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 fn from_address(addr: usize) -> Self
pub const fn from_address(addr: usize) -> Self
Returns a SendConstPtr 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) -> SendConstPtr<Y>
pub const fn cast<Y>(&self) -> SendConstPtr<Y>
Casts ptr to another data type while keeping it Send.
Sourcepub const fn as_sync_const(&self) -> SyncConstPtr<T>
pub const fn as_sync_const(&self) -> SyncConstPtr<T>
Makes this ptr Sync
Sourcepub const fn as_send_const(&self) -> Self
pub const fn as_send_const(&self) -> Self
This is equivalent to .clone() and does nothing.
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 SendConstPtr<T>
impl<T> Clone for SendConstPtr<T>
Source§impl<T> Debug for SendConstPtr<T>
impl<T> Debug for SendConstPtr<T>
Source§impl<T> Deref for SendConstPtr<T>
impl<T> Deref for SendConstPtr<T>
Source§impl<T> From<SendConstPtr<T>> for *const T
impl<T> From<SendConstPtr<T>> for *const T
Source§fn from(val: SendConstPtr<T>) -> *const T
fn from(val: SendConstPtr<T>) -> *const T
Converts to this type from the input type.
Source§impl<T> From<SendConstPtr<T>> for usize
impl<T> From<SendConstPtr<T>> for usize
Source§fn from(val: SendConstPtr<T>) -> Self
fn from(val: SendConstPtr<T>) -> Self
Converts to this type from the input type.
Source§impl<T> From<usize> for SendConstPtr<T>
impl<T> From<usize> for SendConstPtr<T>
Source§impl<T> Hash for SendConstPtr<T>
impl<T> Hash for SendConstPtr<T>
Source§impl<T> Ord for SendConstPtr<T>
impl<T> Ord for SendConstPtr<T>
Source§impl<T> PartialEq for SendConstPtr<T>
impl<T> PartialEq for SendConstPtr<T>
Source§impl<T> PartialOrd for SendConstPtr<T>
impl<T> PartialOrd for SendConstPtr<T>
Source§impl<T> Pointer for SendConstPtr<T>
impl<T> Pointer for SendConstPtr<T>
impl<T> Copy for SendConstPtr<T>
impl<T> Eq for SendConstPtr<T>
impl<T> Send 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
Mutably borrows from an owned value. Read more