From 0affa87c00d79d3fca6b16a487bddcae2579860b Mon Sep 17 00:00:00 2001 From: Tochukwu Nkemdilim Date: Sat, 10 Nov 2018 06:42:45 +0100 Subject: [PATCH] Chore(Docs): Improve Docs --- src/lib.rs | 1 + src/platforms/osx.rs | 3 +-- tests/mod.rs | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 36ca433..69a63c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ mod platforms; pub mod prelude { pub use connectivity::*; pub use hotspot::*; + pub use platforms::Config; } pub use platforms::WiFi; diff --git a/src/platforms/osx.rs b/src/platforms/osx.rs index c743899..c60b979 100644 --- a/src/platforms/osx.rs +++ b/src/platforms/osx.rs @@ -27,7 +27,6 @@ impl Osx { /// Wifi interface for osx operating system. /// This provides basic functionalities for wifi interface. impl WifiInterface for Osx { - /// Check if wireless network adapter is enabled. fn is_wifi_enabled() -> Result { let output = Command::new("networksetup") .args(&["radio", "wifi"]) @@ -50,7 +49,7 @@ impl WifiInterface for Osx { Ok(()) } - /// Turn off the wireless network adapter. + /// Turn off the wireless adapter. fn turn_off() -> Result<(), WifiError> { let output = Command::new("networksetup") .args(&["-setairportpower", "en0", "off"]) diff --git a/tests/mod.rs b/tests/mod.rs index 1d9dd35..1947e55 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -1,5 +1,5 @@ extern crate wifi_rs; -use self::wifi_rs::{prelude::*, Config, WiFi}; +use self::wifi_rs::{prelude::*, WiFi}; #[test] fn connect_to_wifi_failed() { @@ -14,7 +14,12 @@ fn connect_to_wifi_failed() { #[test] fn create_hotspot() { - let hotspot_created = WiFi::create_hotspot("hello", "hi").unwrap(); + let config = Some(Config { + interface: Some("wlo1"), + }); + + let mut wifi = WiFi::new(config); + let hotspot_created = wifi.create_hotspot("hello", "hi", None).unwrap(); assert_eq!(hotspot_created, true); }