feat: zbus 4.2.1 update
This commit is contained in:
parent
ce9c789fe6
commit
f05789c4ce
42 changed files with 390 additions and 389 deletions
|
|
@ -22,34 +22,34 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use zbus::{
|
||||
dbus_proxy,
|
||||
proxy,
|
||||
zvariant::{self, OwnedValue},
|
||||
};
|
||||
|
||||
#[dbus_proxy(
|
||||
#[proxy(
|
||||
interface = "net.hadess.SwitcherooControl",
|
||||
default_service = "net.hadess.SwitcherooControl",
|
||||
default_path = "/net/hadess/SwitcherooControl"
|
||||
)]
|
||||
trait SwitcherooControl {
|
||||
/// GPUs property
|
||||
#[dbus_proxy(property, name = "GPUs")]
|
||||
#[zbus(property, name = "GPUs")]
|
||||
fn gpus(
|
||||
&self,
|
||||
) -> zbus::Result<Vec<std::collections::HashMap<String, zbus::zvariant::OwnedValue>>>;
|
||||
|
||||
/// HasDualGpu property
|
||||
#[dbus_proxy(property)]
|
||||
#[zbus(property)]
|
||||
fn has_dual_gpu(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// NumGPUs property
|
||||
#[dbus_proxy(property, name = "NumGPUs")]
|
||||
#[zbus(property, name = "NumGPUs")]
|
||||
fn num_gpus(&self) -> zbus::Result<u32>;
|
||||
}
|
||||
|
||||
impl<'a> SwitcherooControlProxy<'a> {
|
||||
pub fn get_cached_gpus(&self) -> zbus::Result<Vec<Gpu>> {
|
||||
let res = self.cached_gpus().map_err(|err| zbus::Error::from(err))?;
|
||||
let res = self.cached_gpus()?;
|
||||
if let Some(res) = res {
|
||||
convert_gpus(res)
|
||||
} else {
|
||||
|
|
@ -66,7 +66,7 @@ impl<'a> SwitcherooControlProxy<'a> {
|
|||
|
||||
impl<'a> SwitcherooControlProxyBlocking<'a> {
|
||||
pub fn get_cached_gpus(&self) -> zbus::Result<Vec<Gpu>> {
|
||||
let res = self.cached_gpus().map_err(|err| zbus::Error::from(err))?;
|
||||
let res = self.cached_gpus()?;
|
||||
if let Some(res) = res {
|
||||
convert_gpus(res)
|
||||
} else {
|
||||
|
|
@ -88,12 +88,12 @@ impl TryFrom<HashMap<String, OwnedValue>> for Gpu {
|
|||
let name = value
|
||||
.get("Name")
|
||||
.ok_or(zvariant::Error::IncorrectType)?
|
||||
.to_owned()
|
||||
.try_clone()?
|
||||
.try_into()?;
|
||||
let environment: Vec<String> = value
|
||||
.get("Environment")
|
||||
.ok_or(zvariant::Error::IncorrectType)?
|
||||
.to_owned()
|
||||
.try_clone()?
|
||||
.try_into()?;
|
||||
let environment: HashMap<String, String> = environment
|
||||
.chunks_exact(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue