1
0
forked from Rativel/BurritOS

merge branch documentation

This commit is contained in:
Rémi Rativel
2023-05-25 14:16:59 +02:00
17 changed files with 200 additions and 41 deletions

View File

@@ -104,6 +104,10 @@ pub fn get_debug_configuration() -> Settings {
}
/// Removes comments and empty lines
/// Filters out empty lines and comments from the reader `BufReader`.
///
/// Returns a [`Vec<String>`], each entry containing a valid
/// line from the input file.
fn filter_garbage<R: std::io::Read>(reader: BufReader<R>) -> Vec<String> {
reader.lines()
.map(|l| l.unwrap())
@@ -111,11 +115,13 @@ fn filter_garbage<R: std::io::Read>(reader: BufReader<R>) -> Vec<String> {
.collect()
}
/// Inserts user settings into setting map
/// Adds a <K, V> pair to a [`Settings`] map.
///
/// Returns the updated [`Settings`].
fn update_settings_map(mut settings_map: Settings, key: &str, setting: &str) -> Settings {
let key = MachineSettingKey::from(key);
let setting = setting.parse::<u64>().unwrap_or(0);
let setting = str::parse::<u64>(setting).unwrap_or(0);
settings_map.insert(key, setting);
settings_map
}