Skip to main content

TypedDispatchExt

Trait TypedDispatchExt 

Source
pub trait TypedDispatchExt: VyreBackend {
    // Provided methods
    fn dispatch_bytes(
        &self,
        program: &Program,
        inputs: &[&[u8]],
        config: &DispatchConfig,
    ) -> Result<Vec<Vec<u8>>, BackendError> { ... }
    fn dispatch_pod<T: Pod>(
        &self,
        program: &Program,
        inputs: &[&[T]],
        config: &DispatchConfig,
    ) -> Result<Vec<Vec<T>>, BackendError> { ... }
    fn dispatch_pod_into<T: Pod>(
        &self,
        program: &Program,
        inputs: &[&[T]],
        config: &DispatchConfig,
        raw_outputs: &mut OutputBuffers,
        typed_outputs: &mut Vec<Vec<T>>,
    ) -> Result<(), BackendError> { ... }
    fn dispatch_u32(
        &self,
        program: &Program,
        inputs: &[&[u32]],
        config: &DispatchConfig,
    ) -> Result<Vec<Vec<u32>>, BackendError> { ... }
    fn dispatch_u32_into(
        &self,
        program: &Program,
        inputs: &[&[u32]],
        config: &DispatchConfig,
        raw_outputs: &mut OutputBuffers,
        typed_outputs: &mut Vec<Vec<u32>>,
    ) -> Result<(), BackendError> { ... }
    fn dispatch_f32(
        &self,
        program: &Program,
        inputs: &[&[f32]],
        config: &DispatchConfig,
    ) -> Result<Vec<Vec<f32>>, BackendError> { ... }
    fn dispatch_f32_into(
        &self,
        program: &Program,
        inputs: &[&[f32]],
        config: &DispatchConfig,
        raw_outputs: &mut OutputBuffers,
        typed_outputs: &mut Vec<Vec<f32>>,
    ) -> Result<(), BackendError> { ... }
}
Expand description

Extension methods for callers that work with typed POD buffers instead of manually packing and unpacking byte vectors.

Provided Methods§

Source

fn dispatch_bytes( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, ) -> Result<Vec<Vec<u8>>, BackendError>

Dispatch borrowed byte slices.

This is a naming convenience over VyreBackend::dispatch_borrowed for call sites that are migrating away from owned Vec<u8> inputs.

§Errors

Returns BackendError when the backend rejects the program, inputs, or dispatch.

Source

fn dispatch_pod<T: Pod>( &self, program: &Program, inputs: &[&[T]], config: &DispatchConfig, ) -> Result<Vec<Vec<T>>, BackendError>

Dispatch borrowed typed POD inputs and decode each output as T.

§Errors

Returns BackendError when an output byte length is not a whole number of T values or when the backend dispatch fails.

Source

fn dispatch_pod_into<T: Pod>( &self, program: &Program, inputs: &[&[T]], config: &DispatchConfig, raw_outputs: &mut OutputBuffers, typed_outputs: &mut Vec<Vec<T>>, ) -> Result<(), BackendError>

Dispatch borrowed typed POD inputs and decode each output as T into caller-owned storage.

raw_outputs retains the backend byte buffers between calls and typed_outputs retains decoded POD slots. Hot loops should use this instead of TypedDispatchExt::dispatch_pod to avoid rebuilding both output shells on every launch.

§Errors

Returns BackendError when an output byte length is not a whole number of T values or when the backend dispatch fails.

Source

fn dispatch_u32( &self, program: &Program, inputs: &[&[u32]], config: &DispatchConfig, ) -> Result<Vec<Vec<u32>>, BackendError>

Dispatch borrowed u32 inputs and decode each output as u32.

§Errors

Returns BackendError on backend failure or malformed output length.

Source

fn dispatch_u32_into( &self, program: &Program, inputs: &[&[u32]], config: &DispatchConfig, raw_outputs: &mut OutputBuffers, typed_outputs: &mut Vec<Vec<u32>>, ) -> Result<(), BackendError>

Dispatch borrowed u32 inputs and decode outputs into caller-owned typed storage.

§Errors

Returns BackendError on backend failure or malformed output length.

Source

fn dispatch_f32( &self, program: &Program, inputs: &[&[f32]], config: &DispatchConfig, ) -> Result<Vec<Vec<f32>>, BackendError>

Dispatch borrowed f32 inputs and decode each output as f32.

§Errors

Returns BackendError on backend failure or malformed output length.

Source

fn dispatch_f32_into( &self, program: &Program, inputs: &[&[f32]], config: &DispatchConfig, raw_outputs: &mut OutputBuffers, typed_outputs: &mut Vec<Vec<f32>>, ) -> Result<(), BackendError>

Dispatch borrowed f32 inputs and decode outputs into caller-owned typed storage.

§Errors

Returns BackendError on backend failure or malformed output length.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§