1#![warn(missing_docs)]
4
5pub mod level;
6pub mod project;
7
8use std::error::Error as StdError;
9use std::fmt::{self, Display, Formatter};
10use std::io;
11
12use serde::{Deserialize, Serialize};
13
14pub use level::{Layer, Level, Value};
15pub use project::Project;
16
17#[derive(Debug)]
19pub enum Error {
20 Io(io::Error),
22
23 Json(serde_json::Error),
25}
26
27impl Display for Error {
28 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
29 match self {
30 Error::Io(_) => write!(f, "IO error"),
31 Error::Json(_) => write!(f, "JSON error"),
32 }
33 }
34}
35
36impl StdError for Error {
37 fn source(&self) -> Option<&(dyn StdError + 'static)> {
38 match self {
39 Error::Io(cause) => Some(cause),
40 Error::Json(cause) => Some(cause),
41 }
42 }
43}
44
45#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
47pub struct Vec2<T> {
48 pub x: T,
50
51 pub y: T,
53}