Changed ruleset variable type to i32
This commit is contained in:
parent
e00f489f55
commit
7d0a371311
@ -4,14 +4,13 @@ extern crate serde_yaml;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
extern crate log;
|
||||
use log::warn;
|
||||
use log::{info, warn};
|
||||
|
||||
// mod utils;
|
||||
pub mod utils;
|
||||
use utils::SettingsType;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const RULESET_CURRENT_VERSION: &'static str = "1";
|
||||
const RULESET_CURRENT_VERSION: i32 = 1;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Settings {
|
||||
@ -106,7 +105,7 @@ impl Settings {
|
||||
Ok(val) => val,
|
||||
},
|
||||
};
|
||||
|
||||
info!("Successfuly imported {}", path.display());
|
||||
Ok(settings)
|
||||
}
|
||||
|
||||
@ -161,12 +160,13 @@ impl Settings {
|
||||
Ok(val) => val,
|
||||
},
|
||||
};
|
||||
info!("Successfuly exported settings to {}", path.display());
|
||||
utils::write_file(&path, &content)
|
||||
}
|
||||
|
||||
/// Get the current ruleset version of LangEvolve.
|
||||
fn get_ruleset_version() -> String {
|
||||
String::from(RULESET_CURRENT_VERSION)
|
||||
RULESET_CURRENT_VERSION.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ use std::io::{Read, Result};
|
||||
use std::path::Path;
|
||||
|
||||
/// Type of supported settings format: yaml or json
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum SettingsType {
|
||||
/// Files ending with the `yml` or `yaml` extension
|
||||
Yaml,
|
||||
@ -78,6 +79,7 @@ where
|
||||
info!("Wrote settings to file {}", path.display());
|
||||
}
|
||||
};
|
||||
info!("Successfuly written {}", path.display());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user