Struct passcod_networkmanager::configs::Ip4Config
source · 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)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
fn main() -> Result<(), Error> {
let nm = NetworkManager::new()?;
for dev in nm.get_devices()? {
match dev {
Device::Ethernet(x) => {
println!("Is autoconnected: {:?}", x.autoconnect()?);
println!("Speed: {:?}", x.speed()?);
println!("S390 Subchannels: {:?}", x.s390_subchannels()?);
println!("Carrier: {:?}", x.carrier()?);
let conf = x.ip4_config()?;
println!("Gateway: {:?}", conf.gateway()?);
let con = x.active_connection()?;
println!("Connection id: {}", con.id()?);
}
Device::WiFi(x) => {
println!("Bitrate: {:?}", x.bitrate()?);
x.request_scan(std::collections::HashMap::new())?;
for ap in x.get_all_access_points()? {
println!("SSID: {:?}", ap.ssid()?);
}
}
_ => {}
}
}
let eth0 = nm.get_device_by_ip_iface("eth0")?;
match eth0 {
Device::Ethernet(x) => {
// NetworkManager >= 1.24
// println!("Hardware Address: {:?}", Any::hw_address(&x)?);
// NetworkManager < 1.24
// println!("Hardware Address: {:?}", Wired::hw_address(&x)?);
println!("Speed: {:?}", x.speed()?);
}
_ => {}
}
Ok(())
}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 !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