Skip to main content

InferenceWriterChannel

Trait InferenceWriterChannel 

Source
pub trait InferenceWriterChannel<O> {
    // Required methods
    fn write(&self, output: O) -> Result<(), InferenceWriterError>;
    fn error(
        &self,
        error: Box<dyn Error + Send + Sync>,
    ) -> Result<(), InferenceWriterError>;
    fn finish(&self, duration: Duration);
}
Expand description

Trait representing an inference task that can be executed with a given input and a writer for outputs. The inference implementation is responsible for writing outputs and errors to the provided writer, which will be sent back to the session.

Required Methods§

Source

fn write(&self, output: O) -> Result<(), InferenceWriterError>

Write an output item to the channel. This can be called multiple times to emit multiple items.

Source

fn error( &self, error: Box<dyn Error + Send + Sync>, ) -> Result<(), InferenceWriterError>

Signal an error on the inference, which will be sent back to the session.

Source

fn finish(&self, duration: Duration)

Called when the InferenceWriter is dropped, allowing the channel to perform any necessary cleanup or finalization.

Implementors§