cli: add randr subcommand
This commit is contained in:
parent
5b2bfb8531
commit
20ac21e412
14 changed files with 1053 additions and 17 deletions
25
src/utils/gfx_api_ext.rs
Normal file
25
src/utils/gfx_api_ext.rs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue