Chore(Stage): Some Refactoring

This commit is contained in:
Tochukwu Nkemdilim
2018-07-18 17:23:51 +01:00
parent 468368bc30
commit e8b83bf245
10 changed files with 361 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "osx")]
mod osx;
// #[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
pub(crate) use self::linux::{Connection, Linux};
#[cfg(target_os = "osx")]
pub use self::osx::OSX;
// #[cfg(target_os = "windows")]
pub use self::windows::Windows;
use std::{fmt, io};
#[derive(Debug)]
pub enum WifiError {
OsNotSupported,
InterfaceDisabled,
InterfaceFailedToOn,
IoError(io::Error),
}
pub trait WifiInterface: fmt::Debug {
/// Checks if the wifi interface on host machine is enables.
fn is_wifi_enabled() -> bool;
/// Turns on the wifi interface of host machine.
fn turn_on() -> Result<bool, WifiError>;
// Turns off the wifi interface of host machine.
fn turn_off() -> Result<bool, WifiError>;
}