pub struct Device { /* private fields */ }
Implementations§
Source§impl Device
impl Device
pub fn device_type(&self) -> &DeviceType
pub fn interface(&self) -> &str
pub fn get_state(&self) -> Result<DeviceState>
pub fn as_wifi_device(&self) -> Option<WiFiDevice<'_>>
Sourcepub fn connect(&self) -> Result<DeviceState>
pub fn connect(&self) -> Result<DeviceState>
Connects a Network Manager device.
Examples
use network_manager::{NetworkManager, DeviceType};
let manager = NetworkManager::new();
let devices = manager.get_devices().unwrap();
let i = devices.iter().position(|ref d| *d.device_type() == DeviceType::WiFi).unwrap();
devices[i].connect().unwrap();
Sourcepub fn disconnect(&self) -> Result<DeviceState>
pub fn disconnect(&self) -> Result<DeviceState>
Disconnect a Network Manager device.
§Examples
use network_manager::{NetworkManager, DeviceType};
let manager = NetworkManager::new();
let devices = manager.get_devices().unwrap();
let i = devices.iter().position(|ref d| *d.device_type() == DeviceType::WiFi).unwrap();
devices[i].disconnect().unwrap();
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Device
impl !RefUnwindSafe for Device
impl !Send for Device
impl !Sync for Device
impl Unpin for Device
impl !UnwindSafe for Device
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