Trait Cog

Source
pub trait Cog: Sized + Send {
    type Request: DeserializeOwned + JsonSchema + Send;
    type Response: CogResponse + Debug + JsonSchema;

    // Required methods
    fn setup() -> impl Future<Output = Result<Self>> + Send;
    fn predict(&self, input: Self::Request) -> Result<Self::Response>;
}
Expand description

A Cog model

Required Associated Types§

Required Methods§

Source

fn setup() -> impl Future<Output = Result<Self>> + Send

Setup the model

§Errors

Returns an error if setup fails.

Source

fn predict(&self, input: Self::Request) -> Result<Self::Response>

Run a prediction on the model

§Errors

Returns an error if the prediction fails.

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§