Skip to main content

Projection

Trait Projection 

Source
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§

Source

fn byte_size() -> usize

Fixed byte size of this projection’s memory region.

Source

fn id() -> ProjectionId

Projection type identifier.

Source

fn read(buf: &[u8]) -> Self

Read projection state from a byte slice. Panics if buf.len() < Self::byte_size().

Source

fn write(&self, buf: &mut [u8])

Write projection state into a byte slice. Panics if buf.len() < Self::byte_size().

Source

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.

Implementors§