Chore(Cleanup): Resolve Warnings

This commit is contained in:
Tochukwu Nkemdilim
2020-11-29 17:28:56 +01:00
parent c37f41fdbf
commit 22b6393d4d
8 changed files with 73 additions and 75 deletions
+38 -35
View File
@@ -2,53 +2,56 @@ mod providers;
use self::providers::prelude::HotspotConfig;
use crate::platforms::{WifiError, WifiInterface};
use std::{fmt, io};
use std::fmt;
/// Error that might occur when interacting managing wireless hotspot.
#[derive(Debug)]
pub enum WifiHotspotError {
/// Failed to ceate wireless hotspot.
CreationFailed,
/// Failed to stop wireless hotspot service. Try turning off
/// the wireless interface via ```wifi.turn_off()```.
FailedToStop(io::Error),
/// A wireless interface error occurred.
Other { kind: WifiError },
/// Failed to ceate wireless hotspot.
#[cfg(target_os = "linux")]
#[cfg(target_os = "windows")]
CreationFailed,
/// Failed to stop wireless hotspot service. Try turning off
/// the wireless interface via ```wifi.turn_off()```.
#[cfg(target_os = "linux")]
FailedToStop(std::io::Error),
/// A wireless interface error occurred.
Other { kind: WifiError },
}
/// Wireless hotspot functionality for a wifi interface.
pub trait WifiHotspot: fmt::Debug + WifiInterface {
/// Creates wireless hotspot service for host machine. This only creates the wifi network,
/// and isn't responsible for initiating the serving of the wifi network process.
/// To begin serving the hotspot, use ```start_hotspot()```.
fn create_hotspot(
&mut self,
ssid: &str,
password: &str,
configuration: Option<&HotspotConfig>,
) -> Result<bool, WifiHotspotError> {
let _a = ssid;
let _b = password;
let _c = configuration;
/// Creates wireless hotspot service for host machine. This only creates the wifi network,
/// and isn't responsible for initiating the serving of the wifi network process.
/// To begin serving the hotspot, use ```start_hotspot()```.
fn create_hotspot(
&mut self,
ssid: &str,
password: &str,
configuration: Option<&HotspotConfig>,
) -> Result<bool, WifiHotspotError> {
let _a = ssid;
let _b = password;
let _c = configuration;
unimplemented!();
}
unimplemented!();
}
/// Start serving publicly an already created wireless hotspot.
fn start_hotspot() -> Result<bool, WifiHotspotError> {
unimplemented!();
}
/// Start serving publicly an already created wireless hotspot.
fn start_hotspot() -> Result<bool, WifiHotspotError> {
unimplemented!();
}
/// Stop serving a wireless network.
///
/// **NOTE: All users connected will automatically be disconnected.**
fn stop_hotspot(&mut self) -> Result<bool, WifiHotspotError> {
unimplemented!();
}
/// Stop serving a wireless network.
///
/// **NOTE: All users connected will automatically be disconnected.**
fn stop_hotspot(&mut self) -> Result<bool, WifiHotspotError> {
unimplemented!();
}
}
impl From<WifiError> for WifiHotspotError {
fn from(error: WifiError) -> Self {
WifiHotspotError::Other { kind: error }
}
fn from(error: WifiError) -> Self {
WifiHotspotError::Other { kind: error }
}
}
-1
View File
@@ -26,7 +26,6 @@ pub enum HotspotBand {
Bg,
}
#[allow(dead_code)]
#[derive(Debug, Clone, Copy)]
/// Channel to broadcast wireless hotspot on.
pub enum Channel {
+6 -6
View File
@@ -8,10 +8,10 @@ mod linux;
mod osx;
pub mod prelude {
#[cfg(target_os = "linux")]
pub use super::linux::*;
#[cfg(target_os = "macos")]
pub use super::osx::*;
#[cfg(target_os = "windows")]
pub use super::windows::*;
#[cfg(target_os = "linux")]
pub use super::linux::*;
#[cfg(target_os = "macos")]
pub use super::osx::*;
#[cfg(target_os = "windows")]
pub use super::windows::*;
}
+2 -3
View File
@@ -1,9 +1,8 @@
use hotspot::{WifiHotspot, WifiHotspotError};
use connectivity::{Connectivity, WifiConnectionError};
use hotspot::WifiHotspot;
use platforms::WiFi;
use std::process::Command;
/// Configuration for a wireless hotspot.
#[allow(dead_code)]
pub struct HotspotConfig {}
/// Wireless hotspot functionality for a wifi interface.