Struct NetworkManager

Source
pub struct NetworkManager { /* private fields */ }

Implementations§

Source§

impl NetworkManager

Source

pub fn new() -> Self

Source

pub fn with_method_timeout(timeout: u64) -> Self

Source

pub fn start_service(timeout: u64) -> Result<ServiceState>

Starts the Network Manager service.

§Examples
use network_manager::NetworkManager;
let state = NetworkManager::start_service(10).unwrap();
println!("{:?}", state);
Source

pub fn stop_service(timeout: u64) -> Result<ServiceState>

Stops the Network Manager service.

§Examples
use network_manager::NetworkManager;
let state = NetworkManager::stop_service(10).unwrap();
println!("{:?}", state);
Source

pub fn get_service_state() -> Result<ServiceState>

Gets the state of the Network Manager service.

§Examples
use network_manager::NetworkManager;
let state = NetworkManager::get_service_state().unwrap();
println!("{:?}", state);
Source

pub fn get_connections(&self) -> Result<Vec<Connection>>

Get a list of Network Manager connections sorted by path.

§Examples
use network_manager::NetworkManager;
let manager = NetworkManager::new();
let connections = manager.get_connections().unwrap();
println!("{:?}", connections);
Source

pub fn get_active_connections(&self) -> Result<Vec<Connection>>

Source

pub fn get_devices(&self) -> Result<Vec<Device>>

Get a list of Network Manager devices.

§Examples
use network_manager::NetworkManager;
let manager = NetworkManager::new();
let devices = manager.get_devices().unwrap();
println!("{:?}", devices);
Source

pub fn get_device_by_interface(&self, interface: &str) -> Result<Device>

Source

pub fn get_state(&self) -> Result<NetworkManagerState>

Source

pub fn get_connectivity(&self) -> Result<Connectivity>

Source

pub fn is_networking_enabled(&self) -> Result<bool>

Source

pub fn is_wireless_enabled(&self) -> Result<bool>

Trait Implementations§

Source§

impl Default for NetworkManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.