From 54a9f4d6f3b718afccf7235937e9c68be6075ad1 Mon Sep 17 00:00:00 2001 From: Lucy Date: Thu, 13 Jan 2022 14:32:52 -0500 Subject: [PATCH] Fix `downcast_to_device` --- networkmanager/src/device.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/networkmanager/src/device.rs b/networkmanager/src/device.rs index c146519..e8a58f8 100644 --- a/networkmanager/src/device.rs +++ b/networkmanager/src/device.rs @@ -56,30 +56,30 @@ impl<'a> Device<'a> { self.0.device_type().await.map(DeviceType::from) } - pub async fn downcast_to_device(&'a self) -> Result> { + pub async fn downcast_to_device(&'a self) -> Result>> { match self.device_type().await? { - DeviceType::Bluetooth => Ok(SpecificDevice::Bluetooth( + DeviceType::Bluetooth => Ok(Some(SpecificDevice::Bluetooth( BluetoothDeviceProxy::builder(self.0.connection()) .path(self.0.path())? .build() .await? .into(), - )), - DeviceType::Ethernet => Ok(SpecificDevice::Wired( + ))), + DeviceType::Ethernet => Ok(Some(SpecificDevice::Wired( WiredDeviceProxy::builder(self.0.connection()) .path(self.0.path())? .build() .await? .into(), - )), - DeviceType::Wifi => Ok(SpecificDevice::Wireless( + ))), + DeviceType::Wifi => Ok(Some(SpecificDevice::Wireless( WirelessDeviceProxy::builder(self.0.connection()) .path(self.0.path())? .build() .await? .into(), - )), - _ => unimplemented!(), + ))), + _ => Ok(None), } }