feat(switcheroo): Discrete parameter support with fallback to !default
This commit is contained in:
parent
87c3c35666
commit
755442641e
1 changed files with 6 additions and 0 deletions
|
|
@ -103,11 +103,16 @@ impl TryFrom<HashMap<String, OwnedValue>> for Gpu {
|
||||||
.get("Default")
|
.get("Default")
|
||||||
.ok_or(zvariant::Error::IncorrectType)?
|
.ok_or(zvariant::Error::IncorrectType)?
|
||||||
.try_into()?;
|
.try_into()?;
|
||||||
|
let discrete = value
|
||||||
|
.get("Discrete")
|
||||||
|
.and_then(|v| v.try_into().ok())
|
||||||
|
.unwrap_or(!default);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
name,
|
name,
|
||||||
environment,
|
environment,
|
||||||
default,
|
default,
|
||||||
|
discrete,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,4 +130,5 @@ pub struct Gpu {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub environment: HashMap<String, String>,
|
pub environment: HashMap<String, String>,
|
||||||
pub default: bool,
|
pub default: bool,
|
||||||
|
pub discrete: bool,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue