Trait Cog

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

    // Required methods
    fn setup<'async_trait>(    ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn predict(&self, input: Self::Request) -> Result<Self::Response, Error>;
}

Required Associated Types§

Required Methods§

Source

fn setup<'async_trait>() -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Setup the cog

§Errors

Returns an error if setup fails.

Source

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

Run a prediction

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§