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