46 lines
957 B
Rust
46 lines
957 B
Rust
// TODO: remove on implementation
|
|
#![allow(unused_imports)]
|
|
#![allow(unused_variables)]
|
|
#![allow(dead_code)]
|
|
|
|
use std::io;
|
|
|
|
mod sha256;
|
|
pub use sha256::Sha256;
|
|
|
|
mod texture_format;
|
|
pub use texture_format::TextureFormat;
|
|
|
|
#[derive(Eq, PartialEq, Clone, Serialize, Deserialize, Debug, Hash)]
|
|
pub struct Texture {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub tags: Vec<String>,
|
|
pub format: TextureFormat,
|
|
pub resolution: (usize, usize),
|
|
pub texture_hash: Sha256,
|
|
}
|
|
|
|
pub enum ReplaceTextureStatus {
|
|
/// Done.
|
|
Ok,
|
|
|
|
/// Call Again With Texture Binary
|
|
NeedTextureData(Sha256),
|
|
}
|
|
|
|
pub type ProtocolResult<T> = Result<T, ProtocolError>;
|
|
pub enum ProtocolError {
|
|
BadRequest(String),
|
|
FileNotFound(String),
|
|
Conflict(String),
|
|
InternalServerError(std::io::Error),
|
|
NotImplemented,
|
|
}
|
|
|
|
impl From<io::Error> for ProtocolError {
|
|
fn from(err: io::Error) -> Self {
|
|
ProtocolError::InternalServerError(err)
|
|
}
|
|
}
|