pub struct Ip4Config { /* private fields */ }Implementations§
Source§impl Ip4Config
impl Ip4Config
pub fn addresses(&self) -> Result<Vec<Vec<u32>>, Error>
pub fn address_data( &self, ) -> Result<Vec<HashMap<String, Variant<Box<dyn RefArg + 'static>>>>, Error>
Sourcepub fn gateway(&self) -> Result<String, Error>
pub fn gateway(&self) -> Result<String, Error>
Examples found in repository?
examples/testing.rs (line 15)
4fn main() -> Result<(), Error> {
5 let nm = NetworkManager::new()?;
6
7 for dev in nm.get_devices()? {
8 match dev {
9 Device::Ethernet(x) => {
10 println!("Is autoconnected: {:?}", x.autoconnect()?);
11 println!("Speed: {:?}", x.speed()?);
12 println!("S390 Subchannels: {:?}", x.s390_subchannels()?);
13 println!("Carrier: {:?}", x.carrier()?);
14 let conf = x.ip4_config()?;
15 println!("Gateway: {:?}", conf.gateway()?);
16 let con = x.active_connection()?;
17 println!("Connection id: {}", con.id()?);
18 }
19 Device::WiFi(x) => {
20 println!("Bitrate: {:?}", x.bitrate()?);
21 x.request_scan(std::collections::HashMap::new())?;
22 for ap in x.get_all_access_points()? {
23 println!("SSID: {:?}", ap.ssid()?);
24 }
25 }
26 _ => {}
27 }
28 }
29
30 let eth0 = nm.get_device_by_ip_iface("eth0")?;
31 match eth0 {
32 Device::Ethernet(x) => {
33 // NetworkManager >= 1.24
34 // println!("Hardware Address: {:?}", Any::hw_address(&x)?);
35
36 // NetworkManager < 1.24
37 // println!("Hardware Address: {:?}", Wired::hw_address(&x)?);
38
39 println!("Speed: {:?}", x.speed()?);
40 }
41 _ => {}
42 }
43
44 Ok(())
45}pub fn routes(&self) -> Result<Vec<Vec<u32>>, Error>
pub fn route_data( &self, ) -> Result<Vec<HashMap<String, Variant<Box<dyn RefArg + 'static>>>>, Error>
pub fn nameservers(&self) -> Result<Vec<u32>, Error>
pub fn nameserver_data( &self, ) -> Result<Vec<HashMap<String, Variant<Box<dyn RefArg + 'static>>>>, Error>
pub fn domains(&self) -> Result<Vec<String>, Error>
pub fn searches(&self) -> Result<Vec<String>, Error>
pub fn dns_options(&self) -> Result<Vec<String>, Error>
pub fn dns_priority(&self) -> Result<i32, Error>
pub fn wins_servers(&self) -> Result<Vec<u32>, Error>
pub fn wins_server_data(&self) -> Result<Vec<String>, Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ip4Config
impl !RefUnwindSafe for Ip4Config
impl !Send for Ip4Config
impl !Sync for Ip4Config
impl Unpin for Ip4Config
impl !UnwindSafe for Ip4Config
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