1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#![allow(non_snake_case, non_camel_case_types)]
extern crate qapi_spec as qapi;
extern crate serde;
#[macro_use]
extern crate serde_derive;
use std::string;
include!(concat!(env!("OUT_DIR"), "/qmp.rs"));
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QMP {
pub version: VersionInfo,
pub capabilities: Vec<()>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QapiCapabilities {
pub QMP: QMP,
}
impl device_add {
pub fn new<P: IntoIterator<Item=(string::String, qapi::Any)>>(driver: string::String, id: Option<string::String>, bus: Option<string::String>, props: P) -> Self {
let mut dict = qapi::Dictionary::default();
dict.insert("driver".into(), qapi::Any::String(driver));
if let Some(id) = id {
dict.insert("id".into(), qapi::Any::String(id));
}
if let Some(bus) = bus {
dict.insert("bus".into(), qapi::Any::String(bus));
}
dict.extend(props);
device_add(dict)
}
}