pub trait StreamJob {
type Output: Send;
type ResponseBody: for<'de> Deserialize<'de> + Send;
// Required methods
fn build_request(&self, client: &Client, base: &str) -> RequestBuilder;
fn body_to_output(
&self,
response: Self::ResponseBody,
) -> Option<Self::Output>;
}
Expand description
A job send to the Aleph Alpha Api using the http client. A job wraps all the knowledge required
for the Aleph Alpha API to specify its result. Notably it includes the model(s) the job is
executed on. This allows this trait to hold in the presence of services, which use more than one
model and task type to achieve their result. On the other hand a bare crate::TaskCompletion
can not implement this trait directly, since its result would depend on what model is chosen to
execute it. You can remedy this by turning completion task into a job, calling
[Task::with_model
].
Required Associated Types§
Sourcetype Output: Send
type Output: Send
Output returned by crate::Client::output_of
Sourcetype ResponseBody: for<'de> Deserialize<'de> + Send
type ResponseBody: for<'de> Deserialize<'de> + Send
Expected answer of the Aleph Alpha API
Required Methods§
Sourcefn build_request(&self, client: &Client, base: &str) -> RequestBuilder
fn build_request(&self, client: &Client, base: &str) -> RequestBuilder
Prepare the request for the Aleph Alpha API. Authentication headers can be assumed to be already set.
Sourcefn body_to_output(&self, response: Self::ResponseBody) -> Option<Self::Output>
fn body_to_output(&self, response: Self::ResponseBody) -> Option<Self::Output>
Parses the response of the server into higher level structs for the user.