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