mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-10 00:20:29 -04:00
power: Make GPUPerformanceLevel::from_str implementation consistent with others
This commit is contained in:
parent
fbfb07e684
commit
20227416e1
1 changed files with 9 additions and 9 deletions
18
src/power.rs
18
src/power.rs
|
@ -5,7 +5,7 @@
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, ensure, Error, Result};
|
use anyhow::{bail, ensure, Error, Result};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use tokio::fs::{self, File};
|
use tokio::fs::{self, File};
|
||||||
|
@ -52,14 +52,14 @@ impl TryFrom<u32> for GPUPerformanceLevel {
|
||||||
impl FromStr for GPUPerformanceLevel {
|
impl FromStr for GPUPerformanceLevel {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
fn from_str(input: &str) -> Result<GPUPerformanceLevel, Self::Err> {
|
fn from_str(input: &str) -> Result<GPUPerformanceLevel, Self::Err> {
|
||||||
match input {
|
Ok(match input {
|
||||||
"auto" => Ok(GPUPerformanceLevel::Auto),
|
"auto" => GPUPerformanceLevel::Auto,
|
||||||
"low" => Ok(GPUPerformanceLevel::Low),
|
"low" => GPUPerformanceLevel::Low,
|
||||||
"high" => Ok(GPUPerformanceLevel::High),
|
"high" => GPUPerformanceLevel::High,
|
||||||
"manual" => Ok(GPUPerformanceLevel::Manual),
|
"manual" => GPUPerformanceLevel::Manual,
|
||||||
"peak_performance" => Ok(GPUPerformanceLevel::ProfilePeak),
|
"peak_performance" => GPUPerformanceLevel::ProfilePeak,
|
||||||
v => Err(anyhow!("No enum match for value {v}")),
|
v => bail!("No enum match for value {v}"),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue