llama-server 0.1.1

Download, embed, and run llama.cpp in your Rust projects
Documentation
use std::io;
use std::sync::Arc;

/// An error.
#[derive(Debug, Clone)]
pub enum Error {
    /// Some input/ouput operation failed.
    IOFailed(Arc<io::Error>),
    /// Some HTTP request failed.
    RequestFailed(Arc<reqwest::Error>),
}

impl From<io::Error> for Error {
    fn from(error: io::Error) -> Self {
        Self::IOFailed(Arc::new(error))
    }
}

impl From<Error> for io::Error {
    fn from(error: Error) -> Self {
        match error {
            Error::IOFailed(error) => io::Error::new(error.kind(), error),
            Error::RequestFailed(error) => io::Error::other(error),
        }
    }
}

impl From<reqwest::Error> for Error {
    fn from(error: reqwest::Error) -> Self {
        Self::RequestFailed(Arc::new(error))
    }
}

impl From<tokio::task::JoinError> for Error {
    fn from(error: tokio::task::JoinError) -> Self {
        Error::IOFailed(Arc::new(io::Error::other(error)))
    }
}

impl From<zip::result::ZipError> for Error {
    fn from(error: zip::result::ZipError) -> Self {
        Error::IOFailed(Arc::new(io::Error::other(error)))
    }
}