pub trait Projection: Sized {
// Required methods
fn byte_size() -> usize;
fn id() -> ProjectionId;
fn read(buf: &[u8]) -> Self;
fn write(&self, buf: &mut [u8]);
fn shape_hash_contribution(&self) -> u32;
}Expand description
A projection is a typed view over a contiguous byte region within a ComputeAtom.
Implementations must be deterministic: same bytes in → same state out.
byte_size() is const per type (known at compile time).
Required Methods§
Sourcefn id() -> ProjectionId
fn id() -> ProjectionId
Projection type identifier.
Sourcefn read(buf: &[u8]) -> Self
fn read(buf: &[u8]) -> Self
Read projection state from a byte slice.
Panics if buf.len() < Self::byte_size().
Sourcefn write(&self, buf: &mut [u8])
fn write(&self, buf: &mut [u8])
Write projection state into a byte slice.
Panics if buf.len() < Self::byte_size().
Sourcefn shape_hash_contribution(&self) -> u32
fn shape_hash_contribution(&self) -> u32
Contribution to the atom’s shape hash (FNV-1a input).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.