summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 4ad7c39..e059293 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,11 +4,31 @@ pub mod commands;
4pub mod input; 4pub mod input;
5pub mod db; 5pub mod db;
6 6
7use std::io::{Error, ErrorKind};
8
7pub use apis::*; 9pub use apis::*;
8pub use commands::*; 10pub use commands::*;
9 11
10#[derive(Debug)] 12#[derive(Debug, Clone)]
11pub enum Modloader { 13pub enum Modloader {
12 Fabric, 14 Fabric,
13 Forge 15 Forge
14} 16}
17
18impl Modloader {
19 fn stringify(&self) -> String {
20 match self {
21 Modloader::Fabric => String::from("fabric"),
22 Modloader::Forge => String::from("forge"),
23 }
24 }
25
26}
27
28pub fn get_modloader(string: String) -> Result<Modloader, Box<dyn std::error::Error>> {
29 match string.as_str() {
30 "forge" => Ok(Modloader::Forge),
31 "fabric" => Ok(Modloader::Fabric),
32 _ => Err(Box::new(Error::new(ErrorKind::InvalidData, "UNKNOWN_MODLOADER")))
33 }
34}