pub struct SharedMemory<T: Send + Sync> { /* private fields */ }Expand description
Static shared memory allocation.
Represents a fixed-size shared memory buffer that is known at compile time.
Analogous to __shared__ T data[N] in CUDA.
§Type Parameters
T: Element type (must beSend + Syncsince shared across threads)
Implementations§
Sourcepub fn new(count: usize) -> Self
pub fn new(count: usize) -> Self
Allocate a new shared memory buffer with count elements, all zeroed.
§Panics
Panics if the allocation fails or if count * size_of::<T>() overflows.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the buffer is empty (always false after construction).
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get a mutable raw pointer to the underlying buffer.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Trait Implementations§
Auto Trait Implementations§
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