// Copyright 2015, Igor Shaula // Licensed under the MIT License <LICENSE or // http://opensource.org/licenses/MIT>. This file // may not be copied, modified, or distributed // except according to those terms. #[macro_use] externcrate serde_derive; externcrate winreg; use std::collections::HashMap; use std::error::Error; use winreg::enums::*;
#[derive(Debug, Serialize, Deserialize, PartialEq)] struct Test {
t_bool: bool,
t_u8: u8,
t_u16: u16,
t_u32: u32,
t_u64: u64,
t_usize: usize,
t_struct: Rectangle,
t_map: HashMap<String, u32>,
t_string: String, #[serde(rename = "")] // empty name becomes the (Default) value in the registry
t_char: char,
t_i8: i8,
t_i16: i16,
t_i32: i32,
t_i64: i64,
t_isize: isize,
t_f64: f64,
t_f32: f32,
}
fn main() -> Result<(), Box<dyn Error>> { let hkcu = winreg::RegKey::predef(HKEY_CURRENT_USER); let (key, _disp) = hkcu.create_subkey("Software\\RustEncode")?;
letmut map = HashMap::new();
map.insert("".to_owned(), 0); // empty name becomes the (Default) value in the registry
map.insert("v1".to_owned(), 1);
map.insert("v2".to_owned(), 2);
map.insert("v3".to_owned(), 3);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.