pub struct MutableSharedArray<T: Copy> { /* private fields */ }Expand description
A mutable array backed by shared memory.
Used for output arrays where Rust writes computed results that TypeScript reads.
Implementations§
Sourcepub unsafe fn new(ptr: *mut T, len: usize) -> Self
pub unsafe fn new(ptr: *mut T, len: usize) -> Self
Create a new mutable shared array.
§Safety
ptrmust point to valid shared memory- The memory must remain valid for the lifetime of this array
- No other code should write to this memory region
Sourcepub unsafe fn from_context(
ctx: &SharedBufferContext,
byte_offset: usize,
len: usize,
) -> Self
pub unsafe fn from_context( ctx: &SharedBufferContext, byte_offset: usize, len: usize, ) -> Self
Create from a SharedBufferContext with byte offset.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub unsafe fn as_mut_slice(&mut self) -> &mut [T]
pub unsafe fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice of the underlying data.
§Safety
The returned slice is only valid while no other code is accessing this memory.
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