Debian Codegraph @

third_party/rust/winreg/examples/enum.rs

raw
1 // Copyright 2015, Igor Shaula
2 // Licensed under the MIT License <LICENSE or
3 // http://opensource.org/licenses/MIT>. This file
4 // may not be copied, modified, or distributed
5 // except according to those terms.
6 extern crate winreg;
7 use std::io;
8 use winreg::enums::*;
9 use winreg::RegKey;
10
11 fn main() -> io::Result<()> {
12 println!("File extensions, registered in system:");
13 for i in RegKey::predef(HKEY_CLASSES_ROOT)
14 .enum_keys()
15 .map(|x| x.unwrap())
16 .filter(|x| x.starts_with('.'))
17 {
18 println!("{}", i);
19 }
20
21 let system = RegKey::predef(HKEY_LOCAL_MACHINE).open_subkey("HARDWARE\\DESCRIPTION\\System")?;
22 for (name, value) in system.enum_values().map(|x| x.unwrap()) {
23 println!("{} = {:?}", name, value);
24 }
25
26 Ok(())
27 }