proxmox-backup/src/main.rs

56 lines
1.4 KiB
Rust
Raw Normal View History

2018-10-30 09:04:30 +00:00
#![feature(plugin)]
#![plugin(phf_macros)]
extern crate phf;
2018-10-30 09:40:05 +00:00
extern crate failure;
2018-10-30 09:04:30 +00:00
2018-10-30 09:40:05 +00:00
extern crate json_schema;
use json_schema::*;
2018-10-30 09:04:30 +00:00
static PARAMETERS1: StaticPropertyMap = phf_map! {
"force" => Boolean!{
description => "Test for boolean options."
},
"text1" => ApiString!{
description => "A simple text string.",
min_length => Some(10),
max_length => Some(30)
},
"count" => Integer!{
description => "A counter for everything.",
minimum => Some(0),
maximum => Some(10)
},
"myarray1" => Array!{
description => "Test Array of simple integers.",
items => &PVE_VMID
},
2018-10-30 09:40:05 +00:00
"myarray2" => Jss::Array(JssArray {
2018-10-30 09:04:30 +00:00
description: "Test Array of simple integers.",
optional: Some(false),
items: &Object!{description => "Empty Object."},
}),
"myobject" => Object!{
description => "TEST Object.",
properties => &phf_map!{
2018-10-30 09:40:05 +00:00
"vmid" => Jss::Reference { reference: &PVE_VMID},
2018-10-30 09:04:30 +00:00
"loop" => Integer!{
description => "Totally useless thing.",
optional => Some(false)
}
}
},
"emptyobject" => Object!{description => "Empty Object."},
};
fn main() {
println!("Fast Static Type Definitions 1");
for (k, v) in PARAMETERS1.entries() {
println!("Parameter: {} Value: {:?}", k, v);
}
}