use std::collections::HashMap; use std::time::Duration; use mikrotik_lite::MikrotikLite; #[tokio::main] async fn main() { let mut api = MikrotikLite::new( "api_login".to_string(), "api_pass".to_string(), "10.80.80.1:8728".to_string(), ).unwrap(); let mut attr = HashMap::new(); attr.insert("address".to_string(), "8.8.8.8".to_string()); attr.insert("count".to_string(), "5".to_string()); let ping = api.send_command_json( "/ping".to_string(), Some(attr.clone()) ).unwrap(); println!("{}", ping); api.set_timeout(Duration::from_secs(10)); let ping = api.send_command_json_async( "/ping".to_string(), Some(attr) ).await.unwrap(); println!("{}", ping); }