mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-15 15:30:00 -04:00
add none configformat case to hide other errors
This commit is contained in:
parent
23b96c2073
commit
9d1604cc3e
1 changed files with 11 additions and 4 deletions
|
@ -339,6 +339,8 @@ impl Config {
|
||||||
ConfigFormat::Json => serde_json::to_string_pretty(self)?,
|
ConfigFormat::Json => serde_json::to_string_pretty(self)?,
|
||||||
#[cfg(feature = "yaml")]
|
#[cfg(feature = "yaml")]
|
||||||
ConfigFormat::Yaml => serde_yaml::to_string(self)?,
|
ConfigFormat::Yaml => serde_yaml::to_string(self)?,
|
||||||
|
#[cfg(not(any(feature = "toml", feature = "json", feature = "yaml")))]
|
||||||
|
ConfigFormat::None => String::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +352,8 @@ impl Config {
|
||||||
ConfigFormat::Json => serde_json::from_str(&string)?,
|
ConfigFormat::Json => serde_json::from_str(&string)?,
|
||||||
#[cfg(feature = "yaml")]
|
#[cfg(feature = "yaml")]
|
||||||
ConfigFormat::Yaml => serde_yaml::from_str(&string)?,
|
ConfigFormat::Yaml => serde_yaml::from_str(&string)?,
|
||||||
|
#[cfg(not(any(feature = "toml", feature = "json", feature = "yaml")))]
|
||||||
|
ConfigFormat::None => { let _ = string; Self::default() },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,19 +366,22 @@ pub enum ConfigFormat {
|
||||||
Json,
|
Json,
|
||||||
#[cfg(feature = "yaml")]
|
#[cfg(feature = "yaml")]
|
||||||
Yaml,
|
Yaml,
|
||||||
|
#[cfg(not(any(feature = "toml", feature = "json", feature = "yaml")))]
|
||||||
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ConfigFormat {
|
impl Default for ConfigFormat {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "toml")] {
|
if #[cfg(feature = "toml")] {
|
||||||
return Self::Toml;
|
Self::Toml
|
||||||
} else if #[cfg(feature = "json")] {
|
} else if #[cfg(feature = "json")] {
|
||||||
return Self::Json;
|
Self::Json
|
||||||
} else if #[cfg(feature = "yaml")] {
|
} else if #[cfg(feature = "yaml")] {
|
||||||
return Self::Yaml;
|
Self::Yaml
|
||||||
} else {
|
} else {
|
||||||
compile_error!("no config format feature enabled - build will fail!");
|
compile_error!("no config format feature enabled!");
|
||||||
|
Self::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue