mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
feat: add server_info example
This commit is contained in:
39
examples/server_info.rs
Normal file
39
examples/server_info.rs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
use libnotify_rs::functions::{self, uninit};
|
||||||
|
|
||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
functions::init("Morbius");
|
||||||
|
|
||||||
|
if let Some(caps) = functions::get_server_caps() {
|
||||||
|
println!("=== Server caps ===");
|
||||||
|
for s in caps {
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("No server caps");
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(info) = functions::get_server_info() {
|
||||||
|
println!("=== Server info ===");
|
||||||
|
if let Some(name) = info.name {
|
||||||
|
println!("Server name: {}", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(vendor) = info.vendor {
|
||||||
|
println!("Server vendor: {}", vendor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(version) = info.version {
|
||||||
|
println!("Server version: {}", version);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(spec_version) = info.spec_version {
|
||||||
|
println!("Server spec version: {}", spec_version);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("No server info");
|
||||||
|
}
|
||||||
|
|
||||||
|
uninit();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user