mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-09 16:10:34 -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
|
||||
*/
|
||||
|
||||
use anyhow::{anyhow, bail, ensure, Error, Result};
|
||||
use anyhow::{bail, ensure, Error, Result};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use tokio::fs::{self, File};
|
||||
|
@ -52,14 +52,14 @@ impl TryFrom<u32> for GPUPerformanceLevel {
|
|||
impl FromStr for GPUPerformanceLevel {
|
||||
type Err = Error;
|
||||
fn from_str(input: &str) -> Result<GPUPerformanceLevel, Self::Err> {
|
||||
match input {
|
||||
"auto" => Ok(GPUPerformanceLevel::Auto),
|
||||
"low" => Ok(GPUPerformanceLevel::Low),
|
||||
"high" => Ok(GPUPerformanceLevel::High),
|
||||
"manual" => Ok(GPUPerformanceLevel::Manual),
|
||||
"peak_performance" => Ok(GPUPerformanceLevel::ProfilePeak),
|
||||
v => Err(anyhow!("No enum match for value {v}")),
|
||||
}
|
||||
Ok(match input {
|
||||
"auto" => GPUPerformanceLevel::Auto,
|
||||
"low" => GPUPerformanceLevel::Low,
|
||||
"high" => GPUPerformanceLevel::High,
|
||||
"manual" => GPUPerformanceLevel::Manual,
|
||||
"peak_performance" => GPUPerformanceLevel::ProfilePeak,
|
||||
v => bail!("No enum match for value {v}"),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue