summaryrefslogblamecommitdiff
path: root/src/lib.rs
blob: 971f54414bd42422ab88490bc70a113c14aa013c (plain) (tree)
1
2
3
4
5
6
7
8
9
             



                 
              
              
 
                                
 
                

                    
                                      



                    








                                                        





                                                                                       

     
pub mod apis;
pub mod config;
pub mod commands;
pub mod input;
pub mod db;
pub mod error;
pub mod files;

use std::io::{Error, ErrorKind};

pub use apis::*;
pub use commands::*;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Modloader {
    Fabric,
    Forge
}

impl Modloader {
    fn stringify(&self) -> String {
        match self {
            Modloader::Fabric => String::from("fabric"),
            Modloader::Forge => String::from("forge"),
        }
    }

    fn from(string: &str) -> Result<Modloader, Box<Error>> {
        match string {
            "forge" => Ok(Modloader::Forge),
            "fabric" => Ok(Modloader::Fabric),
            _ => Err(Box::new(Error::new(ErrorKind::InvalidData, "UNKNOWN_MODLOADER")))
        }
    }
}