free-rusty-maker/src/lib.rs

42 lines
1.2 KiB
Rust

#![warn(missing_docs)]
//! This crates contains the (future) rusty game.
use std::{io, fmt, result};
/// This module contains all the tools needed for the game.
pub mod engine;
/// This module contains all the applications of the game.
pub mod app;
/// This is the error type of this library.
#[derive(Debug)]
pub enum Error {
/// An error occured while trying to save a file.
Save(io::Error),
/// An error occured while trying to load a file.
Load(io::Error),
/// An error occured while encoding a file.
Encoding(bincode::Error),
/// An error occured while decoding a file.
Decoding(bincode::Error),
}
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self {
Error::Save(ref e) => write!(fmt, "couldn't save file: {}", e),
Error::Load(ref e) => write!(fmt, "couldn't load file: {}", e),
Error::Encoding(ref e) => write!(fmt, "couldn't encode file: {}", e),
Error::Decoding(ref e) => write!(fmt, "couldn't decode file: {}", e),
}
}
}
/// This is the result type of this library.
type Result<T> = result::Result<T, Error>;