Skip to main content

GpuState

Trait GpuState 

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

Source

fn to_control_block_bytes(&self) -> Vec<u8>

Serialize state to bytes for GPU transfer.

Source

fn from_control_block_bytes(bytes: &[u8]) -> Result<Self>
where Self: Sized,

Deserialize state from bytes read from GPU.

Provided Methods§

Source

fn state_version() -> u32

State version for compatibility checking.

Source

fn prefer_embedded() -> bool
where 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.

Implementors§