summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2022-11-03 21:34:04 +0100
committerfxqnlr <[email protected]>2022-11-03 21:34:04 +0100
commit96cc5257de09682df345e768dc2a91303f9b36c9 (patch)
treef505d14c581e2bef4cfe222bd1069661bedd22e0 /src/lib.rs
parentb125dfd03084fff47ab8e90d002c6699b762d998 (diff)
downloadmodlist-96cc5257de09682df345e768dc2a91303f9b36c9.tar
modlist-96cc5257de09682df345e768dc2a91303f9b36c9.tar.gz
modlist-96cc5257de09682df345e768dc2a91303f9b36c9.zip
added update beginnings; init of tests
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}