summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index eb845d8..8d97d1a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,7 @@ pub mod db;
6pub mod error; 6pub mod error;
7pub mod files; 7pub mod files;
8 8
9use std::path::Path; 9use std::{path::Path, fmt::Display};
10 10
11pub use apis::*; 11pub use apis::*;
12pub use commands::*; 12pub use commands::*;
@@ -19,14 +19,7 @@ pub enum Modloader {
19} 19}
20 20
21impl Modloader { 21impl Modloader {
22 fn to_string(&self) -> String { 22 pub fn from(string: &str) -> MLE<Modloader> {
23 match self {
24 Modloader::Fabric => String::from("fabric"),
25 Modloader::Forge => String::from("forge"),
26 }
27 }
28
29 fn from(string: &str) -> MLE<Modloader> {
30 match string { 23 match string {
31 "forge" => Ok(Modloader::Forge), 24 "forge" => Ok(Modloader::Forge),
32 "fabric" => Ok(Modloader::Fabric), 25 "fabric" => Ok(Modloader::Fabric),
@@ -35,6 +28,15 @@ impl Modloader {
35 } 28 }
36} 29}
37 30
31impl Display for Modloader {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 match self {
34 Modloader::Fabric => write!(f, "fabric"),
35 Modloader::Forge => write!(f, "forge"),
36 }
37 }
38}
39
38pub fn devdir(path: &str) -> String { 40pub fn devdir(path: &str) -> String {
39 let p = Path::new(path); 41 let p = Path::new(path);
40 let dev = std::env::var("DEV"); 42 let dev = std::env::var("DEV");