1
0
Fork 0
forked from wry/wry

gfx-api: add GfxApi

This commit is contained in:
Julian Orth 2026-02-24 19:56:51 +01:00
parent b604192bf0
commit ca6e3891af
15 changed files with 72 additions and 61 deletions

View file

@ -1,25 +0,0 @@
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,
}
}
}