wifi_rs/connectivity/
mod.rs1#[cfg(target_os = "windows")]
2mod handlers;
3mod providers;
4#[cfg(target_os = "windows")]
5mod stubs;
6
7use crate::platforms::WifiError;
8use std::{fmt, io};
9
10pub trait Connectivity: fmt::Debug {
12 fn connect(&mut self, ssid: &str, password: &str) -> Result<bool, WifiConnectionError>;
14
15 fn disconnect(&self) -> Result<bool, WifiConnectionError>;
17}
18
19#[derive(Debug)]
21pub enum WifiConnectionError {
22 #[cfg(target_os = "windows")]
24 AddNetworkProfileFailed,
25 FailedToConnect(String),
27 FailedToDisconnect(String),
29 Other { kind: WifiError },
31 }
33
34impl From<io::Error> for WifiConnectionError {
35 fn from(error: io::Error) -> Self {
36 WifiConnectionError::Other {
37 kind: WifiError::IoError(error),
38 }
39 }
40}