Skip to main content

TensorTransactionHandler

Trait TensorTransactionHandler 

Source
pub trait TensorTransactionHandler: Send {
    // Required method
    fn apply(
        &mut self,
        transaction: TensorTransaction<'_>,
    ) -> Result<TensorWriteback, TensorTransactionError>;
}
Expand description

Synchronous safe handler for selected tensor transactions.

Required Methods§

Source

fn apply( &mut self, transaction: TensorTransaction<'_>, ) -> Result<TensorWriteback, TensorTransactionError>

Applies caller-defined mechanics to one Rust-owned tensor copy.

For TensorAccess::ReadWriteF32, successful finite output is written back exactly once after this method returns. Returning an error or unwinding causes no write-back.

§Errors

Returns an implementation-defined bounded failure.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> TensorTransactionHandler for F

Any suitable closure is a handler, so callers can pass one directly to TensorTransactions::new instead of defining a dedicated type.