Upcoming changes to the GUI mean that it will be double the work to keep maintaining this, and it is already lagging behind on pane support. With the Mesa llvmpipe fallback we should be in a pretty good state to not need another non-GL implementation.
37 lines
950 B
Rust
37 lines
950 B
Rust
use super::*;
|
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq, Eq)]
|
|
pub enum FrontEndSelection {
|
|
OpenGL,
|
|
Software,
|
|
}
|
|
impl_lua_conversion!(FrontEndSelection);
|
|
|
|
impl Default for FrontEndSelection {
|
|
fn default() -> Self {
|
|
FrontEndSelection::OpenGL
|
|
}
|
|
}
|
|
|
|
impl FrontEndSelection {
|
|
// TODO: find or build a proc macro for this
|
|
pub fn variants() -> Vec<&'static str> {
|
|
vec!["OpenGL", "Software"]
|
|
}
|
|
}
|
|
|
|
impl std::str::FromStr for FrontEndSelection {
|
|
type Err = Error;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s.to_lowercase().as_ref() {
|
|
"software" => Ok(FrontEndSelection::Software),
|
|
"opengl" => Ok(FrontEndSelection::OpenGL),
|
|
_ => Err(anyhow!(
|
|
"{} is not a valid FrontEndSelection variant, possible values are {:?}",
|
|
s,
|
|
FrontEndSelection::variants()
|
|
)),
|
|
}
|
|
}
|
|
}
|