From 8df68611fefd7abd195f0f5fc3c1f6842ab90652 Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 26 Jan 2022 13:32:13 -0500 Subject: [PATCH] Constructor from zbus object for Settings --- networkmanager/src/settings/connection.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/networkmanager/src/settings/connection.rs b/networkmanager/src/settings/connection.rs index 371282a..e43005e 100644 --- a/networkmanager/src/settings/connection.rs +++ b/networkmanager/src/settings/connection.rs @@ -74,6 +74,23 @@ pub struct Settings { } impl Settings { + pub fn new( + mut src: std::collections::HashMap< + String, + std::collections::HashMap, + >, + ) -> Self { + Self { + connection: src.remove("connection").map(ConnectionSettings::new), + ethernet: src.remove("802-3-ethernet").map(EthernetSettings::new), + wifi: src.remove("802-11-wireless").map(WifiSettings::new), + bluetooth: src.remove("bluetooth").map(BluetoothSettings::new), + ipv4: src.remove("ipv4").map(Ipv4Settings::new), + ipv6: src.remove("ipv6").map(Ipv6Settings::new), + proxy: src.remove("proxy").map(WwwProxySettings::new), + } + } + pub fn build( &self, ) -> std::collections::HashMap<