pub struct DevicePtr(/* private fields */);Expand description
Unowned CUDA device address. Copying this value retains no allocation and proves no bounds, lifetime, context association, alignment, or access permissions.
Implementations§
Source§impl DevicePtr
impl DevicePtr
Sourcepub const unsafe fn new(raw: *mut ()) -> Self
pub const unsafe fn new(raw: *mut ()) -> Self
Wraps a raw CUDA device pointer value.
§Safety
raw must be either null or a pointer value that is valid for the CUDA operation it is passed to.
This wrapper does not prove allocation ownership, size, lifetime, context association, or access permissions.
Sourcepub const unsafe fn from_raw(raw: *mut ()) -> Self
pub const unsafe fn from_raw(raw: *mut ()) -> Self
Wraps a raw CUDA device pointer value.
§Safety
raw must be either null or a pointer value that is valid for the CUDA operation it is passed to.
This wrapper does not prove allocation ownership, size, lifetime, context association, or access permissions.
Sourcepub const fn as_raw(self) -> *mut ()
pub const fn as_raw(self) -> *mut ()
Returns the untyped device pointer without retaining or validating its allocation.
Sourcepub const fn as_ptr(self) -> *mut ()
pub const fn as_ptr(self) -> *mut ()
Returns the stored mutable device pointer without dereferencing it.
Sourcepub const fn as_const_ptr(self) -> *const ()
pub const fn as_const_ptr(self) -> *const ()
Returns the stored device address as a const pointer without dereferencing it.
Sourcepub fn is_aligned_to(self, alignment: usize) -> bool
pub fn is_aligned_to(self, alignment: usize) -> bool
Whether the address is a multiple of alignment, which must be nonzero.
Sourcepub fn checked_byte_add(self, bytes: usize) -> Option<Self>
pub fn checked_byte_add(self, bytes: usize) -> Option<Self>
Offsets the address by bytes, returning None when the address overflows.
The result is an address computation only and is not checked against any allocation.
Trait Implementations§
impl AnyBitPatternDeviceRepr for DevicePtr
impl Copy for DevicePtr
Source§impl DeviceRepr for DevicePtr
impl DeviceRepr for DevicePtr
impl Eq for DevicePtr
impl NoUninitDeviceRepr for DevicePtr
impl StructuralPartialEq for DevicePtr
impl ZeroableDeviceRepr for DevicePtr
Auto Trait Implementations§
impl !Send for DevicePtr
impl !Sync for DevicePtr
impl Forget for DevicePtr
impl Freeze for DevicePtr
impl Move for DevicePtr
impl RefUnwindSafe for DevicePtr
impl Unpin for DevicePtr
impl UnsafeUnpin for DevicePtr
impl UnwindSafe for DevicePtr
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.