Debian Codegraph @

third_party/rust/coremidi/examples/properties.rs

raw
1 extern crate coremidi;
2
3 use coremidi::{Client, PacketList, Properties, PropertyGetter, PropertySetter};
4
5 fn main() {
6 let client = Client::new("Example Client").unwrap();
7
8 let callback = |packet_list: &PacketList| {
9 println!("{}", packet_list);
10 };
11
12 // Creates a virtual destination, then gets its properties
13 let destination = client
14 .virtual_destination("Example Destination", callback)
15 .unwrap();
16
17 println!("Created Virtual Destination...");
18
19 // How to get a property
20 let name: String = Properties::name().value_from(&destination).unwrap();
21 println!("With Name: {}", name);
22
23 // How to set a property
24 Properties::private().set_value(&destination, true).unwrap();
25 }