Skip to main content

ModelService

Trait ModelService 

pub trait ModelService: Debug {
    // Required methods
    fn request(&mut self, request: ModelRequest) -> Result<(), String>;
    fn poll(&mut self) -> Result<Vec<ModelReply>, String>;
}
Expand description

Optional off-thread executor. Errors permanently select the inline path. Implementations wake the canvas when a reply or failure arrives.

Required Methods§

fn request(&mut self, request: ModelRequest) -> Result<(), String>

Sends one request. An error means the service is unavailable.

§Errors

Returns an error if the service cannot accept work.

fn poll(&mut self) -> Result<Vec<ModelReply>, String>

Drains available replies without blocking.

§Errors

Returns an error if the service has failed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§