pub struct ComputeAtom {
pub buffer: Vec<u8>,
pub layout: ProjectionLayout,
pub shape_hash: u32,
}Expand description
A single computational atom in the substrate.
Fields§
§buffer: Vec<u8>Contiguous memory backing all projections.
layout: ProjectionLayoutFrozen layout determining projection offsets.
shape_hash: u32Shape hash σ — deterministic content address.
Implementations§
Source§impl ComputeAtom
impl ComputeAtom
Sourcepub fn new(layout: ProjectionLayout) -> Self
pub fn new(layout: ProjectionLayout) -> Self
Create a zero-initialized atom with the given layout. All projections start at their default (void instantiation).
Sourcepub fn create_n(layout: &ProjectionLayout, n: usize) -> Vec<Self>
pub fn create_n(layout: &ProjectionLayout, n: usize) -> Vec<Self>
Create N atoms sharing the same layout.
Sourcepub fn read_projection<P: Projection>(&self) -> Option<P>
pub fn read_projection<P: Projection>(&self) -> Option<P>
Read a projection from this atom. Returns None if projection not in layout.
Sourcepub fn write_projection<P: Projection>(&mut self, proj: &P) -> bool
pub fn write_projection<P: Projection>(&mut self, proj: &P) -> bool
Write a projection into this atom. Returns false if projection not in layout.
Sourcepub fn projection_bytes(&self, id: ProjectionId) -> Option<&[u8]>
pub fn projection_bytes(&self, id: ProjectionId) -> Option<&[u8]>
Get a read-only byte slice for a projection’s region.
Trait Implementations§
Source§impl Clone for ComputeAtom
impl Clone for ComputeAtom
Source§fn clone(&self) -> ComputeAtom
fn clone(&self) -> ComputeAtom
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ComputeAtom
impl RefUnwindSafe for ComputeAtom
impl Send for ComputeAtom
impl Sync for ComputeAtom
impl Unpin for ComputeAtom
impl UnsafeUnpin for ComputeAtom
impl UnwindSafe for ComputeAtom
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