pub trait GpuState:
Send
+ Sync
+ 'static {
// Required methods
fn to_control_block_bytes(&self) -> Vec<u8> ⓘ;
fn from_control_block_bytes(bytes: &[u8]) -> Result<Self>
where Self: Sized;
// Provided methods
fn state_version() -> u32 { ... }
fn prefer_embedded() -> bool
where Self: Sized { ... }
}Expand description
Trait for GPU-compatible state types that may be stored externally.
Unlike EmbeddedState, types implementing GpuState can be larger
than 24 bytes and are stored in separate GPU memory.
Required Methods§
Sourcefn to_control_block_bytes(&self) -> Vec<u8> ⓘ
fn to_control_block_bytes(&self) -> Vec<u8> ⓘ
Serialize state to bytes for GPU transfer.
Sourcefn from_control_block_bytes(bytes: &[u8]) -> Result<Self>where
Self: Sized,
fn from_control_block_bytes(bytes: &[u8]) -> Result<Self>where
Self: Sized,
Deserialize state from bytes read from GPU.
Provided Methods§
Sourcefn state_version() -> u32
fn state_version() -> u32
State version for compatibility checking.
Sourcefn prefer_embedded() -> boolwhere
Self: Sized,
fn prefer_embedded() -> boolwhere
Self: Sized,
Whether this state should be embedded (if small enough).
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.