mirror of
https://github.com/OMGeeky/confique.git
synced 2026-01-18 09:24:10 +01:00
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:
11
src/file.rs
11
src/file.rs
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user