1#![doc = include_str!("../README.md")]
2#![allow(deprecated)]
3
4mod bundles;
5mod conformance;
6mod download;
7pub mod jobs;
8mod predictions;
9mod presets;
10mod spec;
11pub mod surface;
12
13pub use bundles::*;
14pub use conformance::*;
15pub use download::*;
16pub use jobs::{
17 plan_model_access, plan_model_bundle, ModelAccessJobRequest, ModelAccessPlan, ModelBundlePlan,
18 ModelBundlePlanFile, ModelJobInput, ModelJobKind,
19};
20pub use predictions::*;
21pub use presets::*;
22pub use spec::*;
23
24use std::fmt;
25
26pub type Result<T> = std::result::Result<T, ModelRuntimeError>;
28
29#[derive(Debug)]
31pub enum ModelRuntimeError {
32 InvalidArgument(String),
34 Source(String),
36 Io(std::io::Error),
38}
39
40impl fmt::Display for ModelRuntimeError {
41 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
42 match self {
43 Self::InvalidArgument(message) => write!(formatter, "invalid argument: {message}"),
44 Self::Source(message) => write!(formatter, "model source error: {message}"),
45 Self::Io(error) => write!(formatter, "{error}"),
46 }
47 }
48}
49
50impl std::error::Error for ModelRuntimeError {}
51
52impl From<std::io::Error> for ModelRuntimeError {
53 fn from(error: std::io::Error) -> Self {
54 Self::Io(error)
55 }
56}
57
58#[cfg(test)]
59mod tests;