summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 17ad6b9..eb845d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,10 +6,11 @@ pub mod db;
6pub mod error; 6pub mod error;
7pub mod files; 7pub mod files;
8 8
9use std::{io::{Error, ErrorKind}, path::Path}; 9use std::path::Path;
10 10
11pub use apis::*; 11pub use apis::*;
12pub use commands::*; 12pub use commands::*;
13use error::{MLE, ErrorType, MLError};
13 14
14#[derive(Debug, Clone, PartialEq, Eq)] 15#[derive(Debug, Clone, PartialEq, Eq)]
15pub enum Modloader { 16pub enum Modloader {
@@ -18,18 +19,18 @@ pub enum Modloader {
18} 19}
19 20
20impl Modloader { 21impl 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}