all: refactor to cargo workspace, remove config shared library, remove protocol perms, add dpms cli (#7)
This commit is contained in:
parent
5db14936e7
commit
bfc2a525de
616 changed files with 32344 additions and 31026 deletions
|
|
@ -1,34 +0,0 @@
|
|||
use {
|
||||
crate::{
|
||||
config::parser::{DataType, ParseResult, Parser, UnexpectedDataType},
|
||||
toml::toml_span::{Span, SpannedExt},
|
||||
},
|
||||
jay_config::video::GfxApi,
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct GfxApiParser;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GfxApiParserError {
|
||||
#[error(transparent)]
|
||||
DataType(#[from] UnexpectedDataType),
|
||||
#[error("Unknown API {0}")]
|
||||
Unknown(String),
|
||||
}
|
||||
|
||||
impl Parser for GfxApiParser {
|
||||
type Value = GfxApi;
|
||||
type Error = GfxApiParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::String];
|
||||
|
||||
fn parse_string(&mut self, span: Span, string: &str) -> ParseResult<Self> {
|
||||
use GfxApi::*;
|
||||
let api = match string.to_ascii_lowercase().as_str() {
|
||||
"opengl" => OpenGl,
|
||||
"vulkan" => Vulkan,
|
||||
_ => return Err(GfxApiParserError::Unknown(string.to_string()).spanned(span)),
|
||||
};
|
||||
Ok(api)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue