pub struct SharedSlotBuffer<T: Copy + PartialEq + 'static> { /* private fields */ }Expand description
A reactive typed array backed by shared memory.
get(index)performs a reactive read (tracks dependency viatrack_read)set(index, value)writes to shared memory + marks reactions dirty + notifiespeek(index)reads without reactive tracking
The buffer owns no allocation — it operates on external memory via raw pointers.
§Type Parameters
T: Element type (must be Copy + PartialEq for equality checking)
Implementations§
Sourcepub unsafe fn new(
ptr: *mut T,
len: usize,
default_value: T,
notifier: impl Notifier,
) -> Self
pub unsafe fn new( ptr: *mut T, len: usize, default_value: T, notifier: impl Notifier, ) -> Self
Create a new SharedSlotBuffer over external memory.
§Safety
ptrmust point to valid memory with at leastlen * size_of::<T>()bytes- The memory must remain valid for the lifetime of this buffer
- If
dirtyis Some, it must point to valid memory with at leastlenbytes
Sourcepub unsafe fn with_dirty(
ptr: *mut T,
len: usize,
dirty: *mut u8,
default_value: T,
notifier: impl Notifier,
) -> Self
pub unsafe fn with_dirty( ptr: *mut T, len: usize, dirty: *mut u8, default_value: T, notifier: impl Notifier, ) -> Self
Create with dirty flags.
§Safety
Same as new(), plus dirty must point to valid memory with len bytes.
Sourcepub fn set(&self, index: usize, value: T)
pub fn set(&self, index: usize, value: T)
Write + mark reactions dirty + set dirty flag + notify cross-side.
Sourcepub fn notify_changed(&self)
pub fn notify_changed(&self)
Notify the Rust reactive graph that the other side changed data. Call this after waking from a cross-side notification.
Sourcepub fn source(&self) -> Rc<SourceInner<u32>>
pub fn source(&self) -> Rc<SourceInner<u32>>
Get the coarse-grained reactive source (for building deriveds that depend on this buffer).
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