onnx-export-rs 0.1.1

Export canonical Rust machine-learning models to ONNX
Documentation
//! Error types.

use std::path::PathBuf;

/// Errors returned while constructing, encoding, or validating a model.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// The supplied canonical model is inconsistent.
    #[error("invalid model: {0}")]
    InvalidModel(String),
    /// ONNX serialization failed.
    #[error("failed to encode ONNX model: {0}")]
    Encode(#[from] prost::EncodeError),
    /// A model file could not be written.
    #[error("failed to write ONNX model to {path}: {source}")]
    Io {
        /// Destination path.
        path: PathBuf,
        /// Underlying I/O error.
        source: std::io::Error,
    },
    /// Loading or running a model in the validation runtime failed.
    #[cfg(feature = "validate")]
    #[error("ONNX validation runtime failed: {0}")]
    Validation(String),
}

/// Crate-wide result type.
pub type Result<T> = std::result::Result<T, Error>;