1
0
Fork 0
forked from wry/wry

cli: add randr subcommand

This commit is contained in:
Julian Orth 2024-03-05 14:17:36 +01:00
parent 5b2bfb8531
commit 20ac21e412
14 changed files with 1053 additions and 17 deletions

25
src/utils/gfx_api_ext.rs Normal file
View file

@ -0,0 +1,25 @@
use jay_config::video::GfxApi;
pub trait GfxApiExt: Sized {
fn to_str(&self) -> &'static str;
fn from_str_lossy(s: &str) -> Option<Self>;
}
impl GfxApiExt for GfxApi {
fn to_str(&self) -> &'static str {
match self {
GfxApi::OpenGl => "OpenGl",
GfxApi::Vulkan => "Vulkan",
_ => "unknown",
}
}
fn from_str_lossy(s: &str) -> Option<Self> {
match &*s.to_ascii_lowercase() {
"opengl" => Some(Self::OpenGl),
"vulkan" => Some(Self::Vulkan),
_ => None,
}
}
}