Chore(Refactor): Simplify Imports
This commit is contained in:
+53
@@ -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,6 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "wifi-rs"
|
name = "wifi-rs"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
edition = "2018"
|
||||||
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
||||||
description = "Interface with and manage Wireless Network (WiFi)"
|
description = "Interface with and manage Wireless Network (WiFi)"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "wifi-cli"
|
name = "wifi-connect"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
extern crate wifi_rs;
|
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use wifi_rs::WiFi;
|
use wifi_rs::{prelude::*, WiFi};
|
||||||
use wifi_rs::prelude::*;
|
|
||||||
|
|
||||||
fn main() -> Result<(), io::Error> {
|
fn main() -> Result<(), io::Error> {
|
||||||
let config = Some(Config {
|
let config = Some(Config {
|
||||||
@@ -12,13 +9,7 @@ fn main() -> Result<(), io::Error> {
|
|||||||
let mut wifi = WiFi::new(config);
|
let mut wifi = WiFi::new(config);
|
||||||
let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|
let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|
||||||
|
|
||||||
wifi.create_hotspot(
|
wifi.create_hotspot("test-hotspot", "password", Some(&config));
|
||||||
"test-hotspot",
|
|
||||||
"password",
|
|
||||||
Some(
|
|
||||||
&config
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "wifi-cli"
|
name = "wifi-cli"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
extern crate clap;
|
|
||||||
extern crate wifi_rs;
|
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
use std::io;
|
use std::io;
|
||||||
use wifi_rs::WiFi;
|
|
||||||
use wifi_rs::prelude::*;
|
use wifi_rs::prelude::*;
|
||||||
|
use wifi_rs::WiFi;
|
||||||
|
|
||||||
fn main() -> Result<(), io::Error> {
|
fn main() -> Result<(), io::Error> {
|
||||||
let matches = App::new("Wi-Fi")
|
let matches = App::new("Wi-Fi")
|
||||||
@@ -58,4 +55,4 @@ fn main() -> Result<(), io::Error> {
|
|||||||
println!("Connection Status: {:?}", wifi.connect(ssid, password));
|
println!("Connection Status: {:?}", wifi.connect(ssid, password));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use connectivity::{Connectivity, WifiConnectionError};
|
use crate::{
|
||||||
use platforms::{Connection, WiFi, WifiError, WifiInterface};
|
connectivity::{Connectivity, WifiConnectionError},
|
||||||
|
platforms::{Connection, WiFi, WifiError, WifiInterface},
|
||||||
|
};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
/// Wireless network connectivity functionality.
|
/// Wireless network connectivity functionality.
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ pub struct HotspotConfig {
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
impl HotspotConfig {
|
impl HotspotConfig {
|
||||||
pub fn new(band: Option<HotspotBand>, channel: Option<Channel>) -> HotspotConfig {
|
pub fn new(band: Option<HotspotBand>, channel: Option<Channel>) -> HotspotConfig {
|
||||||
HotspotConfig {
|
HotspotConfig { band, channel }
|
||||||
band,
|
|
||||||
channel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
use hotspot::WifiHotspot;
|
use crate::{hotspot::WifiHotspot, platforms::WiFi};
|
||||||
use platforms::WiFi;
|
|
||||||
|
|
||||||
/// Configuration for a wireless hotspot.
|
/// Configuration for a wireless hotspot.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct HotspotConfig {}
|
pub struct HotspotConfig;
|
||||||
|
|
||||||
/// Wireless hotspot functionality for a wifi interface.
|
/// Wireless hotspot functionality for a wifi interface.
|
||||||
impl WifiHotspot for WiFi {}
|
impl WifiHotspot for WiFi {}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
use hotspot::{WifiHotspot, WifiHotspotError};
|
use crate::{
|
||||||
use platforms::{WiFi, WifiError, WifiInterface};
|
hotspot::{WifiHotspot, WifiHotspotError},
|
||||||
|
platforms::{WiFi, WifiError, WifiInterface},
|
||||||
|
};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
/// Configuration for a wireless hotspot.
|
/// Configuration for a wireless hotspot.
|
||||||
pub struct HotspotConfig {}
|
pub struct HotspotConfig;
|
||||||
|
|
||||||
impl WiFi {
|
impl WiFi {
|
||||||
/// Attempts to turn on a wireless networ if down.
|
/// Attempts to turn on a wireless networ if down.
|
||||||
|
|||||||
+4
-4
@@ -4,10 +4,10 @@ mod platforms;
|
|||||||
|
|
||||||
/// Pre-requisite module for `Connectivity`, `Hotspot` functionality.
|
/// Pre-requisite module for `Connectivity`, `Hotspot` functionality.
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::connectivity::*;
|
pub use crate::connectivity::*;
|
||||||
pub use crate::hotspot::*;
|
pub use crate::hotspot::providers::prelude::*;
|
||||||
pub use crate::hotspot::providers::prelude::*;
|
pub use crate::hotspot::*;
|
||||||
pub use crate::platforms::Config;
|
pub use crate::platforms::Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use crate::platforms::WiFi;
|
pub use crate::platforms::WiFi;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use platforms::{Config, WifiError, WifiInterface};
|
use crate::platforms::{Config, WifiError, WifiInterface};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use platforms::Config;
|
use crate::platforms::{Config, WifiError, WifiInterface};
|
||||||
use platforms::WifiError;
|
|
||||||
use platforms::WifiInterface;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
const WINDOWS_INTERFACE: &'static str = "Wireless Network Connection";
|
const WINDOWS_INTERFACE: &'static str = "Wireless Network Connection";
|
||||||
|
|||||||
Reference in New Issue
Block a user