Chore(Refactor): Simplify Imports

This commit is contained in:
Tochukwu Nkemdilim
2021-02-07 17:58:11 +01:00
parent 9f374641ea
commit 1c86f673bc
13 changed files with 79 additions and 37 deletions
+53
View File
@@ -0,0 +1,53 @@
language: rust
os:
- linux
- osx
- windows
rust:
- nightly
- beta
- stable
matrix:
allow_failures:
- rust: nightly
before_script:
- |
pip install 'travis-cargo<0.2' --user &&
export PATH=$HOME/.local/bin:$PATH
script:
- cargo build
- cargo test
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- libssl-dev
after_success:
- travis-cargo --only stable doc-upload
- travis-cargo coveralls --no-sudo
- |
if [[ "$TRAVIS_RUST_VERSION" == stable ]]; then
bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
# Uncomment the following line for coveralls.io
cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID
# Uncomment the following two lines create and upload a report for codecov.io
cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
fi
notifications:
email:
on_success: never
env:
global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=dev
+1
View File
@@ -1,6 +1,7 @@
[package]
name = "wifi-rs"
version = "0.2.2"
edition = "2018"
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
description = "Interface with and manage Wireless Network (WiFi)"
license = "MIT"
+2 -1
View File
@@ -1,6 +1,7 @@
[package]
name = "wifi-cli"
name = "wifi-connect"
version = "0.1.0"
edition = "2018"
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
[dependencies]
+2 -11
View File
@@ -1,8 +1,5 @@
extern crate wifi_rs;
use std::io;
use wifi_rs::WiFi;
use wifi_rs::prelude::*;
use wifi_rs::{prelude::*, WiFi};
fn main() -> Result<(), io::Error> {
let config = Some(Config {
@@ -12,13 +9,7 @@ fn main() -> Result<(), io::Error> {
let mut wifi = WiFi::new(config);
let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
wifi.create_hotspot(
"test-hotspot",
"password",
Some(
&config
)
);
wifi.create_hotspot("test-hotspot", "password", Some(&config));
Ok(())
}
+1
View File
@@ -1,6 +1,7 @@
[package]
name = "wifi-cli"
version = "0.1.0"
edition = "2018"
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
[dependencies]
+2 -5
View File
@@ -1,10 +1,7 @@
extern crate clap;
extern crate wifi_rs;
use clap::{App, Arg};
use std::io;
use wifi_rs::WiFi;
use wifi_rs::prelude::*;
use wifi_rs::WiFi;
fn main() -> Result<(), io::Error> {
let matches = App::new("Wi-Fi")
@@ -58,4 +55,4 @@ fn main() -> Result<(), io::Error> {
println!("Connection Status: {:?}", wifi.connect(ssid, password));
Ok(())
}
}
+4 -2
View File
@@ -1,5 +1,7 @@
use connectivity::{Connectivity, WifiConnectionError};
use platforms::{Connection, WiFi, WifiError, WifiInterface};
use crate::{
connectivity::{Connectivity, WifiConnectionError},
platforms::{Connection, WiFi, WifiError, WifiInterface},
};
use std::process::Command;
/// Wireless network connectivity functionality.
+1 -4
View File
@@ -20,10 +20,7 @@ pub struct HotspotConfig {
#[allow(dead_code)]
impl HotspotConfig {
pub fn new(band: Option<HotspotBand>, channel: Option<Channel>) -> HotspotConfig {
HotspotConfig {
band,
channel
}
HotspotConfig { band, channel }
}
}
+2 -3
View File
@@ -1,9 +1,8 @@
use hotspot::WifiHotspot;
use platforms::WiFi;
use crate::{hotspot::WifiHotspot, platforms::WiFi};
/// Configuration for a wireless hotspot.
#[allow(dead_code)]
pub struct HotspotConfig {}
pub struct HotspotConfig;
/// Wireless hotspot functionality for a wifi interface.
impl WifiHotspot for WiFi {}
+5 -3
View File
@@ -1,9 +1,11 @@
use hotspot::{WifiHotspot, WifiHotspotError};
use platforms::{WiFi, WifiError, WifiInterface};
use crate::{
hotspot::{WifiHotspot, WifiHotspotError},
platforms::{WiFi, WifiError, WifiInterface},
};
use std::process::Command;
/// Configuration for a wireless hotspot.
pub struct HotspotConfig {}
pub struct HotspotConfig;
impl WiFi {
/// Attempts to turn on a wireless networ if down.
+4 -4
View File
@@ -4,10 +4,10 @@ mod platforms;
/// Pre-requisite module for `Connectivity`, `Hotspot` functionality.
pub mod prelude {
pub use crate::connectivity::*;
pub use crate::hotspot::*;
pub use crate::hotspot::providers::prelude::*;
pub use crate::platforms::Config;
pub use crate::connectivity::*;
pub use crate::hotspot::providers::prelude::*;
pub use crate::hotspot::*;
pub use crate::platforms::Config;
}
pub use crate::platforms::WiFi;
+1 -1
View File
@@ -1,4 +1,4 @@
use platforms::{Config, WifiError, WifiInterface};
use crate::platforms::{Config, WifiError, WifiInterface};
use std::process::Command;
#[derive(Debug)]
+1 -3
View File
@@ -1,6 +1,4 @@
use platforms::Config;
use platforms::WifiError;
use platforms::WifiInterface;
use crate::platforms::{Config, WifiError, WifiInterface};
use std::process::Command;
const WINDOWS_INTERFACE: &'static str = "Wireless Network Connection";