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]
|
||||
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"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "wifi-cli"
|
||||
name = "wifi-connect"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -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,6 +1,7 @@
|
||||
[package]
|
||||
name = "wifi-cli"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
authors = ["Tochukwu Nkemdilim <nkemdilimtochukwu@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
@@ -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
@@ -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,4 +1,4 @@
|
||||
use platforms::{Config, WifiError, WifiInterface};
|
||||
use crate::platforms::{Config, WifiError, WifiInterface};
|
||||
use std::process::Command;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user