diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -6,10 +6,11 @@ pub mod db; | |||
6 | pub mod error; | 6 | pub mod error; |
7 | pub mod files; | 7 | pub mod files; |
8 | 8 | ||
9 | use std::{io::{Error, ErrorKind}, path::Path}; | 9 | use std::path::Path; |
10 | 10 | ||
11 | pub use apis::*; | 11 | pub use apis::*; |
12 | pub use commands::*; | 12 | pub use commands::*; |
13 | use error::{MLE, ErrorType, MLError}; | ||
13 | 14 | ||
14 | #[derive(Debug, Clone, PartialEq, Eq)] | 15 | #[derive(Debug, Clone, PartialEq, Eq)] |
15 | pub enum Modloader { | 16 | pub enum Modloader { |
@@ -18,18 +19,18 @@ pub enum Modloader { | |||
18 | } | 19 | } |
19 | 20 | ||
20 | impl Modloader { | 21 | impl Modloader { |
21 | fn stringify(&self) -> String { | 22 | fn to_string(&self) -> String { |
22 | match self { | 23 | match self { |
23 | Modloader::Fabric => String::from("fabric"), | 24 | Modloader::Fabric => String::from("fabric"), |
24 | Modloader::Forge => String::from("forge"), | 25 | Modloader::Forge => String::from("forge"), |
25 | } | 26 | } |
26 | } | 27 | } |
27 | 28 | ||
28 | fn from(string: &str) -> Result<Modloader, Box<Error>> { | 29 | fn from(string: &str) -> MLE<Modloader> { |
29 | match string { | 30 | match string { |
30 | "forge" => Ok(Modloader::Forge), | 31 | "forge" => Ok(Modloader::Forge), |
31 | "fabric" => Ok(Modloader::Fabric), | 32 | "fabric" => Ok(Modloader::Fabric), |
32 | _ => Err(Box::new(Error::new(ErrorKind::InvalidData, "UNKNOWN_MODLOADER"))) | 33 | _ => Err(MLError::new(ErrorType::ArgumentError, "UNKNOWN_MODLOADER")) |
33 | } | 34 | } |
34 | } | 35 | } |
35 | } | 36 | } |