Remove File::toml and File::yaml

The added convenience is minimal over `new`, so I'd rather have a
smaller API and less code with `#[cfg]`.
This commit is contained in:
Lukas Kalbertodt
2021-05-16 16:52:10 +02:00
parent 0d25489a31
commit e3e90430f4

View File

@@ -35,6 +35,7 @@ pub struct File {
}
impl File {
/// Creates an optional file source.
pub fn new(path: impl Into<PathBuf>, format: FileFormat) -> Self {
Self {
path: path.into(),
@@ -43,16 +44,6 @@ impl File {
}
}
#[cfg(feature = "toml")]
pub fn toml(path: impl Into<PathBuf>) -> Self {
Self::new(path, FileFormat::Toml)
}
#[cfg(feature = "yaml")]
pub fn yaml(path: impl Into<PathBuf>) -> Self {
Self::new(path, FileFormat::Yaml)
}
/// Marks this file as required, meaning that `<File as Source<_>>::load`
/// will return an error if the file does not exist. Otherwise, an empty
/// layer (all values are `None`) is returned.