pub struct Client(/* private fields */);
Expand description
A connection to wpa_supplicant
/ hostapd
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Creates a builder for a wpa_supplicant
/ hostapd
connection
§Examples
let wpa = wpactrl::Client::builder().open().unwrap();
Sourcepub fn attach(self) -> Result<ClientAttached>
pub fn attach(self) -> Result<ClientAttached>
Register as an event monitor for control interface messages
§Examples
let mut wpa = wpactrl::Client::builder().open().unwrap();
let wpa_attached = wpa.attach().unwrap();
§Errors
Error::Attach
- Unexpected (non-OK) responseError::Io
- Low-level I/O errorError::Utf8ToStr
- Corrupted message or message with non-UTF8 charactersError::Wait
- Failed to wait on underlying Unix socket
Sourcepub fn request(&mut self, cmd: &str) -> Result<String>
pub fn request(&mut self, cmd: &str) -> Result<String>
Send a command to wpa_supplicant
/ hostapd
.
Commands are generally identical to those used in wpa_cli
,
except all uppercase (eg LIST_NETWORKS
, SCAN
, etc)
§Examples
let mut wpa = wpactrl::Client::builder().open().unwrap();
assert_eq!(wpa.request("PING").unwrap(), "PONG\n");
§Errors
Error::Io
- Low-level I/O errorError::Utf8ToStr
- Corrupted message or message with non-UTF8 charactersError::Wait
- Failed to wait on underlying Unix socket
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more